ProveConsistency.hs revision 04857331be117d4e2215d866c309a17bd9a7e15c
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederModule : $Header$
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederDescription : CMDL interface commands
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederCopyright : uni-bremen and DFKI
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederMaintainer : r.pascanu@jacobs-university.de
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederStability : provisional
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian MaederPortability : portable
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian MaederCMDL.ProveConsistency contains prove and consistency check command
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder , cConsChecker
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder , sigIntHandler
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maederimport Interfaces.GenericATPState (ATPTacticScript (..))
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maederimport CMDL.DataTypes (CmdlState (intState))
7f0e81a8fc10c17b13569f23474a0e3fbfa79e7dChristian Maederimport CMDL.Utils (checkPresenceProvers)
ea03c5d09694b4a966fbd19d46cfa5772648d95fChristian Maederimport Comorphisms.LogicGraph (logicGraph)
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maederimport Common.Result (Result (Result))
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maederimport qualified Common.OrderedMap as OMap
cf3232cec840a6945667bdb06f5b47b22243bc8fChristian Maederimport qualified Data.Map as Map
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maederimport Control.Concurrent (ThreadId, killThread)
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maederimport Control.Concurrent.MVar (MVar, newMVar, putMVar, takeMVar, readMVar,
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder swapMVar, modifyMVar_)
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maedernegate_th_with_cons_checker :: G_theory_with_cons_checker -> String -> Maybe G_theory_with_cons_checker
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maedernegate_th_with_cons_checker g_th goal = case g_th of
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder G_theory_with_cons_checker lid1 th cons_check ->
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder P.Theory lid2 sens -> case OMap.lookup goal sens of
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder Nothing -> Nothing
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder Just sen -> case negation lid1 $ sentence sen of
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder Nothing -> Nothing
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder Just sen' -> let
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder negSen = sen { sentence = sen', isAxiom = True }
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder sens' = OMap.insert goal negSen $ OMap.filter isAxiom sens
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder target' = P.Theory lid2 sens'
f0742398d4587242b1a115de113cd17f63dcb6d0Christian Maeder in Just $ G_theory_with_cons_checker lid1 th{P.tTarget = target'} cons_check
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian MaedergetProversAutomatic :: G_sublogics -> [(G_prover, AnyComorphism)]
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian MaedergetProversAutomatic sl = getAllProvers P.ProveCMDLautomatic sl logicGraph
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder-- | Select a prover
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian MaedercProver :: String -> CmdlState -> IO CmdlState
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian MaedercProver input state =
e289294500ad68fa0706b09521af340bbb356a69Christian Maeder -- trimed input
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder inpls <- checkPresenceProvers [trim input]
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder let inp = case inpls of
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder [] -> "Unknown"
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder pnme : _ -> pnme
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder case i_state $ intState state of
08faa81d4dd8409cd923b334064f64f802ecc33dChristian Maeder Nothing -> return $ genMsgAndCode "Nothing selected" 1 state
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder -- check that some theories are selected
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder case elements pS of
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder [] -> return $ genMsgAndCode "Nothing selected" 1 state
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder Element z _ : _ -> let
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder prov = getProversAutomatic (sublogicOfTheory z)
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder pl = filter ((== inp) . getProverName . fst) prov
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder prover_names = map (getProverName . fst) prov
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder in case case cComorphism pS of
3c72be149cf673945cbe07a04c336fb8f4d406a3Christian Maeder Nothing -> pl
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder Just x -> filter ((== x) . snd) pl ++ pl of
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder [] -> (if inp=="" then do
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder mapM_ putStrLn (nub prover_names)
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder else return (genMsgAndCode
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder ("No applicable prover with name \"" ++ inp ++ "\" found") 1
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder (p, nCm@(Comorphism cid)) : _ ->
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder return $ add2hist [ ProverChange $ prover pS
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder , CComorphismChange $ cComorphism pS ]
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder $ genMessage "" ("Hint: Using comorphism `"
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder ++ language_name cid ++ "`")
c00adad2e9459b422dee09e3a2bddba66b433bb7Christian Maeder intState = (intState state) {
502ed7ed7fecd10b6d0c83cdd48a244ec45e840aChristian Maeder i_state = Just pS
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder { cComorphism = Just nCm
02b62afbc463450900c5285569e9ab6dc2f9a014Christian Maeder , prover = Just p } } }
02b62afbc463450900c5285569e9ab6dc2f9a014Christian Maeder-- | Selects a consistency checker
case P.ccAutomatic p of
(P.TacticScript tLimit)
putStrLn $ case P.ccResult cstat of
Just iist -> case P.ccResult cstat of
Just iist { i_libEnv = Map.insert ln newDg le } }
Nothing -> lookupKnownProver st P.ProveCMDLautomatic
Nothing -> lookupKnownProver st P.ProveCMDLautomatic
lookupKnownProver st P.ProveCMDLautomatic
case P.proveCMDLautomaticBatch p of
$ P.toNamedList sens))) -}
(P.TacticScript $ show sTxt)
case P.ccAutomatic p of
th2 <- coerceTheoryMorphism l2 l "coerce error CMDL.ProveConsistency " th'
(P.TacticScript tLimit)
putStrLn $ case P.ccResult cstat of
Just iist -> case P.ccResult cstat of
Just iist { i_libEnv = Map.insert ln newDg le } }
MVar (Result [P.ProofStatus proof_tree]) ->
mapM_ (\ gs -> putStrLn $ "Goal " ++ P.goalName gs
++ " used " ++ unwords (P.usedAxioms gs))
$ filter P.isProvedStat d'
-- kill the prove/prove-all thread