Grothendieck.hs revision 22e8d3e72e27b9038f28861fb022b05dd4f31207
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegariModule : $Header$
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens ElknerCopyright : (c) Till Mossakowski, and Uni Bremen 2002-2004
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegariLicence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegariMaintainer : till@tzi.de
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegariStability : provisional
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegariPortability : non-portable (overlapping instances, dynamics, existentials)
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari The Grothendieck logic is defined to be the
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari heterogeneous logic over the logic graph.
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari This will be the logic over which the data
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari structures and algorithms for specification in-the-large
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari R. Diaconescu:
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari Grothendieck institutions
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari J. applied categorical structures 10, 2002, p. 383-402.
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari T. Mossakowski:
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari Heterogeneous development graphs and heterogeneous borrowing
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari Fossacs 2002, LNCS 2303, p. 326-341
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder T. Mossakowski: Foundations of heterogeneous specification
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari T. Mossakowski:
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari Relating CASL with Other Specification Languages:
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari the Institution Level
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder Theoretical Computer Science 286, 2002, p. 367-475
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariimport qualified Common.Lib.Map as Map
1a38107941725211e7c3f051f7a8f5e12199f03acmaederimport qualified Common.Lib.Set as Set
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegariimport qualified Data.List as List
1a38107941725211e7c3f051f7a8f5e12199f03acmaederimport Common.Lib.Parsec.Pos -- for testing purposes
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari------------------------------------------------------------------
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder--"Grothendieck" versions of the various parts of type class Logic
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder------------------------------------------------------------------
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | Grothendieck basic specifications
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederdata G_basic_spec = forall lid sublogics
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder basic_spec sentence symb_items symb_map_items
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari sign morphism symbol raw_symbol proof_tree .
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari Logic lid sublogics
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari basic_spec sentence symb_items symb_map_items
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari sign morphism symbol raw_symbol proof_tree =>
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari G_basic_spec lid basic_spec
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariinstance Show G_basic_spec where
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari show (G_basic_spec _ s) = show s
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariinstance PrettyPrint G_basic_spec where
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari printText0 ga (G_basic_spec _ s) = printText0 ga s
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | Grothendieck sentences
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegaridata G_sentence = forall lid sublogics
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari basic_spec sentence symb_items symb_map_items
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder sign morphism symbol raw_symbol proof_tree .
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder Logic lid sublogics
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder basic_spec sentence symb_items symb_map_items
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari sign morphism symbol raw_symbol proof_tree =>
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari G_sentence lid sentence
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegariinstance Show G_sentence where
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari show (G_sentence _ s) = show s
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari-- | Grothendieck sentence lists
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegaridata G_l_sentence_list = forall lid sublogics
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari basic_spec sentence symb_items symb_map_items
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari sign morphism symbol raw_symbol proof_tree .
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari Logic lid sublogics
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder basic_spec sentence symb_items symb_map_items
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari sign morphism symbol raw_symbol proof_tree =>
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari G_l_sentence_list lid [Named sentence]
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegariinstance Show G_l_sentence_list where
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari show (G_l_sentence_list _ s) = show s
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegariinstance Eq G_l_sentence_list where
eb06c6332e2e2ef6f5d1cdd74c5ce7abbd23de28Daniel Calegari (G_l_sentence_list i1 nl1) == (G_l_sentence_list i2 nl2) =
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder coerce i1 i2 nl1 == Just nl2
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegarieq_G_l_sentence_set :: G_l_sentence_list -> G_l_sentence_list -> Bool
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegarieq_G_l_sentence_set (G_l_sentence_list i1 nl1) (G_l_sentence_list i2 nl2) =
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari case coerce i1 i2 nl1 of
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari Just nl1' -> Set.fromList nl1' == Set.fromList nl2
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari Nothing -> False
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari-- | Grothendieck signatures
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegaridata G_sign = forall lid sublogics
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari basic_spec sentence symb_items symb_map_items
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari sign morphism symbol raw_symbol proof_tree .
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari Logic lid sublogics
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder basic_spec sentence symb_items symb_map_items
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder sign morphism symbol raw_symbol proof_tree =>
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder G_sign lid sign
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegarityconG_sign :: TyCon
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegarityconG_sign = mkTyCon "Logic.Grothendieck.G_sign"
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariinstance Typeable G_sign where
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder typeOf _ = mkTyConApp tyconG_sign []
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariinstance Eq G_sign where
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari (G_sign i1 sigma1) == (G_sign i2 sigma2) =
a58d43a4b2864a25ab74b96758fb9d98f18eeed7Daniel Calegari coerce i1 i2 sigma1 == Just sigma2
1a38107941725211e7c3f051f7a8f5e12199f03acmaederinstance Show G_sign where
a58d43a4b2864a25ab74b96758fb9d98f18eeed7Daniel Calegari show (G_sign _ s) = show s
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegariinstance PrettyPrint G_sign where
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari printText0 ga (G_sign _ s) = printText0 ga s
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegarilangNameSig :: G_sign -> String
d3d15411081a9ac4a84d409079153135bb30442aDaniel CalegarilangNameSig (G_sign lid _) = language_name lid
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari-- | Grothendieck signature lists
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederdata G_sign_list = forall lid sublogics
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder basic_spec sentence symb_items symb_map_items
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari sign morphism symbol raw_symbol proof_tree .
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari Logic lid sublogics
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari basic_spec sentence symb_items symb_map_items
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder sign morphism symbol raw_symbol proof_tree =>
d3d15411081a9ac4a84d409079153135bb30442aDaniel Calegari G_sign_list lid [sign]
acc049a844d19fb294ce7f68742390dee87447dcDaniel Calegari-- | Grothendieck extended signatures
G_ext_sign lid sign (Set.Set symbol)
tyconG_ext_sign = mkTyCon "Logic.Grothendieck.G_ext_sign"
logics :: Map.Map String AnyLogic,
comorphisms :: Map.Map String AnyComorphism,
inclusions :: Map.Map (String,String) AnyComorphism
case Map.lookup logname (logics logicGraph) of
$ Map.lookup logic (logics logicGraph)
$ Map.lookup name (comorphisms logicGraph)
tyconAnyComorphismAux = mkTyCon "Logic.Grothendieck.AnyComorphismAux"
else case Map.lookup (ln1,ln2) (inclusions logicGraph) of
newL = List.nub (l ++ (concat (map extend l)))
extend coMor = catMaybes $ map (compComorphism coMor) $ Map.elems $ coMors