mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 05:43:39 +00:00
fixing unit tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
3bf86e1a49
75 changed files with 876 additions and 874 deletions
|
@ -143,7 +143,7 @@ void prove_example2() {
|
||||||
void nonlinear_example1() {
|
void nonlinear_example1() {
|
||||||
std::cout << "nonlinear example 1\n";
|
std::cout << "nonlinear example 1\n";
|
||||||
config cfg;
|
config cfg;
|
||||||
cfg.set(":auto-config", true);
|
cfg.set("auto_config", true);
|
||||||
context c(cfg);
|
context c(cfg);
|
||||||
|
|
||||||
expr x = c.real_const("x");
|
expr x = c.real_const("x");
|
||||||
|
@ -158,12 +158,13 @@ void nonlinear_example1() {
|
||||||
std::cout << s.check() << "\n";
|
std::cout << s.check() << "\n";
|
||||||
model m = s.get_model();
|
model m = s.get_model();
|
||||||
std::cout << m << "\n";
|
std::cout << m << "\n";
|
||||||
c.set(":pp-decimal", true); // set decimal notation
|
set_param("pp.decimal", true); // set decimal notation
|
||||||
std::cout << "model in decimal notation\n";
|
std::cout << "model in decimal notation\n";
|
||||||
std::cout << m << "\n";
|
std::cout << m << "\n";
|
||||||
c.set(":pp-decimal-precision", 50); // increase number of decimal places to 50.
|
set_param("pp.decimal-precision", 50); // increase number of decimal places to 50.
|
||||||
std::cout << "model using 50 decimal places\n";
|
std::cout << "model using 50 decimal places\n";
|
||||||
std::cout << m << "\n";
|
std::cout << m << "\n";
|
||||||
|
set_param("pp.decimal", false); // disable decimal notation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +353,7 @@ void quantifier_example() {
|
||||||
|
|
||||||
// making sure model based quantifier instantiation is enabled.
|
// making sure model based quantifier instantiation is enabled.
|
||||||
params p(c);
|
params p(c);
|
||||||
p.set(":mbqi", true);
|
p.set("mbqi", true);
|
||||||
s.set(p);
|
s.set(p);
|
||||||
|
|
||||||
s.add(forall(x, y, f(x, y) >= 0));
|
s.add(forall(x, y, f(x, y) >= 0));
|
||||||
|
@ -468,7 +469,7 @@ void unsat_core_example3() {
|
||||||
|
|
||||||
// enabling unsat core tracking
|
// enabling unsat core tracking
|
||||||
params p(c);
|
params p(c);
|
||||||
p.set(":unsat-core", true);
|
p.set("unsat_core", true);
|
||||||
s.set(p);
|
s.set(p);
|
||||||
|
|
||||||
// The following assertion will not be tracked.
|
// The following assertion will not be tracked.
|
||||||
|
@ -585,7 +586,7 @@ void tactic_example4() {
|
||||||
std::cout << "tactic example 4\n";
|
std::cout << "tactic example 4\n";
|
||||||
context c;
|
context c;
|
||||||
params p(c);
|
params p(c);
|
||||||
p.set(":mul2concat", true);
|
p.set("mul2concat", true);
|
||||||
tactic t =
|
tactic t =
|
||||||
with(tactic(c, "simplify"), p) &
|
with(tactic(c, "simplify"), p) &
|
||||||
tactic(c, "solve-eqs") &
|
tactic(c, "solve-eqs") &
|
||||||
|
@ -628,8 +629,8 @@ void tactic_example6() {
|
||||||
std::cout << "tactic example 6\n";
|
std::cout << "tactic example 6\n";
|
||||||
context c;
|
context c;
|
||||||
params p(c);
|
params p(c);
|
||||||
p.set(":arith-lhs", true);
|
p.set("arith_lhs", true);
|
||||||
p.set(":som", true); // sum-of-monomials normal form
|
p.set("som", true); // sum-of-monomials normal form
|
||||||
solver s =
|
solver s =
|
||||||
(with(tactic(c, "simplify"), p) &
|
(with(tactic(c, "simplify"), p) &
|
||||||
tactic(c, "normalize-bounds") &
|
tactic(c, "normalize-bounds") &
|
||||||
|
|
|
@ -70,7 +70,7 @@ Z3_context mk_context_custom(Z3_config cfg, Z3_error_handler err)
|
||||||
{
|
{
|
||||||
Z3_context ctx;
|
Z3_context ctx;
|
||||||
|
|
||||||
Z3_set_param_value(cfg, "MODEL", "true");
|
Z3_set_param_value(cfg, "model", "true");
|
||||||
ctx = Z3_mk_context(cfg);
|
ctx = Z3_mk_context(cfg);
|
||||||
Z3_set_error_handler(ctx, err);
|
Z3_set_error_handler(ctx, err);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ Z3_context mk_context()
|
||||||
Z3_context mk_proof_context() {
|
Z3_context mk_proof_context() {
|
||||||
Z3_config cfg = Z3_mk_config();
|
Z3_config cfg = Z3_mk_config();
|
||||||
Z3_context ctx;
|
Z3_context ctx;
|
||||||
Z3_set_param_value(cfg, "PROOF_MODE", "2");
|
Z3_set_param_value(cfg, "proof", "true");
|
||||||
ctx = mk_context_custom(cfg, throw_z3_error);
|
ctx = mk_context_custom(cfg, throw_z3_error);
|
||||||
Z3_del_config(cfg);
|
Z3_del_config(cfg);
|
||||||
return ctx;
|
return ctx;
|
||||||
|
@ -1038,12 +1038,12 @@ void quantifier_example1()
|
||||||
/* If quantified formulas are asserted in a logical context, then
|
/* If quantified formulas are asserted in a logical context, then
|
||||||
Z3 may return L_UNDEF. In this case, the model produced by Z3 should be viewed as a potential/candidate model.
|
Z3 may return L_UNDEF. In this case, the model produced by Z3 should be viewed as a potential/candidate model.
|
||||||
*/
|
*/
|
||||||
Z3_set_param_value(cfg, "MODEL", "true");
|
|
||||||
/*
|
/*
|
||||||
The current model finder for quantified formulas cannot handle injectivity.
|
The current model finder for quantified formulas cannot handle injectivity.
|
||||||
So, we are limiting the number of iterations to avoid a long "wait".
|
So, we are limiting the number of iterations to avoid a long "wait".
|
||||||
*/
|
*/
|
||||||
Z3_set_param_value(cfg, "MBQI_MAX_ITERATIONS", "10");
|
Z3_global_param_set("smt.mbqi.max_iterations", "10");
|
||||||
ctx = mk_context_custom(cfg, error_handler);
|
ctx = mk_context_custom(cfg, error_handler);
|
||||||
Z3_del_config(cfg);
|
Z3_del_config(cfg);
|
||||||
|
|
||||||
|
@ -1087,8 +1087,9 @@ void quantifier_example1()
|
||||||
if (Z3_get_search_failure(ctx) != Z3_QUANTIFIERS) {
|
if (Z3_get_search_failure(ctx) != Z3_QUANTIFIERS) {
|
||||||
exitf("unexpected result");
|
exitf("unexpected result");
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3_del_context(ctx);
|
Z3_del_context(ctx);
|
||||||
|
/* reset global parameters set by this function */
|
||||||
|
Z3_global_param_reset_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1646,7 +1647,7 @@ void parser_example3()
|
||||||
|
|
||||||
cfg = Z3_mk_config();
|
cfg = Z3_mk_config();
|
||||||
/* See quantifer_example1 */
|
/* See quantifer_example1 */
|
||||||
Z3_set_param_value(cfg, "MODEL", "true");
|
Z3_set_param_value(cfg, "model", "true");
|
||||||
ctx = mk_context_custom(cfg, error_handler);
|
ctx = mk_context_custom(cfg, error_handler);
|
||||||
Z3_del_config(cfg);
|
Z3_del_config(cfg);
|
||||||
|
|
||||||
|
@ -2249,57 +2250,6 @@ void unsat_core_and_proof_example() {
|
||||||
Z3_del_context(ctx);
|
Z3_del_context(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Extract classes of implied equalities.
|
|
||||||
|
|
||||||
This example illustrates the use of #Z3_get_implied_equalities.
|
|
||||||
*/
|
|
||||||
void get_implied_equalities_example() {
|
|
||||||
Z3_config cfg = Z3_mk_config();
|
|
||||||
Z3_context ctx;
|
|
||||||
|
|
||||||
printf("\nget_implied_equalities example\n");
|
|
||||||
LOG_MSG("get_implied_equalities example");
|
|
||||||
|
|
||||||
Z3_set_param_value(cfg, "ARITH_PROCESS_ALL_EQS", "true");
|
|
||||||
Z3_set_param_value(cfg, "ARITH_EQ_BOUNDS", "true");
|
|
||||||
ctx = Z3_mk_context(cfg);
|
|
||||||
Z3_del_config(cfg);
|
|
||||||
{
|
|
||||||
Z3_sort int_ty = Z3_mk_int_sort(ctx);
|
|
||||||
Z3_ast a = mk_int_var(ctx,"a");
|
|
||||||
Z3_ast b = mk_int_var(ctx,"b");
|
|
||||||
Z3_ast c = mk_int_var(ctx,"c");
|
|
||||||
Z3_ast d = mk_int_var(ctx,"d");
|
|
||||||
Z3_func_decl f = Z3_mk_func_decl(ctx, Z3_mk_string_symbol(ctx,"f"), 1, &int_ty, int_ty);
|
|
||||||
Z3_ast fa = Z3_mk_app(ctx, f, 1, &a);
|
|
||||||
Z3_ast fb = Z3_mk_app(ctx, f, 1, &b);
|
|
||||||
Z3_ast fc = Z3_mk_app(ctx, f, 1, &c);
|
|
||||||
unsigned const num_terms = 7;
|
|
||||||
unsigned i;
|
|
||||||
Z3_ast terms[7] = { a, b, c, d, fa, fb, fc };
|
|
||||||
unsigned class_ids[7] = { 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
Z3_assert_cnstr(ctx, Z3_mk_eq(ctx, a, b));
|
|
||||||
Z3_assert_cnstr(ctx, Z3_mk_eq(ctx, b, c));
|
|
||||||
Z3_assert_cnstr(ctx, Z3_mk_le(ctx, fc, b));
|
|
||||||
Z3_assert_cnstr(ctx, Z3_mk_le(ctx, b, fa));
|
|
||||||
|
|
||||||
Z3_get_implied_equalities(ctx, num_terms, terms, class_ids);
|
|
||||||
for (i = 0; i < num_terms; ++i) {
|
|
||||||
printf("Class %s |-> %d\n", Z3_ast_to_string(ctx, terms[i]), class_ids[i]);
|
|
||||||
}
|
|
||||||
printf("asserting f(a) <= b\n");
|
|
||||||
Z3_assert_cnstr(ctx, Z3_mk_le(ctx, fa, b));
|
|
||||||
Z3_get_implied_equalities(ctx, num_terms, terms, class_ids);
|
|
||||||
for (i = 0; i < num_terms; ++i) {
|
|
||||||
printf("Class %s |-> %d\n", Z3_ast_to_string(ctx, terms[i]), class_ids[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* delete logical context */
|
|
||||||
Z3_del_context(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAX_RETRACTABLE_ASSERTIONS 1024
|
#define MAX_RETRACTABLE_ASSERTIONS 1024
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2504,7 +2454,7 @@ void reference_counter_example() {
|
||||||
LOG_MSG("reference_counter_example");
|
LOG_MSG("reference_counter_example");
|
||||||
|
|
||||||
cfg = Z3_mk_config();
|
cfg = Z3_mk_config();
|
||||||
Z3_set_param_value(cfg, "MODEL", "true");
|
Z3_set_param_value(cfg, "model", "true");
|
||||||
// Create a Z3 context where the user is reponsible for managing
|
// Create a Z3 context where the user is reponsible for managing
|
||||||
// Z3_ast reference counters.
|
// Z3_ast reference counters.
|
||||||
ctx = Z3_mk_context_rc(cfg);
|
ctx = Z3_mk_context_rc(cfg);
|
||||||
|
@ -2685,7 +2635,6 @@ int main() {
|
||||||
binary_tree_example();
|
binary_tree_example();
|
||||||
enum_example();
|
enum_example();
|
||||||
unsat_core_and_proof_example();
|
unsat_core_and_proof_example();
|
||||||
get_implied_equalities_example();
|
|
||||||
incremental_example1();
|
incremental_example1();
|
||||||
reference_counter_example();
|
reference_counter_example();
|
||||||
smt2parser_example();
|
smt2parser_example();
|
||||||
|
|
|
@ -248,10 +248,13 @@ namespace test_mapi
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Prove(Context ctx, BoolExpr f, params BoolExpr[] assumptions)
|
static void Prove(Context ctx, BoolExpr f, bool useMBQI = false, params BoolExpr[] assumptions)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Proving: " + f);
|
Console.WriteLine("Proving: " + f);
|
||||||
Solver s = ctx.MkSolver();
|
Solver s = ctx.MkSolver();
|
||||||
|
Params p = ctx.MkParams();
|
||||||
|
p.Add("mbqi", useMBQI);
|
||||||
|
s.Parameters = p;
|
||||||
foreach (BoolExpr a in assumptions)
|
foreach (BoolExpr a in assumptions)
|
||||||
s.Assert(a);
|
s.Assert(a);
|
||||||
s.Assert(ctx.MkNot(f));
|
s.Assert(ctx.MkNot(f));
|
||||||
|
@ -270,10 +273,13 @@ namespace test_mapi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Disprove(Context ctx, BoolExpr f, params BoolExpr[] assumptions)
|
static void Disprove(Context ctx, BoolExpr f, bool useMBQI = false, params BoolExpr[] assumptions)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Disproving: " + f);
|
Console.WriteLine("Disproving: " + f);
|
||||||
Solver s = ctx.MkSolver();
|
Solver s = ctx.MkSolver();
|
||||||
|
Params p = ctx.MkParams();
|
||||||
|
p.Add("mbqi", useMBQI);
|
||||||
|
s.Parameters = p;
|
||||||
foreach (BoolExpr a in assumptions)
|
foreach (BoolExpr a in assumptions)
|
||||||
s.Assert(a);
|
s.Assert(a);
|
||||||
s.Assert(ctx.MkNot(f));
|
s.Assert(ctx.MkNot(f));
|
||||||
|
@ -298,7 +304,7 @@ namespace test_mapi
|
||||||
|
|
||||||
ArithExpr xr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("x"), ctx.MkRealSort());
|
ArithExpr xr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("x"), ctx.MkRealSort());
|
||||||
ArithExpr yr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("y"), ctx.MkRealSort());
|
ArithExpr yr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("y"), ctx.MkRealSort());
|
||||||
Goal g4 = ctx.MkGoal(true, false, true);
|
Goal g4 = ctx.MkGoal(true);
|
||||||
g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
|
g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
|
||||||
g4.Assert(ctx.MkEq(yr, ctx.MkAdd(xr, ctx.MkReal(1, 1))));
|
g4.Assert(ctx.MkEq(yr, ctx.MkAdd(xr, ctx.MkReal(1, 1))));
|
||||||
g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1)));
|
g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1)));
|
||||||
|
@ -330,7 +336,7 @@ namespace test_mapi
|
||||||
{
|
{
|
||||||
Console.WriteLine("ArrayExample1");
|
Console.WriteLine("ArrayExample1");
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, false);
|
Goal g = ctx.MkGoal(true);
|
||||||
ArraySort asort = ctx.MkArraySort(ctx.IntSort, ctx.MkBitVecSort(32));
|
ArraySort asort = ctx.MkArraySort(ctx.IntSort, ctx.MkBitVecSort(32));
|
||||||
ArrayExpr aex = (ArrayExpr)ctx.MkConst(ctx.MkSymbol("MyArray"), asort);
|
ArrayExpr aex = (ArrayExpr)ctx.MkConst(ctx.MkSymbol("MyArray"), asort);
|
||||||
Expr sel = ctx.MkSelect(aex, ctx.MkInt(0));
|
Expr sel = ctx.MkSelect(aex, ctx.MkInt(0));
|
||||||
|
@ -640,22 +646,13 @@ namespace test_mapi
|
||||||
/// Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
/// Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
||||||
/// <code>f</code> is injective in the second argument. <seealso cref="inj_axiom"/>
|
/// <code>f</code> is injective in the second argument. <seealso cref="inj_axiom"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void QuantifierExample3()
|
public static void QuantifierExample3(Context ctx)
|
||||||
{
|
{
|
||||||
Console.WriteLine("QuantifierExample3");
|
Console.WriteLine("QuantifierExample3");
|
||||||
|
|
||||||
|
|
||||||
Dictionary<string, string> cfg = new Dictionary<string, string>() {
|
|
||||||
{ "MBQI", "false" },
|
|
||||||
{ "PROOF_MODE", "2" },
|
|
||||||
{ "AUTO_CONFIG", "false" }
|
|
||||||
};
|
|
||||||
|
|
||||||
/* If quantified formulas are asserted in a logical context, then
|
/* If quantified formulas are asserted in a logical context, then
|
||||||
the model produced by Z3 should be viewed as a potential model. */
|
the model produced by Z3 should be viewed as a potential model. */
|
||||||
|
|
||||||
using (Context ctx = new Context(cfg))
|
|
||||||
{
|
|
||||||
/* declare function f */
|
/* declare function f */
|
||||||
Sort I = ctx.IntSort;
|
Sort I = ctx.IntSort;
|
||||||
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
||||||
|
@ -676,33 +673,24 @@ namespace test_mapi
|
||||||
|
|
||||||
/* prove f(x, y) = f(w, v) implies y = v */
|
/* prove f(x, y) = f(w, v) implies y = v */
|
||||||
BoolExpr p2 = ctx.MkEq(y, v);
|
BoolExpr p2 = ctx.MkEq(y, v);
|
||||||
Prove(ctx, p2, inj, p1);
|
Prove(ctx, p2, false, inj, p1);
|
||||||
|
|
||||||
/* disprove f(x, y) = f(w, v) implies x = w */
|
/* disprove f(x, y) = f(w, v) implies x = w */
|
||||||
BoolExpr p3 = ctx.MkEq(x, w);
|
BoolExpr p3 = ctx.MkEq(x, w);
|
||||||
Disprove(ctx, p3, inj, p1);
|
Disprove(ctx, p3, false, inj, p1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
/// Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
||||||
/// <code>f</code> is injective in the second argument. <seealso cref="inj_axiom"/>
|
/// <code>f</code> is injective in the second argument. <seealso cref="inj_axiom"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void QuantifierExample4()
|
public static void QuantifierExample4(Context ctx)
|
||||||
{
|
{
|
||||||
Console.WriteLine("QuantifierExample4");
|
Console.WriteLine("QuantifierExample4");
|
||||||
|
|
||||||
Dictionary<string, string> cfg = new Dictionary<string, string>() {
|
|
||||||
{ "MBQI", "false" },
|
|
||||||
{ "PROOF_MODE", "2" },
|
|
||||||
{ "AUTO_CONFIG","false" }};
|
|
||||||
|
|
||||||
|
|
||||||
/* If quantified formulas are asserted in a logical context, then
|
/* If quantified formulas are asserted in a logical context, then
|
||||||
the model produced by Z3 should be viewed as a potential model. */
|
the model produced by Z3 should be viewed as a potential model. */
|
||||||
|
|
||||||
using (Context ctx = new Context(cfg))
|
|
||||||
{
|
|
||||||
/* declare function f */
|
/* declare function f */
|
||||||
Sort I = ctx.IntSort;
|
Sort I = ctx.IntSort;
|
||||||
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
||||||
|
@ -723,12 +711,11 @@ namespace test_mapi
|
||||||
|
|
||||||
/* prove f(x, y) = f(w, v) implies y = v */
|
/* prove f(x, y) = f(w, v) implies y = v */
|
||||||
BoolExpr p2 = ctx.MkEq(y, v);
|
BoolExpr p2 = ctx.MkEq(y, v);
|
||||||
Prove(ctx, p2, inj, p1);
|
Prove(ctx, p2, false, inj, p1);
|
||||||
|
|
||||||
/* disprove f(x, y) = f(w, v) implies x = w */
|
/* disprove f(x, y) = f(w, v) implies x = w */
|
||||||
BoolExpr p3 = ctx.MkEq(x, w);
|
BoolExpr p3 = ctx.MkEq(x, w);
|
||||||
Disprove(ctx, p3, inj, p1);
|
Disprove(ctx, p3, false, inj, p1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -756,7 +743,7 @@ namespace test_mapi
|
||||||
BoolExpr trivial_eq = ctx.MkEq(fapp, fapp);
|
BoolExpr trivial_eq = ctx.MkEq(fapp, fapp);
|
||||||
BoolExpr nontrivial_eq = ctx.MkEq(fapp, fapp2);
|
BoolExpr nontrivial_eq = ctx.MkEq(fapp, fapp2);
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true);
|
||||||
g.Assert(trivial_eq);
|
g.Assert(trivial_eq);
|
||||||
g.Assert(nontrivial_eq);
|
g.Assert(nontrivial_eq);
|
||||||
Console.WriteLine("Goal: " + g);
|
Console.WriteLine("Goal: " + g);
|
||||||
|
@ -784,18 +771,18 @@ namespace test_mapi
|
||||||
throw new TestFailedException();
|
throw new TestFailedException();
|
||||||
|
|
||||||
|
|
||||||
Goal g2 = ctx.MkGoal(true, true, false);
|
Goal g2 = ctx.MkGoal(true, true);
|
||||||
ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2);
|
ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2);
|
||||||
if (ar.NumSubgoals != 1 || !ar.Subgoals[0].IsDecidedSat)
|
if (ar.NumSubgoals != 1 || !ar.Subgoals[0].IsDecidedSat)
|
||||||
throw new TestFailedException();
|
throw new TestFailedException();
|
||||||
|
|
||||||
g2 = ctx.MkGoal(true, true, false);
|
g2 = ctx.MkGoal(true, true);
|
||||||
g2.Assert(ctx.MkFalse());
|
g2.Assert(ctx.MkFalse());
|
||||||
ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2);
|
ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2);
|
||||||
if (ar.NumSubgoals != 1 || !ar.Subgoals[0].IsDecidedUnsat)
|
if (ar.NumSubgoals != 1 || !ar.Subgoals[0].IsDecidedUnsat)
|
||||||
throw new TestFailedException();
|
throw new TestFailedException();
|
||||||
|
|
||||||
Goal g3 = ctx.MkGoal(true, true, false);
|
Goal g3 = ctx.MkGoal(true, true);
|
||||||
Expr xc = ctx.MkConst(ctx.MkSymbol("x"), ctx.IntSort);
|
Expr xc = ctx.MkConst(ctx.MkSymbol("x"), ctx.IntSort);
|
||||||
Expr yc = ctx.MkConst(ctx.MkSymbol("y"), ctx.IntSort);
|
Expr yc = ctx.MkConst(ctx.MkSymbol("y"), ctx.IntSort);
|
||||||
g3.Assert(ctx.MkEq(xc, ctx.MkNumeral(1, ctx.IntSort)));
|
g3.Assert(ctx.MkEq(xc, ctx.MkNumeral(1, ctx.IntSort)));
|
||||||
|
@ -1063,7 +1050,7 @@ namespace test_mapi
|
||||||
|
|
||||||
|
|
||||||
// Or perhaps a tactic for QF_BV
|
// Or perhaps a tactic for QF_BV
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true);
|
||||||
g.Assert(eq);
|
g.Assert(eq);
|
||||||
|
|
||||||
Tactic t = ctx.MkTactic("qfbv");
|
Tactic t = ctx.MkTactic("qfbv");
|
||||||
|
@ -1086,7 +1073,7 @@ namespace test_mapi
|
||||||
Expr y = ctx.MkConst("y", bvs);
|
Expr y = ctx.MkConst("y", bvs);
|
||||||
BoolExpr q = ctx.MkEq(x, y);
|
BoolExpr q = ctx.MkEq(x, y);
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true);
|
||||||
g.Assert(q);
|
g.Assert(q);
|
||||||
|
|
||||||
Tactic t1 = ctx.MkTactic("qfbv");
|
Tactic t1 = ctx.MkTactic("qfbv");
|
||||||
|
@ -1128,7 +1115,7 @@ namespace test_mapi
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void FindModelExample2(Context ctx)
|
public static void FindModelExample2(Context ctx)
|
||||||
{
|
{
|
||||||
Console.WriteLine("find_model_example2");
|
Console.WriteLine("FindModelExample2");
|
||||||
|
|
||||||
IntExpr x = ctx.MkIntConst("x");
|
IntExpr x = ctx.MkIntConst("x");
|
||||||
IntExpr y = ctx.MkIntConst("y");
|
IntExpr y = ctx.MkIntConst("y");
|
||||||
|
@ -1250,13 +1237,13 @@ namespace test_mapi
|
||||||
/* prove z < 0 */
|
/* prove z < 0 */
|
||||||
BoolExpr f = ctx.MkLt(z, zero);
|
BoolExpr f = ctx.MkLt(z, zero);
|
||||||
Console.WriteLine("prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0");
|
Console.WriteLine("prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0");
|
||||||
Prove(ctx, f, c1, c2, c3);
|
Prove(ctx, f, false, c1, c2, c3);
|
||||||
|
|
||||||
/* disprove z < -1 */
|
/* disprove z < -1 */
|
||||||
IntExpr minus_one = ctx.MkInt(-1);
|
IntExpr minus_one = ctx.MkInt(-1);
|
||||||
f = ctx.MkLt(z, minus_one);
|
f = ctx.MkLt(z, minus_one);
|
||||||
Console.WriteLine("disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1");
|
Console.WriteLine("disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1");
|
||||||
Disprove(ctx, f, c1, c2, c3);
|
Disprove(ctx, f, false, c1, c2, c3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1448,7 +1435,7 @@ namespace test_mapi
|
||||||
|
|
||||||
BoolExpr thm = ctx.SMTLIBFormulas[0];
|
BoolExpr thm = ctx.SMTLIBFormulas[0];
|
||||||
Console.WriteLine("formula: {0}", thm);
|
Console.WriteLine("formula: {0}", thm);
|
||||||
Prove(ctx, thm, ca);
|
Prove(ctx, thm, false, ca);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1979,14 +1966,10 @@ namespace test_mapi
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extract unsatisfiable core example
|
/// Extract unsatisfiable core example
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void UnsatCoreAndProofExample()
|
public static void UnsatCoreAndProofExample(Context ctx)
|
||||||
{
|
{
|
||||||
Console.WriteLine("UnsatCoreAndProofExample");
|
Console.WriteLine("UnsatCoreAndProofExample");
|
||||||
|
|
||||||
Dictionary<string, string> cfg = new Dictionary<string, string>() { { "PROOF_MODE", "2" } };
|
|
||||||
|
|
||||||
using (Context ctx = new Context(cfg))
|
|
||||||
{
|
|
||||||
Solver solver = ctx.MkSolver();
|
Solver solver = ctx.MkSolver();
|
||||||
|
|
||||||
BoolExpr pa = ctx.MkBoolConst("PredA");
|
BoolExpr pa = ctx.MkBoolConst("PredA");
|
||||||
|
@ -2020,7 +2003,6 @@ namespace test_mapi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void FiniteDomainExample(Context ctx)
|
public static void FiniteDomainExample(Context ctx)
|
||||||
{
|
{
|
||||||
|
@ -2054,9 +2036,8 @@ namespace test_mapi
|
||||||
|
|
||||||
SimpleExample();
|
SimpleExample();
|
||||||
|
|
||||||
using (Context ctx = new Context(new Dictionary<string, string>()
|
// These examples need model generation turned on.
|
||||||
{ { "MODEL", "true"},
|
using (Context ctx = new Context(new Dictionary<string, string>() { { "model", "true" } }))
|
||||||
{ "PROOF_MODE", "2"} }))
|
|
||||||
{
|
{
|
||||||
BasicTests(ctx);
|
BasicTests(ctx);
|
||||||
CastingTest(ctx);
|
CastingTest(ctx);
|
||||||
|
@ -2067,25 +2048,16 @@ namespace test_mapi
|
||||||
ParOrExample(ctx);
|
ParOrExample(ctx);
|
||||||
FindModelExample1(ctx);
|
FindModelExample1(ctx);
|
||||||
FindModelExample2(ctx);
|
FindModelExample2(ctx);
|
||||||
ProveExample1(ctx);
|
|
||||||
ProveExample2(ctx);
|
|
||||||
PushPopExample1(ctx);
|
PushPopExample1(ctx);
|
||||||
ArrayExample1(ctx);
|
ArrayExample1(ctx);
|
||||||
ArrayExample2(ctx);
|
|
||||||
ArrayExample3(ctx);
|
ArrayExample3(ctx);
|
||||||
TupleExample(ctx);
|
|
||||||
BitvectorExample1(ctx);
|
BitvectorExample1(ctx);
|
||||||
BitvectorExample2(ctx);
|
BitvectorExample2(ctx);
|
||||||
ParserExample1(ctx);
|
ParserExample1(ctx);
|
||||||
ParserExample2(ctx);
|
ParserExample2(ctx);
|
||||||
ParserExample3(ctx);
|
|
||||||
ParserExample4(ctx);
|
ParserExample4(ctx);
|
||||||
ParserExample5(ctx);
|
ParserExample5(ctx);
|
||||||
ITEExample(ctx);
|
ITEExample(ctx);
|
||||||
EnumExample(ctx);
|
|
||||||
ListExample(ctx);
|
|
||||||
TreeExample(ctx);
|
|
||||||
ForestExample(ctx);
|
|
||||||
EvalExample1(ctx);
|
EvalExample1(ctx);
|
||||||
EvalExample2(ctx);
|
EvalExample2(ctx);
|
||||||
FindSmallModelExample(ctx);
|
FindSmallModelExample(ctx);
|
||||||
|
@ -2093,9 +2065,29 @@ namespace test_mapi
|
||||||
FiniteDomainExample(ctx);
|
FiniteDomainExample(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QuantifierExample3();
|
// These examples need proof generation turned on.
|
||||||
QuantifierExample4();
|
using (Context ctx = new Context(new Dictionary<string, string>() { { "proof", "true" } }))
|
||||||
UnsatCoreAndProofExample();
|
{
|
||||||
|
ProveExample1(ctx);
|
||||||
|
ProveExample2(ctx);
|
||||||
|
ArrayExample2(ctx);
|
||||||
|
TupleExample(ctx);
|
||||||
|
ParserExample3(ctx);
|
||||||
|
EnumExample(ctx);
|
||||||
|
ListExample(ctx);
|
||||||
|
TreeExample(ctx);
|
||||||
|
ForestExample(ctx);
|
||||||
|
UnsatCoreAndProofExample(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// These examples need proof generation turned on and auto-config set to false.
|
||||||
|
using (Context ctx = new Context(new Dictionary<string, string>()
|
||||||
|
{ {"proof", "true" },
|
||||||
|
{"auto-config", "false" } }))
|
||||||
|
{
|
||||||
|
QuantifierExample3(ctx);
|
||||||
|
QuantifierExample4(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
Log.Close();
|
Log.Close();
|
||||||
if (Log.isOpen())
|
if (Log.isOpen())
|
||||||
|
|
|
@ -182,6 +182,7 @@ class JavaExample
|
||||||
public void SimpleExample() throws Z3Exception
|
public void SimpleExample() throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("SimpleExample");
|
System.out.println("SimpleExample");
|
||||||
|
Log.Append("SimpleExample");
|
||||||
|
|
||||||
{
|
{
|
||||||
Context ctx = new Context();
|
Context ctx = new Context();
|
||||||
|
@ -249,24 +250,28 @@ class JavaExample
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prove(Context ctx, BoolExpr f) throws Z3Exception, TestFailedException
|
void Prove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception,
|
||||||
|
TestFailedException
|
||||||
{
|
{
|
||||||
BoolExpr[] assumptions = new BoolExpr[0];
|
BoolExpr[] assumptions = new BoolExpr[0];
|
||||||
Prove(ctx, f, assumptions);
|
Prove(ctx, f, useMBQI, assumptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prove(Context ctx, BoolExpr f, BoolExpr assumption)
|
void Prove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr assumption)
|
||||||
throws Z3Exception, TestFailedException
|
throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
BoolExpr[] assumptions = { assumption };
|
BoolExpr[] assumptions = { assumption };
|
||||||
Prove(ctx, f, assumptions);
|
Prove(ctx, f, useMBQI, assumptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prove(Context ctx, BoolExpr f, BoolExpr[] assumptions)
|
void Prove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr[] assumptions)
|
||||||
throws Z3Exception, TestFailedException
|
throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("Proving: " + f);
|
System.out.println("Proving: " + f);
|
||||||
Solver s = ctx.MkSolver();
|
Solver s = ctx.MkSolver();
|
||||||
|
Params p = ctx.MkParams();
|
||||||
|
p.Add("mbqi", useMBQI);
|
||||||
|
s.setParameters(p);
|
||||||
for (BoolExpr a : assumptions)
|
for (BoolExpr a : assumptions)
|
||||||
s.Assert(a);
|
s.Assert(a);
|
||||||
s.Assert(ctx.MkNot(f));
|
s.Assert(ctx.MkNot(f));
|
||||||
|
@ -285,25 +290,28 @@ class JavaExample
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disprove(Context ctx, BoolExpr f) throws Z3Exception,
|
void Disprove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception,
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
BoolExpr[] a = {};
|
BoolExpr[] a = {};
|
||||||
Disprove(ctx, f, a);
|
Disprove(ctx, f, useMBQI, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disprove(Context ctx, BoolExpr f, BoolExpr assumption)
|
void Disprove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr assumption)
|
||||||
throws Z3Exception, TestFailedException
|
throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
BoolExpr[] a = { assumption };
|
BoolExpr[] a = { assumption };
|
||||||
Disprove(ctx, f, a);
|
Disprove(ctx, f, useMBQI, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disprove(Context ctx, BoolExpr f, BoolExpr[] assumptions)
|
void Disprove(Context ctx, BoolExpr f, boolean useMBQI,
|
||||||
throws Z3Exception, TestFailedException
|
BoolExpr[] assumptions) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("Disproving: " + f);
|
System.out.println("Disproving: " + f);
|
||||||
Solver s = ctx.MkSolver();
|
Solver s = ctx.MkSolver();
|
||||||
|
Params p = ctx.MkParams();
|
||||||
|
p.Add("mbqi", useMBQI);
|
||||||
|
s.setParameters(p);
|
||||||
for (BoolExpr a : assumptions)
|
for (BoolExpr a : assumptions)
|
||||||
s.Assert(a);
|
s.Assert(a);
|
||||||
s.Assert(ctx.MkNot(f));
|
s.Assert(ctx.MkNot(f));
|
||||||
|
@ -331,7 +339,7 @@ class JavaExample
|
||||||
ctx.MkRealSort());
|
ctx.MkRealSort());
|
||||||
ArithExpr yr = (ArithExpr) ctx.MkConst(ctx.MkSymbol("y"),
|
ArithExpr yr = (ArithExpr) ctx.MkConst(ctx.MkSymbol("y"),
|
||||||
ctx.MkRealSort());
|
ctx.MkRealSort());
|
||||||
Goal g4 = ctx.MkGoal(true, false, true);
|
Goal g4 = ctx.MkGoal(true, false, false);
|
||||||
g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
|
g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
|
||||||
g4.Assert(ctx.MkEq(yr,
|
g4.Assert(ctx.MkEq(yr,
|
||||||
ctx.MkAdd(new ArithExpr[] { xr, ctx.MkReal(1, 1) })));
|
ctx.MkAdd(new ArithExpr[] { xr, ctx.MkReal(1, 1) })));
|
||||||
|
@ -367,6 +375,7 @@ class JavaExample
|
||||||
void ArrayExample1(Context ctx) throws Z3Exception, TestFailedException
|
void ArrayExample1(Context ctx) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ArrayExample1");
|
System.out.println("ArrayExample1");
|
||||||
|
Log.Append("ArrayExample1");
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, false);
|
Goal g = ctx.MkGoal(true, false, false);
|
||||||
ArraySort asort = ctx.MkArraySort(ctx.IntSort(), ctx.MkBitVecSort(32));
|
ArraySort asort = ctx.MkArraySort(ctx.IntSort(), ctx.MkBitVecSort(32));
|
||||||
|
@ -416,6 +425,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ArrayExample2");
|
System.out.println("ArrayExample2");
|
||||||
|
Log.Append("ArrayExample2");
|
||||||
|
|
||||||
Sort int_type = ctx.IntSort();
|
Sort int_type = ctx.IntSort();
|
||||||
Sort array_type = ctx.MkArraySort(int_type, int_type);
|
Sort array_type = ctx.MkArraySort(int_type, int_type);
|
||||||
|
@ -452,7 +462,7 @@ class JavaExample
|
||||||
System.out
|
System.out
|
||||||
.println("prove: store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))");
|
.println("prove: store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))");
|
||||||
System.out.println(thm);
|
System.out.println(thm);
|
||||||
Prove(ctx, thm);
|
Prove(ctx, thm, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Show that <code>distinct(a_0, ... , a_n)</code> is
|
// / Show that <code>distinct(a_0, ... , a_n)</code> is
|
||||||
|
@ -465,6 +475,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ArrayExample3");
|
System.out.println("ArrayExample3");
|
||||||
|
Log.Append("ArrayExample2");
|
||||||
|
|
||||||
for (int n = 2; n <= 5; n++)
|
for (int n = 2; n <= 5; n++)
|
||||||
{
|
{
|
||||||
|
@ -503,6 +514,7 @@ class JavaExample
|
||||||
void SudokuExample(Context ctx) throws Z3Exception, TestFailedException
|
void SudokuExample(Context ctx) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("SudokuExample");
|
System.out.println("SudokuExample");
|
||||||
|
Log.Append("SudokuExample");
|
||||||
|
|
||||||
// 9x9 matrix of integer variables
|
// 9x9 matrix of integer variables
|
||||||
IntExpr[][] X = new IntExpr[9][];
|
IntExpr[][] X = new IntExpr[9][];
|
||||||
|
@ -609,6 +621,7 @@ class JavaExample
|
||||||
void QuantifierExample1(Context ctx) throws Z3Exception
|
void QuantifierExample1(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("QuantifierExample");
|
System.out.println("QuantifierExample");
|
||||||
|
Log.Append("QuantifierExample");
|
||||||
|
|
||||||
Sort[] types = new Sort[3];
|
Sort[] types = new Sort[3];
|
||||||
IntExpr[] xs = new IntExpr[3];
|
IntExpr[] xs = new IntExpr[3];
|
||||||
|
@ -654,6 +667,7 @@ class JavaExample
|
||||||
{
|
{
|
||||||
|
|
||||||
System.out.println("QuantifierExample2");
|
System.out.println("QuantifierExample2");
|
||||||
|
Log.Append("QuantifierExample2");
|
||||||
|
|
||||||
Expr q1, q2;
|
Expr q1, q2;
|
||||||
FuncDecl f = ctx.MkFuncDecl("f", ctx.IntSort(), ctx.IntSort());
|
FuncDecl f = ctx.MkFuncDecl("f", ctx.IntSort(), ctx.IntSort());
|
||||||
|
@ -707,23 +721,17 @@ class JavaExample
|
||||||
// / <code>f</code> is injective in the second argument. <seealso
|
// / <code>f</code> is injective in the second argument. <seealso
|
||||||
// cref="inj_axiom"/>
|
// cref="inj_axiom"/>
|
||||||
|
|
||||||
public void QuantifierExample3() throws Z3Exception, TestFailedException
|
public void QuantifierExample3(Context ctx) throws Z3Exception,
|
||||||
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("QuantifierExample3");
|
System.out.println("QuantifierExample3");
|
||||||
|
Log.Append("QuantifierExample3");
|
||||||
HashMap<String, String> cfg = new HashMap<String, String>();
|
|
||||||
cfg.put("MBQI", "false");
|
|
||||||
cfg.put("PROOF_MODE", "2");
|
|
||||||
cfg.put("AUTO_CONFIG", "false");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If quantified formulas are asserted in a logical context, then the
|
* If quantified formulas are asserted in a logical context, then the
|
||||||
* model produced by Z3 should be viewed as a potential model.
|
* model produced by Z3 should be viewed as a potential model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
|
||||||
Context ctx = new Context(cfg);
|
|
||||||
|
|
||||||
/* declare function f */
|
/* declare function f */
|
||||||
Sort I = ctx.IntSort();
|
Sort I = ctx.IntSort();
|
||||||
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
||||||
|
@ -744,34 +752,27 @@ class JavaExample
|
||||||
|
|
||||||
/* prove f(x, y) = f(w, v) implies y = v */
|
/* prove f(x, y) = f(w, v) implies y = v */
|
||||||
BoolExpr p2 = ctx.MkEq(y, v);
|
BoolExpr p2 = ctx.MkEq(y, v);
|
||||||
Prove(ctx, p2, new BoolExpr[] { inj, p1 });
|
Prove(ctx, p2, false, new BoolExpr[] { inj, p1 });
|
||||||
|
|
||||||
/* disprove f(x, y) = f(w, v) implies x = w */
|
/* disprove f(x, y) = f(w, v) implies x = w */
|
||||||
BoolExpr p3 = ctx.MkEq(x, w);
|
BoolExpr p3 = ctx.MkEq(x, w);
|
||||||
Disprove(ctx, p3, new BoolExpr[] { inj, p1 });
|
Disprove(ctx, p3, false, new BoolExpr[] { inj, p1 });
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
// / Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when
|
||||||
// / <code>f</code> is injective in the second argument. <seealso
|
// / <code>f</code> is injective in the second argument. <seealso
|
||||||
// cref="inj_axiom"/>
|
// cref="inj_axiom"/>
|
||||||
|
|
||||||
public void QuantifierExample4() throws Z3Exception, TestFailedException
|
public void QuantifierExample4(Context ctx) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("QuantifierExample4");
|
System.out.println("QuantifierExample4");
|
||||||
|
Log.Append("QuantifierExample4");
|
||||||
HashMap<String, String> cfg = new HashMap<String, String>();
|
|
||||||
cfg.put("MBQI", "false");
|
|
||||||
cfg.put("PROOF_MODE", "2");
|
|
||||||
cfg.put("AUTO_CONFIG", "false");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If quantified formulas are asserted in a logical context, then the
|
* If quantified formulas are asserted in a logical context, then the
|
||||||
* model produced by Z3 should be viewed as a potential model.
|
* model produced by Z3 should be viewed as a potential model.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
|
||||||
Context ctx = new Context(cfg);
|
|
||||||
/* declare function f */
|
/* declare function f */
|
||||||
Sort I = ctx.IntSort();
|
Sort I = ctx.IntSort();
|
||||||
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I);
|
||||||
|
@ -792,12 +793,11 @@ class JavaExample
|
||||||
|
|
||||||
/* prove f(x, y) = f(w, v) implies y = v */
|
/* prove f(x, y) = f(w, v) implies y = v */
|
||||||
BoolExpr p2 = ctx.MkEq(y, v);
|
BoolExpr p2 = ctx.MkEq(y, v);
|
||||||
Prove(ctx, p2, new BoolExpr[] { inj, p1 });
|
Prove(ctx, p2, false, new BoolExpr[] { inj, p1 });
|
||||||
|
|
||||||
/* disprove f(x, y) = f(w, v) implies x = w */
|
/* disprove f(x, y) = f(w, v) implies x = w */
|
||||||
BoolExpr p3 = ctx.MkEq(x, w);
|
BoolExpr p3 = ctx.MkEq(x, w);
|
||||||
Disprove(ctx, p3, new BoolExpr[] { inj, p1 });
|
Disprove(ctx, p3, false, new BoolExpr[] { inj, p1 });
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Some basic tests.
|
// / Some basic tests.
|
||||||
|
@ -824,7 +824,7 @@ class JavaExample
|
||||||
BoolExpr trivial_eq = ctx.MkEq(fapp, fapp);
|
BoolExpr trivial_eq = ctx.MkEq(fapp, fapp);
|
||||||
BoolExpr nontrivial_eq = ctx.MkEq(fapp, fapp2);
|
BoolExpr nontrivial_eq = ctx.MkEq(fapp, fapp2);
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true, false, false);
|
||||||
g.Assert(trivial_eq);
|
g.Assert(trivial_eq);
|
||||||
g.Assert(nontrivial_eq);
|
g.Assert(nontrivial_eq);
|
||||||
System.out.println("Goal: " + g);
|
System.out.println("Goal: " + g);
|
||||||
|
@ -1081,7 +1081,7 @@ class JavaExample
|
||||||
|
|
||||||
{
|
{
|
||||||
HashMap<String, String> cfg = new HashMap<String, String>();
|
HashMap<String, String> cfg = new HashMap<String, String>();
|
||||||
cfg.put("MODEL", "true");
|
cfg.put("model", "true");
|
||||||
Context ctx = new Context(cfg);
|
Context ctx = new Context(cfg);
|
||||||
Expr a = ctx.ParseSMTLIB2File(filename, null, null, null, null);
|
Expr a = ctx.ParseSMTLIB2File(filename, null, null, null, null);
|
||||||
|
|
||||||
|
@ -1117,6 +1117,7 @@ class JavaExample
|
||||||
void LogicExample(Context ctx) throws Z3Exception, TestFailedException
|
void LogicExample(Context ctx) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("LogicTest");
|
System.out.println("LogicTest");
|
||||||
|
Log.Append("LogicTest");
|
||||||
|
|
||||||
Context.ToggleWarningMessages(true);
|
Context.ToggleWarningMessages(true);
|
||||||
|
|
||||||
|
@ -1132,7 +1133,7 @@ class JavaExample
|
||||||
System.out.println("solver result: " + res);
|
System.out.println("solver result: " + res);
|
||||||
|
|
||||||
// Or perhaps a tactic for QF_BV
|
// Or perhaps a tactic for QF_BV
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true, false, false);
|
||||||
g.Assert(eq);
|
g.Assert(eq);
|
||||||
|
|
||||||
Tactic t = ctx.MkTactic("qfbv");
|
Tactic t = ctx.MkTactic("qfbv");
|
||||||
|
@ -1148,13 +1149,14 @@ class JavaExample
|
||||||
void ParOrExample(Context ctx) throws Z3Exception, TestFailedException
|
void ParOrExample(Context ctx) throws Z3Exception, TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ParOrExample");
|
System.out.println("ParOrExample");
|
||||||
|
Log.Append("ParOrExample");
|
||||||
|
|
||||||
BitVecSort bvs = ctx.MkBitVecSort(32);
|
BitVecSort bvs = ctx.MkBitVecSort(32);
|
||||||
Expr x = ctx.MkConst("x", bvs);
|
Expr x = ctx.MkConst("x", bvs);
|
||||||
Expr y = ctx.MkConst("y", bvs);
|
Expr y = ctx.MkConst("y", bvs);
|
||||||
BoolExpr q = ctx.MkEq(x, y);
|
BoolExpr q = ctx.MkEq(x, y);
|
||||||
|
|
||||||
Goal g = ctx.MkGoal(true, false, true);
|
Goal g = ctx.MkGoal(true, false, false);
|
||||||
g.Assert(q);
|
g.Assert(q);
|
||||||
|
|
||||||
Tactic t1 = ctx.MkTactic("qfbv");
|
Tactic t1 = ctx.MkTactic("qfbv");
|
||||||
|
@ -1179,6 +1181,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("FindModelExample1");
|
System.out.println("FindModelExample1");
|
||||||
|
Log.Append("FindModelExample1");
|
||||||
|
|
||||||
BoolExpr x = ctx.MkBoolConst("x");
|
BoolExpr x = ctx.MkBoolConst("x");
|
||||||
BoolExpr y = ctx.MkBoolConst("y");
|
BoolExpr y = ctx.MkBoolConst("y");
|
||||||
|
@ -1195,7 +1198,8 @@ class JavaExample
|
||||||
public void FindModelExample2(Context ctx) throws Z3Exception,
|
public void FindModelExample2(Context ctx) throws Z3Exception,
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("find_model_example2");
|
System.out.println("FindModelExample2");
|
||||||
|
Log.Append("FindModelExample2");
|
||||||
|
|
||||||
IntExpr x = ctx.MkIntConst("x");
|
IntExpr x = ctx.MkIntConst("x");
|
||||||
IntExpr y = ctx.MkIntConst("y");
|
IntExpr y = ctx.MkIntConst("y");
|
||||||
|
@ -1235,6 +1239,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ProveExample1");
|
System.out.println("ProveExample1");
|
||||||
|
Log.Append("ProveExample1");
|
||||||
|
|
||||||
/* create uninterpreted type. */
|
/* create uninterpreted type. */
|
||||||
Sort U = ctx.MkUninterpretedSort(ctx.MkSymbol("U"));
|
Sort U = ctx.MkUninterpretedSort(ctx.MkSymbol("U"));
|
||||||
|
@ -1255,7 +1260,7 @@ class JavaExample
|
||||||
/* prove g(x) = g(y) */
|
/* prove g(x) = g(y) */
|
||||||
BoolExpr f = ctx.MkEq(gx, gy);
|
BoolExpr f = ctx.MkEq(gx, gy);
|
||||||
System.out.println("prove: x = y implies g(x) = g(y)");
|
System.out.println("prove: x = y implies g(x) = g(y)");
|
||||||
Prove(ctx, ctx.MkImplies(eq, f));
|
Prove(ctx, ctx.MkImplies(eq, f), false);
|
||||||
|
|
||||||
/* create g(g(x)) */
|
/* create g(g(x)) */
|
||||||
Expr ggx = g.Apply(gx);
|
Expr ggx = g.Apply(gx);
|
||||||
|
@ -1263,7 +1268,7 @@ class JavaExample
|
||||||
/* disprove g(g(x)) = g(y) */
|
/* disprove g(g(x)) = g(y) */
|
||||||
f = ctx.MkEq(ggx, gy);
|
f = ctx.MkEq(ggx, gy);
|
||||||
System.out.println("disprove: x = y implies g(g(x)) = g(y)");
|
System.out.println("disprove: x = y implies g(g(x)) = g(y)");
|
||||||
Disprove(ctx, ctx.MkImplies(eq, f));
|
Disprove(ctx, ctx.MkImplies(eq, f), false);
|
||||||
|
|
||||||
/* Print the model using the custom model printer */
|
/* Print the model using the custom model printer */
|
||||||
Model m = Check(ctx, ctx.MkNot(f), Status.SATISFIABLE);
|
Model m = Check(ctx, ctx.MkNot(f), Status.SATISFIABLE);
|
||||||
|
@ -1281,6 +1286,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ProveExample2");
|
System.out.println("ProveExample2");
|
||||||
|
Log.Append("ProveExample2");
|
||||||
|
|
||||||
/* declare function g */
|
/* declare function g */
|
||||||
Sort I = ctx.IntSort();
|
Sort I = ctx.IntSort();
|
||||||
|
@ -1318,14 +1324,14 @@ class JavaExample
|
||||||
BoolExpr f = ctx.MkLt(z, zero);
|
BoolExpr f = ctx.MkLt(z, zero);
|
||||||
System.out
|
System.out
|
||||||
.println("prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0");
|
.println("prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0");
|
||||||
Prove(ctx, f, new BoolExpr[] { c1, c2, c3 });
|
Prove(ctx, f, false, new BoolExpr[] { c1, c2, c3 });
|
||||||
|
|
||||||
/* disprove z < -1 */
|
/* disprove z < -1 */
|
||||||
IntExpr minus_one = ctx.MkInt(-1);
|
IntExpr minus_one = ctx.MkInt(-1);
|
||||||
f = ctx.MkLt(z, minus_one);
|
f = ctx.MkLt(z, minus_one);
|
||||||
System.out
|
System.out
|
||||||
.println("disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1");
|
.println("disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1");
|
||||||
Disprove(ctx, f, new BoolExpr[] { c1, c2, c3 });
|
Disprove(ctx, f, false, new BoolExpr[] { c1, c2, c3 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Show how push & pop can be used to create "backtracking" points.
|
// / Show how push & pop can be used to create "backtracking" points.
|
||||||
|
@ -1336,6 +1342,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("PushPopExample1");
|
System.out.println("PushPopExample1");
|
||||||
|
Log.Append("PushPopExample1");
|
||||||
|
|
||||||
/* create a big number */
|
/* create a big number */
|
||||||
IntSort int_type = ctx.IntSort();
|
IntSort int_type = ctx.IntSort();
|
||||||
|
@ -1402,6 +1409,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("TupleExample");
|
System.out.println("TupleExample");
|
||||||
|
Log.Append("TupleExample");
|
||||||
|
|
||||||
Sort int_type = ctx.IntSort();
|
Sort int_type = ctx.IntSort();
|
||||||
TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of
|
TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of
|
||||||
|
@ -1423,7 +1431,7 @@ class JavaExample
|
||||||
Expr n2 = first.Apply(n1);
|
Expr n2 = first.Apply(n1);
|
||||||
BoolExpr n3 = ctx.MkEq(x, n2);
|
BoolExpr n3 = ctx.MkEq(x, n2);
|
||||||
System.out.println("Tuple example: " + n3);
|
System.out.println("Tuple example: " + n3);
|
||||||
Prove(ctx, n3);
|
Prove(ctx, n3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Simple bit-vector example.
|
// / Simple bit-vector example.
|
||||||
|
@ -1436,6 +1444,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("BitvectorExample1");
|
System.out.println("BitvectorExample1");
|
||||||
|
Log.Append("BitvectorExample1");
|
||||||
|
|
||||||
Sort bv_type = ctx.MkBitVecSort(32);
|
Sort bv_type = ctx.MkBitVecSort(32);
|
||||||
BitVecExpr x = (BitVecExpr) ctx.MkConst("x", bv_type);
|
BitVecExpr x = (BitVecExpr) ctx.MkConst("x", bv_type);
|
||||||
|
@ -1448,7 +1457,7 @@ class JavaExample
|
||||||
BoolExpr thm = ctx.MkIff(c1, c2);
|
BoolExpr thm = ctx.MkIff(c1, c2);
|
||||||
System.out
|
System.out
|
||||||
.println("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
|
.println("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
|
||||||
Disprove(ctx, thm);
|
Disprove(ctx, thm, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Find x and y such that: x ^ y - 103 == x * y
|
// / Find x and y such that: x ^ y - 103 == x * y
|
||||||
|
@ -1457,6 +1466,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("BitvectorExample2");
|
System.out.println("BitvectorExample2");
|
||||||
|
Log.Append("BitvectorExample2");
|
||||||
|
|
||||||
/* construct x ^ y - 103 == x * y */
|
/* construct x ^ y - 103 == x * y */
|
||||||
Sort bv_type = ctx.MkBitVecSort(32);
|
Sort bv_type = ctx.MkBitVecSort(32);
|
||||||
|
@ -1482,6 +1492,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ParserExample1");
|
System.out.println("ParserExample1");
|
||||||
|
Log.Append("ParserExample1");
|
||||||
|
|
||||||
ctx.ParseSMTLIBString(
|
ctx.ParseSMTLIBString(
|
||||||
"(benchmark tst :extrafuns ((x Int) (y Int)) :formula (> x y) :formula (> x 0))",
|
"(benchmark tst :extrafuns ((x Int) (y Int)) :formula (> x y) :formula (> x 0))",
|
||||||
|
@ -1499,6 +1510,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ParserExample2");
|
System.out.println("ParserExample2");
|
||||||
|
Log.Append("ParserExample2");
|
||||||
|
|
||||||
Symbol[] declNames = { ctx.MkSymbol("a"), ctx.MkSymbol("b") };
|
Symbol[] declNames = { ctx.MkSymbol("a"), ctx.MkSymbol("b") };
|
||||||
FuncDecl a = ctx.MkConstDecl(declNames[0], ctx.MkIntSort());
|
FuncDecl a = ctx.MkConstDecl(declNames[0], ctx.MkIntSort());
|
||||||
|
@ -1517,6 +1529,7 @@ class JavaExample
|
||||||
public void ParserExample3(Context ctx) throws Exception
|
public void ParserExample3(Context ctx) throws Exception
|
||||||
{
|
{
|
||||||
System.out.println("ParserExample3");
|
System.out.println("ParserExample3");
|
||||||
|
Log.Append("ParserExample3");
|
||||||
|
|
||||||
/* declare function g */
|
/* declare function g */
|
||||||
Sort I = ctx.MkIntSort();
|
Sort I = ctx.MkIntSort();
|
||||||
|
@ -1531,7 +1544,7 @@ class JavaExample
|
||||||
|
|
||||||
BoolExpr thm = ctx.SMTLIBFormulas()[0];
|
BoolExpr thm = ctx.SMTLIBFormulas()[0];
|
||||||
System.out.println("formula: " + thm);
|
System.out.println("formula: " + thm);
|
||||||
Prove(ctx, thm, ca);
|
Prove(ctx, thm, false, ca);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Display the declarations, assumptions and formulas in a SMT-LIB string.
|
// / Display the declarations, assumptions and formulas in a SMT-LIB string.
|
||||||
|
@ -1539,6 +1552,7 @@ class JavaExample
|
||||||
public void ParserExample4(Context ctx) throws Z3Exception
|
public void ParserExample4(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("ParserExample4");
|
System.out.println("ParserExample4");
|
||||||
|
Log.Append("ParserExample4");
|
||||||
|
|
||||||
ctx.ParseSMTLIBString(
|
ctx.ParseSMTLIBString(
|
||||||
"(benchmark tst :extrafuns ((x Int) (y Int)) :assumption (= x 20) :formula (> x y) :formula (> x 0))",
|
"(benchmark tst :extrafuns ((x Int) (y Int)) :assumption (= x 20) :formula (> x y) :formula (> x 0))",
|
||||||
|
@ -1585,6 +1599,7 @@ class JavaExample
|
||||||
public void ITEExample(Context ctx) throws Z3Exception
|
public void ITEExample(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("ITEExample");
|
System.out.println("ITEExample");
|
||||||
|
Log.Append("ITEExample");
|
||||||
|
|
||||||
BoolExpr f = ctx.MkFalse();
|
BoolExpr f = ctx.MkFalse();
|
||||||
Expr one = ctx.MkInt(1);
|
Expr one = ctx.MkInt(1);
|
||||||
|
@ -1600,6 +1615,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("EnumExample");
|
System.out.println("EnumExample");
|
||||||
|
Log.Append("EnumExample");
|
||||||
|
|
||||||
Symbol name = ctx.MkSymbol("fruit");
|
Symbol name = ctx.MkSymbol("fruit");
|
||||||
|
|
||||||
|
@ -1620,15 +1636,16 @@ class JavaExample
|
||||||
Expr orange = fruit.Consts()[2];
|
Expr orange = fruit.Consts()[2];
|
||||||
|
|
||||||
/* Apples are different from oranges */
|
/* Apples are different from oranges */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(apple, orange)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(apple, orange)), false);
|
||||||
|
|
||||||
/* Apples pass the apple test */
|
/* Apples pass the apple test */
|
||||||
Prove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], apple));
|
Prove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], apple), false);
|
||||||
|
|
||||||
/* Oranges fail the apple test */
|
/* Oranges fail the apple test */
|
||||||
Disprove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], orange));
|
Disprove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], orange),
|
||||||
|
false);
|
||||||
Prove(ctx, (BoolExpr) ctx.MkNot((BoolExpr) ctx.MkApp(
|
Prove(ctx, (BoolExpr) ctx.MkNot((BoolExpr) ctx.MkApp(
|
||||||
fruit.TesterDecls()[0], orange)));
|
fruit.TesterDecls()[0], orange)), false);
|
||||||
|
|
||||||
Expr fruity = ctx.MkConst("fruity", fruit);
|
Expr fruity = ctx.MkConst("fruity", fruit);
|
||||||
|
|
||||||
|
@ -1636,7 +1653,8 @@ class JavaExample
|
||||||
|
|
||||||
Prove(ctx,
|
Prove(ctx,
|
||||||
ctx.MkOr(new BoolExpr[] { ctx.MkEq(fruity, apple),
|
ctx.MkOr(new BoolExpr[] { ctx.MkEq(fruity, apple),
|
||||||
ctx.MkEq(fruity, banana), ctx.MkEq(fruity, orange) }));
|
ctx.MkEq(fruity, banana), ctx.MkEq(fruity, orange) }),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Create a list datatype.
|
// / Create a list datatype.
|
||||||
|
@ -1645,6 +1663,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ListExample");
|
System.out.println("ListExample");
|
||||||
|
Log.Append("ListExample");
|
||||||
|
|
||||||
Sort int_ty;
|
Sort int_ty;
|
||||||
ListSort int_list;
|
ListSort int_list;
|
||||||
|
@ -1660,25 +1679,25 @@ class JavaExample
|
||||||
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { ctx.MkInt(2), nil });
|
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { ctx.MkInt(2), nil });
|
||||||
|
|
||||||
/* nil != cons(1, nil) */
|
/* nil != cons(1, nil) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)), false);
|
||||||
|
|
||||||
/* cons(2,nil) != cons(1, nil) */
|
/* cons(2,nil) != cons(1, nil) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(l1, l2)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(l1, l2)), false);
|
||||||
|
|
||||||
/* cons(x,nil) = cons(y, nil) => x = y */
|
/* cons(x,nil) = cons(y, nil) => x = y */
|
||||||
x = ctx.MkConst("x", int_ty);
|
x = ctx.MkConst("x", int_ty);
|
||||||
y = ctx.MkConst("y", int_ty);
|
y = ctx.MkConst("y", int_ty);
|
||||||
l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, nil });
|
l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, nil });
|
||||||
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, nil });
|
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, nil });
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false);
|
||||||
|
|
||||||
/* cons(x,u) = cons(x, v) => u = v */
|
/* cons(x,u) = cons(x, v) => u = v */
|
||||||
u = ctx.MkConst("u", int_list);
|
u = ctx.MkConst("u", int_list);
|
||||||
v = ctx.MkConst("v", int_list);
|
v = ctx.MkConst("v", int_list);
|
||||||
l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, u });
|
l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, u });
|
||||||
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, v });
|
l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, v });
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false);
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false);
|
||||||
|
|
||||||
/* is_nil(u) or is_cons(u) */
|
/* is_nil(u) or is_cons(u) */
|
||||||
Prove(ctx,
|
Prove(ctx,
|
||||||
|
@ -1686,10 +1705,10 @@ class JavaExample
|
||||||
(BoolExpr) ctx.MkApp(int_list.IsNilDecl(),
|
(BoolExpr) ctx.MkApp(int_list.IsNilDecl(),
|
||||||
new Expr[] { u }),
|
new Expr[] { u }),
|
||||||
(BoolExpr) ctx.MkApp(int_list.IsConsDecl(),
|
(BoolExpr) ctx.MkApp(int_list.IsConsDecl(),
|
||||||
new Expr[] { u }) }));
|
new Expr[] { u }) }), false);
|
||||||
|
|
||||||
/* occurs check u != cons(x,u) */
|
/* occurs check u != cons(x,u) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false);
|
||||||
|
|
||||||
/* destructors: is_cons(u) => u = cons(head(u),tail(u)) */
|
/* destructors: is_cons(u) => u = cons(head(u),tail(u)) */
|
||||||
fml1 = ctx.MkEq(u, ctx.MkApp(int_list.ConsDecl(),
|
fml1 = ctx.MkEq(u, ctx.MkApp(int_list.ConsDecl(),
|
||||||
|
@ -1700,9 +1719,9 @@ class JavaExample
|
||||||
fml1);
|
fml1);
|
||||||
System.out.println("Formula " + fml);
|
System.out.println("Formula " + fml);
|
||||||
|
|
||||||
Prove(ctx, fml);
|
Prove(ctx, fml, false);
|
||||||
|
|
||||||
Disprove(ctx, fml1);
|
Disprove(ctx, fml1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Create a binary tree datatype.
|
// / Create a binary tree datatype.
|
||||||
|
@ -1711,6 +1730,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("TreeExample");
|
System.out.println("TreeExample");
|
||||||
|
Log.Append("TreeExample");
|
||||||
|
|
||||||
Sort cell;
|
Sort cell;
|
||||||
FuncDecl nil_decl, is_nil_decl, cons_decl, is_cons_decl, car_decl, cdr_decl;
|
FuncDecl nil_decl, is_nil_decl, cons_decl, is_cons_decl, car_decl, cdr_decl;
|
||||||
|
@ -1741,7 +1761,7 @@ class JavaExample
|
||||||
l2 = ctx.MkApp(cons_decl, new Expr[] { l1, nil });
|
l2 = ctx.MkApp(cons_decl, new Expr[] { l1, nil });
|
||||||
|
|
||||||
/* nil != cons(nil, nil) */
|
/* nil != cons(nil, nil) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)), false);
|
||||||
|
|
||||||
/* cons(x,u) = cons(x, v) => u = v */
|
/* cons(x,u) = cons(x, v) => u = v */
|
||||||
u = ctx.MkConst("u", cell);
|
u = ctx.MkConst("u", cell);
|
||||||
|
@ -1750,17 +1770,18 @@ class JavaExample
|
||||||
y = ctx.MkConst("y", cell);
|
y = ctx.MkConst("y", cell);
|
||||||
l1 = ctx.MkApp(cons_decl, new Expr[] { x, u });
|
l1 = ctx.MkApp(cons_decl, new Expr[] { x, u });
|
||||||
l2 = ctx.MkApp(cons_decl, new Expr[] { y, v });
|
l2 = ctx.MkApp(cons_decl, new Expr[] { y, v });
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false);
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false);
|
||||||
|
|
||||||
/* is_nil(u) or is_cons(u) */
|
/* is_nil(u) or is_cons(u) */
|
||||||
Prove(ctx,
|
Prove(ctx,
|
||||||
ctx.MkOr(new BoolExpr[] {
|
ctx.MkOr(new BoolExpr[] {
|
||||||
(BoolExpr) ctx.MkApp(is_nil_decl, new Expr[] { u }),
|
(BoolExpr) ctx.MkApp(is_nil_decl, new Expr[] { u }),
|
||||||
(BoolExpr) ctx.MkApp(is_cons_decl, new Expr[] { u }) }));
|
(BoolExpr) ctx.MkApp(is_cons_decl, new Expr[] { u }) }),
|
||||||
|
false);
|
||||||
|
|
||||||
/* occurs check u != cons(x,u) */
|
/* occurs check u != cons(x,u) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false);
|
||||||
|
|
||||||
/* destructors: is_cons(u) => u = cons(car(u),cdr(u)) */
|
/* destructors: is_cons(u) => u = cons(car(u),cdr(u)) */
|
||||||
fml1 = ctx.MkEq(
|
fml1 = ctx.MkEq(
|
||||||
|
@ -1771,9 +1792,9 @@ class JavaExample
|
||||||
ctx.MkApp(cdr_decl, u) }));
|
ctx.MkApp(cdr_decl, u) }));
|
||||||
fml = ctx.MkImplies((BoolExpr) ctx.MkApp(is_cons_decl, u), fml1);
|
fml = ctx.MkImplies((BoolExpr) ctx.MkApp(is_cons_decl, u), fml1);
|
||||||
System.out.println("Formula " + fml);
|
System.out.println("Formula " + fml);
|
||||||
Prove(ctx, fml);
|
Prove(ctx, fml, false);
|
||||||
|
|
||||||
Disprove(ctx, fml1);
|
Disprove(ctx, fml1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Create a forest of trees.
|
// / Create a forest of trees.
|
||||||
|
@ -1786,6 +1807,7 @@ class JavaExample
|
||||||
TestFailedException
|
TestFailedException
|
||||||
{
|
{
|
||||||
System.out.println("ForestExample");
|
System.out.println("ForestExample");
|
||||||
|
Log.Append("ForestExample");
|
||||||
|
|
||||||
Sort tree, forest;
|
Sort tree, forest;
|
||||||
FuncDecl nil1_decl, is_nil1_decl, cons1_decl, is_cons1_decl, car1_decl, cdr1_decl;
|
FuncDecl nil1_decl, is_nil1_decl, cons1_decl, is_cons1_decl, car1_decl, cdr1_decl;
|
||||||
|
@ -1874,8 +1896,8 @@ class JavaExample
|
||||||
f3 = ctx.MkApp(cons1_decl, new Expr[] { t1, f1 });
|
f3 = ctx.MkApp(cons1_decl, new Expr[] { t1, f1 });
|
||||||
|
|
||||||
/* nil != cons(nil,nil) */
|
/* nil != cons(nil,nil) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(nil1, f1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(nil1, f1)), false);
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(nil2, t1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(nil2, t1)), false);
|
||||||
|
|
||||||
/* cons(x,u) = cons(x, v) => u = v */
|
/* cons(x,u) = cons(x, v) => u = v */
|
||||||
u = ctx.MkConst("u", forest);
|
u = ctx.MkConst("u", forest);
|
||||||
|
@ -1884,16 +1906,16 @@ class JavaExample
|
||||||
y = ctx.MkConst("y", tree);
|
y = ctx.MkConst("y", tree);
|
||||||
l1 = ctx.MkApp(cons1_decl, new Expr[] { x, u });
|
l1 = ctx.MkApp(cons1_decl, new Expr[] { x, u });
|
||||||
l2 = ctx.MkApp(cons1_decl, new Expr[] { y, v });
|
l2 = ctx.MkApp(cons1_decl, new Expr[] { y, v });
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false);
|
||||||
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)));
|
Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false);
|
||||||
|
|
||||||
/* is_nil(u) or is_cons(u) */
|
/* is_nil(u) or is_cons(u) */
|
||||||
Prove(ctx, ctx.MkOr(new BoolExpr[] {
|
Prove(ctx, ctx.MkOr(new BoolExpr[] {
|
||||||
(BoolExpr) ctx.MkApp(is_nil1_decl, new Expr[] { u }),
|
(BoolExpr) ctx.MkApp(is_nil1_decl, new Expr[] { u }),
|
||||||
(BoolExpr) ctx.MkApp(is_cons1_decl, new Expr[] { u }) }));
|
(BoolExpr) ctx.MkApp(is_cons1_decl, new Expr[] { u }) }), false);
|
||||||
|
|
||||||
/* occurs check u != cons(x,u) */
|
/* occurs check u != cons(x,u) */
|
||||||
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)));
|
Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / Demonstrate how to use #Eval.
|
// / Demonstrate how to use #Eval.
|
||||||
|
@ -1901,6 +1923,7 @@ class JavaExample
|
||||||
public void EvalExample1(Context ctx) throws Z3Exception
|
public void EvalExample1(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("EvalExample1");
|
System.out.println("EvalExample1");
|
||||||
|
Log.Append("EvalExample1");
|
||||||
|
|
||||||
IntExpr x = ctx.MkIntConst("x");
|
IntExpr x = ctx.MkIntConst("x");
|
||||||
IntExpr y = ctx.MkIntConst("y");
|
IntExpr y = ctx.MkIntConst("y");
|
||||||
|
@ -1940,6 +1963,7 @@ class JavaExample
|
||||||
public void EvalExample2(Context ctx) throws Z3Exception
|
public void EvalExample2(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("EvalExample2");
|
System.out.println("EvalExample2");
|
||||||
|
Log.Append("EvalExample2");
|
||||||
|
|
||||||
Sort int_type = ctx.IntSort();
|
Sort int_type = ctx.IntSort();
|
||||||
TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of
|
TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of
|
||||||
|
@ -2063,6 +2087,7 @@ class JavaExample
|
||||||
public void FindSmallModelExample(Context ctx) throws Z3Exception
|
public void FindSmallModelExample(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("FindSmallModelExample");
|
System.out.println("FindSmallModelExample");
|
||||||
|
Log.Append("FindSmallModelExample");
|
||||||
|
|
||||||
BitVecExpr x = ctx.MkBVConst("x", 32);
|
BitVecExpr x = ctx.MkBVConst("x", 32);
|
||||||
BitVecExpr y = ctx.MkBVConst("y", 32);
|
BitVecExpr y = ctx.MkBVConst("y", 32);
|
||||||
|
@ -2079,6 +2104,7 @@ class JavaExample
|
||||||
public void SimplifierExample(Context ctx) throws Z3Exception
|
public void SimplifierExample(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("SimplifierExample");
|
System.out.println("SimplifierExample");
|
||||||
|
Log.Append("SimplifierExample");
|
||||||
|
|
||||||
IntExpr x = ctx.MkIntConst("x");
|
IntExpr x = ctx.MkIntConst("x");
|
||||||
IntExpr y = ctx.MkIntConst("y");
|
IntExpr y = ctx.MkIntConst("y");
|
||||||
|
@ -2095,15 +2121,11 @@ class JavaExample
|
||||||
|
|
||||||
// / Extract unsatisfiable core example
|
// / Extract unsatisfiable core example
|
||||||
|
|
||||||
public void UnsatCoreAndProofExample() throws Z3Exception
|
public void UnsatCoreAndProofExample(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("UnsatCoreAndProofExample");
|
System.out.println("UnsatCoreAndProofExample");
|
||||||
|
Log.Append("UnsatCoreAndProofExample");
|
||||||
|
|
||||||
HashMap<String, String> cfg = new HashMap<String, String>();
|
|
||||||
cfg.put("PROOF_MODE", "2");
|
|
||||||
|
|
||||||
{
|
|
||||||
Context ctx = new Context(cfg);
|
|
||||||
Solver solver = ctx.MkSolver();
|
Solver solver = ctx.MkSolver();
|
||||||
|
|
||||||
BoolExpr pa = ctx.MkBoolConst("PredA");
|
BoolExpr pa = ctx.MkBoolConst("PredA");
|
||||||
|
@ -2114,12 +2136,11 @@ class JavaExample
|
||||||
BoolExpr p2 = ctx.MkBoolConst("P2");
|
BoolExpr p2 = ctx.MkBoolConst("P2");
|
||||||
BoolExpr p3 = ctx.MkBoolConst("P3");
|
BoolExpr p3 = ctx.MkBoolConst("P3");
|
||||||
BoolExpr p4 = ctx.MkBoolConst("P4");
|
BoolExpr p4 = ctx.MkBoolConst("P4");
|
||||||
BoolExpr[] assumptions = new BoolExpr[] { ctx.MkNot(p1),
|
BoolExpr[] assumptions = new BoolExpr[] { ctx.MkNot(p1), ctx.MkNot(p2),
|
||||||
ctx.MkNot(p2), ctx.MkNot(p3), ctx.MkNot(p4) };
|
ctx.MkNot(p3), ctx.MkNot(p4) };
|
||||||
BoolExpr f1 = ctx.MkAnd(new BoolExpr[] { pa, pb, pc });
|
BoolExpr f1 = ctx.MkAnd(new BoolExpr[] { pa, pb, pc });
|
||||||
BoolExpr f2 = ctx.MkAnd(new BoolExpr[] { pa, ctx.MkNot(pb), pc });
|
BoolExpr f2 = ctx.MkAnd(new BoolExpr[] { pa, ctx.MkNot(pb), pc });
|
||||||
BoolExpr f3 = ctx.MkOr(new BoolExpr[] { ctx.MkNot(pa),
|
BoolExpr f3 = ctx.MkOr(new BoolExpr[] { ctx.MkNot(pa), ctx.MkNot(pc) });
|
||||||
ctx.MkNot(pc) });
|
|
||||||
BoolExpr f4 = pd;
|
BoolExpr f4 = pd;
|
||||||
|
|
||||||
solver.Assert(ctx.MkOr(new BoolExpr[] { f1, p1 }));
|
solver.Assert(ctx.MkOr(new BoolExpr[] { f1, p1 }));
|
||||||
|
@ -2139,11 +2160,11 @@ class JavaExample
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void FiniteDomainExample(Context ctx) throws Z3Exception
|
public void FiniteDomainExample(Context ctx) throws Z3Exception
|
||||||
{
|
{
|
||||||
System.out.println("FiniteDomainExample");
|
System.out.println("FiniteDomainExample");
|
||||||
|
Log.Append("FiniteDomainExample");
|
||||||
|
|
||||||
FiniteDomainSort s = ctx.MkFiniteDomainSort("S", 10);
|
FiniteDomainSort s = ctx.MkFiniteDomainSort("S", 10);
|
||||||
FiniteDomainSort t = ctx.MkFiniteDomainSort("T", 10);
|
FiniteDomainSort t = ctx.MkFiniteDomainSort("T", 10);
|
||||||
|
@ -2174,10 +2195,9 @@ class JavaExample
|
||||||
|
|
||||||
p.SimpleExample();
|
p.SimpleExample();
|
||||||
|
|
||||||
{
|
{ // These examples need model generation turned on.
|
||||||
HashMap<String, String> cfg = new HashMap<String, String>();
|
HashMap<String, String> cfg = new HashMap<String, String>();
|
||||||
cfg.put("MODEL", "true");
|
cfg.put("model", "true");
|
||||||
cfg.put("PROOF_MODE", "2");
|
|
||||||
Context ctx = new Context(cfg);
|
Context ctx = new Context(cfg);
|
||||||
p.BasicTests(ctx);
|
p.BasicTests(ctx);
|
||||||
p.CastingTest(ctx);
|
p.CastingTest(ctx);
|
||||||
|
@ -2188,25 +2208,16 @@ class JavaExample
|
||||||
p.ParOrExample(ctx);
|
p.ParOrExample(ctx);
|
||||||
p.FindModelExample1(ctx);
|
p.FindModelExample1(ctx);
|
||||||
p.FindModelExample2(ctx);
|
p.FindModelExample2(ctx);
|
||||||
p.ProveExample1(ctx);
|
|
||||||
p.ProveExample2(ctx);
|
|
||||||
p.PushPopExample1(ctx);
|
p.PushPopExample1(ctx);
|
||||||
p.ArrayExample1(ctx);
|
p.ArrayExample1(ctx);
|
||||||
p.ArrayExample2(ctx);
|
|
||||||
p.ArrayExample3(ctx);
|
p.ArrayExample3(ctx);
|
||||||
p.TupleExample(ctx);
|
|
||||||
p.BitvectorExample1(ctx);
|
p.BitvectorExample1(ctx);
|
||||||
p.BitvectorExample2(ctx);
|
p.BitvectorExample2(ctx);
|
||||||
p.ParserExample1(ctx);
|
p.ParserExample1(ctx);
|
||||||
p.ParserExample2(ctx);
|
p.ParserExample2(ctx);
|
||||||
p.ParserExample3(ctx);
|
|
||||||
p.ParserExample4(ctx);
|
p.ParserExample4(ctx);
|
||||||
p.ParserExample5(ctx);
|
p.ParserExample5(ctx);
|
||||||
p.ITEExample(ctx);
|
p.ITEExample(ctx);
|
||||||
p.EnumExample(ctx);
|
|
||||||
p.ListExample(ctx);
|
|
||||||
p.TreeExample(ctx);
|
|
||||||
p.ForestExample(ctx);
|
|
||||||
p.EvalExample1(ctx);
|
p.EvalExample1(ctx);
|
||||||
p.EvalExample2(ctx);
|
p.EvalExample2(ctx);
|
||||||
p.FindSmallModelExample(ctx);
|
p.FindSmallModelExample(ctx);
|
||||||
|
@ -2214,9 +2225,31 @@ class JavaExample
|
||||||
p.FiniteDomainExample(ctx);
|
p.FiniteDomainExample(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.QuantifierExample3();
|
{ // These examples need proof generation turned on.
|
||||||
p.QuantifierExample4();
|
HashMap<String, String> cfg = new HashMap<String, String>();
|
||||||
p.UnsatCoreAndProofExample();
|
cfg.put("proof", "true");
|
||||||
|
Context ctx = new Context(cfg);
|
||||||
|
p.ProveExample1(ctx);
|
||||||
|
p.ProveExample2(ctx);
|
||||||
|
p.ArrayExample2(ctx);
|
||||||
|
p.TupleExample(ctx);
|
||||||
|
p.ParserExample3(ctx);
|
||||||
|
p.EnumExample(ctx);
|
||||||
|
p.ListExample(ctx);
|
||||||
|
p.TreeExample(ctx);
|
||||||
|
p.ForestExample(ctx);
|
||||||
|
p.UnsatCoreAndProofExample(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // These examples need proof generation turned on and auto-config
|
||||||
|
// set to false.
|
||||||
|
HashMap<String, String> cfg = new HashMap<String, String>();
|
||||||
|
cfg.put("proof", "true");
|
||||||
|
cfg.put("auto-config", "false");
|
||||||
|
Context ctx = new Context(cfg);
|
||||||
|
p.QuantifierExample3(ctx);
|
||||||
|
p.QuantifierExample4(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
Log.Close();
|
Log.Close();
|
||||||
if (Log.isOpen())
|
if (Log.isOpen())
|
||||||
|
|
|
@ -43,6 +43,13 @@ extern "C" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Z3_API Z3_global_param_reset_all() {
|
||||||
|
memory::initialize(UINT_MAX);
|
||||||
|
LOG_Z3_global_param_reset_all();
|
||||||
|
gparams::reset();
|
||||||
|
env_params::updt_params();
|
||||||
|
}
|
||||||
|
|
||||||
std::string g_Z3_global_param_get_buffer;
|
std::string g_Z3_global_param_get_buffer;
|
||||||
|
|
||||||
Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) {
|
Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace api {
|
||||||
}
|
}
|
||||||
|
|
||||||
context::context(context_params * p, bool user_ref_count):
|
context::context(context_params * p, bool user_ref_count):
|
||||||
m_params(*p),
|
m_params(p != 0 ? *p : context_params()),
|
||||||
m_user_ref_count(user_ref_count),
|
m_user_ref_count(user_ref_count),
|
||||||
m_manager(m_params.m_proof ? PGM_FINE : PGM_DISABLED, m_params.m_trace ? m_params.m_trace_file_name.c_str() : 0),
|
m_manager(m_params.m_proof ? PGM_FINE : PGM_DISABLED, m_params.m_trace ? m_params.m_trace_file_name.c_str() : 0),
|
||||||
m_plugins(m_manager),
|
m_plugins(m_manager),
|
||||||
|
|
|
@ -201,7 +201,7 @@ extern "C" {
|
||||||
LOG_Z3_get_as_array_func_decl(c, a);
|
LOG_Z3_get_as_array_func_decl(c, a);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
if (is_expr(to_ast(a)) && is_app_of(to_expr(a), mk_c(c)->get_array_fid(), OP_AS_ARRAY)) {
|
if (is_expr(to_ast(a)) && is_app_of(to_expr(a), mk_c(c)->get_array_fid(), OP_AS_ARRAY)) {
|
||||||
return of_func_decl(to_func_decl(to_app(a)->get_decl()->get_parameter(0).get_ast()));
|
RETURN_Z3(of_func_decl(to_func_decl(to_app(a)->get_decl()->get_parameter(0).get_ast())));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SET_ERROR_CODE(Z3_INVALID_ARG);
|
SET_ERROR_CODE(Z3_INVALID_ARG);
|
||||||
|
|
|
@ -66,7 +66,7 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_params_set_bool(c, p, k, v);
|
LOG_Z3_params_set_bool(c, p, k, v);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
to_params(p)->m_params.set_bool(to_symbol(k), v != 0);
|
to_params(p)->m_params.set_bool(norm_param_name(to_symbol(k)).c_str(), v != 0);
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_params_set_uint(c, p, k, v);
|
LOG_Z3_params_set_uint(c, p, k, v);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
to_params(p)->m_params.set_uint(to_symbol(k), v);
|
to_params(p)->m_params.set_uint(norm_param_name(to_symbol(k)).c_str(), v);
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_params_set_double(c, p, k, v);
|
LOG_Z3_params_set_double(c, p, k, v);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
to_params(p)->m_params.set_double(to_symbol(k), v);
|
to_params(p)->m_params.set_double(norm_param_name(to_symbol(k)).c_str(), v);
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ extern "C" {
|
||||||
Z3_TRY;
|
Z3_TRY;
|
||||||
LOG_Z3_params_set_symbol(c, p, k, v);
|
LOG_Z3_params_set_symbol(c, p, k, v);
|
||||||
RESET_ERROR_CODE();
|
RESET_ERROR_CODE();
|
||||||
to_params(p)->m_params.set_sym(to_symbol(k), to_symbol(v));
|
to_params(p)->m_params.set_sym(norm_param_name(to_symbol(k)).c_str(), to_symbol(v));
|
||||||
Z3_CATCH;
|
Z3_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ namespace z3 {
|
||||||
class apply_result;
|
class apply_result;
|
||||||
class fixedpoint;
|
class fixedpoint;
|
||||||
|
|
||||||
|
inline void set_param(char const * param, char const * value) { Z3_global_param_set(param, value); }
|
||||||
|
inline void set_param(char const * param, bool value) { Z3_global_param_set(param, value ? "true" : "false"); }
|
||||||
|
inline void set_param(char const * param, int value) { std::ostringstream oss; oss << value; Z3_global_param_set(param, oss.str().c_str()); }
|
||||||
|
inline void reset_params() { Z3_global_param_reset_all(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Exception used to sign API usage errors.
|
\brief Exception used to sign API usage errors.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3657,6 +3657,7 @@ namespace Microsoft.Z3
|
||||||
Goal_DRQ.Clear(this);
|
Goal_DRQ.Clear(this);
|
||||||
Model_DRQ.Clear(this);
|
Model_DRQ.Clear(this);
|
||||||
Params_DRQ.Clear(this);
|
Params_DRQ.Clear(this);
|
||||||
|
ParamDescrs_DRQ.Clear(this);
|
||||||
Probe_DRQ.Clear(this);
|
Probe_DRQ.Clear(this);
|
||||||
Solver_DRQ.Clear(this);
|
Solver_DRQ.Clear(this);
|
||||||
Statistics_DRQ.Clear(this);
|
Statistics_DRQ.Clear(this);
|
||||||
|
|
|
@ -252,6 +252,71 @@
|
||||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\Debug\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\external\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'external|x86'">
|
||||||
|
<OutputPath>bin\x86\external\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\external\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>bin\Release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_delaysign|x86'">
|
||||||
|
<OutputPath>bin\x86\Release_delaysign\</OutputPath>
|
||||||
|
<DefineConstants>DELAYSIGN</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<DocumentationFile>..\Release_delaysign\Microsoft.Z3.xml</DocumentationFile>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<CodeAnalysisLogFile>..\release\Microsoft.Z3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||||
|
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||||
|
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||||
|
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||||
|
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
|
|
@ -44,8 +44,8 @@ public class Params extends Z3Object
|
||||||
**/
|
**/
|
||||||
public void Add(String name, boolean value) throws Z3Exception
|
public void Add(String name, boolean value) throws Z3Exception
|
||||||
{
|
{
|
||||||
Native.paramsSetBool(Context().nCtx(), NativeObject(), Context()
|
Native.paramsSetBool(Context().nCtx(), NativeObject(),
|
||||||
.MkSymbol(name).NativeObject(), (value) ? true : false);
|
Context().MkSymbol(name).NativeObject(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -198,10 +198,10 @@ def _get_ctx(ctx):
|
||||||
else:
|
else:
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
def set_option(*args, **kws):
|
def set_param(*args, **kws):
|
||||||
"""Set Z3 global (or module) parameters.
|
"""Set Z3 global (or module) parameters.
|
||||||
|
|
||||||
>>> set_option(precision=10)
|
>>> set_param(precision=10)
|
||||||
"""
|
"""
|
||||||
if __debug__:
|
if __debug__:
|
||||||
_z3_assert(len(args) % 2 == 0, "Argument list must have an even number of elements.")
|
_z3_assert(len(args) % 2 == 0, "Argument list must have an even number of elements.")
|
||||||
|
@ -219,11 +219,21 @@ def set_option(*args, **kws):
|
||||||
Z3_global_param_set(str(prev), _to_param_value(a))
|
Z3_global_param_set(str(prev), _to_param_value(a))
|
||||||
prev = None
|
prev = None
|
||||||
|
|
||||||
def get_option(name):
|
def reset_params():
|
||||||
|
"""Reset all global (or module) parameters.
|
||||||
|
"""
|
||||||
|
Z3_global_param_reset_all()
|
||||||
|
|
||||||
|
def set_option(*args, **kws):
|
||||||
|
"""Alias for 'set_param' for backward compatibility.
|
||||||
|
"""
|
||||||
|
return set_param(*args, **kws)
|
||||||
|
|
||||||
|
def get_param(name):
|
||||||
"""Return the value of a Z3 global (or module) parameter
|
"""Return the value of a Z3 global (or module) parameter
|
||||||
|
|
||||||
>>> get_option('nlsat.reorder')
|
>>> get_param('nlsat.reorder')
|
||||||
true
|
'true'
|
||||||
"""
|
"""
|
||||||
ptr = (ctypes.c_char_p * 1)()
|
ptr = (ctypes.c_char_p * 1)()
|
||||||
if Z3_global_param_get(str(name), ptr):
|
if Z3_global_param_get(str(name), ptr):
|
||||||
|
@ -4384,8 +4394,8 @@ def args2params(arguments, keywords, ctx=None):
|
||||||
"""Convert python arguments into a Z3_params object.
|
"""Convert python arguments into a Z3_params object.
|
||||||
A ':' is added to the keywords, and '_' is replaced with '-'
|
A ':' is added to the keywords, and '_' is replaced with '-'
|
||||||
|
|
||||||
>>> args2params([':model', True, ':relevancy', 2], {'elim_and' : True})
|
>>> args2params(['model', True, 'relevancy', 2], {'elim_and' : True})
|
||||||
(params :model 1 :relevancy 2 :elim-and 1)
|
(params model 1 relevancy 2 elim_and 1)
|
||||||
"""
|
"""
|
||||||
if __debug__:
|
if __debug__:
|
||||||
_z3_assert(len(arguments) % 2 == 0, "Argument list must have an even number of elements.")
|
_z3_assert(len(arguments) % 2 == 0, "Argument list must have an even number of elements.")
|
||||||
|
@ -4398,7 +4408,6 @@ def args2params(arguments, keywords, ctx=None):
|
||||||
r.set(prev, a)
|
r.set(prev, a)
|
||||||
prev = None
|
prev = None
|
||||||
for k, v in keywords.iteritems():
|
for k, v in keywords.iteritems():
|
||||||
k = ':' + k.replace('_', '-')
|
|
||||||
r.set(k, v)
|
r.set(k, v)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
|
@ -1261,6 +1261,17 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
void Z3_API Z3_global_param_set(__in Z3_string param_id, __in Z3_string param_value);
|
void Z3_API Z3_global_param_set(__in Z3_string param_id, __in Z3_string param_value);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Restore the value of all global (and module) parameters.
|
||||||
|
This command will not affect already created objects (such as tactics and solvers).
|
||||||
|
|
||||||
|
\sa Z3_global_param_set
|
||||||
|
|
||||||
|
def_API('Z3_global_param_reset_all', VOID, ())
|
||||||
|
*/
|
||||||
|
void Z3_API Z3_global_param_reset_all();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Get a global (or module) parameter.
|
\brief Get a global (or module) parameter.
|
||||||
|
|
||||||
|
@ -1312,7 +1323,7 @@ extern "C" {
|
||||||
- well_sorted_check type checker
|
- well_sorted_check type checker
|
||||||
- auto_config use heuristics to automatically select solver and configure it
|
- auto_config use heuristics to automatically select solver and configure it
|
||||||
- model model generation for solvers, this parameter can be overwritten when creating a solver
|
- model model generation for solvers, this parameter can be overwritten when creating a solver
|
||||||
- validate_model validate models produced by solvers
|
- model_validate validate models produced by solvers
|
||||||
- unsat_core unsat-core generation for solvers, this parameter can be overwritten when creating a solver
|
- unsat_core unsat-core generation for solvers, this parameter can be overwritten when creating a solver
|
||||||
|
|
||||||
\sa Z3_set_param_value
|
\sa Z3_set_param_value
|
||||||
|
@ -1428,7 +1439,7 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
\brief Set a value of a context parameter.
|
\brief Set a value of a context parameter.
|
||||||
|
|
||||||
\sa Use #Z3_global_param_set.
|
\sa Z3_global_param_set
|
||||||
|
|
||||||
def_API('Z3_update_param_value', VOID, (_in(CONTEXT), _in(STRING), _in(STRING)))
|
def_API('Z3_update_param_value', VOID, (_in(CONTEXT), _in(STRING), _in(STRING)))
|
||||||
*/
|
*/
|
||||||
|
@ -1437,7 +1448,7 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
\brief Return the value of a context parameter.
|
\brief Return the value of a context parameter.
|
||||||
|
|
||||||
\sa Use #Z3_global_param_get
|
\sa Z3_global_param_get
|
||||||
|
|
||||||
def_API('Z3_get_param_value', BOOL, (_in(CONTEXT), _in(STRING), _out(STRING)))
|
def_API('Z3_get_param_value', BOOL, (_in(CONTEXT), _in(STRING), _out(STRING)))
|
||||||
*/
|
*/
|
||||||
|
@ -1707,7 +1718,7 @@ extern "C" {
|
||||||
use the APIs for creating numerals and pass a numeric
|
use the APIs for creating numerals and pass a numeric
|
||||||
constant together with the sort returned by this call.
|
constant together with the sort returned by this call.
|
||||||
|
|
||||||
\sa Z3_get_finite_domain_sort_size.
|
\sa Z3_get_finite_domain_sort_size
|
||||||
|
|
||||||
def_API('Z3_mk_finite_domain_sort', SORT, (_in(CONTEXT), _in(SYMBOL), _in(UINT64)))
|
def_API('Z3_mk_finite_domain_sort', SORT, (_in(CONTEXT), _in(SYMBOL), _in(UINT64)))
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -232,8 +232,11 @@ struct z3_replayer::imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_ptr() {
|
void read_ptr() {
|
||||||
if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f')))
|
if (!(('0' <= curr() && curr() <= '9') || ('A' <= curr() && curr() <= 'F') || ('a' <= curr() && curr() <= 'f'))) {
|
||||||
|
TRACE("invalid_ptr", tout << "curr: " << curr() << "\n";);
|
||||||
throw z3_replayer_exception("invalid ptr");
|
throw z3_replayer_exception("invalid ptr");
|
||||||
|
}
|
||||||
|
unsigned pos = 0;
|
||||||
m_ptr = 0;
|
m_ptr = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
char c = curr();
|
char c = curr();
|
||||||
|
@ -246,10 +249,13 @@ struct z3_replayer::imp {
|
||||||
else if ('A' <= c && c <= 'F') {
|
else if ('A' <= c && c <= 'F') {
|
||||||
m_ptr = m_ptr * 16 + 10 + (c - 'A');
|
m_ptr = m_ptr * 16 + 10 + (c - 'A');
|
||||||
}
|
}
|
||||||
|
else if (pos == 1 && (c == 'x' || c == 'X')) {
|
||||||
|
// support for 0x.... notation
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
next();
|
next(); pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ class set_option_cmd : public set_get_option_cmd {
|
||||||
try {
|
try {
|
||||||
gparams::set(m_option, value);
|
gparams::set(m_option, value);
|
||||||
env_params::updt_params();
|
env_params::updt_params();
|
||||||
ctx.params().updt_params();
|
ctx.global_params_updated();
|
||||||
}
|
}
|
||||||
catch (gparams::exception ex) {
|
catch (gparams::exception ex) {
|
||||||
throw cmd_exception(ex.msg());
|
throw cmd_exception(ex.msg());
|
||||||
|
@ -517,7 +517,7 @@ public:
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
std::string val = gparams::get_value(opt);
|
ctx.regular_stream() << gparams::get_value(opt) << std::endl;
|
||||||
}
|
}
|
||||||
catch (gparams::exception ex) {
|
catch (gparams::exception ex) {
|
||||||
ctx.print_unsupported(opt);
|
ctx.print_unsupported(opt);
|
||||||
|
|
|
@ -38,22 +38,6 @@ Notes:
|
||||||
#include"model_evaluator.h"
|
#include"model_evaluator.h"
|
||||||
#include"for_each_expr.h"
|
#include"for_each_expr.h"
|
||||||
|
|
||||||
std::string smt2_keyword_to_param(symbol const & opt) {
|
|
||||||
std::string r;
|
|
||||||
SASSERT(opt.bare_str()[0] == ':');
|
|
||||||
r = opt.bare_str() + 1;
|
|
||||||
unsigned sz = static_cast<unsigned>(r.size());
|
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
|
||||||
char curr = r[i];
|
|
||||||
if ('A' <= curr && curr <= 'Z')
|
|
||||||
r[i] = curr - 'A' + 'a';
|
|
||||||
else if (curr == '-')
|
|
||||||
r[i] = '_';
|
|
||||||
}
|
|
||||||
TRACE("smt2_keyword_to_param", tout << opt << " -> '" << r << "'\n";);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
func_decls::func_decls(ast_manager & m, func_decl * f):
|
func_decls::func_decls(ast_manager & m, func_decl * f):
|
||||||
m_decls(TAG(func_decl*, f, 0)) {
|
m_decls(TAG(func_decl*, f, 0)) {
|
||||||
m.inc_ref(f);
|
m.inc_ref(f);
|
||||||
|
@ -358,6 +342,16 @@ cmd_context::~cmd_context() {
|
||||||
m_check_sat_result = 0;
|
m_check_sat_result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_context::global_params_updated() {
|
||||||
|
m_params.updt_params();
|
||||||
|
if (m_solver) {
|
||||||
|
params_ref p;
|
||||||
|
if (!m_params.m_auto_config)
|
||||||
|
p.set_bool("auto_config", false);
|
||||||
|
m_solver->updt_params(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmd_context::set_produce_models(bool f) {
|
void cmd_context::set_produce_models(bool f) {
|
||||||
if (m_solver)
|
if (m_solver)
|
||||||
m_solver->set_produce_models(f);
|
m_solver->set_produce_models(f);
|
||||||
|
@ -393,7 +387,7 @@ bool cmd_context::well_sorted_check_enabled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_context::validate_model_enabled() const {
|
bool cmd_context::validate_model_enabled() const {
|
||||||
return m_params.m_validate_model;
|
return m_params.m_model_validate;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_context::check_sat_state cmd_context::cs_state() const {
|
cmd_context::check_sat_state cmd_context::cs_state() const {
|
||||||
|
|
|
@ -38,11 +38,6 @@ Notes:
|
||||||
#include"scoped_ptr_vector.h"
|
#include"scoped_ptr_vector.h"
|
||||||
#include"context_params.h"
|
#include"context_params.h"
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Auxiliary function for converting SMT2 keywords into Z3 internal parameter names.
|
|
||||||
*/
|
|
||||||
std::string smt2_keyword_to_param(symbol const & k);
|
|
||||||
|
|
||||||
class func_decls {
|
class func_decls {
|
||||||
func_decl * m_decls;
|
func_decl * m_decls;
|
||||||
public:
|
public:
|
||||||
|
@ -254,6 +249,7 @@ public:
|
||||||
cmd_context(bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
|
cmd_context(bool main_ctx = true, ast_manager * m = 0, symbol const & l = symbol::null);
|
||||||
~cmd_context();
|
~cmd_context();
|
||||||
context_params & params() { return m_params; }
|
context_params & params() { return m_params; }
|
||||||
|
void global_params_updated(); // this method should be invoked when global (and module) params are updated.
|
||||||
void set_logic(symbol const & s);
|
void set_logic(symbol const & s);
|
||||||
bool has_logic() const { return m_logic != symbol::null; }
|
bool has_logic() const { return m_logic != symbol::null; }
|
||||||
symbol const & get_logic() const { return m_logic; }
|
symbol const & get_logic() const { return m_logic; }
|
||||||
|
|
|
@ -62,8 +62,8 @@ void context_params::set(char const * param, char const * value) {
|
||||||
else if (p == "model") {
|
else if (p == "model") {
|
||||||
set_bool(m_model, param, value);
|
set_bool(m_model, param, value);
|
||||||
}
|
}
|
||||||
else if (p == "validate_model") {
|
else if (p == "model_validate") {
|
||||||
set_bool(m_validate_model, param, value);
|
set_bool(m_model_validate, param, value);
|
||||||
}
|
}
|
||||||
else if (p == "trace") {
|
else if (p == "trace") {
|
||||||
set_bool(m_trace, param, value);
|
set_bool(m_trace, param, value);
|
||||||
|
@ -92,7 +92,7 @@ void context_params::updt_params(params_ref const & p) {
|
||||||
m_auto_config = p.get_bool("auto_config", true);
|
m_auto_config = p.get_bool("auto_config", true);
|
||||||
m_proof = p.get_bool("proof", false);
|
m_proof = p.get_bool("proof", false);
|
||||||
m_model = p.get_bool("model", true);
|
m_model = p.get_bool("model", true);
|
||||||
m_validate_model = p.get_bool("validate_model", false);
|
m_model_validate = p.get_bool("model_validate", false);
|
||||||
m_trace = p.get_bool("trace", false);
|
m_trace = p.get_bool("trace", false);
|
||||||
m_trace_file_name = p.get_str("trace_file_name", "z3.log");
|
m_trace_file_name = p.get_str("trace_file_name", "z3.log");
|
||||||
m_unsat_core = p.get_bool("unsat_core", false);
|
m_unsat_core = p.get_bool("unsat_core", false);
|
||||||
|
@ -106,7 +106,7 @@ void context_params::collect_param_descrs(param_descrs & d) {
|
||||||
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");
|
d.insert("auto_config", CPK_BOOL, "use heuristics to automatically select solver and configure it", "true");
|
||||||
d.insert("proof", CPK_BOOL, "proof generation, it must be enabled when the Z3 context is created", "false");
|
d.insert("proof", CPK_BOOL, "proof generation, it must be enabled when the Z3 context is created", "false");
|
||||||
d.insert("model", CPK_BOOL, "model generation for solvers, this parameter can be overwritten when creating a solver", "true");
|
d.insert("model", CPK_BOOL, "model generation for solvers, this parameter can be overwritten when creating a solver", "true");
|
||||||
d.insert("validate_model", CPK_BOOL, "validate models produced by solvers", "false");
|
d.insert("model_validate", CPK_BOOL, "validate models produced by solvers", "false");
|
||||||
d.insert("trace", CPK_BOOL, "trace generation for VCC", "false");
|
d.insert("trace", CPK_BOOL, "trace generation for VCC", "false");
|
||||||
d.insert("trace_file_name", CPK_STRING, "trace out file name (see option 'trace')", "z3.log");
|
d.insert("trace_file_name", CPK_STRING, "trace out file name (see option 'trace')", "z3.log");
|
||||||
d.insert("unsat_core", CPK_BOOL, "unsat-core generation for solvers, this parameter can be overwritten when creating a solver, not every solver in Z3 supports unsat core generation", "false");
|
d.insert("unsat_core", CPK_BOOL, "unsat-core generation for solvers, this parameter can be overwritten when creating a solver, not every solver in Z3 supports unsat core generation", "false");
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
std::string m_trace_file_name;
|
std::string m_trace_file_name;
|
||||||
bool m_well_sorted_check;
|
bool m_well_sorted_check;
|
||||||
bool m_model;
|
bool m_model;
|
||||||
bool m_validate_model;
|
bool m_model_validate;
|
||||||
bool m_unsat_core;
|
bool m_unsat_core;
|
||||||
unsigned m_timeout;
|
unsigned m_timeout;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ cmd_arg_kind parametric_cmd::next_arg_kind(cmd_context & ctx) const {
|
||||||
|
|
||||||
void parametric_cmd::set_next_arg(cmd_context & ctx, symbol const & s) {
|
void parametric_cmd::set_next_arg(cmd_context & ctx, symbol const & s) {
|
||||||
if (m_last == symbol::null) {
|
if (m_last == symbol::null) {
|
||||||
m_last = symbol(smt2_keyword_to_param(s).c_str());
|
m_last = symbol(norm_param_name(s).c_str());
|
||||||
if (pdescrs(ctx).get_kind(m_last.bare_str()) == CPK_INVALID)
|
if (pdescrs(ctx).get_kind(m_last.bare_str()) == CPK_INVALID)
|
||||||
throw cmd_exception("invalid keyword argument");
|
throw cmd_exception("invalid keyword argument");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -497,7 +497,7 @@ static tactic * mk_using_params(cmd_context & ctx, sexpr * n) {
|
||||||
throw cmd_exception("invalid using-params combinator, keyword expected", c->get_line(), c->get_pos());
|
throw cmd_exception("invalid using-params combinator, keyword expected", c->get_line(), c->get_pos());
|
||||||
if (i == num_children)
|
if (i == num_children)
|
||||||
throw cmd_exception("invalid using-params combinator, parameter value expected", c->get_line(), c->get_pos());
|
throw cmd_exception("invalid using-params combinator, parameter value expected", c->get_line(), c->get_pos());
|
||||||
symbol param_name = symbol(smt2_keyword_to_param(c->get_symbol()).c_str());
|
symbol param_name = symbol(norm_param_name(c->get_symbol()).c_str());
|
||||||
c = n->get_child(i);
|
c = n->get_child(i);
|
||||||
i++;
|
i++;
|
||||||
switch (descrs.get_kind(param_name)) {
|
switch (descrs.get_kind(param_name)) {
|
||||||
|
|
|
@ -28,7 +28,6 @@ Notes:
|
||||||
#include"cancel_eh.h"
|
#include"cancel_eh.h"
|
||||||
#include"scoped_ctrl_c.h"
|
#include"scoped_ctrl_c.h"
|
||||||
#include"scoped_timer.h"
|
#include"scoped_timer.h"
|
||||||
#include"params2smt_params.h"
|
|
||||||
#include"trail.h"
|
#include"trail.h"
|
||||||
#include<iomanip>
|
#include<iomanip>
|
||||||
|
|
||||||
|
|
|
@ -1456,7 +1456,6 @@ namespace pdr {
|
||||||
}
|
}
|
||||||
if (m_params.use_farkas() && !classify.is_bool()) {
|
if (m_params.use_farkas() && !classify.is_bool()) {
|
||||||
m.toggle_proof_mode(PGM_FINE);
|
m.toggle_proof_mode(PGM_FINE);
|
||||||
m_fparams.m_proof_mode = PGM_FINE;
|
|
||||||
m_fparams.m_arith_bound_prop = BP_NONE;
|
m_fparams.m_arith_bound_prop = BP_NONE;
|
||||||
m_fparams.m_arith_auto_config_simplex = true;
|
m_fparams.m_arith_auto_config_simplex = true;
|
||||||
m_fparams.m_arith_propagate_eqs = false;
|
m_fparams.m_arith_propagate_eqs = false;
|
||||||
|
|
|
@ -255,7 +255,6 @@ namespace pdr {
|
||||||
|
|
||||||
smt_params farkas_learner::get_proof_params(smt_params& orig_params) {
|
smt_params farkas_learner::get_proof_params(smt_params& orig_params) {
|
||||||
smt_params res(orig_params);
|
smt_params res(orig_params);
|
||||||
res.m_proof_mode = PROOF_MODE;
|
|
||||||
res.m_arith_bound_prop = BP_NONE;
|
res.m_arith_bound_prop = BP_NONE;
|
||||||
// temp hack to fix the build
|
// temp hack to fix the build
|
||||||
// res.m_conflict_resolution_strategy = CR_ALL_DECIDED;
|
// res.m_conflict_resolution_strategy = CR_ALL_DECIDED;
|
||||||
|
|
|
@ -214,7 +214,7 @@ namespace pdr {
|
||||||
|
|
||||||
expr_ref_vector fmls(m);
|
expr_ref_vector fmls(m);
|
||||||
smt_params fparams;
|
smt_params fparams;
|
||||||
fparams.m_proof_mode = PGM_FINE;
|
SASSERT(m.proofs_enabled());
|
||||||
fparams.m_mbqi = true;
|
fparams.m_mbqi = true;
|
||||||
|
|
||||||
fmls.push_back(m_A.get());
|
fmls.push_back(m_A.get());
|
||||||
|
|
|
@ -37,7 +37,6 @@ struct unit_subsumption_tactic : public tactic {
|
||||||
m_cancel(false),
|
m_cancel(false),
|
||||||
m_context(m, m_fparams, p),
|
m_context(m, m_fparams, p),
|
||||||
m_clauses(m) {
|
m_clauses(m) {
|
||||||
m_fparams.m_proof_mode = m.proof_mode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_cancel(bool f) {
|
void set_cancel(bool f) {
|
||||||
|
|
|
@ -45,7 +45,6 @@ Notes:
|
||||||
#include"arith_decl_plugin.h"
|
#include"arith_decl_plugin.h"
|
||||||
#include"for_each_expr.h"
|
#include"for_each_expr.h"
|
||||||
#include"extension_model_converter.h"
|
#include"extension_model_converter.h"
|
||||||
#include"params2smt_params.h"
|
|
||||||
#include"ast_smt2_pp.h"
|
#include"ast_smt2_pp.h"
|
||||||
|
|
||||||
class vsubst_tactic : public tactic {
|
class vsubst_tactic : public tactic {
|
||||||
|
@ -94,7 +93,7 @@ class vsubst_tactic : public tactic {
|
||||||
}
|
}
|
||||||
|
|
||||||
smt_params params;
|
smt_params params;
|
||||||
params2smt_params(p, params);
|
params.updt_params(p);
|
||||||
params.m_model = false;
|
params.m_model = false;
|
||||||
flet<bool> fl1(params.m_nlquant_elim, true);
|
flet<bool> fl1(params.m_nlquant_elim, true);
|
||||||
flet<bool> fl2(params.m_nl_arith_gb, false);
|
flet<bool> fl2(params.m_nl_arith_gb, false);
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace smt2 {
|
||||||
|
|
||||||
class parser {
|
class parser {
|
||||||
cmd_context & m_ctx;
|
cmd_context & m_ctx;
|
||||||
|
params_ref m_params;
|
||||||
scanner m_scanner;
|
scanner m_scanner;
|
||||||
scanner::token m_curr;
|
scanner::token m_curr;
|
||||||
cmd * m_curr_cmd;
|
cmd * m_curr_cmd;
|
||||||
|
@ -2285,6 +2286,10 @@ namespace smt2 {
|
||||||
shrink(m_sexpr_stack, sexpr_spos);
|
shrink(m_sexpr_stack, sexpr_spos);
|
||||||
m_symbol_stack.shrink(sym_spos);
|
m_symbol_stack.shrink(sym_spos);
|
||||||
m_num_bindings = 0;
|
m_num_bindings = 0;
|
||||||
|
// HACK for propagating the update of parser parameters
|
||||||
|
if (norm_param_name(s) == "set_option") {
|
||||||
|
updt_params();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2357,9 +2362,10 @@ namespace smt2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
parser(cmd_context & ctx, std::istream & is, bool interactive, params_ref const & _p):
|
parser(cmd_context & ctx, std::istream & is, bool interactive, params_ref const & p):
|
||||||
m_ctx(ctx),
|
m_ctx(ctx),
|
||||||
m_scanner(ctx, is, interactive, _p),
|
m_params(p),
|
||||||
|
m_scanner(ctx, is, interactive, p),
|
||||||
m_curr(scanner::NULL_TOKEN),
|
m_curr(scanner::NULL_TOKEN),
|
||||||
m_curr_cmd(0),
|
m_curr_cmd(0),
|
||||||
m_num_bindings(0),
|
m_num_bindings(0),
|
||||||
|
@ -2397,16 +2403,20 @@ namespace smt2 {
|
||||||
// the following assertion does not hold if ctx was already attached to an AST manager before the parser object is created.
|
// the following assertion does not hold if ctx was already attached to an AST manager before the parser object is created.
|
||||||
// SASSERT(!m_ctx.has_manager());
|
// SASSERT(!m_ctx.has_manager());
|
||||||
|
|
||||||
parser_params p(_p);
|
updt_params();
|
||||||
m_ignore_user_patterns = p.ignore_user_patterns();
|
|
||||||
m_ignore_bad_patterns = p.ignore_bad_patterns();
|
|
||||||
m_display_error_for_vs = p.error_for_visual_studio();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~parser() {
|
~parser() {
|
||||||
reset_stack();
|
reset_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updt_params() {
|
||||||
|
parser_params p(m_params);
|
||||||
|
m_ignore_user_patterns = p.ignore_user_patterns();
|
||||||
|
m_ignore_bad_patterns = p.ignore_bad_patterns();
|
||||||
|
m_display_error_for_vs = p.error_for_visual_studio();
|
||||||
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
reset_stack();
|
reset_stack();
|
||||||
m_num_bindings = 0;
|
m_num_bindings = 0;
|
||||||
|
|
|
@ -44,15 +44,9 @@ input_kind g_input_kind = IN_UNSPECIFIED;
|
||||||
bool g_display_statistics = false;
|
bool g_display_statistics = false;
|
||||||
bool g_display_istatistics = false;
|
bool g_display_istatistics = false;
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
#define OPT "/"
|
|
||||||
#else
|
|
||||||
#define OPT "-"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void error(const char * msg) {
|
void error(const char * msg) {
|
||||||
std::cerr << "Error: " << msg << "\n";
|
std::cerr << "Error: " << msg << "\n";
|
||||||
std::cerr << "For usage information: z3 " << OPT << "h\n";
|
std::cerr << "For usage information: z3 -h\n";
|
||||||
exit(ERR_CMD_LINE);
|
exit(ERR_CMD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,41 +58,46 @@ void display_usage() {
|
||||||
std::cout << "32";
|
std::cout << "32";
|
||||||
#endif
|
#endif
|
||||||
std::cout << " bit]. (C) Copyright 2006 Microsoft Corp.\n";
|
std::cout << " bit]. (C) Copyright 2006 Microsoft Corp.\n";
|
||||||
std::cout << "Usage: z3 [options] [" << OPT << "file:]file\n";
|
std::cout << "Usage: z3 [options] [-file:]file\n";
|
||||||
std::cout << "\nInput format:\n";
|
std::cout << "\nInput format:\n";
|
||||||
std::cout << " " << OPT << "smt use parser for SMT input format.\n";
|
std::cout << " -smt use parser for SMT input format.\n";
|
||||||
std::cout << " " << OPT << "smt2 use parser for SMT 2 input format.\n";
|
std::cout << " -smt2 use parser for SMT 2 input format.\n";
|
||||||
std::cout << " " << OPT << "dl use parser for Datalog input format.\n";
|
std::cout << " -dl use parser for Datalog input format.\n";
|
||||||
std::cout << " " << OPT << "dimacs use parser for DIMACS input format.\n";
|
std::cout << " -dimacs use parser for DIMACS input format.\n";
|
||||||
std::cout << " " << OPT << "log use parser for Z3 log input format.\n";
|
std::cout << " -log use parser for Z3 log input format.\n";
|
||||||
std::cout << " " << OPT << "in read formula from standard input.\n";
|
std::cout << " -in read formula from standard input.\n";
|
||||||
std::cout << "\nMiscellaneous:\n";
|
std::cout << "\nMiscellaneous:\n";
|
||||||
std::cout << " " << OPT << "h, " << OPT << "? prints this message.\n";
|
std::cout << " -h, -? prints this message.\n";
|
||||||
std::cout << " " << OPT << "version prints version number of Z3.\n";
|
std::cout << " -version prints version number of Z3.\n";
|
||||||
std::cout << " " << OPT << "v:level be verbose, where <level> is the verbosity level.\n";
|
std::cout << " -v:level be verbose, where <level> is the verbosity level.\n";
|
||||||
std::cout << " " << OPT << "nw disable warning messages.\n";
|
std::cout << " -nw disable warning messages.\n";
|
||||||
std::cout << " " << OPT << "p display Z3 global (and module) parameters.\n";
|
std::cout << " -p display Z3 global (and module) parameters.\n";
|
||||||
std::cout << " " << OPT << "pd display Z3 global (and module) parameter descriptions.\n";
|
std::cout << " -pd display Z3 global (and module) parameter descriptions.\n";
|
||||||
std::cout << " " << OPT << "pm:name display Z3 module ('name') parameters.\n";
|
std::cout << " -pm:name display Z3 module ('name') parameters.\n";
|
||||||
std::cout << " " << OPT << "pp:name display Z3 parameter description, if 'name' is not provided, then all module names are listed.\n";
|
std::cout << " -pp:name display Z3 parameter description, if 'name' is not provided, then all module names are listed.\n";
|
||||||
std::cout << " --" << " all remaining arguments are assumed to be part of the input file name. This option allows Z3 to read files with strange names such as: -foo.smt2.\n";
|
std::cout << " --" << " all remaining arguments are assumed to be part of the input file name. This option allows Z3 to read files with strange names such as: -foo.smt2.\n";
|
||||||
std::cout << "\nResources:\n";
|
std::cout << "\nResources:\n";
|
||||||
// timeout and memout are now available on Linux and OSX too.
|
// timeout and memout are now available on Linux and OSX too.
|
||||||
std::cout << " " << OPT << "T:timeout set the timeout (in seconds).\n";
|
std::cout << " -T:timeout set the timeout (in seconds).\n";
|
||||||
std::cout << " " << OPT << "t:timeout set the soft timeout (in seconds). It only kills the current query.\n";
|
std::cout << " -t:timeout set the soft timeout (in seconds). It only kills the current query.\n";
|
||||||
std::cout << " " << OPT << "memory:Megabytes set a limit for virtual memory consumption.\n";
|
std::cout << " -memory:Megabytes set a limit for virtual memory consumption.\n";
|
||||||
//
|
//
|
||||||
std::cout << "\nOutput:\n";
|
std::cout << "\nOutput:\n";
|
||||||
std::cout << " " << OPT << "st display statistics.\n";
|
std::cout << " -st display statistics.\n";
|
||||||
#if defined(Z3DEBUG) || defined(_TRACE)
|
#if defined(Z3DEBUG) || defined(_TRACE)
|
||||||
std::cout << "\nDebugging support:\n";
|
std::cout << "\nDebugging support:\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef _TRACE
|
#ifdef _TRACE
|
||||||
std::cout << " " << OPT << "tr:tag enable trace messages tagged with <tag>.\n";
|
std::cout << " -tr:tag enable trace messages tagged with <tag>.\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
std::cout << " " << OPT << "dbg:tag enable assertions tagged with <tag>.\n";
|
std::cout << " -dbg:tag enable assertions tagged with <tag>.\n";
|
||||||
#endif
|
#endif
|
||||||
|
std::cout << "\nParameter setting:\n";
|
||||||
|
std::cout << "Global and module parameters can be set in the command line.\n";
|
||||||
|
std::cout << " param_name=value for setting global parameters.\n";
|
||||||
|
std::cout << " module_name.param_name=value for setting module parameters.\n";
|
||||||
|
std::cout << "Use 'z3 -p' for the complete list of global and module parameters.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_cmd_line_args(int argc, char ** argv) {
|
void parse_cmd_line_args(int argc, char ** argv) {
|
||||||
|
@ -132,6 +131,9 @@ void parse_cmd_line_args(int argc, char ** argv) {
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
char * opt_name = arg + 1;
|
char * opt_name = arg + 1;
|
||||||
|
// allow names such as --help
|
||||||
|
if (*opt_name == '-')
|
||||||
|
opt_name++;
|
||||||
char * opt_arg = 0;
|
char * opt_arg = 0;
|
||||||
char * colon = strchr(arg, ':');
|
char * colon = strchr(arg, ':');
|
||||||
if (colon) {
|
if (colon) {
|
||||||
|
@ -235,7 +237,7 @@ void parse_cmd_line_args(int argc, char ** argv) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "Error: invalid command line option: " << arg << "\n";
|
std::cerr << "Error: invalid command line option: " << arg << "\n";
|
||||||
std::cerr << "For usage information: z3 " << OPT << "h\n";
|
std::cerr << "For usage information: z3 -h\n";
|
||||||
exit(ERR_CMD_LINE);
|
exit(ERR_CMD_LINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace smt {
|
||||||
\remark if negate == true, then the hypothesis is actually (not (= lhs rhs))
|
\remark if negate == true, then the hypothesis is actually (not (= lhs rhs))
|
||||||
*/
|
*/
|
||||||
proof * mk_hypothesis(ast_manager & m, app * eq, bool negate, expr * lhs, expr * rhs) {
|
proof * mk_hypothesis(ast_manager & m, app * eq, bool negate, expr * lhs, expr * rhs) {
|
||||||
SASSERT(m.is_eq(eq));
|
SASSERT(m.is_eq(eq) || m.is_iff(eq));
|
||||||
SASSERT((eq->get_arg(0) == lhs && eq->get_arg(1) == rhs) ||
|
SASSERT((eq->get_arg(0) == lhs && eq->get_arg(1) == rhs) ||
|
||||||
(eq->get_arg(0) == rhs && eq->get_arg(1) == lhs));
|
(eq->get_arg(0) == rhs && eq->get_arg(1) == lhs));
|
||||||
app * h = negate ? m.mk_not(eq) : eq;
|
app * h = negate ? m.mk_not(eq) : eq;
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*++
|
|
||||||
Copyright (c) 2011 Microsoft Corporation
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
params2smt_params.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Backward compatibility utilities for parameter setting
|
|
||||||
|
|
||||||
Author:
|
|
||||||
|
|
||||||
Leonardo de Moura (leonardo) 2011-05-19.
|
|
||||||
|
|
||||||
Revision History:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
#include"smt_params.h"
|
|
||||||
#include"params.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
Update smt_params using s.
|
|
||||||
Only the most frequently used options are updated.
|
|
||||||
|
|
||||||
This function is mainly used to allow smt::context to be used in
|
|
||||||
the new strategy framework.
|
|
||||||
*/
|
|
||||||
void params2smt_params(params_ref const & s, smt_params & t) {
|
|
||||||
t.m_relevancy_lvl = s.get_uint("relevancy", t.m_relevancy_lvl);
|
|
||||||
TRACE("qi_cost", s.display(tout); tout << "\n";);
|
|
||||||
t.m_qi_cost = s.get_str("qi_cost", t.m_qi_cost.c_str());
|
|
||||||
t.m_mbqi = s.get_bool("mbqi", t.m_mbqi);
|
|
||||||
t.m_mbqi_max_iterations = s.get_uint("mbqi_max_iterations", t.m_mbqi_max_iterations);
|
|
||||||
t.m_random_seed = s.get_uint("random_seed", t.m_random_seed);
|
|
||||||
t.m_model = s.get_bool("produce_models", t.m_model);
|
|
||||||
if (s.get_bool("produce_proofs", false))
|
|
||||||
t.m_proof_mode = PGM_FINE;
|
|
||||||
t.m_qi_eager_threshold = s.get_double("qi_eager_threshold", t.m_qi_eager_threshold);
|
|
||||||
t.m_qi_lazy_threshold = s.get_double("qi_lazy_threshold", t.m_qi_lazy_threshold);
|
|
||||||
t.m_preprocess = s.get_bool("preprocess", t.m_preprocess);
|
|
||||||
t.m_hi_div0 = s.get_bool("hi_div0", t.m_hi_div0);
|
|
||||||
t.m_auto_config = s.get_bool("auto_config", t.m_auto_config);
|
|
||||||
t.m_array_simplify = s.get_bool("array_old_simplifier", t.m_array_simplify);
|
|
||||||
t.m_arith_branch_cut_ratio = s.get_uint("arith_branch_cut_ratio", t.m_arith_branch_cut_ratio);
|
|
||||||
t.m_arith_expand_eqs = s.get_bool("arith_expand_eqs", t.m_arith_expand_eqs);
|
|
||||||
|
|
||||||
if (s.get_bool("arith_greatest_error_pivot", false))
|
|
||||||
t.m_arith_pivot_strategy = ARITH_PIVOT_GREATEST_ERROR;
|
|
||||||
else if (s.get_bool("arith_least_error_pivot", false))
|
|
||||||
t.m_arith_pivot_strategy = ARITH_PIVOT_LEAST_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Copy parameters (from s) that affect the semantics of Z3 (e.g., HI_DIV0).
|
|
||||||
It also copies the model construction parameter. Thus, model construction
|
|
||||||
can be enabled at the command line.
|
|
||||||
*/
|
|
||||||
void smt_params2params(smt_params const & s, params_ref & t) {
|
|
||||||
if (s.m_model)
|
|
||||||
t.set_bool("produce_models", true);
|
|
||||||
if (!s.m_hi_div0)
|
|
||||||
t.set_bool("hi_div0", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Bridge for using params_ref with smt::context.
|
|
||||||
*/
|
|
||||||
void solver_smt_params_descrs(param_descrs & r) {
|
|
||||||
r.insert("hi_div0", CPK_BOOL, "(default: true) if true, then Z3 uses the usual hardware interpretation for division (rem, mod) by zero. Otherwise, these operations are considered uninterpreted");
|
|
||||||
r.insert("relevancy", CPK_UINT, "relevancy propagation heuristic: 0 - disabled, 1 - relevancy is tracked by only affects quantifier instantiation, 2 - relevancy is tracked, and an atom is only asserted if it is relevant");
|
|
||||||
r.insert("mbqi", CPK_BOOL, "model based quantifier instantiation (MBQI)");
|
|
||||||
r.insert("mbqi_max_iterations", CPK_UINT, "maximum number of rounds of MBQI");
|
|
||||||
r.insert("random_seed", CPK_UINT, "random seed for smt solver");
|
|
||||||
r.insert("qi_eager_threshold", CPK_DOUBLE, "threshold for eager quantifier instantiation");
|
|
||||||
r.insert("qi_lazy_threshold", CPK_DOUBLE, "threshold for lazy quantifier instantiation");
|
|
||||||
r.insert("auto_config", CPK_BOOL, "use heuristics to automatically configure smt solver");
|
|
||||||
r.insert("arith_branch_cut_ratio", CPK_UINT, "branch&bound / gomory cut ratio");
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*++
|
|
||||||
Copyright (c) 2011 Microsoft Corporation
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
params2smt_params.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Backward compatibility utilities for parameter setting
|
|
||||||
|
|
||||||
Author:
|
|
||||||
|
|
||||||
Leonardo de Moura (leonardo) 2011-05-19.
|
|
||||||
|
|
||||||
Revision History:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
#ifndef _PARAMS2SMT_PARAMS_H_
|
|
||||||
#define _PARAMS2SMT_PARAMS_H_
|
|
||||||
|
|
||||||
class params_ref;
|
|
||||||
struct smt_params;
|
|
||||||
|
|
||||||
void params2smt_params(params_ref const & s, smt_params & t);
|
|
||||||
|
|
||||||
void smt_params2params(smt_params const & s, params_ref & t);
|
|
||||||
|
|
||||||
void solver_smt_params_descrs(param_descrs & r);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*++
|
|
||||||
Copyright (c) 2006 Microsoft Corporation
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
smt_params.cpp
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
<abstract>
|
|
||||||
|
|
||||||
Author:
|
|
||||||
|
|
||||||
Leonardo de Moura (leonardo) 2008-02-20.
|
|
||||||
|
|
||||||
Revision History:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
#include"smt_params.h"
|
|
||||||
#include"smt_params_helper.hpp"
|
|
||||||
|
|
||||||
void smt_params::updt_local_params(params_ref const & _p) {
|
|
||||||
smt_params_helper p(_p);
|
|
||||||
m_auto_config = p.auto_config();
|
|
||||||
m_ematching = p.ematching();
|
|
||||||
m_phase_selection = static_cast<phase_selection>(p.phase_selection());
|
|
||||||
m_restart_strategy = static_cast<restart_strategy>(p.restart_strategy());
|
|
||||||
m_restart_factor = p.restart_factor();
|
|
||||||
m_case_split_strategy = static_cast<case_split_strategy>(p.case_split());
|
|
||||||
m_delay_units = p.delay_units();
|
|
||||||
m_delay_units_threshold = p.delay_units_threshold();
|
|
||||||
m_proof_mode = _p.get_bool("produce_proofs", false)? PGM_FINE : PGM_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void smt_params::updt_params(params_ref const & p) {
|
|
||||||
preprocessor_params::updt_params(p);
|
|
||||||
qi_params::updt_params(p);
|
|
||||||
theory_arith_params::updt_params(p);
|
|
||||||
theory_bv_params::updt_params(p);
|
|
||||||
updt_local_params(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void smt_params::updt_params(context_params const & p) {
|
|
||||||
m_auto_config = p.m_auto_config;
|
|
||||||
m_soft_timeout = p.m_timeout;
|
|
||||||
m_model = p.m_model;
|
|
||||||
m_model_validate = p.m_validate_model;
|
|
||||||
m_proof_mode = p.m_proof ? PGM_FINE : PGM_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
|
@ -207,7 +207,6 @@ struct smt_params : public preprocessor_params,
|
||||||
bool m_at_labels_cex; // only use labels which contains the @ symbol when building multiple counterexamples.
|
bool m_at_labels_cex; // only use labels which contains the @ symbol when building multiple counterexamples.
|
||||||
bool m_check_at_labels; // check that @ labels are inserted to generate unique counter-examples.
|
bool m_check_at_labels; // check that @ labels are inserted to generate unique counter-examples.
|
||||||
bool m_dump_goal_as_smt;
|
bool m_dump_goal_as_smt;
|
||||||
proof_gen_mode m_proof_mode;
|
|
||||||
bool m_auto_config;
|
bool m_auto_config;
|
||||||
|
|
||||||
smt_params(params_ref const & p = params_ref()):
|
smt_params(params_ref const & p = params_ref()):
|
||||||
|
@ -277,7 +276,6 @@ struct smt_params : public preprocessor_params,
|
||||||
m_at_labels_cex(false),
|
m_at_labels_cex(false),
|
||||||
m_check_at_labels(false),
|
m_check_at_labels(false),
|
||||||
m_dump_goal_as_smt(false),
|
m_dump_goal_as_smt(false),
|
||||||
m_proof_mode(PGM_DISABLED),
|
|
||||||
m_auto_config(true) {
|
m_auto_config(true) {
|
||||||
updt_local_params(p);
|
updt_local_params(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ def_module_params(module_name='smt',
|
||||||
description='smt solver based on lazy smt',
|
description='smt solver based on lazy smt',
|
||||||
export=True,
|
export=True,
|
||||||
params=(('auto_config', BOOL, True, 'automatically configure solver'),
|
params=(('auto_config', BOOL, True, 'automatically configure solver'),
|
||||||
|
('random_seed', UINT, 0, 'random seed for the smt solver'),
|
||||||
|
('relevancy', UINT, 2, 'relevancy propagation heuristic: 0 - disabled, 1 - relevancy is tracked by only affects quantifier instantiation, 2 - relevancy is tracked, and an atom is only asserted if it is relevant'),
|
||||||
('macro_finder', BOOL, False, 'try to find universally quantified formulas that can be viewed as macros'),
|
('macro_finder', BOOL, False, 'try to find universally quantified formulas that can be viewed as macros'),
|
||||||
('ematching', BOOL, True, 'E-Matching based quantifier instantiation'),
|
('ematching', BOOL, True, 'E-Matching based quantifier instantiation'),
|
||||||
('phase_selection', UINT, 4, 'phase selection heuristic: 0 - always false, 1 - always true, 2 - phase caching, 3 - phase caching conservative, 4 - phase caching conservative 2, 5 - random, 6 - number of occurrences'),
|
('phase_selection', UINT, 4, 'phase selection heuristic: 0 - always false, 1 - always true, 2 - phase caching, 3 - phase caching conservative, 4 - phase caching conservative 2, 5 - random, 6 - number of occurrences'),
|
||||||
|
@ -33,6 +35,7 @@ def_module_params(module_name='smt',
|
||||||
('arith.nl.rounds', UINT, 1024, 'threshold for number of (nested) final checks for non linear arithmetic'),
|
('arith.nl.rounds', UINT, 1024, 'threshold for number of (nested) final checks for non linear arithmetic'),
|
||||||
('arith.euclidean_solver', BOOL, False, 'eucliean solver for linear integer arithmetic'),
|
('arith.euclidean_solver', BOOL, False, 'eucliean solver for linear integer arithmetic'),
|
||||||
('arith.propagate_eqs', BOOL, True, 'propagate (cheap) equalities'),
|
('arith.propagate_eqs', BOOL, True, 'propagate (cheap) equalities'),
|
||||||
|
('arith.propagation_mode', UINT, 2, '0 - no propagation, 1 - propagate existing literals, 2 - refine bounds'),
|
||||||
('arith.branch_cut_ratio', UINT, 2, 'branch/cut ratio for linear integer arithmetic'),
|
('arith.branch_cut_ratio', UINT, 2, 'branch/cut ratio for linear integer arithmetic'),
|
||||||
('arith.int_eq_branch', BOOL, False, 'branching using derived integer equations'),
|
('arith.int_eq_branch', BOOL, False, 'branching using derived integer equations'),
|
||||||
('arith.ignore_int', BOOL, False, 'treat integer variables as real')))
|
('arith.ignore_int', BOOL, False, 'treat integer variables as real')))
|
||||||
|
|
|
@ -32,6 +32,7 @@ void theory_arith_params::updt_params(params_ref const & _p) {
|
||||||
m_arith_branch_cut_ratio = p.arith_branch_cut_ratio();
|
m_arith_branch_cut_ratio = p.arith_branch_cut_ratio();
|
||||||
m_arith_int_eq_branching = p.arith_int_eq_branch();
|
m_arith_int_eq_branching = p.arith_int_eq_branch();
|
||||||
m_arith_ignore_int = p.arith_ignore_int();
|
m_arith_ignore_int = p.arith_ignore_int();
|
||||||
|
m_arith_bound_prop = static_cast<bound_prop_mode>(p.arith_propagation_mode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,21 @@ namespace smt {
|
||||||
|
|
||||||
void qi_queue::setup() {
|
void qi_queue::setup() {
|
||||||
TRACE("qi_cost", tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
|
TRACE("qi_cost", tout << "qi_cost: " << m_params.m_qi_cost << "\n";);
|
||||||
if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function))
|
if (!m_parser.parse_string(m_params.m_qi_cost.c_str(), m_cost_function)) {
|
||||||
throw default_exception("invalid cost function %s", m_params.m_qi_cost.c_str());
|
// it is not reasonable to abort here during the creation of smt::context just because an invalid option was provided.
|
||||||
if (!m_parser.parse_string(m_params.m_qi_new_gen.c_str(), m_new_gen_function))
|
// throw default_exception("invalid cost function %s", m_params.m_qi_cost.c_str());
|
||||||
throw default_exception("invalid new-gen function %s", m_params.m_qi_new_gen.c_str());
|
|
||||||
|
// using warning message instead
|
||||||
|
warning_msg("invalid cost function '%s', switching to default one", m_params.m_qi_cost.c_str());
|
||||||
|
// Trying again with default function
|
||||||
|
VERIFY(m_parser.parse_string("(+ weight generation)", m_cost_function));
|
||||||
|
}
|
||||||
|
if (!m_parser.parse_string(m_params.m_qi_new_gen.c_str(), m_new_gen_function)) {
|
||||||
|
// See comment above
|
||||||
|
// throw default_exception("invalid new-gen function %s", m_params.m_qi_new_gen.c_str());
|
||||||
|
warning_msg("invalid new_gen function '%s', switching to default one", m_params.m_qi_new_gen.c_str());
|
||||||
|
VERIFY(m_parser.parse_string("cost", m_new_gen_function));
|
||||||
|
}
|
||||||
m_eager_cost_threshold = m_params.m_qi_eager_threshold;
|
m_eager_cost_threshold = m_params.m_qi_eager_threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
||||||
#include"smt_kernel.h"
|
#include"smt_kernel.h"
|
||||||
#include"smt_context.h"
|
#include"smt_context.h"
|
||||||
#include"ast_smt2_pp.h"
|
#include"ast_smt2_pp.h"
|
||||||
#include"params2smt_params.h"
|
#include"smt_params_helper.hpp"
|
||||||
|
|
||||||
namespace smt {
|
namespace smt {
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void kernel::collect_param_descrs(param_descrs & d) {
|
void kernel::collect_param_descrs(param_descrs & d) {
|
||||||
solver_smt_params_descrs(d);
|
smt_params_helper::collect_param_descrs(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
context & kernel::get_context() {
|
context & kernel::get_context() {
|
||||||
|
|
|
@ -313,7 +313,7 @@ namespace smt {
|
||||||
TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n";
|
TRACE("model_checker", tout << "MODEL_CHECKER INVOKED\n";
|
||||||
tout << "model:\n"; model_pp(tout, *m_curr_model););
|
tout << "model:\n"; model_pp(tout, *m_curr_model););
|
||||||
if (m_params.m_mbqi_trace) {
|
if (m_params.m_mbqi_trace) {
|
||||||
verbose_stream() << "[mbqi] started\n";
|
verbose_stream() << "(smt.mbqi \"started\")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
init_aux_context();
|
init_aux_context();
|
||||||
|
@ -325,13 +325,12 @@ namespace smt {
|
||||||
quantifier * q = *it;
|
quantifier * q = *it;
|
||||||
if (m_context->is_relevant(q) && m_context->get_assignment(q) == l_true) {
|
if (m_context->is_relevant(q) && m_context->get_assignment(q) == l_true) {
|
||||||
if (m_params.m_mbqi_trace && q->get_qid() != symbol::null) {
|
if (m_params.m_mbqi_trace && q->get_qid() != symbol::null) {
|
||||||
verbose_stream() << "[mbqi] checking: " << q->get_qid() << "\n";
|
verbose_stream() << "(smt.mbqi :checking " << q->get_qid() << ")\n";
|
||||||
}
|
}
|
||||||
found_relevant = true;
|
found_relevant = true;
|
||||||
if (!check(q)) {
|
if (!check(q)) {
|
||||||
IF_VERBOSE(5, verbose_stream() << "current model does not satisfy: " << q->get_qid() << "\n";);
|
if (m_params.m_mbqi_trace || get_verbosity_level() >= 5) {
|
||||||
if (m_params.m_mbqi_trace) {
|
verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n";
|
||||||
verbose_stream() << "[mbqi] failed " << q->get_qid() << "\n";
|
|
||||||
}
|
}
|
||||||
num_failures++;
|
num_failures++;
|
||||||
}
|
}
|
||||||
|
@ -348,9 +347,9 @@ namespace smt {
|
||||||
m_curr_model->cleanup();
|
m_curr_model->cleanup();
|
||||||
if (m_params.m_mbqi_trace) {
|
if (m_params.m_mbqi_trace) {
|
||||||
if (num_failures == 0)
|
if (num_failures == 0)
|
||||||
verbose_stream() << "[mbqi] succeeded\n";
|
verbose_stream() << "(smt.mbqi :succeeded true)\n";
|
||||||
else
|
else
|
||||||
verbose_stream() << "[mbqi] num failures " << num_failures << "\n";
|
verbose_stream() << "(smt.mbqi :num-failures " << num_failures << ")\n";
|
||||||
}
|
}
|
||||||
return num_failures == 0;
|
return num_failures == 0;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +360,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void model_checker::restart_eh() {
|
void model_checker::restart_eh() {
|
||||||
IF_VERBOSE(100, verbose_stream() << "instantiating new instances...\n";);
|
IF_VERBOSE(100, verbose_stream() << "(smt.mbqi \"instantiating new instances...\")\n";);
|
||||||
assert_new_instances();
|
assert_new_instances();
|
||||||
reset_new_instances();
|
reset_new_instances();
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,7 +562,7 @@ namespace smt {
|
||||||
virtual quantifier_manager::check_model_result
|
virtual quantifier_manager::check_model_result
|
||||||
check_model(proto_model * m, obj_map<enode, app *> const & root2value) {
|
check_model(proto_model * m, obj_map<enode, app *> const & root2value) {
|
||||||
if (m_fparams->m_mbqi) {
|
if (m_fparams->m_mbqi) {
|
||||||
IF_VERBOSE(10, verbose_stream() << "model based quantifier instantiation...\n";);
|
IF_VERBOSE(10, verbose_stream() << "(smt.mbqi)\n";);
|
||||||
if (m_model_checker->check(m, root2value)) {
|
if (m_model_checker->check(m, root2value)) {
|
||||||
return quantifier_manager::SAT;
|
return quantifier_manager::SAT;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,6 @@ namespace smt {
|
||||||
final_check_status final_check_quant() {
|
final_check_status final_check_quant() {
|
||||||
if (use_ematching()) {
|
if (use_ematching()) {
|
||||||
if (m_lazy_matching_idx < m_fparams->m_qi_max_lazy_multipattern_matching) {
|
if (m_lazy_matching_idx < m_fparams->m_qi_max_lazy_multipattern_matching) {
|
||||||
IF_VERBOSE(100, verbose_stream() << "matching delayed multi-patterns... \n";);
|
|
||||||
m_lazy_mam->rematch();
|
m_lazy_mam->rematch();
|
||||||
m_context->push_trail(value_trail<context, unsigned>(m_lazy_matching_idx));
|
m_context->push_trail(value_trail<context, unsigned>(m_lazy_matching_idx));
|
||||||
m_lazy_matching_idx++;
|
m_lazy_matching_idx++;
|
||||||
|
|
|
@ -266,8 +266,8 @@ namespace smt {
|
||||||
// Moreover, if model construction is enabled, then rational numbers may be needed
|
// Moreover, if model construction is enabled, then rational numbers may be needed
|
||||||
// to compute the actual value of epsilon even if the input does not have rational numbers.
|
// to compute the actual value of epsilon even if the input does not have rational numbers.
|
||||||
// Example: (x < 1) and (x > 0)
|
// Example: (x < 1) and (x > 0)
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
if (m_manager.proofs_enabled()) {
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
else if (!m_params.m_arith_auto_config_simplex && is_dense(st)) {
|
else if (!m_params.m_arith_auto_config_simplex && is_dense(st)) {
|
||||||
if (!st.m_has_rational && !m_params.m_model && st.m_arith_k_sum < rational(INT_MAX / 8))
|
if (!st.m_has_rational && !m_params.m_model && st.m_arith_k_sum < rational(INT_MAX / 8))
|
||||||
|
@ -343,8 +343,8 @@ namespace smt {
|
||||||
tout << "RELEVANCY: " << m_params.m_relevancy_lvl << "\n";
|
tout << "RELEVANCY: " << m_params.m_relevancy_lvl << "\n";
|
||||||
tout << "ARITH_EQ_BOUNDS: " << m_params.m_arith_eq_bounds << "\n";);
|
tout << "ARITH_EQ_BOUNDS: " << m_params.m_arith_eq_bounds << "\n";);
|
||||||
|
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
if (m_manager.proofs_enabled()) {
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
else if (!m_params.m_arith_auto_config_simplex && is_dense(st)) {
|
else if (!m_params.m_arith_auto_config_simplex && is_dense(st)) {
|
||||||
TRACE("setup", tout << "using dense diff logic...\n";);
|
TRACE("setup", tout << "using dense diff logic...\n";);
|
||||||
|
@ -394,8 +394,8 @@ namespace smt {
|
||||||
m_params.m_lemma_gc_half = true;
|
m_params.m_lemma_gc_half = true;
|
||||||
m_params.m_restart_strategy = RS_GEOMETRIC;
|
m_params.m_restart_strategy = RS_GEOMETRIC;
|
||||||
|
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
if (m_manager.proofs_enabled()) {
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
else if (st.m_arith_k_sum < rational(INT_MAX / 8))
|
else if (st.m_arith_k_sum < rational(INT_MAX / 8))
|
||||||
m_context.register_plugin(alloc(smt::theory_dense_si, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_dense_si, m_manager, m_params));
|
||||||
|
@ -409,8 +409,8 @@ namespace smt {
|
||||||
m_params.m_restart_strategy = RS_GEOMETRIC;
|
m_params.m_restart_strategy = RS_GEOMETRIC;
|
||||||
m_params.m_restart_factor = 1.5;
|
m_params.m_restart_factor = 1.5;
|
||||||
m_params.m_restart_adaptive = false;
|
m_params.m_restart_adaptive = false;
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
if (m_manager.proofs_enabled()) {
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
// else if (st.m_arith_k_sum < rational(INT_MAX / 8))
|
// else if (st.m_arith_k_sum < rational(INT_MAX / 8))
|
||||||
// m_context.register_plugin(alloc(smt::theory_si_arith, m_manager, m_params));
|
// m_context.register_plugin(alloc(smt::theory_si_arith, m_manager, m_params));
|
||||||
|
@ -683,22 +683,12 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup::setup_i_arith() {
|
void setup::setup_i_arith() {
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void setup::setup_mi_arith() {
|
void setup::setup_mi_arith() {
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void setup::setup_arith() {
|
void setup::setup_arith() {
|
||||||
switch(m_params.m_arith_mode) {
|
switch(m_params.m_arith_mode) {
|
||||||
|
@ -734,21 +724,10 @@ namespace smt {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (m_params.m_proof_mode != PGM_DISABLED) {
|
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith_w_proofs, m_manager, m_params));
|
|
||||||
}
|
|
||||||
// else if (m_params.m_arith_fixnum) {
|
|
||||||
// if (m_params.m_arith_int_only)
|
|
||||||
// m_context.register_plugin(alloc(smt::theory_si_arith, m_manager, m_params));
|
|
||||||
// else
|
|
||||||
// m_context.register_plugin(alloc(smt::theory_smi_arith, m_manager, m_params));
|
|
||||||
// }
|
|
||||||
else {
|
|
||||||
if (m_params.m_arith_int_only)
|
if (m_params.m_arith_int_only)
|
||||||
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_i_arith, m_manager, m_params));
|
||||||
else
|
else
|
||||||
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
m_context.register_plugin(alloc(smt::theory_mi_arith, m_manager, m_params));
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,13 @@ namespace smt {
|
||||||
|
|
||||||
virtual void init_core(ast_manager & m, symbol const & logic) {
|
virtual void init_core(ast_manager & m, symbol const & logic) {
|
||||||
reset();
|
reset();
|
||||||
#pragma omp critical (solver)
|
// We can throw exceptions when creating a smt::kernel object
|
||||||
|
// So, we should create the smt::kernel outside of the criticial section
|
||||||
|
// block. OMP does not allow exceptions to cross critical section boundaries.
|
||||||
|
smt::kernel * new_kernel = alloc(smt::kernel, m, m_params);
|
||||||
|
#pragma omp critical (solver)
|
||||||
{
|
{
|
||||||
m_context = alloc(smt::kernel, m, m_params);
|
m_context = new_kernel;
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
m_context->set_progress_callback(m_callback);
|
m_context->set_progress_callback(m_callback);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +81,7 @@ namespace smt {
|
||||||
|
|
||||||
virtual void reset_core() {
|
virtual void reset_core() {
|
||||||
if (m_context != 0) {
|
if (m_context != 0) {
|
||||||
#pragma omp critical (solver)
|
#pragma omp critical (solver)
|
||||||
{
|
{
|
||||||
dealloc(m_context);
|
dealloc(m_context);
|
||||||
m_context = 0;
|
m_context = 0;
|
||||||
|
@ -85,51 +89,59 @@ namespace smt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An exception may be thrown when creating a smt::kernel.
|
||||||
|
// So, there is no guarantee that m_context != 0 when
|
||||||
|
// using smt_solver from the SMT 2.0 command line frontend.
|
||||||
|
void check_context() const {
|
||||||
|
if (m_context == 0)
|
||||||
|
throw default_exception("Z3 failed to create solver, check previous error messages");
|
||||||
|
}
|
||||||
|
|
||||||
virtual void assert_expr(expr * t) {
|
virtual void assert_expr(expr * t) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
m_context->assert_expr(t);
|
m_context->assert_expr(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void push_core() {
|
virtual void push_core() {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
m_context->push();
|
m_context->push();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void pop_core(unsigned n) {
|
virtual void pop_core(unsigned n) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
m_context->pop(n);
|
m_context->pop(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
virtual lbool check_sat_core(unsigned num_assumptions, expr * const * assumptions) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
TRACE("solver_na2as", tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";);
|
TRACE("solver_na2as", tout << "smt_solver::check_sat_core: " << num_assumptions << "\n";);
|
||||||
return m_context->check(num_assumptions, assumptions);
|
return m_context->check(num_assumptions, assumptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_unsat_core(ptr_vector<expr> & r) {
|
virtual void get_unsat_core(ptr_vector<expr> & r) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
unsigned sz = m_context->get_unsat_core_size();
|
unsigned sz = m_context->get_unsat_core_size();
|
||||||
for (unsigned i = 0; i < sz; i++)
|
for (unsigned i = 0; i < sz; i++)
|
||||||
r.push_back(m_context->get_unsat_core_expr(i));
|
r.push_back(m_context->get_unsat_core_expr(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_model(model_ref & m) {
|
virtual void get_model(model_ref & m) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
m_context->get_model(m);
|
m_context->get_model(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual proof * get_proof() {
|
virtual proof * get_proof() {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
return m_context->get_proof();
|
return m_context->get_proof();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string reason_unknown() const {
|
virtual std::string reason_unknown() const {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
return m_context->last_failure_as_string();
|
return m_context->last_failure_as_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void get_labels(svector<symbol> & r) {
|
virtual void get_labels(svector<symbol> & r) {
|
||||||
SASSERT(m_context);
|
check_context();
|
||||||
buffer<symbol> tmp;
|
buffer<symbol> tmp;
|
||||||
m_context->get_relevant_labels(0, tmp);
|
m_context->get_relevant_labels(0, tmp);
|
||||||
r.append(tmp.size(), tmp.c_ptr());
|
r.append(tmp.size(), tmp.c_ptr());
|
||||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
||||||
#include"tactical.h"
|
#include"tactical.h"
|
||||||
#include"smt_kernel.h"
|
#include"smt_kernel.h"
|
||||||
#include"smt_params.h"
|
#include"smt_params.h"
|
||||||
#include"params2smt_params.h"
|
#include"smt_params_helper.hpp"
|
||||||
#include"rewriter_types.h"
|
#include"rewriter_types.h"
|
||||||
|
|
||||||
class smt_tactic : public tactic {
|
class smt_tactic : public tactic {
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
virtual void collect_param_descrs(param_descrs & r) {
|
virtual void collect_param_descrs(param_descrs & r) {
|
||||||
r.insert("candidate_models", CPK_BOOL, "(default: false) create candidate models even when quantifier or theory reasoning is incomplete.");
|
r.insert("candidate_models", CPK_BOOL, "(default: false) create candidate models even when quantifier or theory reasoning is incomplete.");
|
||||||
r.insert("fail_if_inconclusive", CPK_BOOL, "(default: true) fail if found unsat (sat) for under (over) approximated goal.");
|
r.insert("fail_if_inconclusive", CPK_BOOL, "(default: true) fail if found unsat (sat) for under (over) approximated goal.");
|
||||||
solver_smt_params_descrs(r);
|
smt_params_helper::collect_param_descrs(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void set_cancel(bool f) {
|
virtual void set_cancel(bool f) {
|
||||||
|
|
|
@ -21,7 +21,6 @@ Revision History:
|
||||||
|
|
||||||
namespace smt {
|
namespace smt {
|
||||||
|
|
||||||
template class theory_arith<mi_ext_with_proofs>;
|
|
||||||
template class theory_arith<mi_ext>;
|
template class theory_arith<mi_ext>;
|
||||||
template class theory_arith<i_ext>;
|
template class theory_arith<i_ext>;
|
||||||
// template class theory_arith<si_ext>;
|
// template class theory_arith<si_ext>;
|
||||||
|
|
|
@ -87,8 +87,8 @@ namespace smt {
|
||||||
typedef vector<numeral> numeral_vector;
|
typedef vector<numeral> numeral_vector;
|
||||||
|
|
||||||
static const int dead_row_id = -1;
|
static const int dead_row_id = -1;
|
||||||
static const bool proofs_enabled = Ext::proofs_enabled;
|
|
||||||
protected:
|
protected:
|
||||||
|
bool proofs_enabled() const { return get_manager().proofs_enabled(); }
|
||||||
|
|
||||||
struct linear_monomial {
|
struct linear_monomial {
|
||||||
numeral m_coeff;
|
numeral m_coeff;
|
||||||
|
@ -233,8 +233,8 @@ namespace smt {
|
||||||
void reset();
|
void reset();
|
||||||
literal_vector& lits() { return m_lits; }
|
literal_vector& lits() { return m_lits; }
|
||||||
eq_vector& eqs() { return m_eqs; }
|
eq_vector& eqs() { return m_eqs; }
|
||||||
void push_lit(literal l, numeral const& r);
|
void push_lit(literal l, numeral const& r, bool proofs_enabled);
|
||||||
void push_eq(enode_pair const& p, numeral const& r);
|
void push_eq(enode_pair const& p, numeral const& r, bool proofs_enabled);
|
||||||
unsigned num_params() const { return empty()?0:m_eq_coeffs.size() + m_lit_coeffs.size() + 1; }
|
unsigned num_params() const { return empty()?0:m_eq_coeffs.size() + m_lit_coeffs.size() + 1; }
|
||||||
numeral const* lit_coeffs() const { return m_lit_coeffs.c_ptr(); }
|
numeral const* lit_coeffs() const { return m_lit_coeffs.c_ptr(); }
|
||||||
numeral const* eq_coeffs() const { return m_eq_coeffs.c_ptr(); }
|
numeral const* eq_coeffs() const { return m_eq_coeffs.c_ptr(); }
|
||||||
|
@ -284,8 +284,8 @@ namespace smt {
|
||||||
bool is_true() const { return m_is_true; }
|
bool is_true() const { return m_is_true; }
|
||||||
void assign_eh(bool is_true, inf_numeral const & epsilon);
|
void assign_eh(bool is_true, inf_numeral const & epsilon);
|
||||||
virtual bool has_justification() const { return true; }
|
virtual bool has_justification() const { return true; }
|
||||||
virtual void push_justification(antecedents& a, numeral const& coeff) {
|
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||||
a.push_lit(literal(get_bool_var(), !m_is_true), coeff);
|
a.push_lit(literal(get_bool_var(), !m_is_true), coeff, proofs_enabled);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -301,9 +301,9 @@ namespace smt {
|
||||||
}
|
}
|
||||||
virtual ~eq_bound() {}
|
virtual ~eq_bound() {}
|
||||||
virtual bool has_justification() const { return true; }
|
virtual bool has_justification() const { return true; }
|
||||||
virtual void push_justification(antecedents& a, numeral const& coeff) {
|
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||||
SASSERT(m_lhs->get_root() == m_rhs->get_root());
|
SASSERT(m_lhs->get_root() == m_rhs->get_root());
|
||||||
a.push_eq(enode_pair(m_lhs, m_rhs), coeff);
|
a.push_eq(enode_pair(m_lhs, m_rhs), coeff, proofs_enabled);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ namespace smt {
|
||||||
derived_bound(theory_var v, inf_numeral const & val, bound_kind k):bound(v, val, k, false) {}
|
derived_bound(theory_var v, inf_numeral const & val, bound_kind k):bound(v, val, k, false) {}
|
||||||
virtual ~derived_bound() {}
|
virtual ~derived_bound() {}
|
||||||
virtual bool has_justification() const { return true; }
|
virtual bool has_justification() const { return true; }
|
||||||
virtual void push_justification(antecedents& a, numeral const& coeff);
|
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled);
|
||||||
virtual void push_lit(literal l, numeral const&) { m_lits.push_back(l); }
|
virtual void push_lit(literal l, numeral const&) { m_lits.push_back(l); }
|
||||||
virtual void push_eq(enode_pair const& p, numeral const&) { m_eqs.push_back(p); }
|
virtual void push_eq(enode_pair const& p, numeral const&) { m_eqs.push_back(p); }
|
||||||
};
|
};
|
||||||
|
@ -329,7 +329,7 @@ namespace smt {
|
||||||
justified_derived_bound(theory_var v, inf_numeral const & val, bound_kind k):derived_bound(v, val, k) {}
|
justified_derived_bound(theory_var v, inf_numeral const & val, bound_kind k):derived_bound(v, val, k) {}
|
||||||
virtual ~justified_derived_bound() {}
|
virtual ~justified_derived_bound() {}
|
||||||
virtual bool has_justification() const { return true; }
|
virtual bool has_justification() const { return true; }
|
||||||
virtual void push_justification(antecedents& a, numeral const& coeff);
|
virtual void push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled);
|
||||||
virtual void push_lit(literal l, numeral const& coeff);
|
virtual void push_lit(literal l, numeral const& coeff);
|
||||||
|
|
||||||
virtual void push_eq(enode_pair const& p, numeral const& coeff);
|
virtual void push_eq(enode_pair const& p, numeral const& coeff);
|
||||||
|
@ -1053,30 +1053,9 @@ namespace smt {
|
||||||
static inf_numeral mk_inf_numeral(numeral const & n, numeral const & r) {
|
static inf_numeral mk_inf_numeral(numeral const & n, numeral const & r) {
|
||||||
return inf_numeral(n, r);
|
return inf_numeral(n, r);
|
||||||
}
|
}
|
||||||
static const bool proofs_enabled = false;
|
|
||||||
mi_ext() : m_int_epsilon(rational(1)), m_real_epsilon(rational(0), true) {}
|
mi_ext() : m_int_epsilon(rational(1)), m_real_epsilon(rational(0), true) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class mi_ext_with_proofs {
|
|
||||||
public:
|
|
||||||
typedef rational numeral;
|
|
||||||
typedef inf_rational inf_numeral;
|
|
||||||
inf_numeral m_int_epsilon;
|
|
||||||
inf_numeral m_real_epsilon;
|
|
||||||
numeral fractional_part(inf_numeral const& n) {
|
|
||||||
SASSERT(n.is_rational());
|
|
||||||
return n.get_rational() - floor(n);
|
|
||||||
}
|
|
||||||
static numeral fractional_part(numeral const & n) {
|
|
||||||
return n - floor(n);
|
|
||||||
}
|
|
||||||
static inf_numeral mk_inf_numeral(numeral const & n, numeral const & r) {
|
|
||||||
return inf_numeral(n, r);
|
|
||||||
}
|
|
||||||
static const bool proofs_enabled = true;
|
|
||||||
mi_ext_with_proofs() : m_int_epsilon(rational(1)), m_real_epsilon(rational(0), true) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class i_ext {
|
class i_ext {
|
||||||
public:
|
public:
|
||||||
typedef rational numeral;
|
typedef rational numeral;
|
||||||
|
@ -1090,7 +1069,6 @@ namespace smt {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return inf_numeral(n);
|
return inf_numeral(n);
|
||||||
}
|
}
|
||||||
static const bool proofs_enabled = false;
|
|
||||||
i_ext() : m_int_epsilon(1), m_real_epsilon(1) {}
|
i_ext() : m_int_epsilon(1), m_real_epsilon(1) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1107,7 +1085,6 @@ namespace smt {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return inf_numeral(n);
|
return inf_numeral(n);
|
||||||
}
|
}
|
||||||
static const bool proofs_enabled = false;
|
|
||||||
si_ext(): m_int_epsilon(s_integer(1)), m_real_epsilon(s_integer(1)) {}
|
si_ext(): m_int_epsilon(s_integer(1)), m_real_epsilon(s_integer(1)) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1128,12 +1105,10 @@ namespace smt {
|
||||||
static inf_numeral mk_inf_numeral(numeral const& n, numeral const& i) {
|
static inf_numeral mk_inf_numeral(numeral const& n, numeral const& i) {
|
||||||
return inf_numeral(n, i);
|
return inf_numeral(n, i);
|
||||||
}
|
}
|
||||||
static const bool proofs_enabled = false;
|
|
||||||
smi_ext() : m_int_epsilon(s_integer(1)), m_real_epsilon(s_integer(0), true) {}
|
smi_ext() : m_int_epsilon(s_integer(1)), m_real_epsilon(s_integer(0), true) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef theory_arith<mi_ext> theory_mi_arith;
|
typedef theory_arith<mi_ext> theory_mi_arith;
|
||||||
typedef theory_arith<mi_ext_with_proofs> theory_mi_arith_w_proofs;
|
|
||||||
typedef theory_arith<i_ext> theory_i_arith;
|
typedef theory_arith<i_ext> theory_i_arith;
|
||||||
// typedef theory_arith<si_ext> theory_si_arith;
|
// typedef theory_arith<si_ext> theory_si_arith;
|
||||||
// typedef theory_arith<smi_ext> theory_smi_arith;
|
// typedef theory_arith<smi_ext> theory_smi_arith;
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_arith<Ext>::antecedents::push_lit(literal l, numeral const& r) {
|
void theory_arith<Ext>::antecedents::push_lit(literal l, numeral const& r, bool proofs_enabled) {
|
||||||
m_lits.push_back(l);
|
m_lits.push_back(l);
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled) {
|
||||||
m_lit_coeffs.push_back(r);
|
m_lit_coeffs.push_back(r);
|
||||||
|
@ -344,7 +344,7 @@ namespace smt {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_arith<Ext>::antecedents::push_eq(enode_pair const& p, numeral const& r) {
|
void theory_arith<Ext>::antecedents::push_eq(enode_pair const& p, numeral const& r, bool proofs_enabled) {
|
||||||
m_eqs.push_back(p);
|
m_eqs.push_back(p);
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled) {
|
||||||
m_eq_coeffs.push_back(r);
|
m_eq_coeffs.push_back(r);
|
||||||
|
@ -690,14 +690,14 @@ namespace smt {
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_arith<Ext>::derived_bound::push_justification(antecedents& a, numeral const& coeff) {
|
void theory_arith<Ext>::derived_bound::push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||||
|
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled) {
|
||||||
for (unsigned i = 0; i < m_lits.size(); ++i) {
|
for (unsigned i = 0; i < m_lits.size(); ++i) {
|
||||||
a.push_lit(m_lits[i], coeff);
|
a.push_lit(m_lits[i], coeff, proofs_enabled);
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < m_eqs.size(); ++i) {
|
for (unsigned i = 0; i < m_eqs.size(); ++i) {
|
||||||
a.push_eq(m_eqs[i], coeff);
|
a.push_eq(m_eqs[i], coeff, proofs_enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -708,12 +708,12 @@ namespace smt {
|
||||||
|
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_arith<Ext>::justified_derived_bound::push_justification(antecedents& a, numeral const& coeff) {
|
void theory_arith<Ext>::justified_derived_bound::push_justification(antecedents& a, numeral const& coeff, bool proofs_enabled) {
|
||||||
for (unsigned i = 0; i < this->m_lits.size(); ++i) {
|
for (unsigned i = 0; i < this->m_lits.size(); ++i) {
|
||||||
a.push_lit(this->m_lits[i], coeff*m_lit_coeffs[i]);
|
a.push_lit(this->m_lits[i], coeff*m_lit_coeffs[i], proofs_enabled);
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < this->m_eqs.size(); ++i) {
|
for (unsigned i = 0; i < this->m_eqs.size(); ++i) {
|
||||||
a.push_eq(this->m_eqs[i], coeff*m_eq_coeffs[i]);
|
a.push_eq(this->m_eqs[i], coeff*m_eq_coeffs[i], proofs_enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ namespace smt {
|
||||||
literal l = ante.lits()[i];
|
literal l = ante.lits()[i];
|
||||||
if (lits.contains(l.index()))
|
if (lits.contains(l.index()))
|
||||||
continue;
|
continue;
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled()) {
|
||||||
new_bound.push_lit(l, ante.lit_coeffs()[i]);
|
new_bound.push_lit(l, ante.lit_coeffs()[i]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -768,7 +768,7 @@ namespace smt {
|
||||||
enode_pair const & p = ante.eqs()[i];
|
enode_pair const & p = ante.eqs()[i];
|
||||||
if (eqs.contains(p))
|
if (eqs.contains(p))
|
||||||
continue;
|
continue;
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled()) {
|
||||||
new_bound.push_eq(p, ante.eq_coeffs()[i]);
|
new_bound.push_eq(p, ante.eq_coeffs()[i]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -796,7 +796,7 @@ namespace smt {
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_arith<Ext>::mk_bound_from_row(theory_var v, inf_numeral const & k, bound_kind kind, row const & r) {
|
void theory_arith<Ext>::mk_bound_from_row(theory_var v, inf_numeral const & k, bound_kind kind, row const & r) {
|
||||||
inf_numeral k_norm = normalize_bound(v, k, kind);
|
inf_numeral k_norm = normalize_bound(v, k, kind);
|
||||||
derived_bound * new_bound = proofs_enabled?alloc(justified_derived_bound, v, k_norm, kind):alloc(derived_bound, v, k_norm, kind);
|
derived_bound * new_bound = proofs_enabled()?alloc(justified_derived_bound, v, k_norm, kind):alloc(derived_bound, v, k_norm, kind);
|
||||||
m_bounds_to_delete.push_back(new_bound);
|
m_bounds_to_delete.push_back(new_bound);
|
||||||
m_asserted_bounds.push_back(new_bound);
|
m_asserted_bounds.push_back(new_bound);
|
||||||
m_tmp_lit_set.reset();
|
m_tmp_lit_set.reset();
|
||||||
|
|
|
@ -2456,7 +2456,7 @@ namespace smt {
|
||||||
delta -= coeff*(k_2 - k_1);
|
delta -= coeff*(k_2 - k_1);
|
||||||
}
|
}
|
||||||
TRACE("propagate_bounds", tout << "delta (after replace): " << delta << "\n";);
|
TRACE("propagate_bounds", tout << "delta (after replace): " << delta << "\n";);
|
||||||
new_atom->push_justification(ante, coeff);
|
new_atom->push_justification(ante, coeff, proofs_enabled());
|
||||||
SASSERT(delta >= inf_numeral::zero());
|
SASSERT(delta >= inf_numeral::zero());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2569,7 +2569,7 @@ namespace smt {
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
lits.push_back(~(*it));
|
lits.push_back(~(*it));
|
||||||
justification * js = 0;
|
justification * js = 0;
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled()) {
|
||||||
js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.c_ptr(),
|
js = alloc(theory_lemma_justification, get_id(), ctx, lits.size(), lits.c_ptr(),
|
||||||
ante.num_params(), ante.params("assign-bounds"));
|
ante.num_params(), ante.params("assign-bounds"));
|
||||||
}
|
}
|
||||||
|
@ -2656,13 +2656,13 @@ namespace smt {
|
||||||
for (unsigned i = 0; i < num_literals; i++) {
|
for (unsigned i = 0; i < num_literals; i++) {
|
||||||
ctx.display_detailed_literal(tout, lits[i]);
|
ctx.display_detailed_literal(tout, lits[i]);
|
||||||
tout << " ";
|
tout << " ";
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled()) {
|
||||||
tout << "bound: " << bounds.lit_coeffs()[i] << "\n";
|
tout << "bound: " << bounds.lit_coeffs()[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < num_eqs; i++) {
|
for (unsigned i = 0; i < num_eqs; i++) {
|
||||||
tout << "#" << eqs[i].first->get_owner_id() << "=#" << eqs[i].second->get_owner_id() << " ";
|
tout << "#" << eqs[i].first->get_owner_id() << "=#" << eqs[i].second->get_owner_id() << " ";
|
||||||
if (proofs_enabled) {
|
if (proofs_enabled()) {
|
||||||
tout << "bound: " << bounds.eq_coeffs()[i] << "\n";
|
tout << "bound: " << bounds.eq_coeffs()[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,7 +342,7 @@ protected:
|
||||||
|
|
||||||
tactic * mk_degree_shift_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_degree_shift_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref mul2power_p;
|
params_ref mul2power_p;
|
||||||
mul2power_p.set_bool(":mul-to-power", true);
|
mul2power_p.set_bool("mul_to_power", true);
|
||||||
return and_then(using_params(mk_simplify_tactic(m), mul2power_p),
|
return and_then(using_params(mk_simplify_tactic(m), mul2power_p),
|
||||||
clean(alloc(degree_shift_tactic, m)));
|
clean(alloc(degree_shift_tactic, m)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,7 +902,7 @@ public:
|
||||||
|
|
||||||
tactic * mk_purify_arith_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_purify_arith_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref elim_rem_p = p;
|
params_ref elim_rem_p = p;
|
||||||
elim_rem_p.set_bool("elim-rem", true);
|
elim_rem_p.set_bool("elim_rem", true);
|
||||||
|
|
||||||
params_ref skolemize_p;
|
params_ref skolemize_p;
|
||||||
skolemize_p.set_bool("skolemize", false);
|
skolemize_p.set_bool("skolemize", false);
|
||||||
|
|
|
@ -120,7 +120,7 @@ tactic * mk_snf_tactic(ast_manager & m, params_ref const & p) {
|
||||||
|
|
||||||
tactic * mk_nnf_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_nnf_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref new_p(p);
|
params_ref new_p(p);
|
||||||
new_p.set_sym("nnf_mode", symbol("full"));
|
new_p.set_sym("mode", symbol("full"));
|
||||||
TRACE("nnf", tout << "mk_nnf: " << new_p << "\n";);
|
TRACE("nnf", tout << "mk_nnf: " << new_p << "\n";);
|
||||||
return using_params(mk_snf_tactic(m, p), new_p);
|
return using_params(mk_snf_tactic(m, p), new_p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1855,7 +1855,7 @@ tactic * mk_sls_tactic(ast_manager & m, params_ref const & p) {
|
||||||
tactic * mk_preamble(ast_manager & m, params_ref const & p) {
|
tactic * mk_preamble(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool("elim_and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
// main_p.set_bool("pull-cheap_ite", true);
|
// main_p.set_bool("pull_cheap_ite", true);
|
||||||
main_p.set_bool("push_ite_bv", true);
|
main_p.set_bool("push_ite_bv", true);
|
||||||
main_p.set_bool("blast_distinct", true);
|
main_p.set_bool("blast_distinct", true);
|
||||||
// main_p.set_bool("udiv2mul", true);
|
// main_p.set_bool("udiv2mul", true);
|
||||||
|
|
|
@ -27,11 +27,11 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_nra_tactic(ast_manager & m, params_ref const& p) {
|
tactic * mk_nra_tactic(ast_manager & m, params_ref const& p) {
|
||||||
params_ref p1 = p;
|
params_ref p1 = p;
|
||||||
p1.set_uint(":seed", 11);
|
p1.set_uint("seed", 11);
|
||||||
p1.set_bool(":factor", false);
|
p1.set_bool("factor", false);
|
||||||
params_ref p2 = p;
|
params_ref p2 = p;
|
||||||
p2.set_uint(":seed", 13);
|
p2.set_uint("seed", 13);
|
||||||
p2.set_bool(":factor", false);
|
p2.set_bool("factor", false);
|
||||||
|
|
||||||
return and_then(mk_simplify_tactic(m, p),
|
return and_then(mk_simplify_tactic(m, p),
|
||||||
mk_nnf_tactic(m, p),
|
mk_nnf_tactic(m, p),
|
||||||
|
|
|
@ -29,22 +29,22 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfaufbv_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfaufbv_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":sort-store", true);
|
main_p.set_bool("sort_store", true);
|
||||||
|
|
||||||
params_ref simp2_p = p;
|
params_ref simp2_p = p;
|
||||||
simp2_p.set_bool(":som", true);
|
simp2_p.set_bool("som", true);
|
||||||
simp2_p.set_bool(":pull-cheap-ite", true);
|
simp2_p.set_bool("pull_cheap_ite", true);
|
||||||
simp2_p.set_bool(":push-ite-bv", false);
|
simp2_p.set_bool("push_ite_bv", false);
|
||||||
simp2_p.set_bool(":local-ctx", true);
|
simp2_p.set_bool("local_ctx", true);
|
||||||
simp2_p.set_uint(":local-ctx-limit", 10000000);
|
simp2_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 32);
|
ctx_simp_p.set_uint("max_depth", 32);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
solver_p.set_bool(":array-old-simplifier", false);
|
solver_p.set_bool("array.simplify", false); // disable array simplifications at old_simplify module
|
||||||
|
|
||||||
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
|
|
@ -26,16 +26,16 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfauflia_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfauflia_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":som", true);
|
main_p.set_bool("som", true);
|
||||||
main_p.set_bool(":sort-store", true);
|
main_p.set_bool("sort_store", true);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 30);
|
ctx_simp_p.set_uint("max_depth", 30);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
solver_p.set_bool(":array-old-simplifier", false);
|
solver_p.set_bool("array.simplify", false); // disable array simplifications at old_simplify module
|
||||||
|
|
||||||
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
|
|
@ -33,40 +33,40 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":push-ite-bv", true);
|
main_p.set_bool("push_ite_bv", true);
|
||||||
main_p.set_bool(":blast-distinct", true);
|
main_p.set_bool("blast_distinct", true);
|
||||||
|
|
||||||
params_ref simp2_p = p;
|
params_ref simp2_p = p;
|
||||||
simp2_p.set_bool(":som", true);
|
simp2_p.set_bool("som", true);
|
||||||
simp2_p.set_bool(":pull-cheap-ite", true);
|
simp2_p.set_bool("pull_cheap_ite", true);
|
||||||
simp2_p.set_bool(":push-ite-bv", false);
|
simp2_p.set_bool("push_ite_bv", false);
|
||||||
simp2_p.set_bool(":local-ctx", true);
|
simp2_p.set_bool("local_ctx", true);
|
||||||
simp2_p.set_uint(":local-ctx-limit", 10000000);
|
simp2_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
params_ref local_ctx_p = p;
|
params_ref local_ctx_p = p;
|
||||||
local_ctx_p.set_bool(":local-ctx", true);
|
local_ctx_p.set_bool("local_ctx", true);
|
||||||
|
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
solver_p.set_bool(":preprocess", false); // preprocessor of smt::context is not needed.
|
solver_p.set_bool("preprocess", false); // preprocessor of smt::context is not needed.
|
||||||
|
|
||||||
params_ref no_flat_p;
|
params_ref no_flat_p;
|
||||||
no_flat_p.set_bool(":flat", false);
|
no_flat_p.set_bool("flat", false);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 32);
|
ctx_simp_p.set_uint("max_depth", 32);
|
||||||
ctx_simp_p.set_uint(":max-steps", 50000000);
|
ctx_simp_p.set_uint("max_steps", 50000000);
|
||||||
|
|
||||||
params_ref hoist_p;
|
params_ref hoist_p;
|
||||||
hoist_p.set_bool(":hoist-mul", true);
|
hoist_p.set_bool("hoist_mul", true);
|
||||||
hoist_p.set_bool(":som", false);
|
hoist_p.set_bool("som", false);
|
||||||
|
|
||||||
params_ref solve_eq_p;
|
params_ref solve_eq_p;
|
||||||
// conservative guassian elimination.
|
// conservative guassian elimination.
|
||||||
solve_eq_p.set_uint(":solve-eqs-max-occs", 2);
|
solve_eq_p.set_uint("solve_eqs_max_occs", 2);
|
||||||
|
|
||||||
params_ref big_aig_p;
|
params_ref big_aig_p;
|
||||||
big_aig_p.set_bool(":aig-per-assertion", false);
|
big_aig_p.set_bool("aig_per_assertion", false);
|
||||||
|
|
||||||
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
@ -74,7 +74,7 @@ tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p) {
|
||||||
mk_elim_uncnstr_tactic(m),
|
mk_elim_uncnstr_tactic(m),
|
||||||
if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
|
if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
|
||||||
using_params(mk_simplify_tactic(m), simp2_p)),
|
using_params(mk_simplify_tactic(m), simp2_p)),
|
||||||
// Z3 can solve a couple of extra benchmarks by using :hoist-mul
|
// Z3 can solve a couple of extra benchmarks by using hoist_mul
|
||||||
// but the timeout in SMT-COMP is too small.
|
// but the timeout in SMT-COMP is too small.
|
||||||
// Moreover, it impacted negatively some easy benchmarks.
|
// Moreover, it impacted negatively some easy benchmarks.
|
||||||
// We should decide later, if we keep it or not.
|
// We should decide later, if we keep it or not.
|
||||||
|
|
|
@ -37,23 +37,23 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfidl_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfidl_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":blast-distinct", true);
|
main_p.set_bool("blast_distinct", true);
|
||||||
main_p.set_bool(":som", true);
|
main_p.set_bool("som", true);
|
||||||
|
|
||||||
params_ref lhs_p;
|
params_ref lhs_p;
|
||||||
lhs_p.set_bool(":arith-lhs", true);
|
lhs_p.set_bool("arith_lhs", true);
|
||||||
|
|
||||||
params_ref lia2pb_p;
|
params_ref lia2pb_p;
|
||||||
lia2pb_p.set_uint(":lia2pb-max-bits", 4);
|
lia2pb_p.set_uint("lia2pb_max_bits", 4);
|
||||||
|
|
||||||
params_ref pb2bv_p;
|
params_ref pb2bv_p;
|
||||||
pb2bv_p.set_uint(":pb2bv-all-clauses-limit", 8);
|
pb2bv_p.set_uint("pb2bv_all_clauses_limit", 8);
|
||||||
|
|
||||||
params_ref pull_ite_p;
|
params_ref pull_ite_p;
|
||||||
pull_ite_p.set_bool(":pull-cheap-ite", true);
|
pull_ite_p.set_bool("pull_cheap_ite", true);
|
||||||
pull_ite_p.set_bool(":local-ctx", true);
|
pull_ite_p.set_bool("local_ctx", true);
|
||||||
pull_ite_p.set_uint(":local-ctx-limit", 10000000);
|
pull_ite_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
||||||
mk_fix_dl_var_tactic(m),
|
mk_fix_dl_var_tactic(m),
|
||||||
|
@ -71,10 +71,10 @@ tactic * mk_qfidl_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref bv_solver_p;
|
params_ref bv_solver_p;
|
||||||
// The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
|
// The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
|
||||||
// Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
|
// Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
|
||||||
bv_solver_p.set_bool(":flat", false);
|
bv_solver_p.set_bool("flat", false);
|
||||||
bv_solver_p.set_bool(":som", false);
|
bv_solver_p.set_bool("som", false);
|
||||||
// dynamic psm seems to work well.
|
// dynamic psm seems to work well.
|
||||||
bv_solver_p.set_sym(":gc-strategy", symbol("dyn-psm"));
|
bv_solver_p.set_sym("gc", symbol("dyn_psm"));
|
||||||
|
|
||||||
tactic * bv_solver = using_params(and_then(mk_simplify_tactic(m),
|
tactic * bv_solver = using_params(and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
@ -93,7 +93,7 @@ tactic * mk_qfidl_tactic(ast_manager & m, params_ref const & p) {
|
||||||
bv_solver);
|
bv_solver);
|
||||||
|
|
||||||
params_ref diff_neq_p;
|
params_ref diff_neq_p;
|
||||||
diff_neq_p.set_uint(":diff-neq-max-k", 25);
|
diff_neq_p.set_uint("diff_neq_max_k", 25);
|
||||||
|
|
||||||
tactic * st = cond(mk_and(mk_lt(mk_num_consts_probe(), mk_const_probe(static_cast<double>(BIG_PROBLEM))),
|
tactic * st = cond(mk_and(mk_lt(mk_num_consts_probe(), mk_const_probe(static_cast<double>(BIG_PROBLEM))),
|
||||||
mk_and(mk_not(mk_produce_proofs_probe()),
|
mk_and(mk_not(mk_produce_proofs_probe()),
|
||||||
|
|
|
@ -64,17 +64,17 @@ probe * mk_quasi_pb_probe() {
|
||||||
// Create SMT solver that does not use cuts
|
// Create SMT solver that does not use cuts
|
||||||
static tactic * mk_no_cut_smt_tactic(unsigned rs) {
|
static tactic * mk_no_cut_smt_tactic(unsigned rs) {
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
solver_p.set_uint(":arith-branch-cut-ratio", 10000000);
|
solver_p.set_uint("arith.branch_cut_ratio", 10000000);
|
||||||
solver_p.set_uint(":random-seed", rs);
|
solver_p.set_uint("random_seed", rs);
|
||||||
return using_params(mk_smt_tactic_using(false), solver_p);
|
return using_params(mk_smt_tactic_using(false), solver_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create SMT solver that does not use cuts
|
// Create SMT solver that does not use cuts
|
||||||
static tactic * mk_no_cut_no_relevancy_smt_tactic(unsigned rs) {
|
static tactic * mk_no_cut_no_relevancy_smt_tactic(unsigned rs) {
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
solver_p.set_uint(":arith-branch-cut-ratio", 10000000);
|
solver_p.set_uint("arith.branch_cut_ratio", 10000000);
|
||||||
solver_p.set_uint(":random-seed", rs);
|
solver_p.set_uint("random_seed", rs);
|
||||||
solver_p.set_uint(":relevancy", 0);
|
solver_p.set_uint("relevancy", 0);
|
||||||
return using_params(mk_smt_tactic_using(false), solver_p);
|
return using_params(mk_smt_tactic_using(false), solver_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ static tactic * mk_bv2sat_tactic(ast_manager & m) {
|
||||||
params_ref solver_p;
|
params_ref solver_p;
|
||||||
// The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
|
// The cardinality constraint encoding generates a lot of shared if-then-else's that can be flattened.
|
||||||
// Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
|
// Several of them are simplified to and/or. If we flat them, we increase a lot the memory consumption.
|
||||||
solver_p.set_bool(":flat", false);
|
solver_p.set_bool("flat", false);
|
||||||
solver_p.set_bool(":som", false);
|
solver_p.set_bool("som", false);
|
||||||
// dynamic psm seems to work well.
|
// dynamic psm seems to work well.
|
||||||
solver_p.set_sym(":gc-strategy", symbol("dyn-psm"));
|
solver_p.set_sym("gc", symbol("dyn_psm"));
|
||||||
|
|
||||||
return using_params(and_then(mk_simplify_tactic(m),
|
return using_params(and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
@ -101,8 +101,8 @@ static tactic * mk_bv2sat_tactic(ast_manager & m) {
|
||||||
|
|
||||||
static tactic * mk_pb_tactic(ast_manager & m) {
|
static tactic * mk_pb_tactic(ast_manager & m) {
|
||||||
params_ref pb2bv_p;
|
params_ref pb2bv_p;
|
||||||
pb2bv_p.set_bool(":ite-extra", true);
|
pb2bv_p.set_bool("ite_extra", true);
|
||||||
pb2bv_p.set_uint(":pb2bv-all-clauses-limit", 8);
|
pb2bv_p.set_uint("pb2bv_all_clauses_limit", 8);
|
||||||
|
|
||||||
return and_then(fail_if_not(mk_is_pb_probe()),
|
return and_then(fail_if_not(mk_is_pb_probe()),
|
||||||
fail_if(mk_produce_proofs_probe()),
|
fail_if(mk_produce_proofs_probe()),
|
||||||
|
@ -119,8 +119,8 @@ static tactic * mk_pb_tactic(ast_manager & m) {
|
||||||
|
|
||||||
static tactic * mk_lia2sat_tactic(ast_manager & m) {
|
static tactic * mk_lia2sat_tactic(ast_manager & m) {
|
||||||
params_ref pb2bv_p;
|
params_ref pb2bv_p;
|
||||||
pb2bv_p.set_bool(":ite-extra", true);
|
pb2bv_p.set_bool("ite_extra", true);
|
||||||
pb2bv_p.set_uint(":pb2bv-all-clauses-limit", 8);
|
pb2bv_p.set_uint("pb2bv_all_clauses_limit", 8);
|
||||||
|
|
||||||
return and_then(fail_if(mk_is_unbounded_probe()),
|
return and_then(fail_if(mk_is_unbounded_probe()),
|
||||||
fail_if(mk_produce_proofs_probe()),
|
fail_if(mk_produce_proofs_probe()),
|
||||||
|
@ -137,11 +137,11 @@ static tactic * mk_lia2sat_tactic(ast_manager & m) {
|
||||||
// Fails if the problem is no ILP.
|
// Fails if the problem is no ILP.
|
||||||
static tactic * mk_ilp_model_finder_tactic(ast_manager & m) {
|
static tactic * mk_ilp_model_finder_tactic(ast_manager & m) {
|
||||||
params_ref add_bounds_p1;
|
params_ref add_bounds_p1;
|
||||||
add_bounds_p1.set_rat(":add-bound-lower", rational(-16));
|
add_bounds_p1.set_rat("add_bound_lower", rational(-16));
|
||||||
add_bounds_p1.set_rat(":add-bound-upper", rational(15));
|
add_bounds_p1.set_rat("add_bound_upper", rational(15));
|
||||||
params_ref add_bounds_p2;
|
params_ref add_bounds_p2;
|
||||||
add_bounds_p2.set_rat(":add-bound-lower", rational(-32));
|
add_bounds_p2.set_rat("add_bound_lower", rational(-32));
|
||||||
add_bounds_p2.set_rat(":add-bound-upper", rational(31));
|
add_bounds_p2.set_rat("add_bound_upper", rational(31));
|
||||||
|
|
||||||
return and_then(fail_if_not(mk_and(mk_is_ilp_probe(), mk_is_unbounded_probe())),
|
return and_then(fail_if_not(mk_and(mk_is_ilp_probe(), mk_is_unbounded_probe())),
|
||||||
fail_if(mk_produce_proofs_probe()),
|
fail_if(mk_produce_proofs_probe()),
|
||||||
|
@ -170,22 +170,22 @@ static tactic * mk_bounded_tactic(ast_manager & m) {
|
||||||
|
|
||||||
tactic * mk_qflia_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qflia_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":som", true);
|
main_p.set_bool("som", true);
|
||||||
// main_p.set_bool(":push-ite-arith", true);
|
// main_p.set_bool("push_ite_arith", true);
|
||||||
|
|
||||||
params_ref pull_ite_p;
|
params_ref pull_ite_p;
|
||||||
pull_ite_p.set_bool(":pull-cheap-ite", true);
|
pull_ite_p.set_bool("pull_cheap_ite", true);
|
||||||
pull_ite_p.set_bool(":push-ite-arith", false);
|
pull_ite_p.set_bool("push_ite_arith", false);
|
||||||
pull_ite_p.set_bool(":local-ctx", true);
|
pull_ite_p.set_bool("local_ctx", true);
|
||||||
pull_ite_p.set_uint(":local-ctx-limit", 10000000);
|
pull_ite_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 30);
|
ctx_simp_p.set_uint("max_depth", 30);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
params_ref lhs_p;
|
params_ref lhs_p;
|
||||||
lhs_p.set_bool(":arith-lhs", true);
|
lhs_p.set_bool("arith_lhs", true);
|
||||||
|
|
||||||
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
@ -197,10 +197,10 @@ tactic * mk_qflia_tactic(ast_manager & m, params_ref const & p) {
|
||||||
);
|
);
|
||||||
|
|
||||||
params_ref quasi_pb_p;
|
params_ref quasi_pb_p;
|
||||||
quasi_pb_p.set_uint(":lia2pb-max-bits", 64);
|
quasi_pb_p.set_uint("lia2pb_max_bits", 64);
|
||||||
|
|
||||||
params_ref no_cut_p;
|
params_ref no_cut_p;
|
||||||
no_cut_p.set_uint(":arith-branch-cut-ratio", 10000000);
|
no_cut_p.set_uint("arith.branch_cut_ratio", 10000000);
|
||||||
|
|
||||||
|
|
||||||
tactic * st = using_params(and_then(preamble_st,
|
tactic * st = using_params(and_then(preamble_st,
|
||||||
|
|
|
@ -29,23 +29,23 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qflra_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qflra_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref pivot_p;
|
params_ref pivot_p;
|
||||||
pivot_p.set_bool(":arith-greatest-error-pivot", true);
|
pivot_p.set_bool("arith.greatest_error_pivot", true);
|
||||||
|
|
||||||
params_ref main_p = p;
|
params_ref main_p = p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":som", true);
|
main_p.set_bool("som", true);
|
||||||
main_p.set_bool(":blast-distinct", true);
|
main_p.set_bool("blast_distinct", true);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 30);
|
ctx_simp_p.set_uint("max_depth", 30);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
params_ref lhs_p;
|
params_ref lhs_p;
|
||||||
lhs_p.set_bool(":arith-lhs", true);
|
lhs_p.set_bool("arith_lhs", true);
|
||||||
lhs_p.set_bool(":eq2ineq", true);
|
lhs_p.set_bool("eq2ineq", true);
|
||||||
|
|
||||||
params_ref elim_to_real_p;
|
params_ref elim_to_real_p;
|
||||||
elim_to_real_p.set_bool(":elim-to-real", true);
|
elim_to_real_p.set_bool("elim_to_real", true);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -31,14 +31,14 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
|
tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
|
||||||
params_ref p = p_ref;
|
params_ref p = p_ref;
|
||||||
p.set_bool(":flat", false);
|
p.set_bool("flat", false);
|
||||||
p.set_bool(":hi-div0", true);
|
p.set_bool("hi_div0", true);
|
||||||
p.set_bool(":elim-and", true);
|
p.set_bool("elim_and", true);
|
||||||
p.set_bool(":blast-distinct", true);
|
p.set_bool("blast_distinct", true);
|
||||||
|
|
||||||
params_ref simp2_p = p;
|
params_ref simp2_p = p;
|
||||||
simp2_p.set_bool(":local-ctx", true);
|
simp2_p.set_bool("local_ctx", true);
|
||||||
simp2_p.set_uint(":local-ctx-limit", 10000000);
|
simp2_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
|
|
||||||
tactic * r = using_params(and_then(mk_simplify_tactic(m),
|
tactic * r = using_params(and_then(mk_simplify_tactic(m),
|
||||||
|
@ -53,19 +53,19 @@ tactic * mk_qfnia_bv_solver(ast_manager & m, params_ref const & p_ref) {
|
||||||
|
|
||||||
tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
|
tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
|
||||||
params_ref pull_ite_p = p_ref;
|
params_ref pull_ite_p = p_ref;
|
||||||
pull_ite_p.set_bool(":pull-cheap-ite", true);
|
pull_ite_p.set_bool("pull_cheap_ite", true);
|
||||||
pull_ite_p.set_bool(":local-ctx", true);
|
pull_ite_p.set_bool("local_ctx", true);
|
||||||
pull_ite_p.set_uint(":local-ctx-limit", 10000000);
|
pull_ite_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
params_ref ctx_simp_p = p_ref;
|
params_ref ctx_simp_p = p_ref;
|
||||||
ctx_simp_p.set_uint(":max-depth", 30);
|
ctx_simp_p.set_uint("max_depth", 30);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
params_ref simp_p = p_ref;
|
params_ref simp_p = p_ref;
|
||||||
simp_p.set_bool(":hoist-mul", true);
|
simp_p.set_bool("hoist_mul", true);
|
||||||
|
|
||||||
params_ref elim_p = p_ref;
|
params_ref elim_p = p_ref;
|
||||||
elim_p.set_uint(":max-memory",20);
|
elim_p.set_uint("max_memory",20);
|
||||||
|
|
||||||
return
|
return
|
||||||
and_then(mk_simplify_tactic(m),
|
and_then(mk_simplify_tactic(m),
|
||||||
|
@ -79,7 +79,7 @@ tactic * mk_qfnia_premable(ast_manager & m, params_ref const & p_ref) {
|
||||||
|
|
||||||
tactic * mk_qfnia_sat_solver(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfnia_sat_solver(ast_manager & m, params_ref const & p) {
|
||||||
params_ref nia2sat_p = p;
|
params_ref nia2sat_p = p;
|
||||||
nia2sat_p.set_uint(":nla2bv-max-bv-size", 64);
|
nia2sat_p.set_uint("nla2bv_max_bv_size", 64);
|
||||||
|
|
||||||
return and_then(mk_nla2bv_tactic(m, nia2sat_p),
|
return and_then(mk_nla2bv_tactic(m, nia2sat_p),
|
||||||
mk_qfnia_bv_solver(m, p),
|
mk_qfnia_bv_solver(m, p),
|
||||||
|
|
|
@ -25,7 +25,7 @@ Notes:
|
||||||
|
|
||||||
static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigned bv_size) {
|
static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigned bv_size) {
|
||||||
params_ref nra2sat_p = p;
|
params_ref nra2sat_p = p;
|
||||||
nra2sat_p.set_uint(":nla2bv-max-bv-size", p.get_uint("nla2bv_max_bv_size", bv_size));
|
nra2sat_p.set_uint("nla2bv_max_bv_size", p.get_uint("nla2bv_max_bv_size", bv_size));
|
||||||
|
|
||||||
return and_then(mk_nla2bv_tactic(m, nra2sat_p),
|
return and_then(mk_nla2bv_tactic(m, nra2sat_p),
|
||||||
mk_smt_tactic(),
|
mk_smt_tactic(),
|
||||||
|
@ -34,11 +34,11 @@ static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigne
|
||||||
|
|
||||||
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
|
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
|
||||||
params_ref p1 = p;
|
params_ref p1 = p;
|
||||||
p1.set_uint(":seed", 11);
|
p1.set_uint("seed", 11);
|
||||||
p1.set_bool(":factor", false);
|
p1.set_bool("factor", false);
|
||||||
params_ref p2 = p;
|
params_ref p2 = p;
|
||||||
p2.set_uint(":seed", 13);
|
p2.set_uint("seed", 13);
|
||||||
p2.set_bool(":factor", false);
|
p2.set_bool("factor", false);
|
||||||
|
|
||||||
return and_then(mk_simplify_tactic(m, p),
|
return and_then(mk_simplify_tactic(m, p),
|
||||||
mk_propagate_values_tactic(m, p),
|
mk_propagate_values_tactic(m, p),
|
||||||
|
|
|
@ -26,9 +26,9 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfuf_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfuf_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref s2_p;
|
params_ref s2_p;
|
||||||
s2_p.set_bool(":pull-cheap-ite", true);
|
s2_p.set_bool("pull_cheap_ite", true);
|
||||||
s2_p.set_bool(":local-ctx", true);
|
s2_p.set_bool("local_ctx", true);
|
||||||
s2_p.set_uint(":local-ctx-limit", 10000000);
|
s2_p.set_uint("local_ctx_limit", 10000000);
|
||||||
return and_then(mk_simplify_tactic(m, p),
|
return and_then(mk_simplify_tactic(m, p),
|
||||||
mk_propagate_values_tactic(m, p),
|
mk_propagate_values_tactic(m, p),
|
||||||
mk_solve_eqs_tactic(m, p),
|
mk_solve_eqs_tactic(m, p),
|
||||||
|
|
|
@ -28,8 +28,8 @@ Notes:
|
||||||
|
|
||||||
tactic * mk_qfufbv_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_qfufbv_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p;
|
params_ref main_p;
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":blast-distinct", true);
|
main_p.set_bool("blast_distinct", true);
|
||||||
|
|
||||||
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
tactic * preamble_st = and_then(mk_simplify_tactic(m),
|
||||||
mk_propagate_values_tactic(m),
|
mk_propagate_values_tactic(m),
|
||||||
|
|
|
@ -27,13 +27,13 @@ Revision History:
|
||||||
|
|
||||||
static tactic * mk_quant_preprocessor(ast_manager & m, bool disable_gaussian = false) {
|
static tactic * mk_quant_preprocessor(ast_manager & m, bool disable_gaussian = false) {
|
||||||
params_ref pull_ite_p;
|
params_ref pull_ite_p;
|
||||||
pull_ite_p.set_bool(":pull-cheap-ite", true);
|
pull_ite_p.set_bool("pull_cheap_ite", true);
|
||||||
pull_ite_p.set_bool(":local-ctx", true);
|
pull_ite_p.set_bool("local_ctx", true);
|
||||||
pull_ite_p.set_uint(":local-ctx-limit", 10000000);
|
pull_ite_p.set_uint("local_ctx_limit", 10000000);
|
||||||
|
|
||||||
params_ref ctx_simp_p;
|
params_ref ctx_simp_p;
|
||||||
ctx_simp_p.set_uint(":max-depth", 30);
|
ctx_simp_p.set_uint("max_depth", 30);
|
||||||
ctx_simp_p.set_uint(":max-steps", 5000000);
|
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||||
|
|
||||||
tactic * solve_eqs;
|
tactic * solve_eqs;
|
||||||
if (disable_gaussian)
|
if (disable_gaussian)
|
||||||
|
@ -71,8 +71,8 @@ tactic * mk_uflra_tactic(ast_manager & m, params_ref const & p) {
|
||||||
|
|
||||||
tactic * mk_auflia_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_auflia_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref qi_p;
|
params_ref qi_p;
|
||||||
qi_p.set_str(":qi-cost", "0");
|
qi_p.set_str("qi.cost", "0");
|
||||||
TRACE("qi_cost", qi_p.display(tout); tout << "\n" << qi_p.get_str("qi_cost", "<null>") << "\n";);
|
TRACE("qi_cost", qi_p.display(tout); tout << "\n" << qi_p.get_str("qi.cost", "<null>") << "\n";);
|
||||||
tactic * st = and_then(mk_no_solve_eq_preprocessor(m),
|
tactic * st = and_then(mk_no_solve_eq_preprocessor(m),
|
||||||
or_else(and_then(fail_if(mk_gt(mk_num_exprs_probe(), mk_const_probe(static_cast<double>(128)))),
|
or_else(and_then(fail_if(mk_gt(mk_num_exprs_probe(), mk_const_probe(static_cast<double>(128)))),
|
||||||
using_params(mk_smt_tactic(), qi_p),
|
using_params(mk_smt_tactic(), qi_p),
|
||||||
|
|
|
@ -37,7 +37,7 @@ tactic * mk_der_fp_tactic(ast_manager & m, params_ref const & p) {
|
||||||
|
|
||||||
tactic * mk_ufbv_preprocessor_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_ufbv_preprocessor_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref no_elim_and(p);
|
params_ref no_elim_and(p);
|
||||||
no_elim_and.set_bool(":elim-and", false);
|
no_elim_and.set_bool("elim_and", false);
|
||||||
|
|
||||||
return and_then(
|
return and_then(
|
||||||
mk_trace_tactic("ufbv_pre"),
|
mk_trace_tactic("ufbv_pre"),
|
||||||
|
@ -61,10 +61,10 @@ tactic * mk_ufbv_preprocessor_tactic(ast_manager & m, params_ref const & p) {
|
||||||
|
|
||||||
tactic * mk_ufbv_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_ufbv_tactic(ast_manager & m, params_ref const & p) {
|
||||||
params_ref main_p(p);
|
params_ref main_p(p);
|
||||||
main_p.set_bool(":mbqi", true);
|
main_p.set_bool("mbqi", true);
|
||||||
main_p.set_uint(":mbqi-max-iterations", -1);
|
main_p.set_uint("mbqi_max_iterations", -1);
|
||||||
main_p.set_bool(":elim-and", true);
|
main_p.set_bool("elim_and", true);
|
||||||
main_p.set_bool(":solver", true);
|
main_p.set_bool("solver", true);
|
||||||
|
|
||||||
tactic * t = and_then(repeat(mk_ufbv_preprocessor_tactic(m, main_p), 2),
|
tactic * t = and_then(repeat(mk_ufbv_preprocessor_tactic(m, main_p), 2),
|
||||||
mk_smt_tactic_using(false, main_p));
|
mk_smt_tactic_using(false, main_p));
|
||||||
|
|
|
@ -72,9 +72,9 @@ void tst_dl_context() {
|
||||||
|
|
||||||
params_ref params;
|
params_ref params;
|
||||||
for(unsigned rel_index=0; rel_index<rel_cnt; rel_index++) {
|
for(unsigned rel_index=0; rel_index<rel_cnt; rel_index++) {
|
||||||
params.set_sym(":default-relation", relations[rel_index]);
|
params.set_sym("default_relation", relations[rel_index]);
|
||||||
for(int eager_checking=1; eager_checking>=0; eager_checking--) {
|
for(int eager_checking=1; eager_checking>=0; eager_checking--) {
|
||||||
params.set_bool(":eager-emptiness-checking", eager_checking!=0);
|
params.set_bool("eager_emptiness_checking", eager_checking!=0);
|
||||||
|
|
||||||
std::cerr << "Testing " << relations[rel_index] << "\n";
|
std::cerr << "Testing " << relations[rel_index] << "\n";
|
||||||
std::cerr << "Eager emptiness checking " << (eager_checking!=0 ? "on" : "off") << "\n";
|
std::cerr << "Eager emptiness checking " << (eager_checking!=0 ? "on" : "off") << "\n";
|
||||||
|
|
|
@ -344,7 +344,7 @@ void tst_dl_product_relation() {
|
||||||
|
|
||||||
test_functional_columns(fparams, params);
|
test_functional_columns(fparams, params);
|
||||||
|
|
||||||
params.set_sym(":default-relation", symbol("tr_sparse"));
|
params.set_sym("default_relation", symbol("tr_sparse"));
|
||||||
test_finite_product_relation(fparams, params);
|
test_finite_product_relation(fparams, params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,13 @@ void dl_query_test(ast_manager & m, smt_params & fparams, params_ref& params,
|
||||||
|
|
||||||
dl_decl_util decl_util(m);
|
dl_decl_util decl_util(m);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
context ctx_q(m, fparams);
|
context ctx_q(m, fparams);
|
||||||
params.set_bool(":magic-sets-for-queries", use_magic_sets);
|
params.set_bool(":magic-sets-for-queries", use_magic_sets);
|
||||||
|
=======
|
||||||
|
context ctx_q(m, fparams);
|
||||||
|
params.set_bool("magic_sets_for_queries", use_magic_sets);
|
||||||
|
>>>>>>> 3736c5ea3b97521dad85cdc6262151fae2875ec5
|
||||||
ctx_q.updt_params(params);
|
ctx_q.updt_params(params);
|
||||||
{
|
{
|
||||||
parser* p = parser::create(ctx_q,m);
|
parser* p = parser::create(ctx_q,m);
|
||||||
|
@ -125,7 +130,7 @@ void dl_query_test(ast_manager & m, smt_params & fparams, params_ref& params,
|
||||||
}
|
}
|
||||||
|
|
||||||
void dl_query_test_wpa(smt_params & fparams, params_ref& params) {
|
void dl_query_test_wpa(smt_params & fparams, params_ref& params) {
|
||||||
params.set_bool(":magic-sets-for-queries", true);
|
params.set_bool("magic_sets_for_queries", true);
|
||||||
ast_manager m;
|
ast_manager m;
|
||||||
reg_decl_plugins(m);
|
reg_decl_plugins(m);
|
||||||
arith_util arith(m);
|
arith_util arith(m);
|
||||||
|
@ -185,8 +190,8 @@ void dl_query_test_wpa(smt_params & fparams, params_ref& params) {
|
||||||
void tst_dl_query() {
|
void tst_dl_query() {
|
||||||
smt_params fparams;
|
smt_params fparams;
|
||||||
params_ref params;
|
params_ref params;
|
||||||
params.set_sym(":default-table", symbol("sparse"));
|
params.set_sym("default_table", symbol("sparse"));
|
||||||
params.set_sym(":default-relation", symbol("tr_sparse"));
|
params.set_sym("default_relation", symbol("tr_sparse"));
|
||||||
|
|
||||||
//params.m_dl_default_table = symbol("hashtable");
|
//params.m_dl_default_table = symbol("hashtable");
|
||||||
//params.m_dl_default_relation = symbol("tr_hashtable");
|
//params.m_dl_default_relation = symbol("tr_hashtable");
|
||||||
|
@ -212,9 +217,9 @@ void tst_dl_query() {
|
||||||
ctx_base.get_rel_context().saturate();
|
ctx_base.get_rel_context().saturate();
|
||||||
|
|
||||||
for(unsigned use_restarts=0; use_restarts<=1; use_restarts++) {
|
for(unsigned use_restarts=0; use_restarts<=1; use_restarts++) {
|
||||||
params.set_uint(":initial-restart-timeout", use_restarts ? 100 : 0);
|
params.set_uint("initial_restart_timeout", use_restarts ? 100 : 0);
|
||||||
for(unsigned use_similar=0; use_similar<=1; use_similar++) {
|
for(unsigned use_similar=0; use_similar<=1; use_similar++) {
|
||||||
params.set_uint(":similarity-compressor", use_similar != 0);
|
params.set_uint("similarity_compressor", use_similar != 0);
|
||||||
|
|
||||||
for(unsigned use_magic_sets=0; use_magic_sets<=1; use_magic_sets++) {
|
for(unsigned use_magic_sets=0; use_magic_sets<=1; use_magic_sets++) {
|
||||||
stopwatch watch;
|
stopwatch watch;
|
||||||
|
|
|
@ -22,6 +22,7 @@ Revision History:
|
||||||
#endif
|
#endif
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include"str_hashtable.h"
|
#include"str_hashtable.h"
|
||||||
|
#include"z3_exception.h"
|
||||||
|
|
||||||
volatile bool g_enable_assertions = true;
|
volatile bool g_enable_assertions = true;
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ void invoke_gdb() {
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int * x = 0;
|
int * x = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
std::cerr << "(C)ontinue, (A)bort, (S)top, Invoke (G)DB\n";
|
std::cerr << "(C)ontinue, (A)bort, (S)top, (T)hrow exception, Invoke (G)DB\n";
|
||||||
char result;
|
char result;
|
||||||
std::cin >> result;
|
std::cin >> result;
|
||||||
switch(result) {
|
switch(result) {
|
||||||
|
@ -88,6 +89,9 @@ void invoke_gdb() {
|
||||||
// force seg fault...
|
// force seg fault...
|
||||||
*x = 0;
|
*x = 0;
|
||||||
return;
|
return;
|
||||||
|
case 't':
|
||||||
|
case 'T':
|
||||||
|
throw default_exception("assertion violation");
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'g':
|
case 'g':
|
||||||
sprintf(buffer, "gdb -nw /proc/%d/exe %d", getpid(), getpid());
|
sprintf(buffer, "gdb -nw /proc/%d/exe %d", getpid(), getpid());
|
||||||
|
|
|
@ -35,6 +35,47 @@ bool is_old_param_name(symbol const & name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char const * g_params_renames[] = {
|
||||||
|
"proof_mode", "proof",
|
||||||
|
"soft_timeout", "timeout",
|
||||||
|
"mbqi", "smt.mbqi",
|
||||||
|
"relevancy", "smt.relevancy",
|
||||||
|
"ematching", "smt.ematching",
|
||||||
|
"macro_finder", "smt.macro_finder",
|
||||||
|
"delay_units", "smt.delay_units",
|
||||||
|
"case_split", "smt.case_split",
|
||||||
|
"phase_selection", "smt.phase_selection",
|
||||||
|
"restart_strategy", "smt.restart_strategy",
|
||||||
|
"restart_factor", "smt.restart_factor",
|
||||||
|
"arith_random_initial_value", "smt.arith.random_initial_value",
|
||||||
|
"bv_reflect", "smt.bv.reflect",
|
||||||
|
"qi_cost", "smt.qi.cost",
|
||||||
|
"qi_eager_threshold", "smt.qi.eager_threshold",
|
||||||
|
"nl_arith", "smt.arith.nl",
|
||||||
|
"nnf_sk_hack", "nnf.sk_hack",
|
||||||
|
"model_v2", "model.v2",
|
||||||
|
"pi_non_nested_arith_weight", "pi.non_nested_arith_weight",
|
||||||
|
"pi_warnings", "pi.warnings",
|
||||||
|
"pp_decimal", "pp.decimal",
|
||||||
|
"pp_decimal", "pp.decimal_precision",
|
||||||
|
"pp_bv_literals", "pp.bv_literals",
|
||||||
|
"pp_bv_neg", "pp.bv_neg",
|
||||||
|
"pp_max_depth", "pp.max_depth",
|
||||||
|
"pp_min_alias_size", "pp.min_alias_size",
|
||||||
|
0 };
|
||||||
|
|
||||||
|
char const * get_new_param_name(symbol const & p) {
|
||||||
|
char const * const * it = g_params_renames;
|
||||||
|
while (*it) {
|
||||||
|
if (p == *it) {
|
||||||
|
it++;
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
it += 2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct gparams::imp {
|
struct gparams::imp {
|
||||||
bool m_modules_registered;
|
bool m_modules_registered;
|
||||||
dictionary<param_descrs*> m_module_param_descrs;
|
dictionary<param_descrs*> m_module_param_descrs;
|
||||||
|
@ -60,19 +101,24 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
~imp() {
|
~imp() {
|
||||||
{
|
reset();
|
||||||
dictionary<param_descrs*>::iterator it = m_module_param_descrs.begin();
|
dictionary<param_descrs*>::iterator it = m_module_param_descrs.begin();
|
||||||
dictionary<param_descrs*>::iterator end = m_module_param_descrs.end();
|
dictionary<param_descrs*>::iterator end = m_module_param_descrs.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
dealloc(it->m_value);
|
dealloc(it->m_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
#pragma omp critical (gparams)
|
||||||
{
|
{
|
||||||
|
m_params.reset();
|
||||||
dictionary<params_ref*>::iterator it = m_module_params.begin();
|
dictionary<params_ref*>::iterator it = m_module_params.begin();
|
||||||
dictionary<params_ref*>::iterator end = m_module_params.end();
|
dictionary<params_ref*>::iterator end = m_module_params.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
dealloc(it->m_value);
|
dealloc(it->m_value);
|
||||||
}
|
}
|
||||||
|
m_module_params.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +201,12 @@ public:
|
||||||
|
|
||||||
void throw_unknown_parameter(symbol const & param_name, symbol const & mod_name) {
|
void throw_unknown_parameter(symbol const & param_name, symbol const & mod_name) {
|
||||||
if (mod_name == symbol::null) {
|
if (mod_name == symbol::null) {
|
||||||
if (is_old_param_name(param_name)) {
|
char const * new_name = get_new_param_name(param_name);
|
||||||
|
if (new_name) {
|
||||||
|
throw exception("the parameter '%s' was renamed to '%s', invoke 'z3 -p' to obtain the new parameter list, and 'z3 -pp:%s' for the full description of the parameter",
|
||||||
|
param_name.bare_str(), new_name, new_name);
|
||||||
|
}
|
||||||
|
else if (is_old_param_name(param_name)) {
|
||||||
throw exception("unknown parameter '%s', this is an old parameter name, invoke 'z3 -p' to obtain the new parameter list",
|
throw exception("unknown parameter '%s', this is an old parameter name, invoke 'z3 -p' to obtain the new parameter list",
|
||||||
param_name.bare_str());
|
param_name.bare_str());
|
||||||
}
|
}
|
||||||
|
@ -178,6 +229,11 @@ public:
|
||||||
long val = strtol(value, 0, 10);
|
long val = strtol(value, 0, 10);
|
||||||
ps.set_uint(param_name, static_cast<unsigned>(val));
|
ps.set_uint(param_name, static_cast<unsigned>(val));
|
||||||
}
|
}
|
||||||
|
else if (k == CPK_DOUBLE) {
|
||||||
|
char * aux;
|
||||||
|
double val = strtod(value, &aux);
|
||||||
|
ps.set_double(param_name, val);
|
||||||
|
}
|
||||||
else if (k == CPK_BOOL) {
|
else if (k == CPK_BOOL) {
|
||||||
if (strcmp(value, "true") == 0) {
|
if (strcmp(value, "true") == 0) {
|
||||||
ps.set_bool(param_name, true);
|
ps.set_bool(param_name, true);
|
||||||
|
@ -196,7 +252,16 @@ public:
|
||||||
ps.set_sym(param_name, symbol(value));
|
ps.set_sym(param_name, symbol(value));
|
||||||
}
|
}
|
||||||
else if (k == CPK_STRING) {
|
else if (k == CPK_STRING) {
|
||||||
ps.set_str(param_name, value);
|
// There is no guarantee that (external) callers will not delete value after invoking gparams::set.
|
||||||
|
// I see two solutions:
|
||||||
|
// 1) Modify params_ref to create a copy of set_str parameters.
|
||||||
|
// This solution is not nice since we create copies and move the params_ref around.
|
||||||
|
// We would have to keep copying the strings.
|
||||||
|
// Moreover, when we use params_ref internally, the value is usually a static value.
|
||||||
|
// So, we would be paying this price for nothing.
|
||||||
|
// 2) "Copy" value by transforming it into a symbol.
|
||||||
|
// I'm using this solution for now.
|
||||||
|
ps.set_str(param_name, symbol(value).bare_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mod_name == symbol::null)
|
if (mod_name == symbol::null)
|
||||||
|
@ -434,6 +499,11 @@ public:
|
||||||
|
|
||||||
gparams::imp * gparams::g_imp = 0;
|
gparams::imp * gparams::g_imp = 0;
|
||||||
|
|
||||||
|
void gparams::reset() {
|
||||||
|
SASSERT(g_imp != 0);
|
||||||
|
g_imp->reset();
|
||||||
|
}
|
||||||
|
|
||||||
void gparams::set(char const * name, char const * value) {
|
void gparams::set(char const * name, char const * value) {
|
||||||
TRACE("gparams", tout << "setting [" << name << "] <- '" << value << "'\n";);
|
TRACE("gparams", tout << "setting [" << name << "] <- '" << value << "'\n";);
|
||||||
SASSERT(g_imp != 0);
|
SASSERT(g_imp != 0);
|
||||||
|
|
|
@ -27,6 +27,11 @@ class gparams {
|
||||||
public:
|
public:
|
||||||
typedef default_exception exception;
|
typedef default_exception exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Reset all global and module parameters.
|
||||||
|
*/
|
||||||
|
static void reset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Set a global parameter \c name with \c value.
|
\brief Set a global parameter \c name with \c value.
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,29 @@ Notes:
|
||||||
#include"symbol.h"
|
#include"symbol.h"
|
||||||
#include"dictionary.h"
|
#include"dictionary.h"
|
||||||
|
|
||||||
|
std::string norm_param_name(char const * n) {
|
||||||
|
if (n == 0)
|
||||||
|
return "_";
|
||||||
|
if (*n == ':')
|
||||||
|
n++;
|
||||||
|
std::string r = n;
|
||||||
|
unsigned sz = r.size();
|
||||||
|
if (sz == 0)
|
||||||
|
return "_";
|
||||||
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
|
char curr = r[i];
|
||||||
|
if ('A' <= curr && curr <= 'Z')
|
||||||
|
r[i] = curr - 'A' + 'a';
|
||||||
|
else if (curr == '-' || curr == ':')
|
||||||
|
r[i] = '_';
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string norm_param_name(symbol const & n) {
|
||||||
|
return norm_param_name(n.bare_str());
|
||||||
|
}
|
||||||
|
|
||||||
struct param_descrs::imp {
|
struct param_descrs::imp {
|
||||||
struct info {
|
struct info {
|
||||||
param_kind m_kind;
|
param_kind m_kind;
|
||||||
|
|
|
@ -22,6 +22,9 @@ Notes:
|
||||||
#include"cmd_context_types.h"
|
#include"cmd_context_types.h"
|
||||||
#include"vector.h"
|
#include"vector.h"
|
||||||
|
|
||||||
|
std::string norm_param_name(char const * n);
|
||||||
|
std::string norm_param_name(symbol const & n);
|
||||||
|
|
||||||
typedef cmd_arg_kind param_kind;
|
typedef cmd_arg_kind param_kind;
|
||||||
|
|
||||||
class params;
|
class params;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue