mirror of
https://github.com/Z3Prover/z3
synced 2025-08-25 12:35:59 +00:00
Update saturation inferences
This commit is contained in:
parent
7468b2326c
commit
3d79cddf33
4 changed files with 226 additions and 342 deletions
|
@ -12,38 +12,26 @@ Author:
|
|||
|
||||
--*/
|
||||
#pragma once
|
||||
#include "math/polysat/clause_builder.h"
|
||||
#include "math/polysat/conflict.h"
|
||||
|
||||
namespace polysat {
|
||||
|
||||
class solver;
|
||||
/**
|
||||
* Introduce lemmas that derive new (simpler) constraints from the current conflict and partial model.
|
||||
*/
|
||||
class saturation {
|
||||
|
||||
class inference_engine {
|
||||
friend class conflict;
|
||||
protected:
|
||||
solver& s;
|
||||
public:
|
||||
inference_engine(solver& s) :s(s) {}
|
||||
virtual ~inference_engine() {}
|
||||
/** Try to apply an inference rule.
|
||||
* Derive new constraints from constraints containing the variable v (i.e., at least one premise must contain v).
|
||||
* Returns true if a new constraint was added to the core.
|
||||
*/
|
||||
virtual bool perform(pvar v, conflict& core) = 0;
|
||||
};
|
||||
|
||||
class inf_saturate : public inference_engine {
|
||||
|
||||
vector<signed_constraint> m_new_constraints;
|
||||
clause_builder m_lemma;
|
||||
char const* m_rule = nullptr;
|
||||
|
||||
void set_rule(char const* r) { m_rule = r; }
|
||||
void set_rule(char const* r) { m_rule = r; }
|
||||
|
||||
void push_omega(pdd const& x, pdd const& y);
|
||||
void push_omega_bisect(pdd const& x, rational x_max, pdd const& y, rational y_max);
|
||||
void insert_omega(pdd const& x, pdd const& y);
|
||||
signed_constraint ineq(bool strict, pdd const& lhs, pdd const& rhs);
|
||||
bool propagate(char const* inf_name, conflict& core, inequality const& crit1, inequality const& crit2, signed_constraint& c);
|
||||
bool propagate(char const* inf_name, conflict& core, inequality const& crit1, inequality const& crit2, bool strict, pdd const& lhs, pdd const& rhs);
|
||||
bool propagate(conflict& core, inequality const& crit1, inequality const& crit2, signed_constraint c);
|
||||
bool propagate(conflict& core, inequality const& crit1, inequality const& crit2, bool strict, pdd const& lhs, pdd const& rhs);
|
||||
|
||||
bool try_ugt_x(pvar v, conflict& core, inequality const& c);
|
||||
|
||||
|
@ -52,14 +40,14 @@ namespace polysat {
|
|||
|
||||
bool try_y_l_ax_and_x_l_z(pvar x, conflict& core, inequality const& c);
|
||||
bool try_y_l_ax_and_x_l_z(pvar x, conflict& core, inequality const& x_l_z, inequality const& y_l_ax, pdd const& a, pdd const& y);
|
||||
|
||||
|
||||
bool try_ugt_z(pvar z, conflict& core, inequality const& c);
|
||||
bool try_ugt_z(pvar z, conflict& core, inequality const& x_l_z0, inequality const& yz_l_xz, pdd const& y, pdd const& x);
|
||||
|
||||
bool try_tangent(pvar v, conflict& core, inequality const& c);
|
||||
|
||||
// c := lhs ~ v
|
||||
// where ~ is < or <=
|
||||
// c := lhs ~ v
|
||||
// where ~ is < or <=
|
||||
bool is_l_v(pvar v, inequality const& c);
|
||||
|
||||
// c := v ~ rhs
|
||||
|
@ -74,11 +62,11 @@ namespace polysat {
|
|||
|
||||
// c := Y ~ Ax
|
||||
bool is_Y_l_Ax(pvar x, inequality const& d, pdd& a, pdd& y);
|
||||
bool verify_Y_l_Ax(pvar x, inequality const& d, pdd const& a, pdd const& y);
|
||||
bool verify_Y_l_Ax(pvar x, inequality const& d, pdd const& a, pdd const& y);
|
||||
|
||||
// c := Y*X ~ z*X
|
||||
bool is_YX_l_zX(pvar z, inequality const& c, pdd& x, pdd& y);
|
||||
bool verify_YX_l_zX(pvar z, inequality const& c, pdd const& x, pdd const& y);
|
||||
bool verify_YX_l_zX(pvar z, inequality const& c, pdd const& x, pdd const& y);
|
||||
|
||||
// c := xY <= xZ
|
||||
bool is_xY_l_xZ(pvar x, inequality const& c, pdd& y, pdd& z);
|
||||
|
@ -92,11 +80,9 @@ namespace polysat {
|
|||
// p := coeff*x*y where coeff_x = coeff*x, x a variable
|
||||
bool is_coeffxY(pdd const& coeff_x, pdd const& p, pdd& y);
|
||||
|
||||
rational max_value(pdd const& x);
|
||||
|
||||
public:
|
||||
inf_saturate(solver& s) : inference_engine(s) {}
|
||||
bool perform(pvar v, conflict& core) override;
|
||||
saturation(solver& s);
|
||||
bool perform(pvar v, conflict& core);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue