Skip to content
Snippets Groups Projects
Commit a2479356 authored by Philippe Suter's avatar Philippe Suter
Browse files

Displaying counter-examples.

FairZ3Solver no longer displays counter-examples. As a result, they were
not shown when doing verification. The fix is to have AnalysisPhase
display the counter-examples when it wants to.
parent 3c0a8231
No related branches found
No related tags found
No related merge requests found
...@@ -159,8 +159,7 @@ class FairZ3Solver(context : LeonContext) ...@@ -159,8 +159,7 @@ class FairZ3Solver(context : LeonContext)
evalResult match { evalResult match {
case EvaluationSuccessful(BooleanLiteral(true)) => case EvaluationSuccessful(BooleanLiteral(true)) =>
reporter.info("- Model validated:") reporter.info("- Model validated.")
reporter.info(modelAsString)
(true, asMap) (true, asMap)
case EvaluationSuccessful(BooleanLiteral(false)) => case EvaluationSuccessful(BooleanLiteral(false)) =>
......
...@@ -109,7 +109,9 @@ object AnalysisPhase extends LeonPhase[Program,VerificationReport] { ...@@ -109,7 +109,9 @@ object AnalysisPhase extends LeonPhase[Program,VerificationReport] {
val t1 = System.nanoTime val t1 = System.nanoTime
se.init() se.init()
val solverResult = se.solve(vc) val (satResult, counterexample) = se.solveSAT(Not(vc))
val solverResult = satResult.map(!_)
val t2 = System.nanoTime val t2 = System.nanoTime
val dt = ((t2 - t1) / 1000000) / 1000.0 val dt = ((t2 - t1) / 1000000) / 1000.0
...@@ -125,8 +127,9 @@ object AnalysisPhase extends LeonPhase[Program,VerificationReport] { ...@@ -125,8 +127,9 @@ object AnalysisPhase extends LeonPhase[Program,VerificationReport] {
true true
} }
case Some(false) => { case Some(false) => {
reporter.error("Found counter-example : ")
reporter.error(counterexample.toSeq.sortBy(_._1.name).map(p => p._1 + " -> " + p._2).mkString("\n"))
reporter.error("==== INVALID ====") reporter.error("==== INVALID ====")
vcInfo.value = Some(false) vcInfo.value = Some(false)
vcInfo.solvedWith = Some(se) vcInfo.solvedWith = Some(se)
vcInfo.time = Some(dt) vcInfo.time = Some(dt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment