ProveCommands.hs revision c3f7e132e0c214b755c6c4b485f4748c4dd1595c
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke{-# LANGUAGE CPP #-}
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederModule : $Header$
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeDescription : CMDL interface commands
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuCopyright : uni-bremen and DFKI
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeMaintainer : r.pascanu@jacobs-university.de
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeStability : provisional
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkePortability : portable
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaederCMDL.ProveCommands contains all commands (except prove\/consistency check)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederrelated to prove mode
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke ( cTranslate
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke , cDropTranslations
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke , cGoalsAxmGeneral
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke , cSetUseThms
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke , cSetSave2File
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder , cStartScript
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder , cNotACommand
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport CMDL.DataTypes(CmdlState(intState), CmdlGoalAxiom(..),
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder CmdlListAction(..))
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport CMDL.DataTypesUtils(add2hist, genErrorMsg, genMessage, getIdComorphism)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport CMDL.DgCommands(selectANode)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport CMDL.ProveConsistency(doLoop, sigIntHandler)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport CMDL.Utils(checkIntString)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Static.GTheory(G_theory(G_theory))
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Common.Result(Result(Result))
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport qualified Common.OrderedMap as OMap
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Data.List (find, nub)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Comorphisms.LogicGraph(lookupComorphism_in_LG)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport Proofs.AbstractState(ProofState(..))
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport Logic.Comorphism(compComorphism)
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport Control.Concurrent.MVar(newEmptyMVar, newMVar, takeMVar)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport System.Posix.Signals(Handler(Catch), installHandler, sigINT)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartkeimport Interfaces.GenericATPState(ATPTacticScript(tsTimeLimit, tsExtraOpts))
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maederimport Interfaces.DataTypes(ListChange(..), IntIState(..), Int_NodeInfo(..),
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke UndoRedoElem(..), IntState(i_state))
656f17ae9b7610ff2de1b6eedeeadea0c3bcdc8dChristian Maeder-- | Drops any seleceted comorphism
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkecDropTranslations :: CmdlState -> IO CmdlState
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaedercDropTranslations state =
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke case i_state $ intState state of
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Nothing -> return $ genErrorMsg "Nothing selected" state
656f17ae9b7610ff2de1b6eedeeadea0c3bcdc8dChristian Maeder case cComorphism pS of
656f17ae9b7610ff2de1b6eedeeadea0c3bcdc8dChristian Maeder Nothing -> return state
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Just _ -> return $
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke add2hist [CComorphismChange $ cComorphism pS] $
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke intState = (intState state ) {
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke i_state = Just $ pS {
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke cComorphism = getIdComorphism $ elements pS } }
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder-- | select comorphisms
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkecTranslate::String -> CmdlState -> IO CmdlState
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian MaedercTranslate input state =
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder case i_state $ intState state of
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke -- nothing selected !
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Nothing -> return $ genErrorMsg "Nothing selected" state
a23e572c8f957cc051a1b0831abd6fe9380d45c7Christian Maeder -- parse the comorphism name
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder case lookupComorphism_in_LG $ trim input of
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder Result _ Nothing -> return $ genErrorMsg "Wrong comorphism name" state
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder Result _ (Just cm) ->
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder case cComorphism pS of
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder -- when selecting some theory the Id comorphism is automatically
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Nothing -> return $ genErrorMsg "No theory selected" state
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke case compComorphism ocm cm of
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Result _ Nothing ->
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke return $ genErrorMsg "Can not add comorphism" state
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke Result _ (Just smth) ->
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke return $ genMessage [] "Adding comorphism"
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke $ add2hist [CComorphismChange $ cComorphism pS] $
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder intState = (intState state) {
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder i_state = Just pS {
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder cComorphism = Just smth } }
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeparseElements :: CmdlListAction -> [String] -> CmdlGoalAxiom
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke -> [Int_NodeInfo]
a7be28e157e9ceeec73a8fd0e642c36ea29d4218Christian Maeder -> ([Int_NodeInfo],[ListChange])
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke -> ([Int_NodeInfo],[ListChange])
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus HartkeparseElements action gls gls_axm elems (acc1,acc2)
9f93539f2fa4f5b9d935c7baa22fcd750806def9Klaus Hartke = case elems of
ChangeGoals -> OMap.keys $ goalMap st
OMap.keys aMap
selectedGoals = OMap.keys $
includedAxioms = OMap.keys aMap,
includedTheorems = OMap.keys $