Morphism.hs revision 202df46772cac2ee2e8627ba196a5faebb6f9a05
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaModule : $Header$
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaDescription : Morphisms in Propositional logic
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaCopyright : (c) Dominik Luecke, Uni Bremen 2007
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaMaintainer : luecke@informatik.uni-bremen.de
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaStability : experimental
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaPortability : portable
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen KuksaDefinition of morphisms for propositional logic
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa Till Mossakowski, Joseph Goguen, Razvan Diaconescu, Andrzej Tarlecki.
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa What is a Logic?.
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa In Jean-Yves Beziau (Ed.), Logica Universalis, pp. 113-@133. Birkhaeuser.
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa ( Morphism (..) -- datatype for Morphisms
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa , pretty -- pretty printing
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa , idMor -- identity morphism
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa , isLegalMorphism -- check if morhpism is ok
import qualified Data.Map as Map
import qualified Data.Set as Set
import Propositional.Sign as Sign
import qualified Common.Result as Result
import qualified Propositional.AS_BASIC_Propositional as AS_BASIC
import Common.Id as Id
import Common.Result
import Common.Doc
import Common.DocUtils
, 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
$ head $ getSimpleId $ 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))