LogicGraph.hs revision 1549f3abf73c1122acff724f718b615c82fa3648
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski{- |
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Module : $Header$
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Copyright : (c) Till Mossakowski and Uni Bremen 2003
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Licence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Maintainer : hets@tzi.de
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Stability : provisional
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Portability : non-portable
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
1549f3abf73c1122acff724f718b615c82fa3648Till Mossakowski Assembles all the logics and comorphisms into a graph.
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski The modules for the Grothendieck logic are logic graph indepdenent,
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski and here is the logic graph that is used to instantiate these.
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Since the logic graph depends on a large number of modules for the
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski individual logics, this separation of concerns (and possibility for
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski separate compilation) is quite useful.
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski References:
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski T. Mossakowski:
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Relating CASL with Other Specification Languages:
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski the Institution Level
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Theoretical Computer Science 286, p. 367-475, 2002.
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Todo:
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski Add many many logics and comorphisms.
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski-}
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskimodule Comorphisms.LogicGraph
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiwhere
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
1549f3abf73c1122acff724f718b615c82fa3648Till Mossakowskiimport Common.Result
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Logic.Logic
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Logic.Comorphism
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Logic.Grothendieck
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport CASL.Logic_CASL -- also serves as default logic
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport HasCASL.Logic_HasCASL
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Haskell.Logic_Haskell
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport CspCASL.Logic_CspCASL
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport Comorphisms.CASL2HasCASL
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport qualified Common.Lib.Map as Map
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowskiimport CASL.ATC_CASL
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilogicList :: [AnyLogic]
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilogicList = [Logic CASL, Logic HasCASL, Logic Haskell, Logic CspCASL]
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiinclusionList :: [AnyComorphism]
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiinclusionList = [Comorphism CASL2HasCASL]
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskicomorphismList :: [AnyComorphism]
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskicomorphismList = inclusionList ++ []
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddLogicName :: AnyLogic -> (String,AnyLogic)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddLogicName l@(Logic lid) = (language_name lid, l)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddComorphismName :: AnyComorphism -> (String,AnyComorphism)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddComorphismName c@(Comorphism cid) = (language_name cid, c)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddInclusionNames :: AnyComorphism -> ((String,String),AnyComorphism)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskiaddInclusionNames c@(Comorphism cid) =
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski ((language_name $ sourceLogic cid,
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski language_name $ targetLogic cid),
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski c)
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilogicGraph :: LogicGraph
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilogicGraph =
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski LogicGraph {
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski logics = Map.fromList $ map addLogicName logicList,
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski comorphisms = Map.fromList $ map addComorphismName comorphismList,
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski inclusions = Map.fromList $ map addInclusionNames inclusionList
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski }
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskidefaultLogic :: AnyLogic
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskidefaultLogic = Logic CASL
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilookupLogic_in_LG :: String -> String -> AnyLogic
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till MossakowskilookupLogic_in_LG errorPrefix logname =
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski lookupLogic errorPrefix (logname) logicGraph
b10d6cef708b7a659f2d3b367e8e0db0d03ae3f5Till Mossakowski
1549f3abf73c1122acff724f718b615c82fa3648Till MossakowskilookupComorphism_in_LG :: String -> Result AnyComorphism
1549f3abf73c1122acff724f718b615c82fa3648Till MossakowskilookupComorphism_in_LG coname =
1549f3abf73c1122acff724f718b615c82fa3648Till Mossakowski lookupComorphism coname logicGraph