ConvertDevToAbstractGraph.hs revision 97018cf5fa25b494adffd7e9b4e87320dae6bf47
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo TorriniModule : $Header$
cd7372fc7e6e43c389619f63daa6eb872d9d5b16Christian MaederCopyright : (c) Jorina Freya Gerken, Till Mossakowski, Uni Bremen 2002-2004
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo TorriniMaintainer : jfgerken@tzi.de
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian MaederStability : provisional
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian MaederPortability : non-portable (imports Logic)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Conversion of development graphs from Logic.DevGraph
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder to abstract graphs of the graph display interface
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder share strings to avoid typos
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder hiding of internal nodes:
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder internal nodes that are not between named nodes should be kept
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder display inclusions and inter-logic links in special colour
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder try different graph layout algorithms for daVinci (dot?)
d4e8d3a0ddb1a63754edc3571b6a3a54a7b62d04Paolo Torrini close program when all windows are closed
d4e8d3a0ddb1a63754edc3571b6a3a54a7b62d04Paolo Torrini issue warning when theory cannot be flattened
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder different linktypes for local and hiding definition links
603e326e7b189de8c1e4ea8c89470b3a61154019Christian Maederimport GUI.Taxonomy (displayConceptGraph,displaySubsortGraph)
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport FileDialog
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport Broadcaster(newSimpleBroadcaster,applySimpleUpdate)
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport Sources(toSimpleSource)
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport DaVinciGraph
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport GraphDisp
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport GraphConfigure
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport TextDisplay
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport Configuration
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport qualified HTk
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport qualified Common.Lib.Map as Map
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport Common.Lib.Pretty as Pretty hiding (isEmpty)
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport qualified Common.Result as Res
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederimport List(nub)
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder{- Maps used to track which node resp edge of the abstract graph
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maedercorrespondes with which of the development graph and vice versa and
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederone Map to store which libname belongs to which development graph-}
62dd3cd58cda003c32ac69ff12dc82b0a6f5d9d3Christian Maederdata ConversionMaps = ConversionMaps {
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder dg2abstrNode :: DGraphToAGraphNode,
62dd3cd58cda003c32ac69ff12dc82b0a6f5d9d3Christian Maeder dg2abstrEdge :: DGraphToAGraphEdge,
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder abstr2dgNode :: AGraphToDGraphNode,
62dd3cd58cda003c32ac69ff12dc82b0a6f5d9d3Christian Maeder abstr2dgEdge :: AGraphToDGraphEdge,
62dd3cd58cda003c32ac69ff12dc82b0a6f5d9d3Christian Maeder libname2dg :: LibEnv}
2f65d931e866162d39d09c43021a55314040b377Christian Maeder deriving Show
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maederinstance PrettyPrint String where
120c9bff9059626735fc12b0399dcc9e5a62c345Christian Maeder printText0 ga c = ptext (take 25 c)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maederinstance Common.PrettyPrint.PrettyPrint ConversionMaps where
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder printText0 ga convMaps =
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder ptext "dg2abstrNode"
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Pretty.$$ (printText0 ga $ dg2abstrNode convMaps)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Pretty.$$ ptext "dg2abstrEdge"
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Pretty.$$ (printText0 ga $ dg2abstrEdge convMaps)
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Pretty.$$ ptext "abstr2dgNode"
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Pretty.$$ (printText0 ga $ abstr2dgNode convMaps)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Pretty.$$ ptext "abstr2dgEdge"
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Pretty.$$ (printText0 ga $ abstr2dgEdge convMaps)
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maederdata GraphMem = GraphMem {
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder graphInfo :: GraphInfo,
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder nextGraphId :: Descr}
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder-- types of the Maps above
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maedertype DGraphToAGraphNode = Map.Map (LIB_NAME,Node) Descr
13ed13e06a5dd4aad12044ed7e7503cbe7f62990Christian Maedertype DGraphToAGraphEdge = Map.Map (LIB_NAME,(Descr,Descr,String)) Descr
ae59cddaa1f9e2dd031cae95a3ba867b9e8e095dPaolo Torrinitype AGraphToDGraphNode = Map.Map Descr (LIB_NAME,Node)
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maedertype AGraphToDGraphEdge = Map.Map Descr (LIB_NAME,(Descr,Descr,String))
cd7372fc7e6e43c389619f63daa6eb872d9d5b16Christian Maederdata InternalNames =
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder InternalNames { showNames :: Bool,
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder updater :: [(String,(String -> String) -> IO ())] }
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maedertype GInfo = (IORef ProofStatus,
f1082bc15d1cbd06522cf49842929d73ba4214fcChristian Maeder IORef ConversionMaps,
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder IORef InternalNames, -- show internal names?
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder IORef [[Node]]
5e4812721f9026ae4ae54381a5fdeb163489087dChristian MaederinitializeConverter :: IO (IORef GraphMem)
5e4812721f9026ae4ae54381a5fdeb163489087dChristian MaederinitializeConverter =
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder showLogicGraph daVinciSort
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder initGraphInfo <- initgraphs
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder graphMem <- (newIORef GraphMem{nextGraphId = 0,
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder graphInfo = initGraphInfo})
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder return graphMem
5e4812721f9026ae4ae54381a5fdeb163489087dChristian Maeder{- converts the development graph given by its libname into an abstract graph
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torriniand returns the descriptor of the latter, the graphInfo it is contained in
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torriniand the conversion maps (see above)-}
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian MaederconvertGraph :: IORef GraphMem -> LIB_NAME -> LibEnv -> HetcatsOpts
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder -> IO (Descr, GraphInfo, ConversionMaps)
5e4812721f9026ae4ae54381a5fdeb163489087dChristian MaederconvertGraph graphMem libname libEnv hetsOpts =
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder do let convMaps = ConversionMaps
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder {dg2abstrNode = Map.empty::DGraphToAGraphNode,
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder abstr2dgNode = Map.empty::AGraphToDGraphNode,
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder dg2abstrEdge = Map.empty::DGraphToAGraphEdge,
4ef05f4edeb290beb89845f57156baa5298af7c4Christian Maeder abstr2dgEdge = Map.empty::AGraphToDGraphEdge,
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder libname2dg = libEnv}
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder case Map.lookup libname libEnv of
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Just globContext@(_,_,dgraph) ->
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder do (abstractGraph,graphInfo,convRef) <-
4ef05f4edeb290beb89845f57156baa5298af7c4Christian Maeder initializeGraph graphMem libname dgraph convMaps globContext hetsOpts
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder if (isEmpty dgraph) then
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder return (abstractGraph, graphInfo,convMaps)
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder do newConvMaps <- convertNodes convMaps abstractGraph
8451d8feb0aa0e67f6585ed10669eec73ba1fba0Christian Maeder graphInfo dgraph libname
8451d8feb0aa0e67f6585ed10669eec73ba1fba0Christian Maeder finalConvMaps <- convertEdges newConvMaps abstractGraph
8451d8feb0aa0e67f6585ed10669eec73ba1fba0Christian Maeder graphInfo dgraph libname
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder writeIORef convRef finalConvMaps
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder return (abstractGraph, graphInfo, finalConvMaps)
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder Nothing -> error ("development graph with libname "
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder ++ (show libname)
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder ++ " does not exist")
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder{- initializes an empty abstract graph with the needed node and edge types,
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maederreturn type equals the one of convertGraph -}
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian MaederinitializeGraph :: IORef GraphMem ->LIB_NAME -> DGraph -> ConversionMaps
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder -> GlobalContext -> HetcatsOpts
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder -> IO (Descr,GraphInfo,IORef ConversionMaps)
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian MaederinitializeGraph ioRefGraphMem ln dGraph convMaps globContext hetsOpts = do
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder graphMem <- readIORef ioRefGraphMem
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder event <- newIORef 0
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder convRef <- newIORef convMaps
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder showInternalNames <- newIORef (InternalNames False [])
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder let proofHistory = Map.fromList [(key,[([]::[DGRule], []::[DGChange])])|
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder key <- Map.keys (libname2dg convMaps)]
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder ioRefProofStatus <- newIORef (ln, libname2dg convMaps,proofHistory)
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder ioRefSubtreeEvents <- newIORef (Map.empty::(Map.Map Descr Descr))
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder ioRefVisibleNodes <- newIORef [(Graph.nodes dGraph)]
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder let gid = nextGraphId graphMem
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder actGraphInfo = graphInfo graphMem
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder let gInfo = (ioRefProofStatus, event, convRef, gid, ln, actGraphInfo, showInternalNames, hetsOpts, ioRefVisibleNodes)
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder Result descr _ <-
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder makegraph ("Development graph for "++show ln)
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder -- action on "open"
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder (do currentPath <- getCurrentDirectory
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder event <- fileDialogStr "Open..." currentPath
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder maybeFilePath <- sync event
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder case maybeFilePath of
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder Just filePath ->
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder do openProofStatus filePath ioRefProofStatus convRef hetsOpts
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini do error ("Could not open file.")
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini -- action on "save"
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini (do proofStatus <- readIORef ioRefProofStatus
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini writeShATermFile ("./" ++ (show ln) ++ ".log") proofStatus)
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini -- action on "save as...:"
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder (do currentPath <- getCurrentDirectory
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder event <- newFileDialogStr "Save as..." currentPath
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder maybeFilePath <- sync event
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder case maybeFilePath of
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder Just filePath -> do
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder proofStatus <- readIORef ioRefProofStatus
4ef05f4edeb290beb89845f57156baa5298af7c4Christian Maeder writeShATermFile filePath proofStatus
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder do error ("Could not save file.")
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder -- the global menu
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder [GlobalMenu (Menu Nothing
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini [Menu (Just "Unnamed nodes")
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini [Button "Hide/show names"
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini (do (int::InternalNames) <- readIORef showInternalNames
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini let showThem = not $ showNames int
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini showIt s = if showThem then s else ""
65e28321f4dbba7bcc6cfe5c900e59f705ebdd12Paolo Torrini mapM_ (\(s,upd) -> upd (\_ -> showIt s)) (updater int)
4ef05f4edeb290beb89845f57156baa5298af7c4Christian Maeder writeIORef showInternalNames (int {showNames = showThem})
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder redisplay gid actGraphInfo
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder Button "Hide nodes"
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder (do Result descr _ <- hideSetOfNodeTypes gid
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder "locallyEmpty_internal"]
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder writeIORef event descr
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder redisplay gid actGraphInfo
74e146c7cfad97817d7e065dcd937cada89b257dChristian Maeder Button "Show nodes"
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder (do descr <- readIORef event
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder showIt gid descr actGraphInfo
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder redisplay gid actGraphInfo
9e5d738f1fb98e67d8b24c1db27a41a0c5dff8edChristian Maeder return () )],
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder Menu (Just "Proofs")
613bf0ed7d98a961755408ead328687ec17f74fdChristian Maeder [Button "Automatic"
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder (proofMenu gInfo (fmap return . automatic)),
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder Button "Global Subsumption"
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder (proofMenu gInfo (fmap return . globSubsume)),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Button "Global Decomposition"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (proofMenu gInfo (fmap return . globDecomp)),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Button "Local Subsumption"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (proofMenu gInfo (fmap return . locSubsume)),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Button "Local Decomposition (merge of rules)"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (proofMenu gInfo (fmap return . locDecomp)),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Button "Hide Theorem Shift"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (proofMenu gInfo (fmap return .
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (hideTheoremShift False))),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Button "Theorem Hide Shift"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (proofMenu gInfo (fmap return . theoremHideShift))
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder -- the node types
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder createLocalMenuNodeTypeSpec "Magenta" ioRefSubtreeEvents
d5ef5a29a89fa5548f81fcd49fcf0ffda69d45b0Christian Maeder actGraphInfo ioRefGraphMem gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("locallyEmpty_spec",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder createLocalMenuNodeTypeSpec "Violet" ioRefSubtreeEvents
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder actGraphInfo ioRefGraphMem gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder createLocalMenuNodeTypeInternal "Grey" gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("locallyEmpty_internal",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder createLocalMenuNodeTypeInternal "LightGrey" gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder createLocalMenuNodeTypeDgRef "SteelBlue" actGraphInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ioRefGraphMem graphMem gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("locallyEmpty_dg_ref",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder createLocalMenuNodeTypeDgRef "LightSteelBlue"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder actGraphInfo ioRefGraphMem graphMem gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder -- the link types (share strings to avoid typos)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder [("globaldef",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenu gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Steelblue"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenu gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hidingdef",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Lightblue"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenu gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenu gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Green"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalMenuValueTitleShowConservativity
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unproventhm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Red"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalMenuValueTitleShowConservativity
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localproventhm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Dashed $$$ Color "Green"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalMenuValueTitleShowConservativity
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Dashed $$$ Color "Red"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalMenuValueTitleShowConservativity
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unprovenhidingthm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Orange"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("provenhidingthm",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Solid $$$ Color "Lightgreen"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenuThmEdge gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder -- > ######### welche Farbe fuer reference ##########
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("reference",
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Dotted $$$ Color "Grey"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ createLocalEdgeMenu gInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder $$$ emptyArcTypeParms :: DaVinciArcTypeParms EdgeValue)]
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder [("globaldef","globaldef","globaldef"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("globaldef","def","def"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("globaldef","hetdef","hetdef"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("globaldef","proventhm","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("globaldef","unproventhm","unproventhm"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("globaldef","localunproventhm","localunproventhm"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("def","globaldef","def"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("def","def","def"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("def","hetdef","hetdef"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("def","proventhm","proventhm"),
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder ("def","unproventhm","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("def","localunproventhm","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","globaldef","hetdef"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","def","hetdef"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","hetdef","hetdef"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","proventhm","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","unproventhm","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("hetdef","localunproventhm","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm","globaldef","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm","def","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm","hetdef","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm","proventhm","proventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("proventhm","unproventhm","unproventhm"),
cbac0a99fd23a43b4e94d30e58ebf93a6af6caa0Christian Maeder ("proventhm","localunproventhm","localunproventhm"),
cbac0a99fd23a43b4e94d30e58ebf93a6af6caa0Christian Maeder ("unproventhm","globaldef","unproventhm"),
cbac0a99fd23a43b4e94d30e58ebf93a6af6caa0Christian Maeder ("unproventhm","def","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unproventhm","hetdef","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unproventhm","proventhm","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unproventhm","unproventhm","unproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("unproventhm","localunproventhm","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","globaldef","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","def","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","hetdef","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","proventhm","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","unproventhm","localunproventhm"),
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ("localunproventhm","localunproventhm","localunproventhm")]
cbac0a99fd23a43b4e94d30e58ebf93a6af6caa0Christian Maeder writeIORef ioRefGraphMem graphMem{nextGraphId = gid+1}
e96fb97935ac710a295b04d60b8ac90ef8364079Christian Maeder graphMem'<- readIORef ioRefGraphMem
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder return (descr,graphInfo graphMem',convRef)
99c923311eab71a85f1dcc4785d349609c828da4Christian MaederopenProofStatus :: FilePath -> (IORef ProofStatus) -> (IORef ConversionMaps)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder -> HetcatsOpts -> IO()
99c923311eab71a85f1dcc4785d349609c828da4Christian MaederopenProofStatus filename ioRefProofStatus convRef hetsOpts =
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder do resultProofStatus <- proofStatusFromShATerm filename
cbac0a99fd23a43b4e94d30e58ebf93a6af6caa0Christian Maeder case Res.maybeResult resultProofStatus of
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Nothing -> error ("Could not read proof status from file '"
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder ++ (show filename) ++ "'")
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Just proofStatus@(ln,libEnv',_) ->
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder do writeIORef ioRefProofStatus proofStatus
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder initGraphInfo <- initgraphs
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder graphMem' <- (newIORef GraphMem{nextGraphId = 0,
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder graphInfo = initGraphInfo})
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (gid, actGraphInfo, convMaps)
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder <- convertGraph graphMem' ln libEnv' hetsOpts
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder writeIORef convRef convMaps
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder redisplay gid actGraphInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian MaederproofMenu :: GInfo
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder -> (ProofStatus -> IO (Res.Result ProofStatus))
99c923311eab71a85f1dcc4785d349609c828da4Christian MaederproofMenu (ioRefProofStatus, event, convRef, gid, ln, actGraphInfo, _, _, ioRefVisibleNodes) proofFun
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder proofStatus <- readIORef ioRefProofStatus
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Res.Result diags res <- proofFun proofStatus
5ecc14b8ff557d4af3a324be29053ec49b3bb679Christian Maeder Nothing -> do sequence $ map (putStrLn . show) diags
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder Just newProofStatus@(ln,libEnv,proofHistory) -> do
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder let (Just history) = Map.lookup ln proofHistory
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder (Just newGlobContext) = Map.lookup ln libEnv
ac53ffcb7dda01eb1faca2c4ef726b06bf7076fbChristian Maeder writeIORef ioRefProofStatus newProofStatus
99c923311eab71a85f1dcc4785d349609c828da4Christian Maeder descr <- readIORef event
Map.insert ln newGlobContext (libname2dg convMapsAux)}
let (Just (_,_,dGraph)) = Map.lookup ln libEnv
Res.Result [] (Just (n, gth)) ->
Res.Result diags _ ->
case Map.lookup descr subtreeEvents of
Map.insert descr
case Map.lookup descr subtreeEvents of
(Map.delete descr subtreeEvents)
case Map.lookup descr convMap of
case Map.lookup descr ab2dgNode of
DGraph -> IO (Res.Result (Node,G_theory))
Res.maybeToResult nullPos ("Node "++show descr++" not found")
$ Map.lookup descr ab2dgNode
Res.Result diags res -> do
Res.maybeToResult nullPos ("Node "++show descr++" not found")
$ Map.lookup descr ab2dgNode
Res.Result [] (Just (node,th)) -> do
sel <- Res.ioToIORes $ listBox "Choose a logic translation"
Res.resToIORes $ map_theory cid (sign',sens')
Res.ioToIORes $ displayTheory "Translated theory" node dgraph
Res.Result diags _ -> showDiags opts diags
case Map.lookup descr ab2dgNode of
Res.Result _ (Just th) ->
Res.Result diags _ ->
case Map.lookup descr ab2dgNode of
case Map.lookup descr ab2dgNode of
$ Map.lookup ln libEnv
Res.Result _ (Just th1) -> th1
let Res.Result diags res =
convertNodesAux convMaps {dg2abstrNode = Map.insert (libname, node)
abstr2dgNode = Map.insert newDescr
do let srcnode = Map.lookup (libname,src) (dg2abstrNode convMaps)
tarnode = Map.lookup (libname,tar) (dg2abstrNode convMaps)
convMaps {dg2abstrEdge = Map.insert
abstr2dgEdge = Map.insert newDescr
case Map.lookup descr (abstr2dgNode convMaps) of
case Map.lookup libname libname2dgMap of
case Map.lookup refLibname libname2dgMap of
case Map.lookup descr (abstr2dgNode convMaps) of
case Map.lookup libname libname2dgMap of
case Map.lookup (libname,node) (dg2abstrNode convMaps) of
-- -- ################ einbindung von proofs.hs ############
Map.insert dgNode descr (dg2abstrNode convMaps),
Map.insert descr dgNode (abstr2dgNode convMaps)}
case Map.lookup dgnode (dg2abstrNode convMaps) of
Map.delete dgnode (dg2abstrNode convMaps),
Map.delete abstrNode (abstr2dgNode convMaps)}
case (Map.lookup (libname,src) dg2abstrNodeMap,
Map.lookup (libname,tgt) dg2abstrNodeMap) of
Map.insert dgEdge descr (dg2abstrEdge convMaps),
Map.insert descr dgEdge (abstr2dgEdge convMaps)}
case Map.lookup dgEdge dg2abstrEdgeMap of
Map.delete dgEdge dg2abstrEdgeMap,
Map.delete abstrEdge (abstr2dgEdge