GTheory.hs revision d9d72d6055f5c9440ca08ff6f0d8b8fcd06406b1
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy Gimblett , GeneralizedNewtypeDeriving #-}
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian MaederModule : $Header$
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederDescription : theory datastructure for development graphs
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachCopyright : (c) Till Mossakowski, Uni Bremen 2002-2006
b4fbc96e05117839ca409f5f20f97b3ac872d1edTill MossakowskiLicense : GPLv2 or higher, see LICENSE.txt
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachMaintainer : till@informatik.uni-bremen.de
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachStability : provisional
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachPortability : non-portable(Logic)
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbachtheory datastructure for development graphs
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbachimport qualified Common.OrderedMap as OMap
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbachimport qualified Data.Map as Map
567db7182e691cce5816365d8c912d09ffe92f86Andy Gimblett-- a theory index describing a set of sentences
0ea916d1e6aea10fd7b84f802fb5148a79d8c20aAndy Gimblettnewtype ThId = ThId Int
1538a6e8d77301d6de757616ffc69ee61f1482e4Andy Gimblett deriving (Typeable, Show, Eq, Ord, Enum, ShATermConvertible)
1538a6e8d77301d6de757616ffc69ee61f1482e4Andy GimblettstartThId :: ThId
c4b2418421546a337f83332fe0db04742dcd735dAndy GimblettstartThId = ThId 0
9f6c50e7b48ca79fc104275f9b1ea091a1359f89Andy Gimblett-- | Grothendieck theories with lookup indices
167414650dc57c11c13ba85253f0211b3de0ecc5Christian Maederdata G_theory = forall lid sublogics
167414650dc57c11c13ba85253f0211b3de0ecc5Christian Maeder basic_spec sentence symb_items symb_map_items
04ceed96d1528b939f2e592d0656290d81d1c045Andy Gimblett sign morphism symbol raw_symbol proof_tree .
167414650dc57c11c13ba85253f0211b3de0ecc5Christian Maeder Logic lid sublogics
167414650dc57c11c13ba85253f0211b3de0ecc5Christian Maeder basic_spec sentence symb_items symb_map_items
1df33829303cbf924aa018ac5ce9a28e69c17d22Till Mossakowski sign morphism symbol raw_symbol proof_tree => G_theory
1df33829303cbf924aa018ac5ce9a28e69c17d22Till Mossakowski { gTheoryLogic :: lid
04ceed96d1528b939f2e592d0656290d81d1c045Andy Gimblett , gTheorySign :: ExtSign sign symbol
04ceed96d1528b939f2e592d0656290d81d1c045Andy Gimblett , gTheorySignIdx :: SigId -- ^ index to lookup 'G_sign' (using 'signOf')
1538a6e8d77301d6de757616ffc69ee61f1482e4Andy Gimblett , gTheorySens :: ThSens sentence (AnyComorphism, BasicProof)
1df33829303cbf924aa018ac5ce9a28e69c17d22Till Mossakowski , gTheorySelfIdx :: ThId -- ^ index to lookup this 'G_theory' in theory map
567db7182e691cce5816365d8c912d09ffe92f86Andy Gimblett } deriving Typeable
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachcreateGThWith :: G_theory -> SigId -> ThId -> G_theory
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachcreateGThWith (G_theory gtl gts _ _ _) si = G_theory gtl gts si noSens
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian MaedercoerceThSens ::
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach ( Logic lid1 sublogics1 basic_spec1 sentence1 symb_items1 symb_map_items1
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian Maeder sign1 morphism1 symbol1 raw_symbol1 proof_tree1
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian Maeder , Logic lid2 sublogics2 basic_spec2 sentence2 symb_items2 symb_map_items2
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach sign2 morphism2 symbol2 raw_symbol2 proof_tree2
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach , Monad m, Typeable b)
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach => lid1 -> lid2 -> String -> ThSens sentence1 b -> m (ThSens sentence2 b)
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachcoerceThSens = primCoerce
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbachinstance Eq G_theory where
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach G_theory l1 sig1 ind1 sens1 ind1' == G_theory l2 sig2 ind2 sens2 ind2' =
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach G_sign l1 sig1 ind1 == G_sign l2 sig2 ind2
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach && (ind1' > startThId && ind2' > startThId && ind1' == ind2'
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach || coerceThSens l1 l2 "" sens1 == Just sens2)
e85b224577b78d08ba5c39fe9dcc2e53995454a2Christian Maederinstance Show G_theory where
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach show (G_theory _ sign _ sens _) =
567db7182e691cce5816365d8c912d09ffe92f86Andy Gimblett shows sign $ '\n' : show sens
af745a4a6cb26002e55b69f90d837fe9c6176d4bAndy Gimblettinstance Pretty G_theory where
af745a4a6cb26002e55b69f90d837fe9c6176d4bAndy Gimblett pretty g = prettyGTheorySL g $++$ prettyGTheory g
specBraces Common.Doc.empty else printTheory lid (s, l)
(map snd $ OMap.toList $
OMap.map (minSublogic . sentence)
getThGoals (G_theory _ _ _ sens _) = map toGoal . OMap.toList
$ OMap.filter (not . isAxiom) sens
(OMap.map (mapValue $ simplify_sen lid s) sens) ind2
case OMap.lookup k sens of
newSens = OMap.map
(axs, ths) = OMap.partition (\ s -> isAxiom s || isProvenSenStatus s) sens
in Map.union axs $ proveSensAux lid axs ths
(proveSensAux lid (OMap.filter (\ s -> isAxiom s || isProvenSenStatus s)
case Map.lookup (sentence sen) axSet of
e { OMap.ele = sen { senAttr = ThmStatus $
if Map.null ps then locTh else
cDiag <- convertNodes Graph.empty dNodes
ensures_amalgamability lid (options, diag, sink', Graph.empty)