{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Abstract.DPO
( Production
, buildProduction
, getLHS
, getRHS
, getNACs
, Derivation(..)
, generateDerivation
, Process(..)
, GenerateProcess(..)
, MorphismsConfig(..)
, MatchRestriction(..)
, matchRestrictionToMorphismType
, NacSatisfaction(..)
, DPO(..)
, satisfiesGluingConditions
, satisfiesNACs
, satisfiesRewritingConditions
, satisfyRewritingConditions
, findAllMatches
, findApplicableMatches
, calculateDPO
, calculateComatch
, rewrite
, invertProductionWithoutNacs
, nacDownwardShift
) where
import Abstract.AdhesiveHLR
import Abstract.DPO.Core
import Abstract.DPO.Derivation
import Abstract.DPO.Process
satisfyRewritingConditions :: DPO m => MorphismsConfig -> (Production m, m) -> (Production m, m) -> Bool
satisfyRewritingConditions conf (l,m1) (r,m2) =
satisfiesRewritingConditions conf l m1 && satisfiesRewritingConditions conf r m2
nacDownwardShift :: EpiPairs m => MorphismsConfig -> m -> m -> [m]
nacDownwardShift conf m n = newNacs
where
pairs = calculateCommutativeSquaresAlongMonomorphism (n,True) (m, matchRestriction conf == MonoMatches)
newNacs = map snd pairs