Logic_Modal.hs revision e4e1509ff358e739fddf1483ad39467e0e1becc2
7a8401ce858002b67e8f4198fde45a1562696ccbChristian Maeder{-# OPTIONS -fno-warn-missing-methods #-}
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu Authors: Wiebke Herding
c2db39a683438b0f3d484519f4c93db26eec9d2eWiebke Herdingimport FiniteMap
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maederdata Modal = Modal deriving (Show)
2bb4c0b7bc54ce51e68bff86b3a19be16e0f0449Christian Maederinstance Language Modal where -- default definition is okay
40f1a7ea3e3ed12cbeca205918b645dabed0402aChristian Maedertype Sign = Set Id
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maederinstance Show Sign where
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maedertype Morphism = (Sign, FiniteMap Id Id, Sign)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maederinstance Category Modal Sign Morphism
2a5b885d9350ec6dd8bc4992ee91d2f68aa592f4Christian Maeder -- ide :: id -> object -> morphism
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder ide Modal sigma = (sigma, listToFM [(i,i) | i<- toList sigma], sigma)
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder -- comp :: id -> morphism -> morphism -> Maybe morphism
a10ff6125d62484ec5961c8a5d9d1c5a3e14fa66Christian Maeder comp Modal (sigma1 ,m1,_) (_,m2,sigma2) =
99cf1c277851e5ac7725b8b18980284d9e9aeb99Christian Maeder Just (sigma1,plusFM m1 m2,sigma2)
e374cd77f3dbe95289afa9431d36a8a8a8fdc81fChristian Maeder -- dom, cod :: id -> morphism -> object
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang dom Modal (sigma,_,_) = sigma
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang cod Modal (_,_,sigma) = sigma
99cf1c277851e5ac7725b8b18980284d9e9aeb99Christian Maeder -- legal_obj :: id -> object -> Bool
1a11b3b997a32ebf7d52758dea143ef361fd9d5bChristian Maeder legal_obj Modal _ = True
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang -- legal_mor :: id -> morphism -> Bool
c64f180c7a3053a773d91a00226073d565fab46bChristian Maeder legal_mor Modal (sigma,m,_)
1a11b3b997a32ebf7d52758dea143ef361fd9d5bChristian Maeder | keysFM m == toList sigma = True
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder | True = False
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang-- abstract syntax, parsing (and printing)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder-- instance Syntax Modal BASIC_SPEC
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang-- SYMB_ITEMS SYMB_MAP_ITEMS
1a11b3b997a32ebf7d52758dea143ef361fd9d5bChristian Maeder-- parse_basic_spec :: id -> Maybe(ParseFun basic_spec)
1a11b3b997a32ebf7d52758dea143ef361fd9d5bChristian Maeder-- parse_symb_items :: id -> Maybe(ParseFun symb_items)
db453fe9625a9dab5d108f7a5e464598814144b8Jian Chun Wang-- parse_symb_map_items :: id -> Maybe(ParseFun symb_map_items)