mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fixes based on regression tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
809a4efc6b
commit
2ede4b2c80
21 changed files with 159 additions and 151 deletions
|
@ -2,7 +2,7 @@ z3_add_component(smt
|
|||
SOURCES
|
||||
arith_eq_adapter.cpp
|
||||
arith_eq_solver.cpp
|
||||
asserted_formulas_new.cpp
|
||||
asserted_formulas.cpp
|
||||
cached_var_subst.cpp
|
||||
cost_evaluator.cpp
|
||||
dyn_ack.cpp
|
||||
|
|
|
@ -3,7 +3,7 @@ Copyright (c) 2006 Microsoft Corporation
|
|||
|
||||
Module Name:
|
||||
|
||||
asserted_formulas_new.cpp
|
||||
asserted_formulas.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
|
@ -25,9 +25,9 @@ Revision History:
|
|||
#include "ast/normal_forms/nnf.h"
|
||||
#include "ast/pattern/pattern_inference.h"
|
||||
#include "ast/macros/quasi_macros.h"
|
||||
#include "smt/asserted_formulas_new.h"
|
||||
#include "smt/asserted_formulas.h"
|
||||
|
||||
asserted_formulas_new::asserted_formulas_new(ast_manager & m, smt_params & p):
|
||||
asserted_formulas::asserted_formulas(ast_manager & m, smt_params & p):
|
||||
m(m),
|
||||
m_params(p),
|
||||
m_rewriter(m),
|
||||
|
@ -60,13 +60,11 @@ asserted_formulas_new::asserted_formulas_new(ast_manager & m, smt_params & p):
|
|||
|
||||
m_macro_finder = alloc(macro_finder, m, m_macro_manager);
|
||||
|
||||
params_ref pa;
|
||||
pa.set_bool("arith_lhs", true);
|
||||
m_rewriter.updt_params(pa);
|
||||
set_eliminate_and(false);
|
||||
|
||||
}
|
||||
|
||||
void asserted_formulas_new::setup() {
|
||||
void asserted_formulas::setup() {
|
||||
switch (m_params.m_lift_ite) {
|
||||
case LI_FULL:
|
||||
m_params.m_ng_lift_ite = LI_NONE;
|
||||
|
@ -84,10 +82,10 @@ void asserted_formulas_new::setup() {
|
|||
}
|
||||
|
||||
|
||||
asserted_formulas_new::~asserted_formulas_new() {
|
||||
asserted_formulas::~asserted_formulas() {
|
||||
}
|
||||
|
||||
void asserted_formulas_new::push_assertion(expr * e, proof * pr, vector<justified_expr>& result) {
|
||||
void asserted_formulas::push_assertion(expr * e, proof * pr, vector<justified_expr>& result) {
|
||||
if (inconsistent()) {
|
||||
return;
|
||||
}
|
||||
|
@ -119,16 +117,18 @@ void asserted_formulas_new::push_assertion(expr * e, proof * pr, vector<justifie
|
|||
}
|
||||
}
|
||||
|
||||
void asserted_formulas_new::set_eliminate_and(bool flag) {
|
||||
void asserted_formulas::set_eliminate_and(bool flag) {
|
||||
params_ref p;
|
||||
p.set_bool("elim_and", true);
|
||||
p.set_bool("elim_and", flag);
|
||||
p.set_bool("arith_lhs", true);
|
||||
p.set_bool("sort_sums", true);
|
||||
p.set_bool("rewrite_patterns", true);
|
||||
m_rewriter.updt_params(p);
|
||||
flush_cache();
|
||||
}
|
||||
|
||||
|
||||
void asserted_formulas_new::assert_expr(expr * e, proof * _in_pr) {
|
||||
void asserted_formulas::assert_expr(expr * e, proof * _in_pr) {
|
||||
proof_ref in_pr(_in_pr, m), pr(_in_pr, m);
|
||||
expr_ref r(e, m);
|
||||
|
||||
|
@ -153,17 +153,17 @@ void asserted_formulas_new::assert_expr(expr * e, proof * _in_pr) {
|
|||
TRACE("asserted_formulas_bug", tout << "after assert_expr\n"; display(tout););
|
||||
}
|
||||
|
||||
void asserted_formulas_new::assert_expr(expr * e) {
|
||||
void asserted_formulas::assert_expr(expr * e) {
|
||||
assert_expr(e, m.mk_asserted(e));
|
||||
}
|
||||
|
||||
void asserted_formulas_new::get_assertions(ptr_vector<expr> & result) const {
|
||||
void asserted_formulas::get_assertions(ptr_vector<expr> & result) const {
|
||||
for (justified_expr const& je : m_formulas) result.push_back(je.get_fml());
|
||||
}
|
||||
|
||||
void asserted_formulas_new::push_scope() {
|
||||
void asserted_formulas::push_scope() {
|
||||
SASSERT(inconsistent() || m_qhead == m_formulas.size() || m.canceled());
|
||||
TRACE("asserted_formulas_new_scopes", tout << "push:\n"; display(tout););
|
||||
TRACE("asserted_formulas_scopes", tout << "push:\n"; display(tout););
|
||||
m_scoped_substitution.push();
|
||||
m_scopes.push_back(scope());
|
||||
scope & s = m_scopes.back();
|
||||
|
@ -176,8 +176,8 @@ void asserted_formulas_new::push_scope() {
|
|||
commit();
|
||||
}
|
||||
|
||||
void asserted_formulas_new::pop_scope(unsigned num_scopes) {
|
||||
TRACE("asserted_formulas_new_scopes", tout << "before pop " << num_scopes << "\n"; display(tout););
|
||||
void asserted_formulas::pop_scope(unsigned num_scopes) {
|
||||
TRACE("asserted_formulas_scopes", tout << "before pop " << num_scopes << "\n"; display(tout););
|
||||
m_bv_sharing.pop_scope(num_scopes);
|
||||
m_macro_manager.pop_scope(num_scopes);
|
||||
unsigned new_lvl = m_scopes.size() - num_scopes;
|
||||
|
@ -189,10 +189,10 @@ void asserted_formulas_new::pop_scope(unsigned num_scopes) {
|
|||
m_qhead = s.m_formulas_lim;
|
||||
m_scopes.shrink(new_lvl);
|
||||
flush_cache();
|
||||
TRACE("asserted_formulas_new_scopes", tout << "after pop " << num_scopes << "\n"; display(tout););
|
||||
TRACE("asserted_formulas_scopes", tout << "after pop " << num_scopes << "\n"; display(tout););
|
||||
}
|
||||
|
||||
void asserted_formulas_new::reset() {
|
||||
void asserted_formulas::reset() {
|
||||
m_defined_names.reset();
|
||||
m_qhead = 0;
|
||||
m_formulas.reset();
|
||||
|
@ -202,14 +202,14 @@ void asserted_formulas_new::reset() {
|
|||
m_inconsistent = false;
|
||||
}
|
||||
|
||||
bool asserted_formulas_new::check_well_sorted() const {
|
||||
bool asserted_formulas::check_well_sorted() const {
|
||||
for (justified_expr const& je : m_formulas) {
|
||||
if (!is_well_sorted(m, je.get_fml())) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void asserted_formulas_new::reduce() {
|
||||
void asserted_formulas::reduce() {
|
||||
if (inconsistent())
|
||||
return;
|
||||
if (canceled())
|
||||
|
@ -255,7 +255,7 @@ void asserted_formulas_new::reduce() {
|
|||
}
|
||||
|
||||
|
||||
unsigned asserted_formulas_new::get_formulas_last_level() const {
|
||||
unsigned asserted_formulas::get_formulas_last_level() const {
|
||||
if (m_scopes.empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ unsigned asserted_formulas_new::get_formulas_last_level() const {
|
|||
}
|
||||
}
|
||||
|
||||
bool asserted_formulas_new::invoke(simplify_fmls& s) {
|
||||
bool asserted_formulas::invoke(simplify_fmls& s) {
|
||||
if (!s.should_apply()) return true;
|
||||
IF_VERBOSE(10, verbose_stream() << "(smt." << s.id() << ")\n";);
|
||||
s();
|
||||
|
@ -281,7 +281,7 @@ bool asserted_formulas_new::invoke(simplify_fmls& s) {
|
|||
}
|
||||
}
|
||||
|
||||
void asserted_formulas_new::display(std::ostream & out) const {
|
||||
void asserted_formulas::display(std::ostream & out) const {
|
||||
out << "asserted formulas:\n";
|
||||
for (unsigned i = 0; i < m_formulas.size(); i++) {
|
||||
if (i == m_qhead)
|
||||
|
@ -291,7 +291,7 @@ void asserted_formulas_new::display(std::ostream & out) const {
|
|||
out << "inconsistent: " << inconsistent() << "\n";
|
||||
}
|
||||
|
||||
void asserted_formulas_new::display_ll(std::ostream & out, ast_mark & pp_visited) const {
|
||||
void asserted_formulas::display_ll(std::ostream & out, ast_mark & pp_visited) const {
|
||||
if (!m_formulas.empty()) {
|
||||
for (justified_expr const& f : m_formulas)
|
||||
ast_def_ll_pp(out, m, f.get_fml(), pp_visited, true, false);
|
||||
|
@ -302,18 +302,18 @@ void asserted_formulas_new::display_ll(std::ostream & out, ast_mark & pp_visited
|
|||
}
|
||||
}
|
||||
|
||||
void asserted_formulas_new::collect_statistics(statistics & st) const {
|
||||
void asserted_formulas::collect_statistics(statistics & st) const {
|
||||
}
|
||||
|
||||
|
||||
void asserted_formulas_new::swap_asserted_formulas(vector<justified_expr>& formulas) {
|
||||
void asserted_formulas::swap_asserted_formulas(vector<justified_expr>& formulas) {
|
||||
SASSERT(!inconsistent() || !formulas.empty());
|
||||
m_formulas.shrink(m_qhead);
|
||||
m_formulas.append(formulas);
|
||||
}
|
||||
|
||||
|
||||
void asserted_formulas_new::find_macros_core() {
|
||||
void asserted_formulas::find_macros_core() {
|
||||
vector<justified_expr> new_fmls;
|
||||
unsigned sz = m_formulas.size();
|
||||
(*m_macro_finder)(sz - m_qhead, m_formulas.c_ptr() + m_qhead, new_fmls);
|
||||
|
@ -321,7 +321,7 @@ void asserted_formulas_new::find_macros_core() {
|
|||
reduce_and_solve();
|
||||
}
|
||||
|
||||
void asserted_formulas_new::apply_quasi_macros() {
|
||||
void asserted_formulas::apply_quasi_macros() {
|
||||
TRACE("before_quasi_macros", display(tout););
|
||||
vector<justified_expr> new_fmls;
|
||||
quasi_macros proc(m, m_macro_manager);
|
||||
|
@ -335,7 +335,7 @@ void asserted_formulas_new::apply_quasi_macros() {
|
|||
reduce_and_solve();
|
||||
}
|
||||
|
||||
void asserted_formulas_new::nnf_cnf() {
|
||||
void asserted_formulas::nnf_cnf() {
|
||||
nnf apply_nnf(m, m_defined_names);
|
||||
vector<justified_expr> new_fmls;
|
||||
expr_ref_vector push_todo(m);
|
||||
|
@ -379,7 +379,7 @@ void asserted_formulas_new::nnf_cnf() {
|
|||
swap_asserted_formulas(new_fmls);
|
||||
}
|
||||
|
||||
void asserted_formulas_new::simplify_fmls::operator()() {
|
||||
void asserted_formulas::simplify_fmls::operator()() {
|
||||
vector<justified_expr> new_fmls;
|
||||
unsigned sz = af.m_formulas.size();
|
||||
for (unsigned i = af.m_qhead; i < sz; i++) {
|
||||
|
@ -405,18 +405,18 @@ void asserted_formulas_new::simplify_fmls::operator()() {
|
|||
}
|
||||
|
||||
|
||||
void asserted_formulas_new::reduce_and_solve() {
|
||||
void asserted_formulas::reduce_and_solve() {
|
||||
IF_IVERBOSE(10, verbose_stream() << "(smt.reducing)\n";);
|
||||
flush_cache(); // collect garbage
|
||||
m_reduce_asserted_formulas();
|
||||
}
|
||||
|
||||
|
||||
void asserted_formulas_new::commit() {
|
||||
void asserted_formulas::commit() {
|
||||
commit(m_formulas.size());
|
||||
}
|
||||
|
||||
void asserted_formulas_new::commit(unsigned new_qhead) {
|
||||
void asserted_formulas::commit(unsigned new_qhead) {
|
||||
m_macro_manager.mark_forbidden(new_qhead - m_qhead, m_formulas.c_ptr() + m_qhead);
|
||||
m_expr2depth.reset();
|
||||
for (unsigned i = m_qhead; i < new_qhead; ++i) {
|
||||
|
@ -426,7 +426,7 @@ void asserted_formulas_new::commit(unsigned new_qhead) {
|
|||
m_qhead = new_qhead;
|
||||
}
|
||||
|
||||
void asserted_formulas_new::propagate_values() {
|
||||
void asserted_formulas::propagate_values() {
|
||||
TRACE("propagate_values", tout << "before:\n"; display(tout););
|
||||
flush_cache();
|
||||
|
||||
|
@ -463,7 +463,7 @@ void asserted_formulas_new::propagate_values() {
|
|||
m_reduce_asserted_formulas();
|
||||
}
|
||||
|
||||
unsigned asserted_formulas_new::propagate_values(unsigned i) {
|
||||
unsigned asserted_formulas::propagate_values(unsigned i) {
|
||||
expr * n = m_formulas[i].get_fml();
|
||||
expr_ref new_n(m);
|
||||
proof_ref new_pr(m);
|
||||
|
@ -481,7 +481,7 @@ unsigned asserted_formulas_new::propagate_values(unsigned i) {
|
|||
return n != new_n ? 1 : 0;
|
||||
}
|
||||
|
||||
void asserted_formulas_new::update_substitution(expr* n, proof* pr) {
|
||||
void asserted_formulas::update_substitution(expr* n, proof* pr) {
|
||||
expr* lhs, *rhs, *n1;
|
||||
if (is_ground(n) && (m.is_eq(n, lhs, rhs) || m.is_iff(n, lhs, rhs))) {
|
||||
compute_depth(lhs);
|
||||
|
@ -510,7 +510,7 @@ void asserted_formulas_new::update_substitution(expr* n, proof* pr) {
|
|||
\brief implement a Knuth-Bendix ordering on expressions.
|
||||
*/
|
||||
|
||||
bool asserted_formulas_new::is_gt(expr* lhs, expr* rhs) {
|
||||
bool asserted_formulas::is_gt(expr* lhs, expr* rhs) {
|
||||
if (lhs == rhs) {
|
||||
return false;
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ bool asserted_formulas_new::is_gt(expr* lhs, expr* rhs) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void asserted_formulas_new::compute_depth(expr* e) {
|
||||
void asserted_formulas::compute_depth(expr* e) {
|
||||
ptr_vector<expr> todo;
|
||||
todo.push_back(e);
|
||||
while (!todo.empty()) {
|
||||
|
@ -573,7 +573,7 @@ void asserted_formulas_new::compute_depth(expr* e) {
|
|||
}
|
||||
}
|
||||
|
||||
proof * asserted_formulas_new::get_inconsistency_proof() const {
|
||||
proof * asserted_formulas::get_inconsistency_proof() const {
|
||||
if (!inconsistent())
|
||||
return 0;
|
||||
if (!m.proofs_enabled())
|
||||
|
@ -586,7 +586,7 @@ proof * asserted_formulas_new::get_inconsistency_proof() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void asserted_formulas_new::refine_inj_axiom_fn::simplify(justified_expr const& j, expr_ref& n, proof_ref& p) {
|
||||
void asserted_formulas::refine_inj_axiom_fn::simplify(justified_expr const& j, expr_ref& n, proof_ref& p) {
|
||||
expr* f = j.get_fml();
|
||||
if (is_quantifier(f) && simplify_inj_axiom(m, to_quantifier(f), n)) {
|
||||
TRACE("inj_axiom", tout << "simplifying...\n" << mk_pp(f, m) << "\n" << n << "\n";);
|
||||
|
@ -597,7 +597,7 @@ void asserted_formulas_new::refine_inj_axiom_fn::simplify(justified_expr const&
|
|||
}
|
||||
|
||||
|
||||
unsigned asserted_formulas_new::get_total_size() const {
|
||||
unsigned asserted_formulas::get_total_size() const {
|
||||
expr_mark visited;
|
||||
unsigned r = 0;
|
||||
for (justified_expr const& j : m_formulas)
|
||||
|
@ -606,7 +606,7 @@ unsigned asserted_formulas_new::get_total_size() const {
|
|||
}
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
void pp(asserted_formulas_new & f) {
|
||||
void pp(asserted_formulas & f) {
|
||||
f.display(std::cout);
|
||||
}
|
||||
#endif
|
|
@ -3,7 +3,7 @@ Copyright (c) 2006 Microsoft Corporation
|
|||
|
||||
Module Name:
|
||||
|
||||
asserted_formulas_new.h
|
||||
asserted_formulas.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
@ -16,8 +16,8 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef ASSERTED_FORMULAS_NEW_H_
|
||||
#define ASSERTED_FORMULAS_NEW_H_
|
||||
#ifndef ASSERTED_FORMULAS_H_
|
||||
#define ASSERTED_FORMULAS_H_
|
||||
|
||||
#include "util/statistics.h"
|
||||
#include "ast/static_features.h"
|
||||
|
@ -41,7 +41,7 @@ Revision History:
|
|||
#include "smt/elim_term_ite.h"
|
||||
|
||||
|
||||
class asserted_formulas_new {
|
||||
class asserted_formulas {
|
||||
|
||||
ast_manager & m;
|
||||
smt_params & m_params;
|
||||
|
@ -66,11 +66,11 @@ class asserted_formulas_new {
|
|||
|
||||
class simplify_fmls {
|
||||
protected:
|
||||
asserted_formulas_new& af;
|
||||
asserted_formulas& af;
|
||||
ast_manager& m;
|
||||
char const* m_id;
|
||||
public:
|
||||
simplify_fmls(asserted_formulas_new& af, char const* id): af(af), m(af.m), m_id(id) {}
|
||||
simplify_fmls(asserted_formulas& af, char const* id): af(af), m(af.m), m_id(id) {}
|
||||
char const* id() const { return m_id; }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) = 0;
|
||||
virtual bool should_apply() const { return true;}
|
||||
|
@ -80,13 +80,13 @@ class asserted_formulas_new {
|
|||
|
||||
class reduce_asserted_formulas_fn : public simplify_fmls {
|
||||
public:
|
||||
reduce_asserted_formulas_fn(asserted_formulas_new& af): simplify_fmls(af, "reduce-asserted") {}
|
||||
reduce_asserted_formulas_fn(asserted_formulas& af): simplify_fmls(af, "reduce-asserted") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { af.m_rewriter(j.get_fml(), n, p); }
|
||||
};
|
||||
|
||||
class find_macros_fn : public simplify_fmls {
|
||||
public:
|
||||
find_macros_fn(asserted_formulas_new& af): simplify_fmls(af, "find-macros") {}
|
||||
find_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-macros") {}
|
||||
virtual void operator()() { af.find_macros_core(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_macro_finder && af.has_quantifiers(); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
|
@ -94,7 +94,7 @@ class asserted_formulas_new {
|
|||
|
||||
class apply_quasi_macros_fn : public simplify_fmls {
|
||||
public:
|
||||
apply_quasi_macros_fn(asserted_formulas_new& af): simplify_fmls(af, "find-quasi-macros") {}
|
||||
apply_quasi_macros_fn(asserted_formulas& af): simplify_fmls(af, "find-quasi-macros") {}
|
||||
virtual void operator()() { af.apply_quasi_macros(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_quasi_macros && af.has_quantifiers(); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
|
@ -102,7 +102,7 @@ class asserted_formulas_new {
|
|||
|
||||
class nnf_cnf_fn : public simplify_fmls {
|
||||
public:
|
||||
nnf_cnf_fn(asserted_formulas_new& af): simplify_fmls(af, "nnf-cnf") {}
|
||||
nnf_cnf_fn(asserted_formulas& af): simplify_fmls(af, "nnf-cnf") {}
|
||||
virtual void operator()() { af.nnf_cnf(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_nnf_cnf || (af.m_params.m_mbqi && af.has_quantifiers()); }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
|
@ -110,7 +110,7 @@ class asserted_formulas_new {
|
|||
|
||||
class propagate_values_fn : public simplify_fmls {
|
||||
public:
|
||||
propagate_values_fn(asserted_formulas_new& af): simplify_fmls(af, "propagate-values") {}
|
||||
propagate_values_fn(asserted_formulas& af): simplify_fmls(af, "propagate-values") {}
|
||||
virtual void operator()() { af.propagate_values(); }
|
||||
virtual bool should_apply() const { return af.m_params.m_propagate_values; }
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { UNREACHABLE(); }
|
||||
|
@ -119,7 +119,7 @@ class asserted_formulas_new {
|
|||
class distribute_forall_fn : public simplify_fmls {
|
||||
distribute_forall m_functor;
|
||||
public:
|
||||
distribute_forall_fn(asserted_formulas_new& af): simplify_fmls(af, "distribute-forall"), m_functor(af.m) {}
|
||||
distribute_forall_fn(asserted_formulas& af): simplify_fmls(af, "distribute-forall"), m_functor(af.m) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_functor(j.get_fml(), n); }
|
||||
virtual bool should_apply() const { return af.m_params.m_distribute_forall && af.has_quantifiers(); }
|
||||
virtual void post_op() { af.reduce_and_solve(); TRACE("asserted_formulas", af.display(tout);); }
|
||||
|
@ -128,21 +128,21 @@ class asserted_formulas_new {
|
|||
class pattern_inference_fn : public simplify_fmls {
|
||||
pattern_inference_rw m_infer;
|
||||
public:
|
||||
pattern_inference_fn(asserted_formulas_new& af): simplify_fmls(af, "pattern-inference"), m_infer(af.m, af.m_params) {}
|
||||
pattern_inference_fn(asserted_formulas& af): simplify_fmls(af, "pattern-inference"), m_infer(af.m, af.m_params) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_infer(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_ematching && af.has_quantifiers(); }
|
||||
};
|
||||
|
||||
class refine_inj_axiom_fn : public simplify_fmls {
|
||||
public:
|
||||
refine_inj_axiom_fn(asserted_formulas_new& af): simplify_fmls(af, "refine-injectivity") {}
|
||||
refine_inj_axiom_fn(asserted_formulas& af): simplify_fmls(af, "refine-injectivity") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p);
|
||||
virtual bool should_apply() const { return af.m_params.m_refine_inj_axiom && af.has_quantifiers(); }
|
||||
};
|
||||
|
||||
class max_bv_sharing_fn : public simplify_fmls {
|
||||
public:
|
||||
max_bv_sharing_fn(asserted_formulas_new& af): simplify_fmls(af, "maximizing-bv-sharing") {}
|
||||
max_bv_sharing_fn(asserted_formulas& af): simplify_fmls(af, "maximizing-bv-sharing") {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { af.m_bv_sharing(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_max_bv_sharing; }
|
||||
virtual void post_op() { af.m_reduce_asserted_formulas(); }
|
||||
|
@ -151,7 +151,7 @@ class asserted_formulas_new {
|
|||
class elim_term_ite_fn : public simplify_fmls {
|
||||
elim_term_ite_rw m_elim;
|
||||
public:
|
||||
elim_term_ite_fn(asserted_formulas_new& af): simplify_fmls(af, "elim-term-ite"), m_elim(af.m, af.m_defined_names) {}
|
||||
elim_term_ite_fn(asserted_formulas& af): simplify_fmls(af, "elim-term-ite"), m_elim(af.m, af.m_defined_names) {}
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { m_elim(j.get_fml(), n, p); }
|
||||
virtual bool should_apply() const { return af.m_params.m_eliminate_term_ite && af.m_params.m_lift_ite != LI_FULL; }
|
||||
virtual void post_op() { af.m_formulas.append(m_elim.new_defs()); af.reduce_and_solve(); m_elim.reset(); }
|
||||
|
@ -161,7 +161,7 @@ class asserted_formulas_new {
|
|||
class NAME : public simplify_fmls { \
|
||||
FUNCTOR m_functor; \
|
||||
public: \
|
||||
NAME(asserted_formulas_new& af):simplify_fmls(af, MSG), m_functor ARG {} \
|
||||
NAME(asserted_formulas& af):simplify_fmls(af, MSG), m_functor ARG {} \
|
||||
virtual void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) { \
|
||||
m_functor(j.get_fml(), n, p); \
|
||||
} \
|
||||
|
@ -221,8 +221,8 @@ class asserted_formulas_new {
|
|||
bool pull_cheap_ite_trees();
|
||||
|
||||
public:
|
||||
asserted_formulas_new(ast_manager & m, smt_params & p);
|
||||
~asserted_formulas_new();
|
||||
asserted_formulas(ast_manager & m, smt_params & p);
|
||||
~asserted_formulas();
|
||||
|
||||
bool has_quantifiers() const { return m_has_quantifiers; }
|
||||
void setup();
|
||||
|
@ -265,5 +265,5 @@ public:
|
|||
|
||||
};
|
||||
|
||||
#endif /* ASSERTED_FORMULAS_NEW_H_ */
|
||||
#endif /* ASSERTED_FORMULAS_H_ */
|
||||
|
|
@ -148,8 +148,8 @@ namespace smt {
|
|||
dst_ctx.set_logic(src_ctx.m_setup.get_logic());
|
||||
dst_ctx.copy_plugins(src_ctx, dst_ctx);
|
||||
|
||||
asserted_formulas_new& src_af = src_ctx.m_asserted_formulas;
|
||||
asserted_formulas_new& dst_af = dst_ctx.m_asserted_formulas;
|
||||
asserted_formulas& src_af = src_ctx.m_asserted_formulas;
|
||||
asserted_formulas& dst_af = dst_ctx.m_asserted_formulas;
|
||||
|
||||
// Copy asserted formulas.
|
||||
for (unsigned i = 0; i < src_af.get_num_formulas(); ++i) {
|
||||
|
|
|
@ -36,7 +36,7 @@ Revision History:
|
|||
#include "smt/smt_case_split_queue.h"
|
||||
#include "smt/smt_almost_cg_table.h"
|
||||
#include "smt/smt_failure.h"
|
||||
#include "smt/asserted_formulas_new.h"
|
||||
#include "smt/asserted_formulas.h"
|
||||
#include "smt/smt_types.h"
|
||||
#include "smt/dyn_ack.h"
|
||||
#include "ast/ast_smt_pp.h"
|
||||
|
@ -81,7 +81,7 @@ namespace smt {
|
|||
params_ref m_params;
|
||||
setup m_setup;
|
||||
timer m_timer;
|
||||
asserted_formulas_new m_asserted_formulas;
|
||||
asserted_formulas m_asserted_formulas;
|
||||
scoped_ptr<quantifier_manager> m_qmanager;
|
||||
scoped_ptr<model_generator> m_model_generator;
|
||||
scoped_ptr<relevancy_propagator> m_relevancy_propagator;
|
||||
|
|
|
@ -395,7 +395,8 @@ namespace smt {
|
|||
|
||||
template<typename Ext>
|
||||
theory_var theory_arith<Ext>::internalize_div(app * n) {
|
||||
if (!m_util.is_numeral(n->get_arg(1))) found_underspecified_op(n);
|
||||
rational r(1);
|
||||
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
|
||||
found_underspecified_op(n);
|
||||
theory_var s = mk_binary_op(n);
|
||||
context & ctx = get_context();
|
||||
|
@ -419,7 +420,8 @@ namespace smt {
|
|||
template<typename Ext>
|
||||
theory_var theory_arith<Ext>::internalize_mod(app * n) {
|
||||
TRACE("arith_mod", tout << "internalizing...\n" << mk_pp(n, get_manager()) << "\n";);
|
||||
if (!m_util.is_numeral(n->get_arg(1))) found_underspecified_op(n);
|
||||
rational r(1);
|
||||
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
|
||||
theory_var s = mk_binary_op(n);
|
||||
context & ctx = get_context();
|
||||
if (!ctx.relevancy())
|
||||
|
@ -429,7 +431,8 @@ namespace smt {
|
|||
|
||||
template<typename Ext>
|
||||
theory_var theory_arith<Ext>::internalize_rem(app * n) {
|
||||
if (!m_util.is_numeral(n->get_arg(1))) found_underspecified_op(n);
|
||||
rational r(1);
|
||||
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
|
||||
theory_var s = mk_binary_op(n);
|
||||
context & ctx = get_context();
|
||||
if (!ctx.relevancy()) {
|
||||
|
@ -734,11 +737,6 @@ namespace smt {
|
|||
return internalize_div(n);
|
||||
else if (m_util.is_idiv(n))
|
||||
return internalize_idiv(n);
|
||||
else if (is_app_of(n, get_id(), OP_IDIV_0) || is_app_of(n, get_id(), OP_DIV_0)) {
|
||||
ctx.internalize(n->get_arg(0), false);
|
||||
enode * e = mk_enode(n);
|
||||
return mk_var(e);
|
||||
}
|
||||
else if (m_util.is_mod(n))
|
||||
return internalize_mod(n);
|
||||
else if (m_util.is_rem(n))
|
||||
|
@ -1226,7 +1224,8 @@ namespace smt {
|
|||
app * rhs = to_app(n->get_arg(1));
|
||||
expr * rhs2;
|
||||
if (m_util.is_to_real(rhs, rhs2) && is_app(rhs2)) { rhs = to_app(rhs2); }
|
||||
if (!m_util.is_numeral(rhs)) {
|
||||
if (!m_util.is_numeral(rhs)) {
|
||||
UNREACHABLE();
|
||||
throw default_exception("malformed atomic constraint");
|
||||
}
|
||||
theory_var v = internalize_term_core(lhs);
|
||||
|
|
|
@ -516,7 +516,8 @@ namespace smt {
|
|||
|
||||
expr_ref sel1(m), sel2(m);
|
||||
sel1 = mk_select(args1.size(), args1.c_ptr());
|
||||
sel2 = ctx.get_rewriter().mk_app(f, args2.size(), args2.c_ptr());
|
||||
sel2 = m.mk_app(f, args2.size(), args2.c_ptr());
|
||||
ctx.get_rewriter()(sel2);
|
||||
ctx.internalize(sel1, false);
|
||||
ctx.internalize(sel2, false);
|
||||
|
||||
|
@ -537,6 +538,7 @@ namespace smt {
|
|||
SASSERT(is_map(mp));
|
||||
|
||||
app* map = mp->get_owner();
|
||||
ast_manager& m = get_manager();
|
||||
context& ctx = get_context();
|
||||
if (!ctx.add_fingerprint(this, 0, 1, &mp)) {
|
||||
return false;
|
||||
|
@ -552,9 +554,9 @@ namespace smt {
|
|||
args2.push_back(mk_default(map->get_arg(i)));
|
||||
}
|
||||
|
||||
expr_ref def2(m.mk_app(f, args2.size(), args2.c_ptr()), m);
|
||||
ctx.get_rewriter()(def2);
|
||||
expr* def1 = mk_default(map);
|
||||
expr_ref def2(get_manager());
|
||||
def2 = ctx.get_rewriter().mk_app(f, args2.size(), args2.c_ptr());
|
||||
ctx.internalize(def1, false);
|
||||
ctx.internalize(def2, false);
|
||||
return try_assign_eq(def1, def2);
|
||||
|
|
|
@ -293,9 +293,6 @@ namespace smt {
|
|||
}
|
||||
|
||||
void found_not_handled(expr* n) {
|
||||
if (a.is_div0(n)) {
|
||||
return;
|
||||
}
|
||||
m_not_handled = n;
|
||||
if (is_app(n) && is_underspecified(to_app(n))) {
|
||||
m_underspecified.push_back(to_app(n));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue