Modal2CASL.inline.hs revision 34bff097c14521b5e57ce37279a34256e1f78aa5
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaModule : $Header$
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaCopyright : (c) Klaus L�ttich and Uni Bremen 2004
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaMaintainer : luecke@informatik.uni-bremen.de
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaStability : provisional
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaPortability : non-portable (imports Logic.Logic)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinaThe possible world encoding comorphism from ModalCASL to CASL.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina We use the Relational Translation by adding one extra parameter of
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina type world to each predicate.
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinamodule Comorphisms.Modal2CASL (Modal2CASL(..)) where
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinaimport qualified Data.Set as Set
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinaimport qualified Data.Map as Map
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina-- generated function
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina-- | The identity of the comorphism
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinadata Modal2CASL = Modal2CASL deriving (Show)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinainstance Language Modal2CASL -- default definition is okay
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinainstance Comorphism Modal2CASL
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina M_BASIC_SPEC ModalFORMULA SYMB_ITEMS SYMB_MAP_ITEMS
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina Symbol RawSymbol ()
68f73e56a9b6133f8a9f4b3c0e696df6c30fec91Pavel Březina CASL CASL_Sublogics
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina CASLBasicSpec CASLFORMULA SYMB_ITEMS SYMB_MAP_ITEMS
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina Symbol RawSymbol () where
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina sourceLogic Modal2CASL = Modal
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina sourceSublogic Modal2CASL = ()
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina targetLogic Modal2CASL = CASL
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina mapSublogic Modal2CASL _ = Just SL.top
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina map_theory (Modal2CASL) (sig, sens) = case transSig sig of
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina mme -> return (caslSign mme, relFormulas mme
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina ++ map (mapNamed $ transSen sig) sens)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina map_morphism Modal2CASL = return . mapMor
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina map_sentence Modal2CASL sig = return . transSen sig
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina map_symbol Modal2CASL = Set.singleton . mapSym
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina has_model_expansion Modal2CASL = True
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina is_weakly_amalgamable Modal2CASL = True
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinadata ModName = SimpleM SIMPLE_ID
488b455f6b7881ec108a127840b1c1f1523d937fMichal Židek | SortM SORT
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina deriving (Show,Ord,Eq)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinatype ModalityRelMap = Map.Map ModName PRED_NAME
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březinadata ModMapEnv = MME { caslSign :: CASLSign,
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina worldSort :: SORT,
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina modalityRelMap :: ModalityRelMap,
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina flexPreds :: Map.Map PRED_NAME (Set.Set PredType),
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina-- rigPreds :: Map.Map PRED_NAME (Set.Set PredType),
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina relFormulas :: [Named CASLFORMULA]
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina-- (CASL signature,World sort introduced,[introduced relations on possible worlds],)
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinatransSig :: MSign -> ModMapEnv
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel BřezinatransSig sign =
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina {- trace ("Flexible Ops: " ++ show flexibleOps ++
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\nRigid Ops: " ++ show rigOps' ++
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\nOriginal Ops: " ++ show (opMap sign) ++ "\n" ++
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "Flexible Preds: " ++ show flexiblePreds ++
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\nRigid Preds: " ++ show rigPreds' ++
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina "\nOriginal Preds: " ++ show (predMap sign) ++ "\n"
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina let sorSet = sortSet sign
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina fws = freshWorldSort sorSet
e157b9f6cb370e1b94bcac2044d26ad66d640fbaPavel Březina flexOps' = Map.foldWithKey (addWorld_OP fws)
Map.foldWithKey (addWorld_PRED fws)
Map.empty $ flexiblePreds
relations = Map.union relsMod relsTermMod
genModFrms f mp = Map.foldWithKey f [] mp
relsMod = genRels (\ me nm -> Map.insert (SimpleM me) (relSymbS me) nm)
Map.insert (SortM me) (relSymbT me) nm)
{sortSet = Set.insert fws sorSet
, modies :: Set.Set SIMPLE_ID
, termModies :: Set.Set Id --SORT
(\ ts -> assert (not $ Set.null ts)
(if Set.member (toPredType pType) ts
(Map.lookup prn fPreds)
_ -> error "Modal2CASL.transSen->mapSen"
(\ ts -> assert (not $ Set.null ts)
(if Set.member (toOpType opType) ts
(Map.lookup on fOps)
_ -> error "Modal2CASL.mapTERM"
addWorld_OP :: SORT -> OP_NAME -> Set.Set OpType
addWorld_PRED :: SORT -> PRED_NAME -> Set.Set PredType
-> SORT -> Id -> Set.Set a
freshWorldSort :: Set.Set SORT -> SORT
-- where notKnown s = not $ s `Set.member` sorSet