Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
SMTOperations, GlobalContext: only print missing SMTLib warning with …
Browse files Browse the repository at this point in the history
…--debug

-   Requires passing the `GlobalOptions` to `SMTOperations`.
-   More informative output regarding why SMT solver could not prove something.
  • Loading branch information
Everett Hildenbrandt committed Nov 18, 2017
1 parent 8aff58f commit a1ee3ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GlobalContext(
this.hookProvider = hookProvider;
this.files = files;
this.equalityOps = new EqualityOperations(() -> def);
this.constraintOps = new SMTOperations(() -> def, smtOptions, new Z3Wrapper(smtOptions, kem, globalOptions, files), kem);
this.constraintOps = new SMTOperations(() -> def, smtOptions, new Z3Wrapper(smtOptions, kem, globalOptions, files), kem, globalOptions);
this.kItemOps = new KItemOperations(stage, deterministicFunctions, kem, this::builtins, globalOptions);
this.stage = stage;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2016 K Team. All Rights Reserved.
package org.kframework.backend.java.symbolic;

import org.kframework.main.GlobalOptions;
import org.kframework.backend.java.kil.Definition;
import org.kframework.backend.java.kil.Variable;
import org.kframework.backend.java.util.Z3Wrapper;
Expand All @@ -14,18 +15,21 @@

public class SMTOperations {

private final SMTOptions smtOptions;
private final Z3Wrapper z3;

private final SMTOptions smtOptions;
private final Z3Wrapper z3;
private final GlobalOptions global;
private final KExceptionManager kem;

public SMTOperations(
Provider<Definition> definitionProvider,
SMTOptions smtOptions,
Z3Wrapper z3, KExceptionManager kem) {
Z3Wrapper z3,
KExceptionManager kem,
GlobalOptions global) {
this.smtOptions = smtOptions;
this.z3 = z3;
this.kem = kem;
this.z3 = z3;
this.kem = kem;
this.global = global;
}

public boolean checkUnsat(ConjunctiveFormula constraint) {
Expand Down Expand Up @@ -64,8 +68,9 @@ public boolean impliesSMT(
smtOptions.z3ImplTimeout);
} catch (UnsupportedOperationException | SMTTranslationFailure e) {
kem.registerCriticalWarning(e.getMessage(), e);
System.err.println(e.getMessage() + "\n");
// TODO: no longer printing stack trace. Perhaps in the future can extract useful information from stack trace to print
if (global.debug) {
System.err.println(e.getMessage() + "\n");
}
}
}
return false;
Expand Down

0 comments on commit a1ee3ec

Please sign in to comment.