COLSign.hs revision b87efd3db0d2dc41615ea28669faf80fc1b48d56
0N/A{- |
0N/AModule : $Header$
0N/ADescription : Signatures of COL as extension of CASL signatures
0N/ACopyright : (c) Till Mossakowski, C. Maeder, Uni Bremen 2004
0N/ALicense : GPLv2 or higher
0N/A
0N/AMaintainer : till@informatik.uni-bremen.de
0N/AStability : provisional
0N/APortability : portable
0N/A
0N/ASignatures of COL as extension of CASL signatures.
0N/A-}
0N/A
0N/Amodule COL.COLSign where
0N/A
0N/Aimport qualified Data.Set as Set
0N/Aimport qualified Data.Map as Map
0N/Aimport Common.Id
0N/A
0N/Adata COLSign = COLSign { constructors :: Set.Set Id
0N/A , observers :: Map.Map Id Int
0N/A } deriving (Show, Eq, Ord)
0N/A
0N/AemptyCOLSign :: COLSign
0N/AemptyCOLSign = COLSign Set.empty Map.empty
0N/A
0N/AaddCOLSign :: COLSign -> COLSign -> COLSign
0N/AaddCOLSign s1 s2 =
0N/A s1 { constructors = Set.union (constructors s1) $ constructors s2
0N/A , observers = Map.union (observers s1) $ observers s2 }
0N/A
0N/AdiffCOLSign :: COLSign -> COLSign -> COLSign
diffCOLSign s1 s2 =
s1 { constructors = Set.difference (constructors s1) $ constructors s2
, observers = Map.difference (observers s1) $ observers s2 }
isSubCOLSign :: COLSign -> COLSign -> Bool
isSubCOLSign s1 s2 =
Set.null (constructors s2 Set.\\ constructors s1)
&& Map.null (observers s2 Map.\\ observers s1)