Changeset 12745
- Timestamp:
- 28.10.2009 20:20:15 (3 weeks ago)
- Location:
- trunk
- Files:
-
- 16 modified
-
CMDL/DgCommands.hs (modified) (1 diff)
-
CMDL/ProveConsistency.hs (modified) (14 diffs)
-
CMDL/Shell.hs (modified) (6 diffs)
-
Comorphisms/HetLogicGraph.hs (modified) (1 diff)
-
GUI/GtkConsistencyChecker.hs (modified) (1 diff)
-
GUI/ShowLogicGraph.hs (modified) (2 diffs)
-
Isabelle/IsaProve.hs (modified) (9 diffs)
-
Logic/Prover.hs (modified) (8 diffs)
-
Makefile (modified) (1 diff)
-
OWL/ProvePellet.hs (modified) (9 diffs)
-
Proofs/AbstractState.hs (modified) (9 diffs)
-
Proofs/InferBasic.hs (modified) (5 diffs)
-
Propositional/Prove.hs (modified) (5 diffs)
-
Propositional/ProveMinisat.hs (modified) (4 diffs)
-
Propositional/ProveWithTruthTable.hs (modified) (8 diffs)
-
SoftFOL/ProveDarwin.hs (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMDL/DgCommands.hs
r12730 r12745 205 205 th 206 206 (shrinkKnownProvers sl kpMap) 207 (getProvers ProveCMDLautomatic sl$207 (getProvers ProveCMDLautomatic (Just sl) $ 208 208 filter hasModelExpansion $ 209 findComorphismPaths logicGraph $ 210 sublogicOfTh th 209 findComorphismPaths logicGraph sl 211 210 ) 212 211 -- all goals and axioms are selected initialy in the proof status -
trunk/CMDL/ProveConsistency.hs
r12731 r12745 38 38 import Static.ComputeTheory 39 39 40 import Logic.Comorphism (AnyComorphism(..), Comorphism(targetLogic))41 import Logic.Grothendieck (findComorphismPaths)42 import Logic.Logic (Language(language_name), Logic(provers))40 import Logic.Comorphism 41 import Logic.Grothendieck 42 import Logic.Logic 43 43 import qualified Logic.Prover as P 44 44 … … 54 54 swapMVar, modifyMVar_) 55 55 56 import Control.Monad(when) 57 58 59 getProversAutomatic :: [AnyComorphism] -> [(G_prover, AnyComorphism)] 60 getProversAutomatic = foldl addProvers [] 61 where addProvers acc cm = 62 case cm of 63 Comorphism cid -> acc ++ 64 foldl (\ l p -> 65 if P.hasProverKind 66 P.ProveCMDLautomatic p 67 then (G_prover (targetLogic cid) 68 p,cm):l 69 else l) [] (provers $ targetLogic cid) 70 56 import Control.Monad 57 58 getProversAutomatic :: G_sublogics -> [(G_prover, AnyComorphism)] 59 getProversAutomatic sl = 60 getProvers P.ProveCMDLautomatic (Just sl) $ findComorphismPaths logicGraph sl 71 61 72 62 -- | Select a prover 73 cProver::String -> CmdlState -> 74 IO CmdlState 63 cProver::String -> CmdlState -> IO CmdlState 75 64 cProver input state = 76 65 do … … 86 75 case elements pS of 87 76 [] -> return $ genErrorMsg "Nothing selected" state 88 (Element z _):_ ->77 Element z _ :_ -> let sl = sublogicOfTh $ theory z in 89 78 -- see if any comorphism was used 90 79 case cComorphism pS of 91 80 -- if none use the theory of the first selected node 92 81 -- to find possible comorphisms 93 Nothing-> case find (\(y,_)-> getPName y == inp) $ 94 getProversAutomatic $ findComorphismPaths logicGraph $ 95 sublogicOfTh $ theory z of 82 Nothing-> case find (\ (y, _)-> getPName y == inp) 83 $ getProversAutomatic sl of 96 84 Nothing -> return $ genErrorMsg ("No applicable prover with" 97 85 ++" this name found") state … … 107 95 -- of provers 108 96 Just x -> 109 case find (\(y,_)-> getPName y == inp) $ getProversAutomatic [x] of 97 case find (\ (y, _)-> getPName y == inp) 98 $ getProvers P.ProveCMDLautomatic (Just sl) [x] of 110 99 Nothing -> 111 case find (\(y,_) -> getPName y == inp) $ getProversAutomatic $112 findComorphismPaths logicGraph $ sublogicOfTh $ theory zof100 case find (\(y,_) -> getPName y == inp) 101 $ getProversAutomatic sl of 113 102 Nothing -> return $ genErrorMsg ("No applicable prover with" 114 103 ++ " this name found") state … … 156 145 Nothing -> case find (\(y,_)-> 157 146 getPName y == inp) $ 158 getConsCheckers Automatic$ findComorphismPaths147 getConsCheckers $ findComorphismPaths 159 148 logicGraph $ sublogicOfTh $ theory z of 160 149 Nothing -> return $ genErrorMsg ("No applicable "++ … … 171 160 Just x -> 172 161 case find(\(y,_) -> getPName y == inp) 173 $ getConsCheckers Automatic[x] of162 $ getConsCheckers [x] of 174 163 Nothing -> 175 case find (\(y,_) -> getPName y == inp) $ getConsCheckersAutomatic$164 case find (\(y,_) -> getPName y == inp) $ getConsCheckers $ 176 165 findComorphismPaths logicGraph $ sublogicOfTh $ 177 166 theory z of … … 209 198 -- proofState of the node that needs proving 210 199 -- all theorems, goals and axioms should have 211 -- been selected before, but the theory should have212 -- not bee drecomputed200 -- been selected before, but the theory should have 201 -- not been recomputed 213 202 Int_NodeInfo -> 214 203 -- node name … … 226 215 -- returns an error message if anything happens 227 216 IO String 228 checkNode useTh save2File sTxt ndpf ndnm mp mcm mThr mSt mlbElibname217 checkNode _useTh _save2File sTxt ndpf ndnm mp mcm _mThr mSt _mlbE _libname 229 218 = case ndpf of 230 219 Element pf_st nd -> … … 235 224 -- compute a prover,comorphism pair to be used in preparing 236 225 -- the theory 237 p_cm@(_,acm) 238 <-case mcm of 239 Nothing -> lookupKnownConsChecker st P.ProveCMDLautomatic 226 p_cm@(_, acm)<- case mcm of 227 Nothing -> lookupKnownConsChecker st 240 228 Just cm' -> 241 229 case mp of 242 Nothing -> lookupKnownConsChecker st P.ProveCMDLautomatic243 Just p' -> return (p', cm')230 Nothing -> lookupKnownConsChecker st 231 Just p' -> return (p', cm') 244 232 245 233 -- try to prepare the theory … … 248 236 do 249 237 p_cm'@(prv',acm'@(Comorphism cid)) <- 250 lookupKnownConsChecker st P.ProveCMDLautomatic238 lookupKnownConsChecker st 251 239 putStrLn ("Analyzing node " ++ ndnm) 252 240 putStrLn ("Using the comorphism " ++ language_name cid) … … 254 242 return $ case prepareForConsChecking st p_cm' of 255 243 Result _ Nothing -> Nothing 256 Result _ (Just sm)-> Just (sm, acm')257 Result _ (Just sm) -> return $ Just (sm, acm)244 Result _ (Just sm)-> Just (sm, acm') 245 Result _ (Just sm) -> return $ Just (sm, acm) 258 246 case prep of 259 247 -- theory could not be computed 260 248 Nothing -> return "No suitable prover and comorphism found" 261 Just (G_theory_with_cons_checker lid1 th p, cmp)-> 262 case P.proveCMDLautomaticBatch p of 263 Nothing -> return "Error obtaining the prover" 264 Just fn -> 249 Just (G_theory_with_cons_checker _ th p, _)-> 250 case P.ccAutomatic p of 251 fn -> 265 252 do 266 -- mVar to poll the prover for results 267 answ <- newMVar (return []) 268 let st' = st { proverRunning= True} 253 let st' = st { proverRunning = True} 269 254 -- store initial input of the prover 270 255 swapMVar mSt $ Just $ Element st' nd 271 {- putStrLn ((theoryName st)++"\n"++ 272 (showDoc sign "") ++ 273 show (vsep (map (print_named lid1) 274 $ P.toNamedList sens))) -} 275 case selectedGoals st' of 276 [] -> return "No goals selected. Nothing to prove" 277 _ -> 278 do 279 tmp <-fn useTh 280 save2File 281 answ 282 (theoryName st) 256 fn (theoryName st) 283 257 (P.TacticScript $ show sTxt) 284 258 th [] 285 swapMVar mThr $ Just $ fst tmp 286 getResults lid1 cmp (snd tmp) answ mSt 287 swapMVar mThr Nothing 288 lbEnv <- readMVar mlbE 289 state <- readMVar mSt 290 case state of 291 Nothing -> return [] 292 Just state' -> 293 do 294 lbEnv' <- addResults lbEnv libname state' 295 swapMVar mSt Nothing 296 swapMVar mlbE lbEnv' 297 return [] 298 259 swapMVar mSt $ Just $ Element st nd 260 return "" 299 261 300 262 -- | Given a proofstatus the function does the actual call of the … … 377 339 _ -> 378 340 do 379 tmp <- fn useTh341 tmp <- fn useTh 380 342 save2File 381 343 answ … … 419 381 420 382 -- | inserts the results of the proof in the development graph 421 addResults :: LibEnv 422 -> LibName 423 -> Int_NodeInfo 424 -> IO LibEnv 383 addResults :: LibEnv -> LibName -> Int_NodeInfo -> IO LibEnv 425 384 addResults lbEnv libname ndps = 426 385 case ndps of 427 Element ps' node -> 428 do 429 -- inspired from Proofs/InferBasic.hs 430 -- and GUI/ProofManagement.hs 431 let ps'' = ps' { 432 proverRunning = False } 433 case theory ps'' of 386 Element ps'' node -> case theory ps'' of 434 387 G_theory lidT sigT indT sensT _ -> 435 388 do 436 gMap <- coerceThSens (logicId ps'') lidT389 gMap <- coerceThSens (logicId ps'') lidT 437 390 "ProveCommands last coerce" 438 391 (goalMap ps'') … … 531 484 mlbE 532 485 (i_ln pS)) 533 when (not $null err) (putStrLn err)486 unless (null err) (putStrLn err) 534 487 doLoop mlbE mThr mSt mOut pS l prvr -
trunk/CMDL/Shell.hs
r12730 r12745 36 36 import Interfaces.GenericATPState 37 37 38 import Logic.Comorphism (AnyComorphism(..), Comorphism(sourceLogic, targetLogic))38 import Logic.Comorphism 39 39 import Logic.Grothendieck(findComorphismPaths) 40 import Logic.Prover(ProverKind(ProveCMDLautomatic), 41 ProverTemplate(proverName), hasProverKind) 42 import Logic.Logic(Language(language_name), Logic(cons_checkers, provers)) 43 44 import Proofs.AbstractState(ProofState(logicId, theory), G_prover(..), 45 G_cons_checker(..)) 40 import Logic.Prover 41 import Logic.Logic 42 43 import Proofs.AbstractState 46 44 47 45 import Static.DevGraph(DGNodeLab(dgn_name), isProvenSenStatus, showName) … … 334 332 then trimRight input 335 333 else unwords $ init $ words input 336 addConsCheckers acc cm = 337 case cm of 338 Comorphism cid -> acc ++ 339 foldl (\ l p -> if hasProverKind ProveCMDLautomatic p 340 then G_cons_checker (targetLogic cid) p : l 341 else l) 342 [] 343 (cons_checkers $ targetLogic cid) 344 getPName' x = case x of 345 (G_cons_checker _ p) -> proverName p 346 getConsCheckersAutomatic' = foldl addConsCheckers [] 347 createConsCheckersList = map getPName' . getConsCheckersAutomatic' 348 case i_state $ intState allState of 334 getCCName (G_cons_checker _ p) = ccName p 335 createConsCheckersList = map (getCCName . fst) . getConsCheckers 336 case i_state $ intState allState of 349 337 Nothing -> 350 338 -- not in proving mode !? you can not choose a consistency … … 354 342 case cComorphism proofState of 355 343 -- some comorphism was used 356 Just c -> return $ map (app bC) $ filter (isPrefixOf tC)344 Just c -> return $ map (app bC) $ filter (isPrefixOf tC) 357 345 $ createConsCheckersList [c] 358 346 Nothing -> … … 360 348 -- no elements selected 361 349 [] -> return [] 362 c:_ -> 363 case c of 350 c : _ -> case c of 364 351 Element z _ -> return $ map (app bC) 365 352 $ filter (isPrefixOf tC) … … 368 355 (sublogicOfTh $ theory z) 369 356 ReqProvers -> do 370 let tC = unwords $ tail $ words input 371 bC = head $ words input 372 addProvers acc cm = 373 case cm of 374 Comorphism cid -> acc ++ 375 foldl (\ l p -> if hasProverKind ProveCMDLautomatic p 376 then G_prover (targetLogic cid) p : l 377 else l) 378 [] 379 (provers $ targetLogic cid) 380 -- this function is identical to the one defined 381 -- in Proofs.InferBasic, but it is redone here 382 -- because InferBasic does not compile without 383 -- UNI_PACKAGE (so it should be moved) 384 getPName' (G_prover _ p) = proverName p 385 -- from the given comorphism generate a list of 386 -- provers that can be applied to theories in that 387 -- comorphism 388 getProversCMDLautomatic = foldl addProvers [] 389 createProverList = map getPName' . getProversCMDLautomatic 357 let bC : tl = words input 358 tC = unwords tl 359 createProverList = map (getProverName . fst) 360 . getProvers ProveCMDLautomatic Nothing 390 361 -- find the last comorphism used if none use the 391 362 -- the comorphism of the first selected node … … 406 377 [] -> return [] 407 378 -- use the first element to get a comorphism 408 c:_ -> 409 case c of 410 Element z _->do 379 c : _ -> case c of 380 Element z _ -> do 411 381 lst <- checkPresenceProvers 412 382 $ createProverList -
trunk/Comorphisms/HetLogicGraph.hs
r12661 r12745 69 69 top_gsl = toGSLPair $ top_sublogic lid 70 70 getPrvSL = map proverSublogic 71 prv_sls = getPrvSL (provers lid) ++ 72 getPrvSL (cons_checkers lid) 71 prv_sls = getPrvSL (provers lid) 73 72 in Map.union mp $ 74 73 Map.fromList (top_gsl : -
trunk/GUI/GtkConsistencyChecker.hs
r12743 r12745 264 264 forkIOWithPostProcessing 265 265 (return $ Map.elems $ foldr 266 (\ (cc, c) m ->266 (\ (cc, c) m -> 267 267 let n = getPName cc 268 268 f = Map.findWithDefault (Finder n cc [] 0) n m in 269 269 Map.insert n (f { comorphs = c : comorphs f}) m 270 270 ) Map.empty 271 $ getConsCheckers Automatic$ findComorphismPaths logicGraph sl)271 $ getConsCheckers $ findComorphismPaths logicGraph sl) 272 272 $ \ res -> do 273 273 mapM_ (listStoreAppend list) res -
trunk/GUI/ShowLogicGraph.hs
r12661 r12745 223 223 224 224 showConsChecker lid = if null (cons_checkers lid) then "None" 225 else unlines $ map proverName (cons_checkers lid)225 else unlines $ map ccName (cons_checkers lid) 226 226 showParse lid = 227 227 let s1 = case parse_basic_spec lid of … … 415 415 showConsChecker li = case cons_checkers li of 416 416 [] -> "None" 417 ls -> unlines $ map proverName ls417 ls -> unlines $ map ccName ls 418 418 showParse li = 419 419 let s1 = case parse_basic_spec li of -
trunk/Isabelle/IsaProve.hs
r12661 r12745 42 42 import Data.List (isSuffixOf) 43 43 import Control.Monad 44 import Data.Time (midnight) 44 45 45 46 import System.Directory … … 57 58 58 59 isabelleConsChecker :: ConsChecker Sign Sentence () (DefaultMorphism Sign) () 59 isabelleConsChecker = mkProverTemplate"Isabelle-refute" () consCheck60 isabelleConsChecker = ConsChecker "Isabelle-refute" () consCheck 60 61 61 62 -- | the name of the inconsistent lemma for consistency checks … … 70 71 _ -> binImpl (foldr1 binConj ts) t 71 72 72 consCheck :: String -> TheoryMorphism Sign Sentence (DefaultMorphism Sign) () 73 -> a -> IO([ProofStatus ()]) 74 consCheck thName tm freedefs = case tTarget tm of 75 Theory sig nSens -> let (axs, _) = getAxioms $ toNamedList nSens in 76 isaProve (thName ++ "_c") 73 consCheck :: String -> b 74 -> TheoryMorphism Sign Sentence (DefaultMorphism Sign) () -> a 75 -> IO (CCStatus ()) 76 consCheck thName _tac tm freedefs = case tTarget tm of 77 Theory sig nSens -> do 78 let (axs, _) = getAxioms $ toNamedList nSens 79 l <- isaProve (thName ++ "_c") 77 80 (Theory sig 78 81 $ markAsGoal $ toThSens $ if null axs then [] else … … 81 84 $ map (metaToTerm . metaTerm . sentence) axs ]) 82 85 freedefs 86 return $ CCStatus () midnight $ case l of 87 [_] -> Just False -- inconsistency was proven 88 _ -> Nothing -- consistency cannot be recorded automatically 83 89 84 90 prepareTheory :: Theory Sign Sentence () … … 117 123 getAllProofDeps :: Map.Map String String -> String -> [String] 118 124 -> IO([ProofStatus ()]) 119 getAllProofDeps m thName = mapM $ getProofDeps m thName125 getAllProofDeps m = mapM . getProofDeps m 120 126 121 127 checkFinalThyFile :: (TheoryHead, Body) -> String -> IO Bool … … 130 136 return False 131 137 else return $ null ds 132 Left err -> p utStrLn (show err)>> return False138 Left err -> print err >> return False 133 139 134 140 mkProved :: String -> [String] -> ProofStatus () … … 144 150 exOrig <- doesFileExist origFile 145 151 exThyFile <- doesFileExist thyFile 146 if exOrig then return () elsewriteFile origFile thy147 if exThyFile then return () elsewriteFile thyFile thy152 unless exOrig $ writeFile origFile thy 153 unless exThyFile $ writeFile thyFile thy 148 154 thy_time <- getModificationTime thyFile 149 155 orig_time <- getModificationTime origFile … … 174 180 unless (h && null ds) $ revertThyFile thyFile thy 175 181 Left err -> do 176 p utStrLn $ showerr182 print err 177 183 revertThyFile thyFile thy 178 184 … … 213 219 else return [] 214 220 Left err -> do 215 p utStrLn $ showerr221 print err 216 222 putStrLn $ "Sorry, generated theory cannot be parsed, see: " ++ thyFile 217 223 writeFile thyFile thy -
trunk/Logic/Prover.hs
r12661 r12745 23 23 import Data.List 24 24 import Data.Maybe (isJust) 25 import Data.Time (TimeOfDay, midnight)25 import Data.Time (TimeOfDay, midnight) 26 26 import Data.Typeable 27 27 … … 166 166 Theory sig (mapThSensStatus (mapProofStatus f) thSens) 167 167 168 -- | theory morphisms between two theories169 data TheoryMorphism sign sen mor proof_tree = TheoryMorphism170 { tSource :: Theory sign sen proof_tree171 , tTarget :: Theory sign sen proof_tree172 , tMorphism :: mor }173 174 168 -- e.g. the file name, or the script itself, or a configuration string 175 169 data TacticScript = TacticScript String deriving (Eq, Ord, Show) … … 208 202 openGoalStatus = Open $ Reason [] 209 203 210 -- | data type representing the proof status for a goal or204 -- | data type representing the proof status for a goal 211 205 data ProofStatus proof_tree = ProofStatus 212 206 { goalName :: String … … 217 211 , usedTime :: TimeOfDay 218 212 , tacticScript :: TacticScript } 219 | Consistent TacticScript220 213 deriving (Show, Eq, Ord) 221 214 … … 223 216 make sure to set proofTree to a useful value before you access it. -} 224 217 openProofStatus :: Ord pt => String -- ^ name of the goal 225 -> String -- ^ name of the prover226 -> pt -> ProofStatus pt218 -> String -- ^ name of the prover 219 -> pt -> ProofStatus pt 227 220 openProofStatus goalname provername proof_tree = ProofStatus 228 221 { goalName = goalname … … 238 231 239 232 isProvedStat :: ProofStatus proof_tree -> Bool 240 isProvedStat pst = case pst of 241 Consistent _ -> False 242 _ -> isProvedGStat . goalStatus $ pst 233 isProvedStat = isProvedGStat . goalStatus 243 234 244 235 isProvedGStat :: GoalStatus -> Bool … … 290 281 -> theory -- 6. 291 282 -> [FreeDefMorphism sentence morphism] 292 -> IO (Concurrent.ThreadId, Concurrent.MVar ())) -- output283 -> IO (Concurrent.ThreadId, Concurrent.MVar ())) -- output 293 284 -- input: 1. True means include proven theorems in subsequent 294 285 -- proof attempts; … … 321 312 , proveCMDLautomaticBatch = Nothing } 322 313 323 type ConsChecker sign sentence sublogics morphism proof_tree = 324 ProverTemplate (TheoryMorphism sign sentence morphism proof_tree) 325 sentence morphism sublogics proof_tree 314 -- | theory morphisms between two theories 315 data TheoryMorphism sign sen mor proof_tree = TheoryMorphism 316 { tSource :: Theory sign sen proof_tree 317 , tTarget :: Theory sign sen proof_tree 318 , tMorphism :: mor } 319 320 data CCStatus proof_tree = CCStatus 321 { ccProofTree :: proof_tree 322 , ccUsedTime :: TimeOfDay 323 , ccResult :: Maybe Bool } 324 325 data ConsChecker sign sentence sublogics morphism proof_tree = ConsChecker 326 { ccName :: String 327 , ccSublogic :: sublogics 328 , ccAutomatic :: String -- 1. 329 -> TacticScript -- 2. 330 -> TheoryMorphism sign sentence morphism proof_tree -- 3. 331 -> [FreeDefMorphism sentence morphism] -- 4. 332 -> IO (CCStatus proof_tree) -- output 333 -- input: 1. theory name 334 -- 2. default TacticScript 335 -- 3. theory morphism 336 -- 5. ingoing free definition morphisms 337 -- output: consistency result status 338 } deriving Typeable 339 -
trunk/Makefile
r12733 r12745 250 250 ATC/Prover.der.hs: Logic/Prover.hs $(GENRULES) 251 251 $(GENRULECALL) -x Logic.Prover.ProverTemplate \ 252 -x Logic.Prover.ConsChecker \ 252 253 -i ATC.AS_Annotation -i ATC.OrderedMap -o $@ $< 253 254 -
trunk/OWL/ProvePellet.hs
r12730 r12745 27 27 import GUI.GenericATP 28 28 import Interfaces.GenericATPState 29 import GUI.Utils ( createTextSaveDisplay,infoDialog)29 import GUI.Utils (infoDialog) 30 30 31 31 import Proofs.BatchProcessing … … 77 77 pelletProverState sig oSens _ = PelletProverState 78 78 { ontologySign = sig 79 ,initialState = filter isAxiom oSens }79 , initialState = filter isAxiom oSens } 80 80 81 81 {- | … … 87 87 , proveCMDLautomaticBatch = Just pelletCMDLautomaticBatch } 88 88 89 pelletConsChecker :: ConsChecker Sign Axiom OWLSub 90 OWLMorphism ProofTree 91 pelletConsChecker = (mkProverTemplate "Pellet Consistency Checker" sl_top 92 (\ s -> consCheck True s $ TacticScript "800")) 93 { proveCMDLautomatic = Just 94 $ \ s ts t -> fmap return . consCheck False s ts t } 89 pelletConsChecker :: ConsChecker Sign Axiom OWLSub OWLMorphism ProofTree 90 pelletConsChecker = ConsChecker "Pellet" sl_top consCheck 95 91 96 92 {- | … … 120 116 -> Named Axiom -- ^ goal to add 121 117 -> PelletProverState 122 insertOWLAxiom pps s = 123 pps{initialState = (initialState pps) ++ [s]} 118 insertOWLAxiom pps s = pps { initialState = initialState pps ++ [s] } 124 119 125 120 -- ** GUI … … 183 178 -} 184 179 185 spamOutput :: ProofStatus ProofTree -> IO ()186 spamOutput ps =187 let188 dName = goalName ps189 dStat = goalStatus ps190 dTree = proofTree ps191 in192 case dStat of193 Open (Reason l) ->194 createTextSaveDisplay "Pellet prover" ("./"++ dName ++".pellet.log")195 $ unlines196 (show dTree :l)197 Disproved -> createTextSaveDisplay "Pellet prover" (dName ++".pellet.owl")198 (199 show dTree200 )201 Proved (Just True) -> -- consistent202 do --createInfoWindow "Pellet consistency check"203 -- "This ontology is consistent."204 createTextSaveDisplay "Pellet prover" ("./"++ dName ++".pellet.log")205 (206 -- "I found a model for the theory " ++207 -- dName ++". :) \n" ++208 show dTree209 )210 211 Proved (Just False) -> -- not consistent212 do --createInfoWindow "Pellet consistency check"213 -- "This ontology is not consistent."214 createTextSaveDisplay "Pellet prover" ("./"++ dName ++".pellet.log")215 (216 -- "I found a model for the theory " ++217 -- dName ++". :) \n" ++218 show dTree219 )220 221 Proved Nothing -> return () -- todo: another errors222 223 180 getEnvSec :: String -> IO String 224 181 getEnvSec s = getEnvDef s "" 225 182 226 consCheck :: Bool ->String183 consCheck :: String 227 184 -> TacticScript 228 185 -> TheoryMorphism Sign Axiom OWLMorphism ProofTree 229 186 -> [FreeDefMorphism Axiom OWLMorphism] -- ^ freeness constraints 230 -> IO ([ProofStatus ProofTree])231 consCheck doSpamOutput thName tac@(TacticScript tl) tm freedefs =187 -> IO (CCStatus ProofTree) 188 consCheck thName (TacticScript tl) tm freedefs = 232 189 case tTarget tm of 233 190 Theory sig nSens -> … … 237 194 proverStateI = pelletProverState sig 238 195 (toNamedList nSens) freedefs 239 -- problem = showOWLProblemA thName proverStateI []240 196 problemS = showOWLProblemS thName proverStateI [] 241 197 simpleOptions = "consistency " … … 243 199 saveFileName = reverse $ fst $ span (/='/') $ reverse thName 244 200 tmpFileName = saveFileName 245 pStatus out tUsed = ProofStatus 246 { goalName = thName 247 , goalStatus = Disproved 248 , usedAxioms = getAxioms 249 , usedProver = proverName pelletProver 250 , proofTree = ProofTree $ unlines out ++ "\n\n" ++ problemS 251 , usedTime = timeToTimeOfDay 252 $ secondsToDiffTime $ toInteger tUsed 253 , tacticScript = tac } 201 pStatus out tUsed = CCStatus 202 { ccResult = Nothing 203 , ccProofTree = ProofTree $ unlines out ++ "\n\n" ++ problemS 204 , ccUsedTime = timeToTimeOfDay 205 $ secondsToDiffTime $ toInteger tUsed } 254 206 proofStatM :: ExitCode -> String -> [String] 255 -> Int -> ProofStatus ProofTree207 -> Int -> CCStatus ProofTree 256 208 proofStatM exitCode _ out tUsed = 257 209 case exitCode of 258 210 ExitSuccess -> -- consistent 259 211 (pStatus out tUsed) 260 { goalStatus = Proved (Just True)}212 { ccResult = Just True } 261 213 ExitFailure 1 -> -- not consistent 262 214 (pStatus out tUsed) 263 { goalStatus = Proved (Just False)}215 { ccResult = Just False } 264 216 ExitFailure 2 -> -- error by runing pellet 265 217 (pStatus out tUsed) 266 { proofTree = ProofTree "Cannot run pellet." }218 { ccProofTree = ProofTree "Cannot run pellet." } 267 219 ExitFailure 3 -> -- timeout 268 220 (pStatus out tUsed) 269 { goalStatus = openGoalStatus 270 , proofTree = ProofTree $ unlines out ++ "\n\n" ++ "timeout" 271 ++ unlines out 272 , usedTime = timeToTimeOfDay $ secondsToDiffTime 0 } 221 { ccProofTree = ProofTree $ unlines out ++ "\n\n" 222 ++ "timeout" } 273 223 ExitFailure 4 -> -- error by runing pellet 274 224 (pStatus out tUsed) 275 { proofTree = ProofTree $ "Pellet returned an error.\n"225 { ccProofTree = ProofTree $ "Pellet returned an error.\n" 276 226 ++ unlines out } 277 227 ExitFailure _ -> -- another errors 278 228 pStatus out tUsed 279 getAxioms = 280 map senAttr $ initialState proverStateI 281 282 timeWatch :: Int 283 -> IO (ProofStatus ProofTree) 284 -> IO (ProofStatus ProofTree) 229 230 timeWatch :: Int -> IO (CCStatus ProofTree) -> IO (CCStatus ProofTree) 285 231 timeWatch time process = 286 232 do … … 297 243 Nothing -> do 298 244 killThread tid1 `catch` print 299 return (ProofStatus{ 300 goalName = thName 301 , goalStatus = openGoalStatus 302 , usedAxioms = getAxioms 303 , usedProver = proverName pelletProver 304 , proofTree = ProofTree ("\n\n" ++ "timeout") 305 , usedTime = timeToTimeOfDay $ secondsToDiffTime 0 306 , tacticScript = tac 307 }) 245 return $ pStatus ["timeout"] time 308 246 in 309 247 do … … 336 274 return outState 337 275 ) 338 when doSpamOutput $ spamOutput outState339 276 removeFile timeTmpFile 340 return [outState]277 return outState 341 278 (b, _) -> do 342 279 let mess = "Pellet not " ++ 343 280 if b then "executable" else "found" 344 281 infoDialog "Pellet prover" mess 345 return [(openProofStatus thName (proverName pelletProver) 346 $ ProofTree mess) 347 { usedAxioms = getAxioms 348 , tacticScript = tac 349 }] 282 return $ pStatus [mess] (0 :: Int) 350 283 351 284 check4Pellet :: IO (Bool, Bool) -
trunk/Proofs/AbstractState.hs
r12661 r12745 21 21 , coerceConsChecker 22 22 , ProofActions (..) 23 , ProofState 24 , theoryName, theory, logicId, sublogicOfTheory, lastSublogic 25 , goalMap, proversMap, comorphismsToProvers, selectedGoals 26 , includedAxioms, includedTheorems, proverRunning, accDiags 27 , selectedProver, selectedConsChecker, selectedTheory 23 , ProofState (..) 28 24 , initialState 29 , selectedGoalMap, axiomMap 25 , selectedGoalMap 26 , axiomMap 30 27 , recalculateSublogicAndSelectedTheory 31 28 , GetPName (..) … … 35 32 , prepareForProving 36 33 , prepareForConsChecking 37 , getProvers, getConsCheckers 34 , getProvers 35 , getConsCheckers 38 36 , lookupKnownProver 39 37 , lookupKnownConsChecker 40 , getConsCheckersAutomatic41 38 ) where 42 39 … … 61 58 import Static.GTheory 62 59 import Static.DevGraph 63 64 60 65 61 -- * Provers … … 358 354 359 355 instance GetPName G_prover where 360 getPName (G_prover _ p) = proverName p356 getPName = getProverName 361 357 362 358 instance GetPName G_cons_checker where 363 getPName (G_cons_checker _ p) = proverName p 364 365 366 getConsCheckersAutomatic :: [AnyComorphism] -> 367 [(G_cons_checker, AnyComorphism)] 368 getConsCheckersAutomatic = foldl addConsCheckers [] 369 where addConsCheckers acc cm = 370 case cm of 371 Comorphism cid -> acc ++ 372 foldl (\ l p -> 373 if hasProverKind 374 ProveCMDLautomatic p 375 then (G_cons_checker (targetLogic cid) p,cm):l 376 else l) [] (cons_checkers $ targetLogic cid) 377 359 getPName (G_cons_checker _ p) = ccName p 360 361 362 getConsCheckers :: [AnyComorphism] -> [(G_cons_checker, AnyComorphism)] 363 getConsCheckers = concatMap (\ cm@(Comorphism cid) -> 364 map (\ cc -> (G_cons_checker (targetLogic cid) cc, cm)) 365 $ cons_checkers $ targetLogic cid) 378 366 379 367 lookupKnownConsChecker :: (Logic lid sublogics1 … … 387 375 raw_symbol1 388 376 proof_tree1 389 , Monad m) =>390 ProofState lid sentence -> ProverKind391 -> m (G_cons_checker, AnyComorphism)392 lookupKnownConsChecker st _=377 , Monad m) => 378 ProofState lid sentence 379 -> m (G_cons_checker, AnyComorphism) 380 lookupKnownConsChecker st = 393 381 let sl = sublogicOfTheory st 394 382 mt = do … … 397 385 return (pr_s, ps) 398 386 matchingCC s (gp,_) = case gp of 399 G_cons_checker _ p -> proverName p == s387 G_cons_checker _ p -> ccName p == s 400 388 findCC (pr_n,cms) = 401 389 case filter (matchingCC pr_n) $ getConsCheckers … … 427 415 ps <- Map.lookup pr_s (proversMap st) 428 416 return (pr_s, ps) 429 matchingPr s (gp, _) = case gp of430 G_prover _ p -> proverName p == s417 matchingPr s (gp, _) = case gp of 418 G_prover _ p -> proverName p == s 431 419 findProver (pr_n, cms) = 432 case filter (matchingPr pr_n) $ getProvers pk sl420 case filter (matchingPr pr_n) $ getProvers pk (Just sl) 433 421 $ filter (lessSublogicComor sl) cms of 434 422 [] -> fail "Proofs.InferBasic: no prover found" … … 438 426 439 427 -- | Pairs each target prover of these comorphisms with its comorphism 440 getProvers :: ProverKind -> G_sublogics428 getProvers :: ProverKind -> Maybe G_sublogics 441 429 -> [AnyComorphism] -> [(G_prover, AnyComorphism)] 442 getProvers pk (G_sublogics lid sl) = foldl addProvers [] 443 where addProvers acc cm = 444 case cm of 445 Comorphism cid -> let slid = sourceLogic cid in acc ++ 446 foldl (\ l p -> if hasProverKind pk p 447 && language_name lid == language_name slid 448 && maybe False 449 (flip isSubElem $ proverSublogic p) 450 (mapSublogic cid 451 $ forceCoerceSublogic lid slid sl) 452 then (G_prover (targetLogic cid) p,cm):l 453 else l) 454 [] 455 (provers $ targetLogic cid) 456 457 getConsCheckers :: [AnyComorphism] -> [(G_cons_checker, AnyComorphism)] 458 getConsCheckers = foldl addCCs [] 459 where addCCs acc cm = 460 case cm of 461 Comorphism cid -> acc ++ 462 map (\p -> (G_cons_checker (targetLogic cid) p,cm)) 463 (cons_checkers $ targetLogic cid) 430 getProvers pk msl = foldl addProvers [] 431 where addProvers acc cm = case cm of 432 Comorphism cid -> let 433 slid = sourceLogic cid 434 tlid = targetLogic cid 435 in acc ++ foldl (\ l p -> 436 if hasProverKind pk p 437 && case msl of 438 Just (G_sublogics lid sl) -> 439 language_name lid == language_name slid 440 && maybe False (flip isSubElem $ proverSublogic p) 441 (mapSublogic cid $ forceCoerceSublogic lid slid sl) 442 Nothing -> True 443 then (G_prover tlid p, cm) : l else l) 444 [] (provers tlid) 464 445 465 446 -- | the list of proof statuses is integrated into the goalMap of the state … … 484 465 sign morphism symbol raw_symbol proof_tree) => 485 466 AnyComorphism -> lid -> [ProofStatus proof_tree] 486 -> ThSens a (AnyComorphism, BasicProof)487 -> ThSens a (AnyComorphism, BasicProof)467 -> ThSens a (AnyComorphism, BasicProof) 468 -> ThSens a (AnyComorphism, BasicProof) 488 469 markProvedGoalMap c lid status thSens = foldl upd thSens status 489 470 where upd m pStat = OMap.update (updStat pStat) (goalName pStat) m -
trunk/Proofs/InferBasic.hs
r12661 r12745 143 143 -> TheoryMorphism sign sentence morphism proof_tree 144 144 -> [FreeDefMorphism sentence morphism] 145 -> IO (Result [ProofStatus proof_tree]) 146 consCheck _ = 147 fromMaybe (\ _ _ -> fail "proveCMDLautomatic not implemented") 148 . proveCMDLautomatic 145 -> IO (CCStatus proof_tree) 146 consCheck _ = ccAutomatic 149 147 150 148 proveTheory :: Logic lid sublogics … … 195 193 pts <- lift $ consCheck lidT cc' thName (TacticScript "20") mor 196 194 $ getCFreeDefMorphs lidT libEnv ln dGraph node 197 liftR $ case pts of 198 Result _ (Just [pt]) -> case goalStatus pt of 199 Proved (Just True) -> let 200 Result ds ms = extractModel cid sig1 $ proofTree pt 201 in case ms of 202 Nothing -> fail $ "consistent but could not reconstruct model\n" 203 ++ show (proofTree pt) 204 Just (sig3, sens3) -> Result ds $ Just $ 195 liftR $ case ccResult pts of 196 Just True -> let 197 Result ds ms = extractModel cid sig1 $ ccProofTree pts 198 in case ms of 199 Nothing -> fail $ "consistent but could not reconstruct model\n" 200 Just (sig3, sens3) -> Result ds $ Just $ 205 201 G_theory lidS (mkExtSign sig3) startSigId 206 202 (toThSens sens3) startThId 207 st -> fail $ "prover status is: " ++ show st208 Result ds _ -> Result ds Nothing203 Just False -> fail "theory is inconsistent." 204 Nothing -> fail "could not determine consistency." 209 205 else do 210 206 let freedefs = getCFreeDefMorphs lid1 libEnv ln dGraph node … … 218 214 recalculateSublogicAndSelectedTheory 219 215 } thName (hidingLabelWarning lbl) thForProof 220 kpMap (getProvers ProveGUI sublogiccms)216 kpMap (getProvers ProveGUI (Just sublogic) cms) 221 217 222 218 data ConsistencyStatus = CSUnchecked … … 229 225 -> DGraph -> LNode DGNodeLab -> Int 230 226 -> IO ConsistencyStatus 231 consistencyCheck (G_cons_checker lid4 cc) (Comorphism cid) ln le dg (n', lbl)227 consistencyCheck (G_cons_checker lid4 cc) (Comorphism cid) ln le dg (n', lbl) 232 228 timeout = do 233 229 let lidS = sourceLogic cid 230 lidT = targetLogic cid 231 thName = shows (getLibId ln) "_" ++ getDGNodeName lbl 234 232 t' = timeToTimeOfDay $ secondsToDiffTime $ toInteger timeout 235 233 ts = TacticScript $ show timeout 236 res <- runResultT $do237 (G_theory lid1 (ExtSign sign _) _ axs _) <-238 liftR $ getGlobalTheory lbl239 let thName = shows (getLibId ln) "_" ++ getDGNodeName lbl240 sens = toNamedList axs241 lidT = targetLogic cid242 bTh'@(sig1, _) <- coerceBasicTheory lid1 lidS "" (sign, sens)243 (sig2, sens2) <- liftR $ wrapMapTheory cid bTh'244 incl <- liftR $ subsig_inclusion lidT (empty_signature lidT) sig2245 let mor = TheoryMorphism { tSource = emptyTheory lidT246 , tTarget = Theory sig2 $ toThSens sens2247 , tMorphism = incl }248 cc' <- coerceConsChecker lid4 lidT "" cc249 Result ds pts <- lift $consCheck lidT cc' thName ts mor234 case do 235 (G_theory lid1 (ExtSign sign _) _ axs _) <- getGlobalTheory lbl 236 let sens = toNamedList axs 237 bTh'@(sig1, _) <- coerceBasicTheory lid1 lidS "" (sign, sens) 238 (sig2, sens2) <- wrapMapTheory cid bTh' 239 incl <- subsig_inclusion lidT (empty_signature lidT) sig2 240 return (sig1, TheoryMorphism 241 { tSource = emptyTheory lidT 242 , tTarget = Theory sig2 $ toThSens sens2 243 , tMorphism = incl }) of 244 Result ds Nothing -> return $ CSError $ unlines $ map diagString ds 245 Result _ (Just (sig1, mor)) -> do 246 cc' <- coerceConsChecker lid4 lidT "" cc 247 pt <- consCheck lidT cc' thName ts mor 250 248 $ getCFreeDefMorphs lidT le ln dg n' 251 case pts of 252 Just pts' -> return (pts', sig1) 253 _ -> liftR $ Result ds Nothing 254 case res of 255 Result ds Nothing -> return $ CSError $ unlines $ map diagString ds 256 Result _ (Just ([pt], sig1)) -> if usedTime pt >= t' then 257 return $ CSTimeout $ "No results within: " ++ show (usedTime pt) 258 else case goalStatus pt of 259 Proved (Just True) -> let 260 Result ds ms = extractModel cid sig1 $ proofTree pt 249 return $ case ccResult pt of 250 Just b -> if b then let 251 Result ds ms = extractModel cid sig1 $ ccProofTree pt 261 252 in case ms of 262 Nothing -> return $CSConsistent $ unlines $263 "consistent, but could not (re-)construct a model"264 : map diagString ds 265 Just (sig3, sens3) -> return $CSConsistent $ showDoc253 Nothing -> CSConsistent $ unlines $ 254 "consistent, but could not reconstruct a model" 255 : map diagString ds ++ lines (show $ ccProofTree pt) 256 Just (sig3, sens3) -> CSConsistent $ showDoc 266 257 (G_theory lidS (mkExtSign sig3) startSigId (toThSens sens3) 267 258 startThId) "" 268 st -> return $ CSInconsistent $ "prover status is:\n\n" ++ show st 269 _ -> return $ CSError "no unique cons checkers found!" 259 else CSInconsistent $ "prover status is:\n\n" ++ show (ccProofTree pt) 260 Nothing -> if ccUsedTime pt >= t' then 261 CSTimeout $ "No results within: " ++ show (ccUsedTime pt) 262 else CSError $ show (ccProofTree pt) 270 263 271 264 proveKnownPMap :: (Logic lid sublogics1 … … 338 331 if sl == lastSublogic st 339 332 then comorphismsToProvers st 340 else getProvers ProveGUI sl$333 else getProvers ProveGUI (Just sl) $ 341 334 filter hasModelExpansion $ findComorphismPaths lg sl 342 335 pr <- selectProver cmsToProvers -
trunk/Propositional/Prove.hs
r12730 r12745 34 34 import Interfaces.GenericATPState 35 35 import GUI.GenericATP 36 import GUI.Utils (infoDialog)37 36 38 37 import Common.UniUtils as CP … … 50 49 import Data.List 51 50 import Data.Maybe 52 import Data.Time (TimeOfDay, timeToTimeOfDay)51 import Data.Time (TimeOfDay, timeToTimeOfDay, midnight) 53 52 import System.Directory 54 53 import System.Cmd … … 83 82 propConsChecker :: LP.ConsChecker Sig.Sign AS_BASIC.FORMULA PropSL 84 83 PMorphism.Morphism ProofTree 85 propConsChecker = LP. mkProverTemplatezchaffS top consCheck86 87 consCheck :: String -> LP.T heoryMorphism Sig.Sign AS_BASIC.FORMULA88 PMorphism.Morphism ProofTree89 -> [LP.FreeDefMorphism AS_BASIC.FORMULA PMorphism.Morphism]90 -- ^ free definitions91 -> IO([LP.ProofStatus ProofTree])92 consCheck thName tm _ =84 propConsChecker = LP.ConsChecker zchaffS top consCheck 85 86 consCheck :: String -> LP.TacticScript 87 -> LP.TheoryMorphism Sig.Sign AS_BASIC.FORMULA PMorphism.Morphism ProofTree 88 -> [LP.FreeDefMorphism AS_BASIC.FORMULA PMorphism.Morphism] 89 -- ^ free definitions 90 -> IO (LP.CCStatus ProofTree) 91 consCheck thName _ tm _ = 93 92 case LP.tTarget tm of 94 93 LP.Theory sig nSens -> do … … 120 119 exitCode <- system ("zchaff " ++ tmpFile ++ " >> " ++ resultFile) 121 120 removeFile tmpFile 122 if exitCode /= ExitSuccess then 123 infoDialog "consistency checker"124 ("error by call zchaff " ++ thName)121 if exitCode /= ExitSuccess then return $ LP.CCStatus 122 (ProofTree $ "error by call zchaff " ++ thName) 123 midnight Nothing 125 124 else do 126 resultHf <- openFile resultFile ReadMode 127 isSAT <- searchResult resultHf 128 hClose resultHf 129 removeFile resultFile 130 if isSAT then 131 infoDialog "consistency checker" 132 ("consistent.") 133 else 134 infoDialog "consistency checker" 135 ("inconsistent.") 136 return [] 125 resultHf <- readFile resultFile 126 let isSAT = searchResult resultHf 127 when (length resultHf > 0) $ removeFile resultFile 128 return $ LP.CCStatus (ProofTree resultHf) midnight isSAT 137 129 138 130 where … … 141 133 getAxioms f = map (AS_Anno.makeNamed "consistency" . AS_Anno.sentence) 142 134 $ filter AS_Anno.isAxiom f 143 144 searchResult :: Handle -> IO Bool 145 searchResult hf = do 146 eof <- hIsEOF hf 147 if eof then 148 return False 149 else 150 do 151 line <- hGetLine hf 152 putStrLn line 153 if line == "RESULT:\tUNSAT" then 154 return True 155 else if line == "RESULT:\tSAT" then 156 return False 157 else searchResult hf 135 searchResult :: String -> Maybe Bool 136 searchResult hf = let ls = lines hf in 137 if any (== "RESULT:\tUNSAT") ls then Just True else 138 if any (== "RESULT:\tSAT") ls then Just False else Nothing 158 139 159 140 -- ** GUI -
trunk/Propositional/ProveMinisat.hs
r12730 r12745 33 33 import Interfaces.GenericATPState 34 34 import GUI.GenericATP 35 import GUI.Utils (infoDialog)36 35 37 36 import Common.ProofTree … … 43 42 import Control.Monad (when) 44 43 import qualified Control.Concurrent as Concurrent 45 import Data.Time (timeToTimeOfDay )44 import Data.Time (timeToTimeOfDay, midnight) 46 45 import System.Directory 47 46 import System.Exit … … 79 78 -} 80 79 minisatConsChecker :: LP.ConsChecker Sig.Sign AS_BASIC.FORMULA PropSL 81 PMorphism.Morphism ProofTree82 minisatConsChecker = LP. mkProverTemplateminisatS top consCheck83 84 consCheck :: String -> LP.T heoryMorphism Sig.Sign AS_BASIC.FORMULA85 PMorphism.Morphism ProofTree86 -> [LP.FreeDefMorphism AS_BASIC.FORMULA PMorphism.Morphism]87 -- ^ free definitions88 -> IO([LP.ProofStatus ProofTree])89 consCheck thName tm _ =80 PMorphism.Morphism ProofTree 81 minisatConsChecker = LP.ConsChecker minisatS top consCheck 82 83 consCheck :: String -> LP.TacticScript 84 -> LP.TheoryMorphism Sig.Sign AS_BASIC.FORMULA PMorphism.Morphism ProofTree 85 -> [LP.FreeDefMorphism AS_BASIC.FORMULA PMorphism.Morphism] 86 -- ^ free definitions 87 -> IO (LP.CCStatus ProofTree) 88 consCheck thName _ tm _ = 90 89 case LP.tTarget tm of 91 90 LP.Theory sig nSens -> do … … 118 117 exitCode <- waitForProcess pid 119 118 removeFile tmpFile 120 infoDialog "consistency checker" $ case exitCode of 121 ExitFailure 20 -> "consistent." 122 ExitFailure 10 -> "inconsistent." 123 _ -> "error by calling minisat " ++ thName 124 return [] 125 119 let (res, out) = case exitCode of 120 ExitFailure 20 -> (Just True, "consistent.") 121 ExitFailure 10 -> (Just False, "inconsistent.") 122 _ -> (Nothing, "error by calling minisat " ++ thName) 123 return LP.CCStatus 124 { LP.ccResult = res 125 , LP.ccUsedTime = midnight 126 , LP.ccProofTree = ProofTree out } 126 127 where 127 128 getAxioms :: [LP.SenStatus AS_BASIC.FORMULA (LP.ProofStatus ProofTree)] -
trunk/Propositional/ProveWithTruthTable.hs
r12730 r12745 32 32 import qualified Propositional.ProverState as PState 33 33 import qualified Propositional.Sign as Sig 34 import Propositional.Sublogic (PropSL,top)34 import Propositional.Sublogic (PropSL, top) 35 35 36 36 import qualified Logic.Prover as LP … … 51 51 import qualified Common.Result as Result 52 52 53 53 import Data.Time (midnight) 54 54 55 55 -- * Prover implementation … … 64 64 65 65 -- display error message when signature is too large 66 sigTooLarge :: Int -> IO() 67 sigTooLarge sigSize = 68 infoDialog "Signature is too large" 69 ("Signature is too large. "++ 70 "It should contain < "++show maxSigSize++" symbols, "++ 71 "but it contains "++show sigSize++" symbols.") 66 sigTooLarge :: Int -> String 67 sigTooLarge sigSize = unlines 68 [ "Signature is too large." 69 , "It should contain < " ++ show maxSigSize ++ " symbols," 70 , "but it contains " ++ show sigSize ++ " symbols." ] 72 71 73 72 ttHelpText :: String … … 223 222 in case map makeExtRow (rextrows r) of 224 223 [] -> [common] 225 (e:extrows) -> (common++e):map (emptyPrefix ++) extrows224 e : extrows -> (common ++ e) : map (emptyPrefix ++) extrows 226 225 table = concatMap makeRow rowsTT 227 226 … … 242 241 ttConsistencyChecker :: LP.ConsChecker Sig.Sign FORMULA PropSL 243 242 PMorphism.Morphism ProofTree 244 ttConsistencyChecker = LP. mkProverTemplatettS top consCheck245 246 consCheck :: String -> LP.T heoryMorphism Sig.Sign FORMULA247 PMorphism.Morphism ProofTree248 -> [LP.FreeDefMorphism FORMULA PMorphism.Morphism]249 -- ^ free definitions250 -> IO([LP.ProofStatus ProofTree])251 consCheck thNametm _freedefs =243 ttConsistencyChecker = LP.ConsChecker ttS top consCheck 244 245 consCheck :: String -> LP.TacticScript 246 -> LP.TheoryMorphism Sig.Sign FORMULA PMorphism.Morphism ProofTree 247 -> [LP.FreeDefMorphism FORMULA PMorphism.Morphism] 248 -- ^ free definitions 249 -> IO (LP.CCStatus ProofTree) 250 consCheck _ _ tm _freedefs = 252 251 case LP.tTarget tm of 253 252 LP.Theory sig nSens -> 254 253 let sigSize = Set.size (items sig) in 255 if sigSize >= maxSigSize then do 256 sigTooLarge sigSize 257 return [] 254 if sigSize >= maxSigSize then 255 return $ LP.CCStatus (ProofTree $ sigTooLarge sigSize) midnight Nothing 258 256 else do 259 257 let axs = filter (AS_Anno.isAxiom . snd) $ OMap.toList nSens … … 281 279 trows = rows 282 280 } 283 title = if isOK then "Theory is consistent" 284 else "Theory is inconsistent" 285 legend = "Legend:\nM+ = model of the axioms\n"++ 286 " - = not a model of the axioms\n" 287 body = legend++"\n"++render id (renderTT table) 288 createTextSaveDisplay title (thName++".tt") body 289 return [] 290 281 legend = "Legend:\nM+ = model of the axioms\n" 282 ++ " - = not a model of the axioms\n" 283 body = legend ++ "\n" ++ render id (renderTT table) 284 return $ LP.CCStatus (ProofTree body) midnight $ Just isOK 291 285 292 286 -- ** prover GUI … … 359 353 sigSize = Set.size $ items sig 360 354 in if sigSize >= maxSigSize then do 361 sigTooLarge sigSize355 infoDialog "Signature too large" $ sigTooLarge sigSize 362 356 return (ATPState.ATPTLimitExceeded, 363 357 cfg{ATPState.proofStatus = defaultProofStatus nGoal}) … … 449 443 in 450 444 if sigSize >= maxSigSize then do 451 return (seq (unsafePerformIO $ sigTooLarge sigSize) Nothing)445 return Nothing 452 446 else do 453 447 let imageAxs = map (AS_Anno.mapNamed (PMorphism.mapSentenceH mor)) srcAxs -
trunk/SoftFOL/ProveDarwin.hs
r12661 r12745 59 59 , proveCMDLautomaticBatch = Just darwinCMDLautomaticBatch } 60 60 61 darwinConsChecker 62 :: ConsChecker Sign Sentence () SoftFOLMorphism ProofTree 63 darwinConsChecker = (mkProverTemplate "darwin" () 64 (\ s -> consCheck s $ TacticScript "20")) 65 { proveCMDLautomatic = Just (\ s ts t -> fmap return . consCheck s ts t) } 61 darwinConsChecker :: ConsChecker Sign Sentence () SoftFOLMorphism ProofTree 62 darwinConsChecker = ConsChecker "darwin" () consCheck 66 63 67 64 {- | … … 154 151 -> TheoryMorphism Sign Sentence SoftFOLMorphism ProofTree 155 152 -> [FreeDefMorphism SPTerm SoftFOLMorphism] -- ^ freeness constraints 156 -> IO( [ProofStatus ProofTree])157 consCheck thName tac@(TacticScript tl) tm freedefs = case tTarget tm of153 -> IO(CCStatus ProofTree) 154 consCheck thName (TacticScript tl) tm freedefs = case tTarget tm of 158 155 Theory sig nSens -> let 159 156 saveTPTP = False 160 157 proverStateI = spassProverState sig (toNamedList nSens) freedefs 161 158 problem = showTPTPProblemM thName proverStateI [] 162 simpleOptions = ""163 159 extraOptions = "-pc true -pmtptp true -fd true -to " 164 160 ++ tl 165 161 saveFileName = reverse $ fst $ span (/= '/') $ reverse thName 166 runDarwinRealM :: IO( [ProofStatus ProofTree])162 runDarwinRealM :: IO(CCStatus ProofTree) 167 163 runDarwinRealM = do 168 164 probl <- problem … … 171 167 ExitFailure _ -> do 172 168 infoDialog "Darwin prover" "Darwin not found" 173 return [ProofStatus 174 { goalName = thName 175 , goalStatus = openGoalStatus 176 , usedAxioms = getAxioms 177 , usedProver = proverName darwinProver 178 , proofTree = ProofTree "Darwin not found" 179 , usedTime = timeToTimeOfDay $ secondsToDiffTime 0 180 , tacticScript = tac }] 169 return CCStatus 170 { ccResult = Nothing 171 , ccProofTree = ProofTree "Darwin not found" 172 , ccUsedTime = timeToTimeOfDay $ secondsToDiffTime 0 } 181 173 ExitSuccess -> do 182 174 when saveTPTP $ writeFile (saveFileName ++ ".tptp") probl … … 188 180 (_, outh, errh, proch) <- runInteractiveCommand command 189 181 (exCode, output, tUsed) <- parseDarwinOut outh errh proch 190 let outState = proofStatM exCode simpleOptions output tUsed 191 return [outState] 192 proofStatM :: ExitCode -> String -> [String] -> Int 193 -> ProofStatus ProofTree 194 proofStatM exitCode _ out tUsed = let 195 outState = ProofStatus 196 { goalName = thName 197 , goalStatus = Proved (Just True) 198 , usedAxioms = getAxioms 199 , usedProver = proverName darwinProver 200 , proofTree = ProofTree (unlines out) 201 , usedTime = timeToTimeOfDay $ secondsToDiffTime 202 $ toInteger tUsed 203 , tacticScript = tac } 182 let outState = proofStatM exCode output tUsed 183 return outState 184 proofStatM :: ExitCode -> [String] -> Int -> CCStatus ProofTree 185 proofStatM exitCode out tUsed = let 186 outState = CCStatus 187 { ccResult = Just True 188 , ccProofTree = ProofTree $ unlines $ show exitCode : out 189 , ccUsedTime = timeToTimeOfDay $ secondsToDiffTime 190 $ toInteger tUsed } 204 191 in case exitCode of 205 192 ExitSuccess -> outState 206 193 ExitFailure i -> outState 207 { goalStatus = if elem i [2, 105, 112] 208 then Open $ Reason [show exitCode] 209 else Disproved } 210 getAxioms = let 211 fl = formulaLists $ initialLogicalPart proverStateI 212 fs = concatMap formulae $ filter isAxiomFormula fl 213 in map AS_Anno.senAttr fs 194 { ccResult = if elem i [2, 105, 112] 195 then Nothing else Just False } 214 196 in runDarwinRealM 215 197