Morphism.hs revision e9458b1a7a19a63aa4c179f9ab20f4d50681c168
Module : ./Propositional/Morphism.hs
License : GPLv2 or higher, see LICENSE.txt
copied to "Temporal.Morphism"
module Propositional.Morphism
import Data.Data
import qualified Data.Map as Map
import qualified Data.Set as Set
import Propositional.Sign as Sign
import qualified Propositional.AS_BASIC_Propositional as AS_BASIC
import Common.Id as Id
import Common.Result
import Common.Doc
import Common.DocUtils
import qualified Common.Result as Result
import Control.Monad (unless)
, propMap :: Map.Map Id Id
pdom = Map.keysSet $ propMap pmor
pcodom = Set.map (applyMorphism pmor) psource
applyMorphism mor idt = Map.findWithDefault idt idt $ propMap mor
applyMap :: Map.Map Id Id -> Id -> Id
applyMap pmap idt = Map.findWithDefault idt idt pmap
, propMap = if Map.null gMap then fMap else
Set.fold ( \ i -> let j = applyMap gMap (applyMap fMap i) in
if i == j then id else Map.insert i j)
Map.empty $ items fSource }
<> pretty y <> rparen) $ Map.assocs $ propMap m)
, propMap = Map.empty }
AS_BASIC.Conjunction form rn ->
AS_BASIC.Conjunction (map (mapSentenceH mor) form) rn
AS_BASIC.Disjunction form rn ->
AS_BASIC.Disjunction (map (mapSentenceH mor) form) rn
$ id2SimpleId $ applyMorphism mor $ Id.simpleIdToId predH
morphismUnion :: Morphism -> Morphism -> Result.Result Morphism
(pds, pmap) = foldr ( \ (i, j) (ds, m) -> case Map.lookup i m of
Nothing -> (ds, Map.insert i j m)
(Map.toList pmap2 ++ map (\ a -> (a, a))