Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/scala/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
noshort = true
)

val disableNL: ScallopOption[Boolean] = opt[Boolean]("disableNL",
descr = "Disable non-linear integer arithmetic when using Z3",
default = Some(false),
noshort = true
)

private val rawProverSaturationTimeout = opt[Int]("proverSaturationTimeout",
descr = ( "Timeout (in ms) used for the prover's state saturation calls (default: 100). "
+ "A timeout of 0 disables all saturation checks."
Expand Down Expand Up @@ -813,6 +819,12 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
sys.error(s"Unexpected combination: $other")
}

validateOpt(disableNL, prover) {
case (Some(true), n) if n != Some(Z3ProverStdIO.name) =>
Left(s"Option ${disableNL.name} is only supported with prover ${Z3ProverStdIO.name}")
case _ => Right(())
}

validateOpt(counterexample, moreCompleteExhale, exhaleModeOption) {
case (Some(_), Some(false), None) |
(Some(_), Some(_), Some(ExhaleMode.Greedy)) =>
Expand Down
9 changes: 8 additions & 1 deletion src/main/scala/decider/Z3ProverStdIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,12 @@ class Z3ProverStdIO(uniqueId: String,
Paths.get(Verifier.config.z3Exe)
}

override def emitSettings(contents: Iterable[String]): Unit = emit(contents)
override def emitSettings(contents: Iterable[String]): Unit = {
emit(contents)
if(Verifier.config.disableNL.getOrElse(false)) {
comment("We disable non-linear integer arithmetic")
writeLine(s"(set-option :smt.arith.nl false)")
readSuccess()
}
}
}
7 changes: 7 additions & 0 deletions src/test/resources/misc/disableNL.vpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
method f(x: Int, y: Int) returns (res: Int)
requires 0 <= x <= 10
requires 0 <= y <= 10
ensures 0 <= res <= 100 // this fails with --disableNL
{
res := x * y
}
Comment thread
Dspil marked this conversation as resolved.