3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-28 12:19:00 +00:00

experiment with arithmetic core generalizers

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-02-07 19:21:52 -08:00
parent 23c5c94311
commit 2e2fa84d40
5 changed files with 195 additions and 2 deletions

View file

@ -33,6 +33,37 @@ namespace pdr {
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
};
template <typename T>
class r_map : public map<rational, T, rational::hash_proc, rational::eq_proc> {
};
class core_arith_inductive_generalizer : public core_generalizer {
typedef std::pair<expr*, unsigned> term_loc_t;
typedef r_map<vector<term_loc_t> > bounds_t;
ast_manager& m;
arith_util a;
expr_ref_vector m_refs;
bounds_t m_lb;
bounds_t m_ub;
struct eq {
expr* m_term;
rational m_value;
unsigned m_i;
unsigned m_j;
eq(expr* t, rational const& r, unsigned i, unsigned j): m_term(t), m_value(r), m_i(i), m_j(j) {}
};
void reset();
void insert_bound(bool is_lower, expr* x, rational const& r, unsigned i);
void get_eqs(expr_ref_vector const& core, svector<eq>& eqs);
bool substitute_alias(rational const&r, expr* x, expr* e, expr_ref& result);
public:
core_arith_inductive_generalizer(context& ctx);
virtual ~core_arith_inductive_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
};
class core_farkas_generalizer : public core_generalizer {
farkas_learner m_farkas_learner;
public: