Skip to content

Commit 860fc1f

Browse files
Add proof checks in TPTPSolver
1 parent 5dd0c46 commit 860fc1f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

lisa-examples/src/main/scala/TPTPSolver.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import lisa.utils.tptp.KernelParser.*
1010
import lisa.utils.tptp.ProblemGatherer.*
1111
import lisa.kernel.proof.SCProof
1212
import lisa.kernel.proof.SequentCalculus.Sequent
13+
import lisa.kernel.proof.SCProofChecker.checkSCProof
1314

1415
object TPTPSolver extends lisa.Main {
1516
try {
@@ -55,8 +56,10 @@ object TPTPSolver extends lisa.Main {
5556
// Attempting proof by Tableau
5657
proveSequent(seq, timeoutTableau, Tableau.solve) match {
5758
case Solved(proof) =>
58-
nbProblemsSolvedByTableau += 1
59-
// writeProof(p, proof, "examples/proofs/tableau/")
59+
if (checkSCProof(proof).isValid)
60+
nbProblemsSolvedByTableau += 1
61+
// writeProof(p, proof, "examples/proofs/tableau/")
62+
else throw new Exception("Tableau proof is not valid")
6063
case _ => ()
6164
}
6265

@@ -66,13 +69,15 @@ object TPTPSolver extends lisa.Main {
6669
case _ => None
6770
proveSequent(seq, timeoutTautology, tautologySolver) match {
6871
case Solved(proof) =>
69-
nbProblemsSolvedByTautology += 1
70-
// writeProof(p, proof, "examples/proofs/tautology/")
72+
if (checkSCProof(proof).isValid)
73+
nbProblemsSolvedByTautology += 1
74+
// writeProof(p, proof, "examples/proofs/tautology/")
75+
else throw new Exception("Tautology proof is not valid")
7176
case _ => ()
7277
}
7378
}
7479
} catch {
75-
case _ => ()
80+
case e => println(s"Error while processing $probfile: $e")
7681
}
7782
}
7883
} catch {

lisa-utils/src/main/scala/lisa/utils/RunSolver.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object RunSolver {
1313
case class Solved(proof: SCProof) extends SolverResult
1414
case object Unsolved extends SolverResult
1515
case object Timeout extends SolverResult
16-
case class SolverException(e: Exception) extends SolverResult
16+
case class SolverThrow(t: Throwable) extends SolverResult
1717

1818
def proveSequent(sequent: Sequent, timeout: Duration, solver: Sequent => Option[SCProof]): SolverResult = {
1919
val (futureSolver, cancelSolver) = Future.interruptibly { solver(sequent) }
@@ -25,9 +25,9 @@ object RunSolver {
2525
case _: TimeoutException =>
2626
cancelSolver()
2727
Timeout
28-
case e: Exception =>
28+
case t: Throwable =>
2929
cancelSolver()
30-
SolverException(e)
30+
SolverThrow(t)
3131
}
3232

3333
// Class to handle future cancellation
@@ -94,6 +94,7 @@ object RunSolver {
9494
catch {
9595
case ie: InterruptedException => throw new CancellationException()
9696
case td: ThreadDeath => throw new CancellationException()
97+
case t: Throwable => throw t
9798
} finally {
9899
if (!exit() && Thread.interrupted())
99100
() // If we were interrupted and flag was not cleared

0 commit comments

Comments
 (0)