Morphism.hs revision 75067b1beba1380cde707c30e7fc050d86f6927f
167414650dc57c11c13ba85253f0211b3de0ecc5Christian MaederModule : $Header$
4eaeba586d49aa0761ee2bb6d20efba91562cef6Andy GimblettDescription : Morphism of Common Logic
4eaeba586d49aa0761ee2bb6d20efba91562cef6Andy GimblettCopyright : (c) Uni Bremen DFKI 2010
4eaeba586d49aa0761ee2bb6d20efba91562cef6Andy GimblettLicense : similar to LGPL, see HetCATS/LICENSE.txt
4eaeba586d49aa0761ee2bb6d20efba91562cef6Andy GimblettMaintainer : kluc@informatik.uni-bremen.de
Portability : non-portable (via Logic.Logic)
module CommonLogic.Morphism
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Common.Result as Result
import Common.Id as Id
import Common.Result
import Common.Doc
import Common.DocUtils
import CommonLogic.AS_CommonLogic as AS_BASIC
import CommonLogic.Sign as Sign
-- import Common.DefaultMorphism
, 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.Quant_sent sen rn -> case sen of
AS_BASIC.Universal ns sen -> sen -- fix
AS_BASIC.Quant_sent form rn -> case form of
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))