Comorphism.hs revision 0cd4575fe679a26de63d9a75a4d66d8366f79ab8
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian Maeder{-# LANGUAGE UndecidableInstances #-}
81d182b21020b815887e9057959228546cf61b6bChristian MaederModule : $Header$
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederDescription : interface and class for logic translations
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederCopyright : (c) Till Mossakowski, Uni Bremen 2002-2006
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
3f69b6948966979163bdfe8331c38833d5d90ecdChristian MaederMaintainer : till@informatik.uni-bremen.de
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederStability : provisional
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederPortability : non-portable (via Logic)
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian MaederCentral interface (type class) for logic translations (comorphisms) in Hets
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder These are just collections of
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder functions between (some of) the types of logics.
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder References: see Logic.hs
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian Maeder ( CompComorphism (..)
35db0960aa2e2a13652381c756fae5fb2b27213bChristian Maeder , InclComorphism
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder , inclusion_logic
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder , inclusion_source_sublogic
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder , inclusion_target_sublogic
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , mkInclComorphism
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , mkIdComorphism
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , Comorphism (..)
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , targetSublogic
99f16a0f9ca757410960ff51a79b034503384fe2Christian Maeder , ext_map_sign
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , mapDefaultMorphism
99f16a0f9ca757410960ff51a79b034503384fe2Christian Maeder , wrapMapTheory
6e5180855658f12f9059d9041f447bf0935de344Christian Maeder , simpleTheoryMapping
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , mkTheoryMapping
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder , AnyComorphism (..)
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder , idComorphism
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder , isIdComorphism
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder , isModelTransportable
4e013227ed41ccd2e3d09dd44bedd651e1901f38Christian Maeder , hasModelExpansion
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder , isWeaklyAmalgamable
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder , compComorphism
529f678f015ae5276f87da63114cdce750b366aeChristian Maederimport qualified Data.Set as Set
529f678f015ae5276f87da63114cdce750b366aeChristian Maederclass (Language cid,
529f678f015ae5276f87da63114cdce750b366aeChristian Maeder Logic lid1 sublogics1
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder basic_spec1 sentence1 symb_items1 symb_map_items1
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder sign1 morphism1 symbol1 raw_symbol1 proof_tree1,
529f678f015ae5276f87da63114cdce750b366aeChristian Maeder Logic lid2 sublogics2
b475a916d62584a2af5f51749240db7a5f0c8b82Christian Maeder basic_spec2 sentence2 symb_items2 symb_map_items2
529f678f015ae5276f87da63114cdce750b366aeChristian Maeder sign2 morphism2 symbol2 raw_symbol2 proof_tree2) =>
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder Comorphism cid
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder lid1 sublogics1 basic_spec1 sentence1 symb_items1 symb_map_items1
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder sign1 morphism1 symbol1 raw_symbol1 proof_tree1
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder lid2 sublogics2 basic_spec2 sentence2 symb_items2 symb_map_items2
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder sign2 morphism2 symbol2 raw_symbol2 proof_tree2
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder | cid -> lid1 sublogics1 basic_spec1 sentence1 symb_items1 symb_map_items1
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder sign1 morphism1 symbol1 raw_symbol1 proof_tree1
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder lid2 sublogics2 basic_spec2 sentence2 symb_items2 symb_map_items2
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder sign2 morphism2 symbol2 raw_symbol2 proof_tree2
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder -- source and target logic and sublogic
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder -- the source sublogic is the maximal one for which the comorphism works
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder sourceLogic :: cid -> lid1
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder sourceSublogic :: cid -> sublogics1
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder targetLogic :: cid -> lid2
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder -- finer information of target sublogics corresponding to source sublogics
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder -- this function must be partial because mapTheory is partial
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder mapSublogic :: cid -> sublogics1 -> Maybe sublogics2
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder -- the translation functions are partial
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder -- because the target may be a sublanguage
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -- map_basic_spec :: cid -> basic_spec1 -> Result basic_spec2
7de39d39bc1700cc8a9bb9df90b920aad9e18d4aChristian Maeder -- cover theoroidal comorphisms as well
ac9e33c3c35b2663e5cb76483228910f142d9576Christian Maeder map_theory :: cid -> (sign1,[Named sentence1])
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -> Result (sign2,[Named sentence2])
529f678f015ae5276f87da63114cdce750b366aeChristian Maeder map_morphism :: cid -> morphism1 -> Result morphism2
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder map_sentence :: cid -> sign1 -> sentence1 -> Result sentence2
b7941d1840cb336e11e7a7c0916f7b763c0366f0Christian Maeder -- also covers semi-comorphisms
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- with no sentence translation
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -- - but these are spans!
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder map_sentence = failMapSentence
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder map_symbol :: cid -> sign1 -> symbol1 -> Set.Set symbol2
76647324ed70f33b95a881b536d883daccf9568dChristian Maeder map_symbol = errMapSymbol
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder extractModel :: cid -> sign1 -> proof_tree2
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder -> Result (sign1, [Named sentence1])
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder extractModel cid _ _ = fail
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder $ "extractModel not implemented for comorphism "
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder ++ language_name cid
5b1f1d57c75562a7af79e8256f4afa07febe921bChristian Maeder --properties of comorphisms
=> cid -> sign1 -> symbol1 -> Set.Set symbol2
map_symbol _ _ = Set.singleton
_ -> error "CompComorphism.map_sentence"
in Set.unions
(Set.toList (map_symbol cid1 sig1 s1)))