@@ -57,6 +57,35 @@ void SMTSolverCommand::setCvc5(std::optional<unsigned int> timeoutInMilliseconds
57
57
}
58
58
}
59
59
60
+ void SMTSolverCommand::setZ3 (std::optional<unsigned int > timeoutInMilliseconds, bool _preprocessing, bool _computeInvariants)
61
+ {
62
+ constexpr int Z3ResourceLimit = 2000000 ;
63
+ m_arguments.clear ();
64
+ m_solverCmd = " z3" ;
65
+ m_arguments.emplace_back (" -in" ); // Read from standard input
66
+ m_arguments.emplace_back (" -smt2" ); // Expect input in SMT-LIB2 format
67
+ if (_computeInvariants)
68
+ m_arguments.emplace_back (" -model" ); // Output model automatically after check-sat
69
+ if (timeoutInMilliseconds)
70
+ m_arguments.emplace_back (" -t:" + std::to_string (timeoutInMilliseconds.value ()));
71
+ else
72
+ m_arguments.emplace_back (" rlimit=" + std::to_string (Z3ResourceLimit));
73
+
74
+ // These options have been empirically established to be helpful
75
+ m_arguments.emplace_back (" rewriter.pull_cheap_ite=true" );
76
+ m_arguments.emplace_back (" fp.spacer.q3.use_qgen=true" );
77
+ m_arguments.emplace_back (" fp.spacer.mbqi=false" );
78
+ m_arguments.emplace_back (" fp.spacer.ground_pobs=false" );
79
+
80
+ // Spacer optimization should be
81
+ // - enabled for better solving (default)
82
+ // - disable for counterexample generation
83
+ std::string preprocessingArg = _preprocessing ? " true" : " false" ;
84
+ m_arguments.emplace_back (" fp.xform.slice=" + preprocessingArg);
85
+ m_arguments.emplace_back (" fp.xform.inline_linear=" + preprocessingArg);
86
+ m_arguments.emplace_back (" fp.xform.inline_eager=" + preprocessingArg);
87
+ }
88
+
60
89
ReadCallback::Result SMTSolverCommand::solve (std::string const & _kind, std::string const & _query) const
61
90
{
62
91
try
0 commit comments