GraphLogic.hs revision 97b8e548427713e0089a30fcc2df84e0f6aa7ffa
e6d40133bc9f858308654afb1262b8b483ec5922Till MossakowskiModule : $Header$
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian MaederDescription : Logic for manipulating the graph in the Central GUI
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuCopyright : (c) Jorina Freya Gerken, Till Mossakowski, Uni Bremen 2002-2006
ea9ad77838dce923ced1df2ac09a7f0226363593Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
ea9ad77838dce923ced1df2ac09a7f0226363593Christian MaederMaintainer : till@informatik.uni-bremen.de
ea9ad77838dce923ced1df2ac09a7f0226363593Christian MaederStability : provisional
f3a94a197960e548ecd6520bb768cb0d547457bbChristian MaederPortability : non-portable (imports Logic)
3b31ee94edcb328d2aa02ddcfa8a2e227d4c98edChristian Maeder , remakeGraph
3b5d1e9f95905d6595b3bb01b54499a37a3d82acChristian Maeder , performProofAction
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , openProofStatus
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , saveProofStatus
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder , openTranslateGraph
75eb4b8bca5dc18a680471287ebe996d908ae5ccChristian Maeder , showReferencedLibrary
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder , getSignatureOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , getTheoryOfNode
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder , getLocalAxOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , translateTheoryOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , displaySubsortGraph
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , displayConceptGraph
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , lookupTheoryOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , getSublogicOfNode
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder , showOriginOfNode
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder , showProofStatusOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , proveAtNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , showJustSubtree
ad270004874ce1d0697fb30d7309f180553bb315Christian Maeder , showIDOfEdge
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , getNumberOfNode
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , showMorphismOfEdge
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , showOriginOfEdge
9963c741a47c42d2dedc6e4589c1b197129a6239Christian Maeder , checkconservativityOfEdge
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder , showProofStatusOfThm
782d5365e084a40e4f717dafbe00fc41476a7cfeChristian Maeder , convertNodes
782d5365e084a40e4f717dafbe00fc41476a7cfeChristian Maeder , convertEdges
782d5365e084a40e4f717dafbe00fc41476a7cfeChristian Maeder , hideShowNames
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder , translateGraph
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder , showLibGraph
782d5365e084a40e4f717dafbe00fc41476a7cfeChristian Maederimport Logic.Logic(conservativityCheck)
782d5365e084a40e4f717dafbe00fc41476a7cfeChristian Maederimport Logic.Coerce(coerceSign, coerceMorphism)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport Syntax.AS_Library(LIB_NAME, getModTime, getLIB_ID)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport Static.DGToSpec(dgToSpec, computeTheory)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport Static.AnalysisLibrary(anaLibExt, anaLib)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Static.DGTranslation(libEnv_translation)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Proofs.InferBasic(basicInferenceNode)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport Proofs.StatusUtils(lookupHistory, removeContraryChanges)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport GUI.Utils(listBox, createTextSaveDisplay)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport GUI.Taxonomy (displayConceptGraph,displaySubsortGraph)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport GUI.DGTranslation(getDGLogic)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport qualified GUI.HTkUtils (displayTheory,
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder displayTheoryWithWarning,
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder createInfoDisplayWithTwoButtons)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport GraphDisp(deleteArc, deleteNode)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport TextDisplay(createTextDisplay)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport InfoBus(encapsulateWaitTermAct)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport DialogWin (useHTk)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Messages(errorMess)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport qualified HTk
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Configuration(size)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Common.Id(nullRange)
c7f5076658d72ea340d7fd8a648908f961af682dChristian Maederimport Common.DocUtils(showDoc, pretty)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport Common.ResultT(liftR, runResultT)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport qualified Common.OrderedMap as OMap
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport qualified Common.InjMap as InjMap
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport qualified Common.Lib.Rel as Rel
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport qualified Common.Lib.Graph as Tree
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport Driver.WriteFn(writeShATermFile)
4d4ec273e5cb1f17985c6edcf90a295a8b612cefChristian Maederimport Driver.ReadFn(libNameToFile, readVerbose)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport System.Directory(getModificationTime)
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederimport Data.Maybe(fromJust)
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederimport Data.List(nub,deleteBy,find)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport Data.Graph.Inductive.Graph as Graph(Node, LEdge, LNode, lab', labNode')
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport qualified Data.IntMap as IntMap
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maederimport qualified Data.Map as Map
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder-- | Undo one step of the History
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maederundo :: GInfo -> IO ()
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maederundo (GInfo { libEnvIORef = ioRefProofStatus
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder , initLibEnv = initEnv
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder , globalHist = gHist
812ee1f62e0e0e7235f3c05b41a0b173497b54ffChristian Maeder , graphId = gid
812ee1f62e0e0e7235f3c05b41a0b173497b54ffChristian Maeder , gi_GraphInfo = actGraph
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder oldEnv <- readIORef ioRefProofStatus
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder (guHist, grHist) <- takeMVar gHist
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder case guHist of
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder showTemporaryMessage gid actGraph "History is empty ..."
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder putMVar gHist (guHist, grHist)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder (ln:guHist') -> do
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder showTemporaryMessage gid actGraph $ "Undo last change to " ++ show ln
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder dg = lookupDGraph ln oldEnv
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder initdg = lookupDGraph ln initEnv
812ee1f62e0e0e7235f3c05b41a0b173497b54ffChristian Maeder phist = proofHistory dg
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder rhist = redoHistory dg
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder if phist == [emptyHistory] then putMVar gHist (guHist, grHist)
eed6203a39f88e398d86431a66d367036a3d17baChristian Maeder lastchange = head phist
9963c741a47c42d2dedc6e4589c1b197129a6239Christian Maeder phist' = tail phist
71de4b92b1ca12890a9e7bc5b0301455da3e052fChristian Maeder rhist' = lastchange:rhist
62198789c7cb57cac13399055515921c0fe3483fChristian Maeder dg' = (applyProofHistory (init phist') initdg )
feb3da029bdab54fe36ff704ca242ab4536b3bc1Christian Maeder {redoHistory = rhist'}
71de4b92b1ca12890a9e7bc5b0301455da3e052fChristian Maeder newEnv = Map.insert ln dg' oldEnv
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder lock = openlock dg'
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder writeIORef ioRefProofStatus newEnv
9963c741a47c42d2dedc6e4589c1b197129a6239Christian Maeder mRemakeF <- tryTakeMVar lock
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder case mRemakeF of
b1c32a0faa63e0c13687f36a2faae5969ec0a9d5Christian Maeder Just remakeF -> do
1012fdd997ea1f35eee2ccdd4015199f09f18fe9Christian Maeder putMVar lock remakeF
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder putMVar gHist (guHist', ln:grHist)
3004ea619754fb657d87ecad1d9a8b6b8ed0f9d1Christian Maeder Nothing -> putMVar gHist (guHist', ln:grHist)
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder-- | redo one step of the redoHistory
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maederredo :: GInfo -> IO ()
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maederredo (GInfo { libEnvIORef = ioRefProofStatus
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder , initLibEnv = initEnv
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder , globalHist = gHist
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder , graphId = gid
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder , gi_GraphInfo = actGraph
81ae4270c8508e5e630e50923a2e790e7b1e5997Christian Maeder oldEnv <- readIORef ioRefProofStatus
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder (guHist, grHist) <- takeMVar gHist
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder case grHist of
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder showTemporaryMessage gid actGraph "History is empty ..."
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder putMVar gHist (guHist, grHist)
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder (ln:grHist') -> do
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder showTemporaryMessage gid actGraph $ "Redo last change to " ++ show ln
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder dg = lookupDGraph ln oldEnv
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder initdg = lookupDGraph ln initEnv
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder phist = proofHistory dg
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder rhist = redoHistory dg
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder if rhist == [emptyHistory] then putMVar gHist (guHist, grHist)
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder nextchange = head rhist
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder rhist' = tail rhist
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder phist' = nextchange:phist
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder dg' = (applyProofHistory (init phist') initdg)
a3000204685374be86c84d76323d95d86e4735acChristian Maeder {redoHistory = rhist'}
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder newEnv = Map.insert ln dg' oldEnv
35c791e6c59ef269ec639360dc94943e264d3ad1Christian Maeder lock = openlock dg'
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder writeIORef ioRefProofStatus newEnv
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder mRemakeF <- tryTakeMVar lock
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder case mRemakeF of
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder Just remakeF -> do
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder putMVar lock remakeF
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder putMVar gHist (ln:guHist, grHist')
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder Nothing -> putMVar gHist (ln:guHist, grHist')
a3000204685374be86c84d76323d95d86e4735acChristian Maeder-- | reloads the Library of the DevGraph
a3000204685374be86c84d76323d95d86e4735acChristian Maederreload :: GInfo -> IO()
a3000204685374be86c84d76323d95d86e4735acChristian Maederreload gInfo@(GInfo { libEnvIORef = ioRefProofStatus
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder , gi_LIB_NAME = ln
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder , gi_hetcatsOpts = opts
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder oldle <- readIORef ioRefProofStatus
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder libdeps = Rel.toList $ Rel.intransKernel $ Rel.transClosure $ Rel.fromList
a3000204685374be86c84d76323d95d86e4735acChristian Maeder $ getLibDeps oldle
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder ioruplibs <- newIORef ([] :: [LIB_NAME])
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder writeIORef ioruplibs []
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder reloadLibs ioRefProofStatus opts libdeps ioruplibs ln
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder remakeGraph gInfo
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder-- | Creates a list of all LIB_NAME pairs, which have a dependency
9c07aad044613547d61ab235665c08adcef03a1cChristian MaedergetLibDeps :: LibEnv -> [(LIB_NAME, LIB_NAME)]
9c07aad044613547d61ab235665c08adcef03a1cChristian MaedergetLibDeps le =
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder concat $ map (\ ln -> getDep ln le) $ Map.keys le
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder-- | Creates a list of LIB_NAME pairs for the fist argument
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian MaedergetDep :: LIB_NAME -> LibEnv -> [(LIB_NAME, LIB_NAME)]
46199904d5e648bc1a25108f60a94078ffb99b30Christian MaedergetDep ln le =
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder map (\ x -> (ln, x)) $ map (\ (_,x,_) -> dgn_libname x) $ IntMap.elems $
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder IntMap.filter (\ (_,x,_) -> isDGRef x) $ Tree.convertToMap $
46199904d5e648bc1a25108f60a94078ffb99b30Christian Maeder dgBody $ lookupDGraph ln le
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder-- | Reloads a library
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian MaederreloadLib :: IORef LibEnv -> HetcatsOpts -> IORef [LIB_NAME] -> LIB_NAME
9963c741a47c42d2dedc6e4589c1b197129a6239Christian MaederreloadLib iorle opts ioruplibs ln = do
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski mfile <- existsAnSource opts {intype = GuessIn}
4693c24801d551cade06e8ff7b4b9f3a8abe12b4Christian Maeder $ rmSuffix $ libNameToFile opts ln
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski case mfile of
b645cf3dc1e449038ed291bbd11fcc6e02b2fc7fChristian Maeder Nothing -> do
ca0d4947f7b0fdcbf7eac627659e6cff6d3863baChristian Maeder Just file -> do
74085f08cdbbfd79fe5f9c6a455ed0b0cadcf145Christian Maeder le <- readIORef iorle
74085f08cdbbfd79fe5f9c6a455ed0b0cadcf145Christian Maeder mres <- anaLibExt opts file le'
4693c24801d551cade06e8ff7b4b9f3a8abe12b4Christian Maeder Just (_, newle) -> do
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder uplibs <- readIORef ioruplibs
4693c24801d551cade06e8ff7b4b9f3a8abe12b4Christian Maeder writeIORef ioruplibs $ ln:uplibs
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder writeIORef iorle newle
74085f08cdbbfd79fe5f9c6a455ed0b0cadcf145Christian Maeder Nothing -> do
14327755c1e6236e5a23594980a4b82bdce4d0a0Christian Maeder fail $ "Could not read original development graph from '"++ file
9963c741a47c42d2dedc6e4589c1b197129a6239Christian Maeder-- | Reloads libraries if nessesary
9963c741a47c42d2dedc6e4589c1b197129a6239Christian MaederreloadLibs :: IORef LibEnv -> HetcatsOpts -> [(LIB_NAME, LIB_NAME)]
9963c741a47c42d2dedc6e4589c1b197129a6239Christian Maeder -> IORef [LIB_NAME] -> LIB_NAME -> IO Bool
9963c741a47c42d2dedc6e4589c1b197129a6239Christian MaederreloadLibs iorle opts deps ioruplibs ln = do
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder uplibs <- readIORef ioruplibs
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder case elem ln uplibs of
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder True -> return True
4693c24801d551cade06e8ff7b4b9f3a8abe12b4Christian Maeder deps' = map (snd) $ filter (\ (ln',_) -> ln == ln') deps
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder res <- mapM (reloadLibs iorle opts deps ioruplibs) deps'
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder libupdate = foldl (\ u r -> if r then True else u) False res
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder case libupdate of
87ce48cde10c6835b292e39b43331a5ed94e9b6eChristian Maeder reloadLib iorle opts ioruplibs ln
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder le <- readIORef iorle
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder newln:_ = filter (ln ==) $ Map.keys le
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder mfile <- existsAnSource opts $ rmSuffix $ libNameToFile opts ln
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder case mfile of
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder Nothing -> do
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder Just file -> do
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder newmt <- getModificationTime file
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder libupdate' = (getModTime $ getLIB_ID newln) < newmt
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder case libupdate' of
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder False -> return False
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder reloadLib iorle opts ioruplibs ln
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder-- | Deletes the old edges and nodes of the Graph and makes new ones
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian MaederremakeGraph :: GInfo -> IO ()
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian MaederremakeGraph (GInfo { libEnvIORef = ioRefProofStatus
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder , conversionMapsIORef = convRef
d645eac2b9bf2e1a458b25982051276232670f09Christian Maeder , graphId = gid
d645eac2b9bf2e1a458b25982051276232670f09Christian Maeder , gi_LIB_NAME = ln
d645eac2b9bf2e1a458b25982051276232670f09Christian Maeder , gi_GraphInfo = actGraphInfo
d645eac2b9bf2e1a458b25982051276232670f09Christian Maeder le <- readIORef ioRefProofStatus
d645eac2b9bf2e1a458b25982051276232670f09Christian Maeder (gs,ev_cnt) <- readIORef actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder dgraph = lookupDGraph ln le
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder Just (_, g) = find (\ (gid', _) -> gid' == gid) gs
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder gs' = deleteBy (\ (gid1,_) (gid2,_) -> gid1 == gid2) (gid,g) gs
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder og = theGraph g
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder -- reads and delets the old nodes and edges
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder mapM_ (deleteArc og) $ map (\ (_,_,_,x) -> x) $ Map.elems $ AGV.edges g
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder mapM_ (deleteNode og) $ map snd $ Map.elems $ AGV.nodes g
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder -- stores the graph without nodes and edges in the GraphInfo
abc9c5b7cae1371cf917b6c881adea0dbba470a2Christian Maeder g' = g {theGraph = og, AGV.nodes = Map.empty, AGV.edges = Map.empty}
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder writeIORef actGraphInfo ((gid,g'):gs',ev_cnt)
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder -- creates new nodes and edges
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder newConvMaps <- convertNodes emptyConversionMaps gid actGraphInfo dgraph ln
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder finalConvMaps <- convertEdges newConvMaps gid actGraphInfo dgraph ln
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder -- writes the ConversionMap and redisplays the graph
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder writeIORef convRef finalConvMaps
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder redisplay gid actGraphInfo
87ce48cde10c6835b292e39b43331a5ed94e9b6eChristian MaederhideShowNames :: GInfo -> Bool -> IO ()
87ce48cde10c6835b292e39b43331a5ed94e9b6eChristian MaederhideShowNames (GInfo {graphId = gid,
87ce48cde10c6835b292e39b43331a5ed94e9b6eChristian Maeder gi_GraphInfo = actGraphInfo,
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder internalNamesIORef = showInternalNames
3f0cd3e73a8aa47bb586b69fe5f7fa450000ecfdChristian Maeder }) toggle = do
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder deactivateGraphWindow gid actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder (intrn::InternalNames) <- readIORef showInternalNames
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder let showThem = if toggle then not $ showNames intrn else showNames intrn
690f3a0b5f77633547e0a797c96b005a5f6ae56cChristian Maeder showItrn s = if showThem then s else ""
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder mapM_ (\(s,upd) -> upd (\_ -> showItrn s)) $ updater intrn
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder writeIORef showInternalNames $ intrn {showNames = showThem}
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder redisplay gid actGraphInfo
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder activateGraphWindow gid actGraphInfo
690f3a0b5f77633547e0a797c96b005a5f6ae56cChristian MaedershowNodes :: GInfo -> IO ()
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian MaedershowNodes gInfo@(GInfo {descrIORef = event,
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder graphId = gid,
0af0cffad0fea46df86ff9a9b1d490247871719aChristian Maeder gi_GraphInfo = actGraphInfo
74085f08cdbbfd79fe5f9c6a455ed0b0cadcf145Christian Maeder deactivateGraphWindow gid actGraphInfo
dcb9ff0e2c2379735acce7073196508d455e0b01Christian Maeder descr <- readIORef event
9256f871e7dd915ccfb5969e2117f054306cd366Christian Maeder AGV.Result _ errorMsg <- checkHasHiddenNodes gid descr actGraphInfo
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder case errorMsg of
c438c79d00fc438f99627e612498744bdc0d0c89Christian Maeder Nothing -> do
0af0cffad0fea46df86ff9a9b1d490247871719aChristian Maeder showTemporaryMessage gid actGraphInfo "Revealing hidden nodes ..."
e849958012c0bd2bfa751f6ec264b3ecb680c00aChristian Maeder showIt gid descr actGraphInfo
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder hideShowNames gInfo False
5e605dc61ff9ec5724c319603905dc9b0dccc05fChristian Maeder showTemporaryMessage gid actGraphInfo "No hidden nodes found ..."
690f3a0b5f77633547e0a797c96b005a5f6ae56cChristian Maeder activateGraphWindow gid actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian MaederhideNodes :: GInfo -> IO ()
9c07aad044613547d61ab235665c08adcef03a1cChristian MaederhideNodes (GInfo {descrIORef = event,
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder graphId = gid,
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder gi_GraphInfo = actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder deactivateGraphWindow gid actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder descr' <- readIORef event
9c07aad044613547d61ab235665c08adcef03a1cChristian Maeder AGV.Result _ errorMsg <- checkHasHiddenNodes gid descr' actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder case errorMsg of
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder Nothing -> do
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder showTemporaryMessage gid actGraphInfo "Nodes already hidden ..."
ccd28c25c1aee73a195053e677eca17e20917d84Christian Maeder showTemporaryMessage gid actGraphInfo "Hiding unnamed nodes..."
0af0cffad0fea46df86ff9a9b1d490247871719aChristian Maeder AGV.Result descr msg <- hideSetOfNodeTypes gid
b1c32a0faa63e0c13687f36a2faae5969ec0a9d5Christian Maeder [--red nodes are not hidden
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder --"open_cons__internal",
0af0cffad0fea46df86ff9a9b1d490247871719aChristian Maeder --"locallyEmpty__open_cons__internal",
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder --"proven_cons__internal",
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder "locallyEmpty__proven_cons__internal"]
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder True actGraphInfo
5cc369fbceee1b13bd0f06e43620c46541d1d4f8Christian Maeder writeIORef event descr
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder Nothing -> do redisplay gid actGraphInfo
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder Just err -> putStrLn err
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder activateGraphWindow gid actGraphInfo
a255351561838b3743d03c1629d335cfb8b83804Christian MaedertranslateGraph :: GInfo -> ConvFunc -> LibFunc -> IO ()
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian MaedertranslateGraph (GInfo {libEnvIORef = ioRefProofStatus,
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder gi_LIB_NAME = ln,
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder gi_hetcatsOpts = opts
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder }) convGraph showLib = do
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder le <- readIORef ioRefProofStatus
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder openTranslateGraph le ln opts (getDGLogic le) convGraph showLib
a255351561838b3743d03c1629d335cfb8b83804Christian MaedershowLibGraph :: GInfo -> LibFunc -> IO ()
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian MaedershowLibGraph gInfo showLib = do
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder showLib gInfo
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian MaederperformProofAction :: GInfo -> IO () -> IO ()
a255351561838b3743d03c1629d335cfb8b83804Christian MaederperformProofAction gInfo@(GInfo {descrIORef = event,
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder graphId = gid,
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder gi_GraphInfo = actGraphInfo
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder }) proofAction = do
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder deactivateGraphWindow gid actGraphInfo
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder let actionWithMessage = do
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder showTemporaryMessage gid actGraphInfo
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder "Applying development graph calculus proof rule..."
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder descr <- readIORef event
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder AGV.Result _ errorMsg <- checkHasHiddenNodes gid descr actGraphInfo
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder case errorMsg of
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder Nothing -> do
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder showNodes gInfo
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder actionWithMessage
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder hideNodes gInfo
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder Just _ -> actionWithMessage
7d13f393d82fc9e02d741927fad70d6be96081e2Christian Maeder showTemporaryMessage gid actGraphInfo
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder "Development graph calculus proof rule finished."
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder activateGraphWindow gid actGraphInfo
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian MaedersaveProofStatus :: GInfo -> FilePath -> IO ()
a255351561838b3743d03c1629d335cfb8b83804Christian MaedersaveProofStatus (GInfo {libEnvIORef = ioRefProofStatus,
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder gi_LIB_NAME = ln,
c8ecc5578d32b222f35b625d4dfe7a3fd8bb4173Christian Maeder gi_hetcatsOpts = opts
64c3ee43f3cbacbeffb633103ffe6269f2177485Christian Maeder }) file = encapsulateWaitTermAct $ do
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder proofStatus <- readIORef ioRefProofStatus
a255351561838b3743d03c1629d335cfb8b83804Christian Maeder writeShATermFile file (ln, lookupHistory ln proofStatus)
190828a6ce12ff8c502e3d7303dcc0d70db49b6cChristian Maeder putIfVerbose opts 2 $ "Wrote " ++ file
Just (_, libEnv) -> case Map.lookup ln libEnv of
let proofStatus = Map.insert ln
-> (LibEnv -> IO (Res.Result LibEnv))
HTk.putWinOnTop w))
Res.Result ds res <- proofFun proofStatus
Map.insert ln newGr newProofStatus
case InjMap.lookupWithB descr dgAndabstrNodeMap of
Res.Result ds Nothing -> show $ vcat $ map pretty ds
Res.Result _ m -> showDoc m ""
in createTextDisplay title (showDoc (descr-1) "") [HTk.size(10,10)]
case InjMap.lookupWithB descr dgAndabstrNodeMap of
[HTk.size(80,50)]
DGraph -> IO (Res.Result (Node,G_theory))
$ InjMap.lookupWithB descr dgAndabstrNodeMap
case InjMap.lookupWithB descr dgAndabstrNodeMap of
[HTk.size(30,10)]
Res.Result ds res -> do
$ InjMap.lookupWithB descr dgAndabstrNodeMap
Res.Result [] (Just (node,th)) -> do
Res.Result ds _ <- runResultT(
Res.Result ds _ -> showDiags opts ds
case InjMap.lookupWithB descr dgAndabstrNodeMap of
Res.Result _ (Just th) ->
in createTextDisplay title logstr [HTk.size(30,10)]
Res.Result ds _ ->
case InjMap.lookupWithB descr dgAndabstrNodeMap of
(showDoc orig "") [HTk.size(30,10)]
case InjMap.lookupWithB descr dgAndabstrNodeMap of
createTextDisplay title stat [HTk.size(105,55)]
let goals = OMap.filter (not . isAxiom) sens
(proven,open) = OMap.partition isProvenSenStatus goals
case InjMap.lookupWithB descr dgAndabstrNodeMap of
createTextDisplay "ID of Edge" (show $ dgl_id linklab) [HTk.size(30,10)]
++ "in the development graph") [HTk.size(30,10)]
[HTk.size(100,40)]
++ "in the development graph") [HTk.size(30,10)]
(showDoc (dgl_origin linklab) "") [HTk.size(30,10)]
++ "in the development graph") [HTk.size(30,10)]
createTextSaveDisplay "Proof Status" "proofstatus.txt"
Res.Result _ (Just th1) -> th1
sign2 <- coerceSign lid1 lid "checkconservativityOfEdge.coerceSign" sign1
let Res.Result ds res =
(showRes ++ "\n" ++ myDiags) [HTk.size(50,50)]
++ "in the development graph") [HTk.size(30,10)]
AGV.Result newDescr _ <- addnode descr
{ dgAndabstrNode = InjMap.insert (libname, node) newDescr
do let srcnode = InjMap.lookupWithA (libname,src) (dgAndabstrNode convMaps)
tarnode = InjMap.lookupWithA (libname,tar) (dgAndabstrNode convMaps)
AGV.Result newDescr msg <- addlink descr (getDGLinkType edgelab)
{ dgAndabstrEdge = InjMap.insert (libname,
case InjMap.lookupWithB descr (dgAndabstrNode convMaps) of
case Map.lookup libname libname2dgMap of
case Map.lookup refLibname libname2dgMap of
case InjMap.lookupWithB descr (dgAndabstrNode convMaps) of
case Map.lookup libname libname2dgMap of
AGV.Result eventDescr errorMsg <- hidenodes abstractGraph
case InjMap.lookupWithA (libname, node) (dgAndabstrNode convMaps) of
case InjMap.lookupWithA dgNode (dgAndabstrNode convMaps) of
AGV.Result descr err <-
{ dgAndabstrNode = InjMap.updateBWithA dgNode
AGV.Result descr err <-
{ dgAndabstrNode = InjMap.insert dgNode descr
case InjMap.lookupWithA dgnode (dgAndabstrNode convMaps) of
AGV.Result descr err <- delnode gid abstrNode grInfo
{ dgAndabstrNode = InjMap.delete dgnode abstrNode
case (InjMap.lookupWithA (libname, src) dgAndabstrNodeMap,
InjMap.lookupWithA (libname, tgt) dgAndabstrNodeMap) of
AGV.Result descr err <-
{ dgAndabstrEdge = InjMap.insert dgEdge descr
case (InjMap.lookupWithA dgEdge dgAndabstrEdgeMap) of
do AGV.Result descr err <- dellink gid abstrEdge grInfo
{ dgAndabstrEdge = InjMap.delete dgEdge
-> Res.Result G_sublogics -> ConvFunc -> LibFunc -> IO ()
openTranslateGraph libEnv ln opts (Res.Result diagsSl mSublogic) convGraph
-- (see GUI.DGTranslation.getDGLogic), the process need not to go on.
Res.Result diagsR i <- runResultT ( do
Res.Result diagsTrans (Just newLibEnv) -> do
Res.Result diagsTrans Nothing ->