Comorphism.hs revision 53310804002cd9e3c9c5844db3b984abcf001788
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaModule : $Header$
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaCopyright : (c) Till Mossakowski, Uni Bremen 2002-2004
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaMaintainer : till@tzi.de
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaStability : provisional
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaPortability : non-portable (via Logic)
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen KuksaProvides data structures for institution comorphisms.
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa These are just collections of
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa functions between (some of) the types of logics.
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa{- References: see Logic.hs
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa Flag for model expansion property
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa Weak amalgamability, also for comorphisms
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa comorphism modifications
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa comorphisms out of sublogic relationships
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa restrictions of comorphisms to sublogics
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa morphisms and other translations via spans
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksaimport qualified Common.Lib.Set as Set
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksaclass (Language cid,
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa Logic lid1 sublogics1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa basic_spec1 sentence1 symb_items1 symb_map_items1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign1 morphism1 symbol1 raw_symbol1 proof_tree1,
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa Logic lid2 sublogics2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa basic_spec2 sentence2 symb_items2 symb_map_items2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign2 morphism2 symbol2 raw_symbol2 proof_tree2) =>
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa Comorphism cid
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa lid1 sublogics1 basic_spec1 sentence1 symb_items1 symb_map_items1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign1 morphism1 symbol1 raw_symbol1 proof_tree1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa lid2 sublogics2 basic_spec2 sentence2 symb_items2 symb_map_items2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign2 morphism2 symbol2 raw_symbol2 proof_tree2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa | cid -> lid1, cid -> lid2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- source and target logic and sublogic
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- the source sublogic is the maximal one for which the comorphism works
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- the target sublogic is the resulting one
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sourceLogic :: cid -> lid1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sourceSublogic :: cid -> sublogics1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa targetLogic :: cid -> lid2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa targetSublogic :: cid -> sublogics2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- finer information of target sublogics corresponding to source sublogics
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa mapSublogic :: cid -> sublogics1 -> sublogics2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- default implementation
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa mapSublogic cid _ = targetSublogic cid
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- the translation functions are partial
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- because the target may be a sublanguage
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- map_basic_spec :: cid -> basic_spec1 -> Result basic_spec2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- cover theoroidal comorphisms as well
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa map_theory :: cid -> (sign1,[Named sentence1])
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -> Result (sign2,[Named sentence2])
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa map_morphism :: cid -> morphism1 -> Result morphism2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa map_sentence :: cid -> sign1 -> sentence1 -> Result sentence2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- also covers semi-comorphisms
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- with no sentence translation
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- - but these are spans!
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa map_symbol :: cid -> symbol1 -> Set.Set symbol2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa constituents :: cid -> [String]
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa -- default implementation
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa constituents cid = [language_name cid]
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksamap_sign :: Comorphism cid
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa lid1 sublogics1 basic_spec1 sentence1 symb_items1 symb_map_items1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign1 morphism1 symbol1 raw_symbol1 proof_tree1
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa lid2 sublogics2 basic_spec2 sentence2 symb_items2 symb_map_items2
7bb0a9e92bc7a6f868eaa0b9c3212c0af4f96b7fEugen Kuksa sign2 morphism2 symbol2 raw_symbol2 proof_tree2
return (sign', disambiguateSens Set.empty . nameSens $ sens' ++ sens'')
map_symbol _ = Set.singleton
_ -> error "CompComorphism.map_sentence"
in Set.unions
(Set.toList (map_symbol cid1 s1)))