mirror of
https://github.com/Z3Prover/z3
synced 2025-08-18 09:12:16 +00:00
wip - adding context equation solver
the solve_eqs_tactic is to be replaced by a re-implementation that uses solve_eqs in the simplifiers directory. The re-implementation should address efficiency issues with the previous code. At this point it punts on low level proofs. The plan is to use coarser dependency tracking instead of low level proofs for pre-processing. Dependencies can be converted into a proof hint representation that can be checked using a stronger checker.
This commit is contained in:
parent
ae2672f132
commit
4d8860c0bc
15 changed files with 416 additions and 117 deletions
|
@ -26,58 +26,51 @@ Author:
|
|||
namespace euf {
|
||||
|
||||
class solve_eqs : public dependent_expr_simplifier {
|
||||
|
||||
friend class solve_context_eqs;
|
||||
|
||||
struct stats {
|
||||
unsigned m_num_steps = 0;
|
||||
unsigned m_num_elim_vars = 0;
|
||||
};
|
||||
|
||||
struct config {
|
||||
bool m_context_solve = true;
|
||||
unsigned m_max_occs = UINT_MAX;
|
||||
};
|
||||
|
||||
th_rewriter m_rewriter;
|
||||
scoped_ptr_vector<extract_eq> m_extract_plugins;
|
||||
unsigned_vector m_var2id, m_id2level, m_subst_ids;
|
||||
ptr_vector<app> m_id2var;
|
||||
vector<dep_eq_vector> m_next;
|
||||
scoped_ptr<expr_substitution> m_subst;
|
||||
|
||||
expr_mark m_unsafe_vars; // expressions that cannot be replaced
|
||||
stats m_stats;
|
||||
config m_config;
|
||||
|
||||
void add_subst(dependent_eq const& eq);
|
||||
th_rewriter m_rewriter;
|
||||
scoped_ptr_vector<extract_eq> m_extract_plugins;
|
||||
unsigned_vector m_var2id; // app->get_id() |-> small numeral
|
||||
ptr_vector<app> m_id2var; // small numeral |-> app
|
||||
unsigned_vector m_id2level; // small numeral |-> level in substitution ordering
|
||||
unsigned_vector m_subst_ids; // sorted list of small numeral by level
|
||||
vector<dep_eq_vector> m_next; // adjacency list for solved equations
|
||||
scoped_ptr<expr_substitution> m_subst; // current substitution
|
||||
expr_mark m_unsafe_vars; // expressions that cannot be replaced
|
||||
|
||||
bool is_var(expr* e) const { return e->get_id() < m_var2id.size() && m_var2id[e->get_id()] != UINT_MAX; }
|
||||
unsigned var2id(expr* v) const { return m_var2id[v->get_id()]; }
|
||||
|
||||
void get_eqs(dep_eq_vector& eqs) {
|
||||
for (unsigned i = m_qhead; i < m_fmls.size(); ++i)
|
||||
get_eqs(m_fmls[i], eqs);
|
||||
}
|
||||
|
||||
void get_eqs(dependent_expr const& f, dep_eq_vector& eqs) {
|
||||
for (extract_eq* ex : m_extract_plugins)
|
||||
ex->get_eqs(f, eqs);
|
||||
}
|
||||
|
||||
void filter_unsafe_vars();
|
||||
bool can_be_var(expr* e) const { return is_uninterp_const(e) && !m_unsafe_vars.is_marked(e); }
|
||||
void get_eqs(dep_eq_vector& eqs);
|
||||
void filter_unsafe_vars();
|
||||
void extract_subst();
|
||||
void extract_dep_graph(dep_eq_vector& eqs);
|
||||
void normalize();
|
||||
void apply_subst();
|
||||
void save_subst();
|
||||
void apply_subst(vector<dependent_expr>& old_fmls);
|
||||
void save_subst(vector<dependent_expr> const& old_fmls);
|
||||
|
||||
public:
|
||||
|
||||
solve_eqs(ast_manager& m, dependent_expr_state& fmls);
|
||||
|
||||
void push() override { dependent_expr_simplifier::push(); }
|
||||
void pop(unsigned n) override { dependent_expr_simplifier::pop(n); }
|
||||
void reduce() override;
|
||||
|
||||
void updt_params(params_ref const& p) override;
|
||||
|
||||
void collect_statistics(statistics& st) const override;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue