mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 03:15:50 +00:00
Merge branch 'str-at-semantics' into develop
This commit is contained in:
commit
94d5f242b8
35 changed files with 799 additions and 66 deletions
|
@ -2175,6 +2175,50 @@ namespace z3 {
|
|||
};
|
||||
inline std::ostream & operator<<(std::ostream & out, optimize const & s) { out << Z3_optimize_to_string(s.ctx(), s.m_opt); return out; }
|
||||
|
||||
class fixedpoint : public object {
|
||||
Z3_fixedpoint m_fp;
|
||||
public:
|
||||
fixedpoint(context& c):object(c) { m_fp = Z3_mk_fixedpoint(c); Z3_fixedpoint_inc_ref(c, m_fp); }
|
||||
~fixedpoint() { Z3_fixedpoint_dec_ref(ctx(), m_fp); }
|
||||
operator Z3_fixedpoint() const { return m_fp; }
|
||||
void from_string(char const* s) { Z3_fixedpoint_from_string(ctx(), m_fp, s); check_error(); }
|
||||
void from_file(char const* s) { Z3_fixedpoint_from_file(ctx(), m_fp, s); check_error(); }
|
||||
void add_rule(expr& rule, symbol const& name) { Z3_fixedpoint_add_rule(ctx(), m_fp, rule, name); check_error(); }
|
||||
void add_fact(func_decl& f, unsigned * args) { Z3_fixedpoint_add_fact(ctx(), m_fp, f, f.arity(), args); check_error(); }
|
||||
check_result query(expr& q) { Z3_lbool r = Z3_fixedpoint_query(ctx(), m_fp, q); check_error(); to_check_result(r); }
|
||||
check_result query(func_decl_vector& relations) {
|
||||
array<Z3_func_decl> rs(relations);
|
||||
Z3_lbool r = Z3_fixedpoint_query_relations(ctx(), m_fp, rs.size(), rs.ptr());
|
||||
check_error();
|
||||
return to_check_result(r);
|
||||
}
|
||||
expr get_answer() { Z3_ast r = Z3_fixedpoint_get_answer(ctx(), m_fp); check_error(); return expr(ctx(), r); }
|
||||
std::string reason_unknown() { return Z3_fixedpoint_get_reason_unknown(ctx(), m_fp); }
|
||||
void update_rule(expr& rule, symbol const& name) { Z3_fixedpoint_update_rule(ctx(), m_fp, rule, name); check_error(); }
|
||||
unsigned get_num_levels(func_decl& p) { unsigned r = Z3_fixedpoint_get_num_levels(ctx(), m_fp, p); check_error(); return r; }
|
||||
expr get_cover_delta(int level, func_decl& p) {
|
||||
Z3_ast r = Z3_fixedpoint_get_cover_delta(ctx(), m_fp, level, p);
|
||||
check_error();
|
||||
return expr(ctx(), r);
|
||||
}
|
||||
void add_cover(int level, func_decl& p, expr& property) { Z3_fixedpoint_add_cover(ctx(), m_fp, level, p, property); check_error(); }
|
||||
stats statistics() const { Z3_stats r = Z3_fixedpoint_get_statistics(ctx(), m_fp); check_error(); return stats(ctx(), r); }
|
||||
void register_relation(func_decl& p) { Z3_fixedpoint_register_relation(ctx(), m_fp, p); }
|
||||
expr_vector assertions() const { Z3_ast_vector r = Z3_fixedpoint_get_assertions(ctx(), m_fp); check_error(); return expr_vector(ctx(), r); }
|
||||
expr_vector rules() const { Z3_ast_vector r = Z3_fixedpoint_get_rules(ctx(), m_fp); check_error(); return expr_vector(ctx(), r); }
|
||||
void set(params const & p) { Z3_fixedpoint_set_params(ctx(), m_fp, p); check_error(); }
|
||||
std::string help() const { return Z3_fixedpoint_get_help(ctx(), m_fp); }
|
||||
param_descrs get_param_descrs() { return param_descrs(ctx(), Z3_fixedpoint_get_param_descrs(ctx(), m_fp)); }
|
||||
std::string to_string() { return Z3_fixedpoint_to_string(ctx(), m_fp, 0, 0); }
|
||||
std::string to_string(expr_vector const& queries) {
|
||||
array<Z3_ast> qs(queries);
|
||||
return Z3_fixedpoint_to_string(ctx(), m_fp, qs.size(), qs.ptr());
|
||||
}
|
||||
void push() { Z3_fixedpoint_push(ctx(), m_fp); check_error(); }
|
||||
void pop() { Z3_fixedpoint_pop(ctx(), m_fp); check_error(); }
|
||||
};
|
||||
inline std::ostream & operator<<(std::ostream & out, fixedpoint const & f) { return out << Z3_fixedpoint_to_string(f.ctx(), f, 0, 0); }
|
||||
|
||||
inline tactic fail_if(probe const & p) {
|
||||
Z3_tactic r = Z3_tactic_fail_if(p.ctx(), p);
|
||||
p.check_error();
|
||||
|
|
|
@ -7204,7 +7204,7 @@ def With(t, *args, **keys):
|
|||
>>> t((x + 1)*(y + 2) == 0)
|
||||
[[2*x + y + x*y == -2]]
|
||||
"""
|
||||
ctx = keys.get('ctx', None)
|
||||
ctx = keys.pop('ctx', None)
|
||||
t = _to_tactic(t, ctx)
|
||||
p = args2params(args, keys, t.ctx)
|
||||
return Tactic(Z3_tactic_using_params(t.ctx.ref(), t.tactic, p.params), t.ctx)
|
||||
|
|
|
@ -836,7 +836,7 @@ func_decl * fpa_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters,
|
|||
return mk_to_ieee_bv(k, num_parameters, parameters, arity, domain, range);
|
||||
|
||||
case OP_FPA_INTERNAL_BVWRAP:
|
||||
return mk_internal_bv_wrap(k, num_parameters, parameters, arity, domain, range);
|
||||
return mk_internal_bv_wrap(k, num_parameters, parameters, arity, domain, range);
|
||||
case OP_FPA_INTERNAL_BV2RM:
|
||||
return mk_internal_bv2rm(k, num_parameters, parameters, arity, domain, range);
|
||||
|
||||
|
@ -915,7 +915,7 @@ void fpa_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol cons
|
|||
op_names.push_back(builtin_name("to_fp_unsigned", OP_FPA_TO_FP_UNSIGNED));
|
||||
|
||||
/* Extensions */
|
||||
op_names.push_back(builtin_name("to_ieee_bv", OP_FPA_TO_IEEE_BV));
|
||||
op_names.push_back(builtin_name("to_ieee_bv", OP_FPA_TO_IEEE_BV));
|
||||
op_names.push_back(builtin_name("fp.to_ieee_bv", OP_FPA_TO_IEEE_BV));
|
||||
}
|
||||
|
||||
|
|
|
@ -315,6 +315,8 @@ protected:
|
|||
template<bool ProofGen>
|
||||
void process_app(app * t, frame & fr);
|
||||
|
||||
bool constant_fold(app* t, frame& fr);
|
||||
|
||||
template<bool ProofGen>
|
||||
void process_quantifier(quantifier * q, frame & fr);
|
||||
|
||||
|
|
|
@ -174,6 +174,38 @@ bool rewriter_tpl<Config>::visit(expr * t, unsigned max_depth) {
|
|||
}
|
||||
}
|
||||
|
||||
template<typename Config>
|
||||
bool rewriter_tpl<Config>::constant_fold(app * t, frame & fr) {
|
||||
if (fr.m_i == 1 && m().is_ite(t)) {
|
||||
expr * cond = result_stack()[fr.m_spos].get();
|
||||
expr* arg = 0;
|
||||
if (m().is_true(cond)) {
|
||||
arg = t->get_arg(1);
|
||||
}
|
||||
else if (m().is_false(cond)) {
|
||||
arg = t->get_arg(2);
|
||||
}
|
||||
if (arg) {
|
||||
result_stack().shrink(fr.m_spos);
|
||||
result_stack().push_back(arg);
|
||||
fr.m_state = REWRITE_BUILTIN;
|
||||
unsigned max_depth = fr.m_max_depth;
|
||||
if (visit<false>(arg, fr.m_max_depth)) {
|
||||
m_r = result_stack().back();
|
||||
result_stack().pop_back();
|
||||
result_stack().pop_back();
|
||||
result_stack().push_back(m_r);
|
||||
cache_result<false>(t, m_r, m_pr, fr.m_cache_result);
|
||||
frame_stack().pop_back();
|
||||
set_new_child_flag(t);
|
||||
}
|
||||
m_r = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Config>
|
||||
template<bool ProofGen>
|
||||
void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
||||
|
@ -183,10 +215,15 @@ void rewriter_tpl<Config>::process_app(app * t, frame & fr) {
|
|||
case PROCESS_CHILDREN: {
|
||||
unsigned num_args = t->get_num_args();
|
||||
while (fr.m_i < num_args) {
|
||||
if (!ProofGen && constant_fold(t, fr)) {
|
||||
return;
|
||||
}
|
||||
expr * arg = t->get_arg(fr.m_i);
|
||||
fr.m_i++;
|
||||
if (!visit<ProofGen>(arg, fr.m_max_depth))
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
func_decl * f = t->get_decl();
|
||||
|
||||
|
|
|
@ -632,14 +632,25 @@ br_status seq_rewriter::mk_seq_contains(expr* a, expr* b, expr_ref& result) {
|
|||
return BR_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
* (str.at s i), constants s/i, i < 0 or i >= |s| ==> (str.at s i) = ""
|
||||
*/
|
||||
br_status seq_rewriter::mk_seq_at(expr* a, expr* b, expr_ref& result) {
|
||||
zstring c;
|
||||
rational r;
|
||||
if (m_util.str.is_string(a, c) && m_autil.is_numeral(b, r) && r.is_unsigned()) {
|
||||
unsigned j = r.get_unsigned();
|
||||
if (j < c.length()) {
|
||||
result = m_util.str.mk_string(c.extract(j, 1));
|
||||
if (m_util.str.is_string(a, c) && m_autil.is_numeral(b, r)) {
|
||||
if (r.is_neg()) {
|
||||
result = m_util.str.mk_string(symbol(""));
|
||||
return BR_DONE;
|
||||
} else if (r.is_unsigned()) {
|
||||
unsigned j = r.get_unsigned();
|
||||
if (j < c.length()) {
|
||||
result = m_util.str.mk_string(c.extract(j, 1));
|
||||
return BR_DONE;
|
||||
} else {
|
||||
result = m_util.str.mk_string(symbol(""));
|
||||
return BR_DONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return BR_FAILED;
|
||||
|
|
|
@ -1554,6 +1554,7 @@ void cmd_context::validate_model() {
|
|||
p.set_uint("sort_store", true);
|
||||
p.set_bool("completion", true);
|
||||
model_evaluator evaluator(*(md.get()), p);
|
||||
evaluator.set_expand_array_equalities(false);
|
||||
contains_array_op_proc contains_array(m());
|
||||
{
|
||||
scoped_rlimit _rlimit(m().limit(), 0);
|
||||
|
|
|
@ -50,6 +50,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
|
|||
unsigned m_max_steps;
|
||||
bool m_model_completion;
|
||||
bool m_cache;
|
||||
bool m_array_equalities;
|
||||
|
||||
evaluator_cfg(ast_manager & m, model_core & md, params_ref const & p):
|
||||
m_model(md),
|
||||
|
@ -81,6 +82,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
|
|||
m_max_steps = p.max_steps();
|
||||
m_model_completion = p.completion();
|
||||
m_cache = p.cache();
|
||||
m_array_equalities = p.array_equalities();
|
||||
}
|
||||
|
||||
ast_manager & m() const { return m_model.get_manager(); }
|
||||
|
@ -264,11 +266,14 @@ struct evaluator_cfg : public default_rewriter_cfg {
|
|||
|
||||
|
||||
br_status mk_array_eq(expr* a, expr* b, expr_ref& result) {
|
||||
return BR_FAILED;
|
||||
if (a == b) {
|
||||
result = m().mk_true();
|
||||
return BR_DONE;
|
||||
}
|
||||
if (!m_array_equalities) {
|
||||
return BR_FAILED;
|
||||
}
|
||||
|
||||
// disabled until made more efficient
|
||||
vector<expr_ref_vector> stores1, stores2;
|
||||
bool args_are_unique1, args_are_unique2;
|
||||
|
@ -508,6 +513,10 @@ void model_evaluator::set_model_completion(bool f) {
|
|||
m_imp->cfg().m_model_completion = f;
|
||||
}
|
||||
|
||||
void model_evaluator::set_expand_array_equalities(bool f) {
|
||||
m_imp->cfg().m_array_equalities = f;
|
||||
}
|
||||
|
||||
unsigned model_evaluator::get_num_steps() const {
|
||||
return m_imp->get_num_steps();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
ast_manager & m () const;
|
||||
void set_model_completion(bool f);
|
||||
void set_expand_array_equalities(bool f);
|
||||
|
||||
void updt_params(params_ref const & p);
|
||||
static void get_param_descrs(param_descrs & r);
|
||||
|
|
|
@ -3,6 +3,7 @@ def_module_params('model_evaluator',
|
|||
params=(max_memory_param(),
|
||||
max_steps_param(),
|
||||
('completion', BOOL, False, 'assigns an interptetation to symbols that do not have one in the current model, when evaluating expressions in the current model'),
|
||||
('cache', BOOL, True, 'cache intermediate results in the model evaluator')
|
||||
('cache', BOOL, True, 'cache intermediate results in the model evaluator'),
|
||||
('array_equalities', BOOL, True, 'evaluate array equalities')
|
||||
))
|
||||
|
||||
|
|
|
@ -1002,7 +1002,8 @@ namespace opt {
|
|||
TRACE("opt", tout << "Term does not evaluate " << term << "\n";);
|
||||
return false;
|
||||
}
|
||||
if (!m_arith.is_numeral(val, r)) {
|
||||
unsigned bvsz;
|
||||
if (!m_arith.is_numeral(val, r) && !m_bv.is_numeral(val, r, bvsz)) {
|
||||
TRACE("opt", tout << "model does not evaluate objective to a value\n";);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3942,7 +3942,7 @@ namespace smt {
|
|||
#endif
|
||||
|
||||
virtual void on_match(quantifier * qa, app * pat, unsigned num_bindings, enode * const * bindings, unsigned max_generation, ptr_vector<enode> & used_enodes) {
|
||||
TRACE("trigger_bug", tout << "found match\n";);
|
||||
TRACE("trigger_bug", tout << "found match " << mk_pp(qa, m_ast_manager) << "\n";);
|
||||
#ifdef Z3DEBUG
|
||||
if (m_check_missing_instances) {
|
||||
if (!m_context.slow_contains_instance(qa, num_bindings, bindings)) {
|
||||
|
|
|
@ -93,6 +93,7 @@ bool proto_model::is_select_of_model_value(expr* e) const {
|
|||
|
||||
bool proto_model::eval(expr * e, expr_ref & result, bool model_completion) {
|
||||
m_eval.set_model_completion(model_completion);
|
||||
m_eval.set_expand_array_equalities(false);
|
||||
try {
|
||||
m_eval(e, result);
|
||||
#if 0
|
||||
|
|
|
@ -306,7 +306,6 @@ namespace smt {
|
|||
TRACE("assign_core", tout << (decision?"decision: ":"propagating: ") << l << " ";
|
||||
display_literal_verbose(tout, l); tout << " level: " << m_scope_lvl << "\n";
|
||||
display(tout, j););
|
||||
SASSERT(l.var() < static_cast<int>(m_b_internalized_stack.size()));
|
||||
m_assigned_literals.push_back(l);
|
||||
m_assignment[l.index()] = l_true;
|
||||
m_assignment[(~l).index()] = l_false;
|
||||
|
@ -321,14 +320,23 @@ namespace smt {
|
|||
d.m_phase_available = true;
|
||||
d.m_phase = !l.sign();
|
||||
TRACE("phase_selection", tout << "saving phase, is_pos: " << d.m_phase << " l: " << l << "\n";);
|
||||
|
||||
TRACE("relevancy",
|
||||
tout << "is_atom: " << d.is_atom() << " is relevant: " << is_relevant_core(bool_var2expr(l.var())) << "\n";);
|
||||
if (d.is_atom() && (m_fparams.m_relevancy_lvl == 0 || (m_fparams.m_relevancy_lvl == 1 && !d.is_quantifier()) || is_relevant_core(bool_var2expr(l.var()))))
|
||||
tout << "is_atom: " << d.is_atom() << " is relevant: " << is_relevant_core(l) << "\n";);
|
||||
if (d.is_atom() && (m_fparams.m_relevancy_lvl == 0 || (m_fparams.m_relevancy_lvl == 1 && !d.is_quantifier()) || is_relevant_core(l)))
|
||||
m_atom_propagation_queue.push_back(l);
|
||||
|
||||
if (m_manager.has_trace_stream())
|
||||
trace_assign(l, j, decision);
|
||||
m_case_split_queue->assign_lit_eh(l);
|
||||
|
||||
// a unit is asserted at search level. Mark it as relevant.
|
||||
// this addresses bug... where a literal becomes fixed to true (false)
|
||||
// as a conflict gets assigned misses relevancy (and quantifier instantiation).
|
||||
//
|
||||
if (false && !decision && relevancy() && at_search_level() && !is_relevant_core(l)) {
|
||||
mark_as_relevant(l);
|
||||
}
|
||||
}
|
||||
|
||||
bool context::bcp() {
|
||||
|
@ -1637,7 +1645,7 @@ namespace smt {
|
|||
m_atom_propagation_queue.push_back(literal(v, val == l_false));
|
||||
}
|
||||
}
|
||||
TRACE("propagate_relevancy", tout << "marking as relevant:\n" << mk_bounded_pp(n, m_manager) << "\n";);
|
||||
TRACE("propagate_relevancy", tout << "marking as relevant:\n" << mk_bounded_pp(n, m_manager) << " " << m_scope_lvl << "\n";);
|
||||
#ifndef SMTCOMP
|
||||
m_case_split_queue->relevant_eh(n);
|
||||
#endif
|
||||
|
@ -3895,6 +3903,7 @@ namespace smt {
|
|||
// I invoke pop_scope_core instead of pop_scope because I don't want
|
||||
// to reset cached generations... I need them to rebuild the literals
|
||||
// of the new conflict clause.
|
||||
if (relevancy()) record_relevancy(num_lits, lits);
|
||||
unsigned num_bool_vars = pop_scope_core(m_scope_lvl - new_lvl);
|
||||
SASSERT(m_scope_lvl == new_lvl);
|
||||
// the logical context may still be in conflict after
|
||||
|
@ -3926,6 +3935,7 @@ namespace smt {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (relevancy()) restore_relevancy(num_lits, lits);
|
||||
// Resetting the cache manually because I did not invoke pop_scope, but pop_scope_core
|
||||
reset_cache_generation();
|
||||
TRACE("resolve_conflict_bug",
|
||||
|
@ -4008,6 +4018,28 @@ namespace smt {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
\brief we record and restore relevancy information for literals in conflict clauses.
|
||||
A literal may have been marked relevant within the scope that gets popped during
|
||||
conflict resolution. In this case, the literal is no longer marked as relevant after
|
||||
the pop. This can cause quantifier instantiation to miss relevant triggers and thereby
|
||||
cause incmpleteness.
|
||||
*/
|
||||
void context::record_relevancy(unsigned n, literal const* lits) {
|
||||
m_relevant_conflict_literals.reset();
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
m_relevant_conflict_literals.push_back(is_relevant(lits[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void context::restore_relevancy(unsigned n, literal const* lits) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (m_relevant_conflict_literals[i] && !is_relevant(lits[i])) {
|
||||
mark_as_relevant(lits[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void context::get_relevant_labels(expr* cnstr, buffer<symbol> & result) {
|
||||
if (m_fparams.m_check_at_labels) {
|
||||
|
@ -4281,6 +4313,7 @@ namespace smt {
|
|||
if (fcs == FC_DONE) {
|
||||
mk_proto_model(l_true);
|
||||
m_model = m_proto_model->mk_model();
|
||||
add_rec_funs_to_model();
|
||||
}
|
||||
|
||||
return fcs == FC_DONE;
|
||||
|
@ -4333,8 +4366,51 @@ namespace smt {
|
|||
return m_last_search_failure;
|
||||
}
|
||||
|
||||
void context::add_rec_funs_to_model() {
|
||||
ast_manager& m = m_manager;
|
||||
SASSERT(m_model);
|
||||
for (unsigned i = 0; i < m_asserted_formulas.get_num_formulas(); ++i) {
|
||||
expr* e = m_asserted_formulas.get_formula(i);
|
||||
if (is_quantifier(e)) {
|
||||
quantifier* q = to_quantifier(e);
|
||||
if (!m.is_rec_fun_def(q)) continue;
|
||||
SASSERT(q->get_num_patterns() == 1);
|
||||
expr* fn = to_app(q->get_pattern(0))->get_arg(0);
|
||||
SASSERT(is_app(fn));
|
||||
func_decl* f = to_app(fn)->get_decl();
|
||||
expr* eq = q->get_expr();
|
||||
expr_ref body(m);
|
||||
if (is_fun_def(fn, q->get_expr(), body)) {
|
||||
func_interp* fi = alloc(func_interp, m, f->get_arity());
|
||||
fi->set_else(body);
|
||||
m_model->register_decl(f, fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool context::is_fun_def(expr* f, expr* body, expr_ref& result) {
|
||||
expr* t1, *t2, *t3;
|
||||
if (m_manager.is_eq(body, t1, t2) || m_manager.is_iff(body, t1, t2)) {
|
||||
if (t1 == f) return result = t2, true;
|
||||
if (t2 == f) return result = t1, true;
|
||||
return false;
|
||||
}
|
||||
if (m_manager.is_ite(body, t1, t2, t3)) {
|
||||
expr_ref body1(m_manager), body2(m_manager);
|
||||
if (is_fun_def(f, t2, body1) && is_fun_def(f, t3, body2)) {
|
||||
// f is not free in t1
|
||||
result = m_manager.mk_ite(t1, body1, body2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
void pp(smt::context & c) {
|
||||
c.display(std::cout);
|
||||
|
|
|
@ -209,6 +209,7 @@ namespace smt {
|
|||
~scoped_mk_model() {
|
||||
if (m_ctx.m_proto_model.get() != 0) {
|
||||
m_ctx.m_model = m_ctx.m_proto_model->mk_model();
|
||||
m_ctx.add_rec_funs_to_model();
|
||||
m_ctx.m_proto_model = 0; // proto_model is not needed anymore.
|
||||
}
|
||||
}
|
||||
|
@ -1132,6 +1133,10 @@ namespace smt {
|
|||
|
||||
bool is_relevant_core(expr * n) const { return m_relevancy_propagator->is_relevant(n); }
|
||||
|
||||
svector<bool> m_relevant_conflict_literals;
|
||||
void record_relevancy(unsigned n, literal const* lits);
|
||||
void restore_relevancy(unsigned n, literal const* lits);
|
||||
|
||||
public:
|
||||
// event handler for relevancy_propagator class
|
||||
void relevant_eh(expr * n);
|
||||
|
@ -1153,6 +1158,10 @@ namespace smt {
|
|||
return is_relevant(l.var());
|
||||
}
|
||||
|
||||
bool is_relevant_core(literal l) const {
|
||||
return is_relevant_core(bool_var2expr(l.var()));
|
||||
}
|
||||
|
||||
void mark_as_relevant(expr * n) { m_relevancy_propagator->mark_as_relevant(n); m_relevancy_propagator->propagate(); }
|
||||
|
||||
void mark_as_relevant(enode * n) { mark_as_relevant(n->get_owner()); }
|
||||
|
@ -1186,6 +1195,10 @@ namespace smt {
|
|||
|
||||
bool propagate();
|
||||
|
||||
void add_rec_funs_to_model();
|
||||
|
||||
bool is_fun_def(expr* f, expr* q, expr_ref& body);
|
||||
|
||||
public:
|
||||
bool can_propagate() const;
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ namespace smt {
|
|||
|
||||
while (true) {
|
||||
lbool r = m_aux_context->check();
|
||||
TRACE("model_checker", tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";);
|
||||
TRACE("model_checker", tout << "[restricted] model-checker (" << (num_new_instances+1) << ") result: " << to_sat_str(r) << "\n";);
|
||||
if (r != l_true)
|
||||
break;
|
||||
model_ref cex;
|
||||
|
@ -300,7 +300,7 @@ namespace smt {
|
|||
}
|
||||
num_new_instances++;
|
||||
if (num_new_instances >= m_max_cexs || !add_blocking_clause(cex.get(), sks)) {
|
||||
TRACE("model_checker", tout << "Add blocking clause failed\n";);
|
||||
TRACE("model_checker", tout << "Add blocking clause failed new-instances: " << num_new_instances << " max-cex: " << m_max_cexs << "\n";);
|
||||
// add_blocking_clause failed... stop the search for new counter-examples...
|
||||
break;
|
||||
}
|
||||
|
@ -407,6 +407,7 @@ namespace smt {
|
|||
found_relevant = true;
|
||||
if (m.is_rec_fun_def(q)) {
|
||||
if (!check_rec_fun(q)) {
|
||||
TRACE("model_checker", tout << "checking recursive function failed\n";);
|
||||
num_failures++;
|
||||
}
|
||||
}
|
||||
|
@ -414,6 +415,7 @@ namespace smt {
|
|||
if (m_params.m_mbqi_trace || get_verbosity_level() >= 5) {
|
||||
verbose_stream() << "(smt.mbqi :failed " << q->get_qid() << ")\n";
|
||||
}
|
||||
TRACE("model_checker", tout << "checking quantifier " << mk_pp(q, m) << " failed\n";);
|
||||
num_failures++;
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +454,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool model_checker::has_new_instances() {
|
||||
TRACE("model_checker", tout << "instances: " << m_new_instances.size() << "\n";);
|
||||
return !m_new_instances.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,9 @@ namespace smt {
|
|||
m_qi_queue.setup();
|
||||
}
|
||||
|
||||
bool has_trace_stream() const { return m_context.get_manager().has_trace_stream(); }
|
||||
std::ostream & trace_stream() { return m_context.get_manager().trace_stream(); }
|
||||
ast_manager& m() const { return m_context.get_manager(); }
|
||||
bool has_trace_stream() const { return m().has_trace_stream(); }
|
||||
std::ostream & trace_stream() { return m().trace_stream(); }
|
||||
|
||||
quantifier_stat * get_stat(quantifier * q) const {
|
||||
return m_quantifier_stat.find(q);
|
||||
|
@ -110,8 +111,9 @@ namespace smt {
|
|||
unsigned max_top_generation,
|
||||
ptr_vector<enode> & used_enodes) {
|
||||
max_generation = std::max(max_generation, get_generation(q));
|
||||
if (m_num_instances > m_params.m_qi_max_instances)
|
||||
if (m_num_instances > m_params.m_qi_max_instances) {
|
||||
return false;
|
||||
}
|
||||
get_stat(q)->update_max_generation(max_generation);
|
||||
fingerprint * f = m_context.add_fingerprint(q, q->get_id(), num_bindings, bindings);
|
||||
if (f) {
|
||||
|
@ -132,9 +134,17 @@ namespace smt {
|
|||
}
|
||||
m_qi_queue.insert(f, pat, max_generation, min_top_generation, max_top_generation); // TODO
|
||||
m_num_instances++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
TRACE("quantifier",
|
||||
tout << mk_pp(q, m()) << " ";
|
||||
for (unsigned i = 0; i < num_bindings; ++i) {
|
||||
tout << mk_pp(bindings[i]->get_owner(), m()) << " ";
|
||||
}
|
||||
tout << "\n";
|
||||
tout << "inserted: " << (f != 0) << "\n";
|
||||
);
|
||||
|
||||
return f != 0;
|
||||
}
|
||||
|
||||
void init_search_eh() {
|
||||
|
@ -186,7 +196,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool check_quantifier(quantifier* q) {
|
||||
return m_context.is_relevant(q) && m_context.get_assignment(q) == l_true; // && !m_context.get_manager().is_rec_fun_def(q);
|
||||
return m_context.is_relevant(q) && m_context.get_assignment(q) == l_true; // && !m().is_rec_fun_def(q);
|
||||
}
|
||||
|
||||
bool quick_check_quantifiers() {
|
||||
|
@ -501,13 +511,13 @@ namespace smt {
|
|||
SASSERT(m_context->get_manager().is_pattern(mp));
|
||||
bool unary = (mp->get_num_args() == 1);
|
||||
if (!unary && j >= num_eager_multi_patterns) {
|
||||
TRACE("assign_quantifier", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m_context->get_manager()) << "\n"
|
||||
TRACE("quantifier", tout << "delaying (too many multipatterns):\n" << mk_ismt2_pp(mp, m_context->get_manager()) << "\n"
|
||||
<< "j: " << j << " unary: " << unary << " m_params.m_qi_max_eager_multipatterns: " << m_fparams->m_qi_max_eager_multipatterns
|
||||
<< " num_eager_multi_patterns: " << num_eager_multi_patterns << "\n";);
|
||||
m_lazy_mam->add_pattern(q, mp);
|
||||
}
|
||||
else {
|
||||
TRACE("assign_quantifier", tout << "adding:\n" << mk_ismt2_pp(mp, m_context->get_manager()) << "\n";);
|
||||
TRACE("quantifier", tout << "adding:\n" << mk_ismt2_pp(mp, m_context->get_manager()) << "\n";);
|
||||
m_mam->add_pattern(q, mp);
|
||||
}
|
||||
if (!unary)
|
||||
|
|
|
@ -165,6 +165,8 @@ namespace smt {
|
|||
virtual void push() = 0;
|
||||
virtual void pop(unsigned num_scopes) = 0;
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
if (m_inc_timeout == UINT_MAX) {
|
||||
IF_VERBOSE(PS_VB_LVL, verbose_stream() << "(combined-solver \"using solver 2 (without a timeout)\")\n";);
|
||||
lbool r = m_solver2->check_sat(num_assumptions, assumptions);
|
||||
if (r != l_undef || !use_solver1_when_undef()) {
|
||||
if (r != l_undef || !use_solver1_when_undef() || get_manager().canceled()) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
@ -285,10 +285,9 @@ public:
|
|||
}
|
||||
|
||||
virtual void collect_statistics(statistics & st) const {
|
||||
m_solver2->collect_statistics(st);
|
||||
if (m_use_solver1_results)
|
||||
m_solver1->collect_statistics(st);
|
||||
else
|
||||
m_solver2->collect_statistics(st);
|
||||
}
|
||||
|
||||
virtual void get_unsat_core(ptr_vector<expr> & r) {
|
||||
|
|
|
@ -49,6 +49,7 @@ void extension_model_converter::operator()(model_ref & md, unsigned goal_idx) {
|
|||
TRACE("extension_mc", model_v2_pp(tout, *md); display_decls_info(tout, md););
|
||||
model_evaluator ev(*(md.get()));
|
||||
ev.set_model_completion(true);
|
||||
ev.set_expand_array_equalities(false);
|
||||
expr_ref val(m());
|
||||
unsigned i = m_vars.size();
|
||||
while (i > 0) {
|
||||
|
|
|
@ -28,6 +28,7 @@ Revision History:
|
|||
#include"ctx_simplify_tactic.h"
|
||||
#include"smt_tactic.h"
|
||||
#include"elim_term_ite_tactic.h"
|
||||
#include"probe_arith.h"
|
||||
|
||||
static tactic * mk_quant_preprocessor(ast_manager & m, bool disable_gaussian = false) {
|
||||
params_ref pull_ite_p;
|
||||
|
@ -107,8 +108,10 @@ tactic * mk_lra_tactic(ast_manager & m, params_ref const & p) {
|
|||
tactic * st = and_then(mk_quant_preprocessor(m),
|
||||
mk_qe_lite_tactic(m, p),
|
||||
cond(mk_has_quantifier_probe(),
|
||||
or_else(mk_qsat_tactic(m, p),
|
||||
and_then(mk_qe_tactic(m), mk_smt_tactic())),
|
||||
cond(mk_is_lira_probe(),
|
||||
or_else(mk_qsat_tactic(m, p),
|
||||
and_then(mk_qe_tactic(m), mk_smt_tactic())),
|
||||
mk_smt_tactic()),
|
||||
mk_smt_tactic()));
|
||||
st->updt_params(p);
|
||||
return st;
|
||||
|
|
|
@ -374,6 +374,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void fill(unsigned sz, T const & elem) {
|
||||
resize(sz);
|
||||
fill(sz, elem);
|
||||
}
|
||||
|
||||
bool contains(T const & elem) const {
|
||||
const_iterator it = begin();
|
||||
const_iterator e = end();
|
||||
|
|
8
src/util/version.h.cmake.in
Normal file
8
src/util/version.h.cmake.in
Normal file
|
@ -0,0 +1,8 @@
|
|||
// automatically generated file.
|
||||
#define Z3_MAJOR_VERSION @Z3_VERSION_MAJOR@
|
||||
#define Z3_MINOR_VERSION @Z3_VERSION_MINOR@
|
||||
#define Z3_BUILD_NUMBER @Z3_VERSION_PATCH@
|
||||
#define Z3_REVISION_NUMBER @Z3_VERSION_TWEAK@
|
||||
|
||||
#define Z3_FULL_VERSION @Z3_FULL_VERSION@
|
||||
#cmakedefine Z3GITHASH @Z3GITHASH@
|
Loading…
Add table
Add a link
Reference in a new issue