Logic.hs revision 9b94043f6a8b10ddf748119a0e34002dd5e592c3
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- needs ghc -fglasgow-exts
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Till Mossakowski
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Provides data structures for logics (with symbols)
601dc92e4c128d23a726593357c654fb776a63a7Till Mossakowski and logic representations. Logics are
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski a type class with an "identitiy" type (usually interpreted
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski by a singleton set) which serves to treat logics as
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski data. All the functions in the type class take the
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski identity as first argument in order to determine the logic.
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Logic representations are just collections of
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski functions between (some of) the types of logics.
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski J. A. Goguen and R. M. Burstall
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Institutions: Abstract Model Theory for Specification and
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski JACM 39, p. 95--146, 1992
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski (general notion of logic - model theory only)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski General Logics
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Logic Colloquium 87, p. 275--329, North Holland, 1989
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski (general notion of logic - also proof theory;
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski notion of logic representation, called map there)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski T. Mossakowski:
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Specification in an arbitrary institution with symbols
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski 14th WADT 1999, LNCS 1827, p. 252--270
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski (treatment of symbols and raw symbols, see also CASL semantics)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski T. Mossakowski, B. Klin:
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Institution Independent Static Analysis for CASL
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski 15h WADT 2001, LNCS 2267, p. 221-237, 2002.
da955132262baab309a50fdffe228c9efe68251dCui Jian (what is needed for static anaylsis)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski S. Autexier and T. Mossakowski
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Integrating HOLCASL into the Development Graph Manager MAYA
da955132262baab309a50fdffe228c9efe68251dCui Jian FroCoS 2002, to appear
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski (interface to provers)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Weak amalgamability, also for reprs
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski reprs out of sublogic relationships
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskimodule Logic where
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiimport AS_Annotation
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiimport Dynamic
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- maps and sets, just a quick thing
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskitype Set a = [a]
da955132262baab309a50fdffe228c9efe68251dCui Jiantype Map a = [(a,a)]
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- diagrams, nodes are just integers
da955132262baab309a50fdffe228c9efe68251dCui Jiantype Node = Int
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskitype Edge morphism = (Node,morphism,Node)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskidata Diagram object morphism = Diagram [(Node,object)] [Edge morphism]
da955132262baab309a50fdffe228c9efe68251dCui Jianempty_diagram :: Diagram o m
da955132262baab309a50fdffe228c9efe68251dCui Jianempty_diagram = Diagram [] []
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiadd_node :: Diagram o m -> o -> (Node,Diagram o m)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiadd_node (Diagram nodes edges) obj =
da955132262baab309a50fdffe228c9efe68251dCui Jian (node,Diagram ((node,obj):nodes) edges) where
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski node = maximum (map fst nodes)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiadd_edge :: Diagram o m -> Edge m -> Diagram o m
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiadd_edge (Diagram nodes edges) edge =
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Diagram nodes (edge:edges)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiobject_at_node :: Node -> Diagram o m -> Maybe (Node,o)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiobject_at_node node (Diagram nodes edges) =
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski case lookup node nodes of
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Just obj -> Just (node,obj)
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski Nothing -> Nothing
da955132262baab309a50fdffe228c9efe68251dCui Jiandiagram_nodes :: Diagram o m -> [(Node,o)]
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskidiagram_nodes (Diagram nodes edges) = nodes
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskidiagram_edges :: Diagram o m -> [Edge m]
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskidiagram_edges (Diagram nodes edges) = edges
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- Categories are given by a quotient,
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- i.e. we need equality
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski-- Should we allow arbitrary composition graphs and build paths?
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowskiclass (Eq object, Eq morphism) =>
da955132262baab309a50fdffe228c9efe68251dCui Jian Category id object morphism | id ->, id -> morphism where
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski ide :: id -> object -> morphism
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski o :: id -> morphism -> morphism -> Maybe morphism
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski dom, cod :: id -> morphism -> object
047de69319a752b9c467166b1264f9e121459e2dTill Mossakowski legal_obj :: id -> object -> Bool