3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2023-10-30 14:54:04 -07:00
parent 938a89e197
commit f97dd34028
6 changed files with 25 additions and 11 deletions

View file

@ -873,8 +873,8 @@ br_status seq_rewriter::mk_seq_length(expr* a, expr_ref& result) {
m_autil.is_numeral(y, r) && r.is_zero() && m_autil.is_numeral(y, r) && r.is_zero() &&
m_autil.is_numeral(z, r) && r >= 0) { m_autil.is_numeral(z, r) && r >= 0) {
expr* len_x = str().mk_length(x); expr* len_x = str().mk_length(x);
expr* zero = m_autil.mk_int(0);
result = m().mk_ite(m_autil.mk_le(len_x, z), len_x, z); result = m().mk_ite(m_autil.mk_le(len_x, z), len_x, z);
// expr* zero = m_autil.mk_int(0);
// result = m().mk_ite(m_autil.mk_le(z, zero), zero, result); // result = m().mk_ite(m_autil.mk_le(z, zero), zero, result);
return BR_REWRITE_FULL; return BR_REWRITE_FULL;
} }

View file

@ -689,7 +689,8 @@ namespace lp {
void int_solver::simplify(std::function<bool(unsigned)>& is_root) { void int_solver::simplify(std::function<bool(unsigned)>& is_root) {
#if 0 return;
#if 1
// in-processing simplification can go here, such as bounds improvements. // in-processing simplification can go here, such as bounds improvements.
@ -699,6 +700,20 @@ namespace lp {
return; return;
} }
#endif
#if 1
lp::explanation exp;
m_ex = &exp;
m_t.clear();
m_k.reset();
if (has_inf_int())
local_gomory();
#endif
#if 0
stopwatch sw; stopwatch sw;
explanation exp1, exp2; explanation exp1, exp2;
@ -919,8 +934,7 @@ namespace lp {
} }
lia_move int_solver::local_gomory() { lia_move int_solver::local_gomory() {
for (unsigned i = 0; i < 4; ++i) { for (unsigned i = 0; i < 2 && has_inf_int() && !settings().get_cancel_flag(); ++i) {
m_ex->clear(); m_ex->clear();
m_t.clear(); m_t.clear();
m_k.reset(); m_k.reset();
@ -939,11 +953,15 @@ namespace lp {
lra.get_infeasibility_explanation(*m_ex); lra.get_infeasibility_explanation(*m_ex);
return lia_move::conflict; return lia_move::conflict;
} }
//r = m_patcher();
//if (r != lia_move::undef)
// return r;
} }
m_ex->clear(); m_ex->clear();
m_t.clear(); m_t.clear();
m_k.reset(); m_k.reset();
if (!has_inf_int())
return lia_move::sat;
return lia_move::undef; return lia_move::undef;
} }

View file

@ -331,7 +331,7 @@ bool basics::basic_lemma_for_mon_neutral_derived(const monic& rm, const factoriz
for (auto fc : f) { for (auto fc : f) {
lpvar j = var(fc); lpvar j = var(fc);
all_int &= c().var_is_int(j); all_int &= c().var_is_int(j);
if (j == null_lpvar && abs(val(j)) == abs_mv && if (u == null_lpvar && abs(val(j)) == abs_mv &&
c().vars_are_equiv(j, mon_var) && c().vars_are_equiv(j, mon_var) &&
(mon_var_is_sep_from_zero || c().var_is_separated_from_zero(j))) (mon_var_is_sep_from_zero || c().var_is_separated_from_zero(j)))
u = j; u = j;

View file

@ -100,7 +100,6 @@ namespace nla {
} }
bool grobner::is_conflicting() { bool grobner::is_conflicting() {
bool is_conflict = false;
for (auto eq : m_solver.equations()) { for (auto eq : m_solver.equations()) {
if (is_conflicting(*eq)) { if (is_conflicting(*eq)) {
lp_settings().stats().m_grobner_conflicts++; lp_settings().stats().m_grobner_conflicts++;
@ -677,7 +676,6 @@ namespace nla {
nex_creator& nc = m_nex_creator; nex_creator& nc = m_nex_creator;
nc.pop(0); nc.pop(0);
nex_creator::sum_factory sum(nc); nex_creator::sum_factory sum(nc);
unsigned row_index = 0;
u_map<nex_var*> var2nex; u_map<nex_var*> var2nex;
for (auto v : eq.poly().free_vars()) for (auto v : eq.poly().free_vars())
var2nex.insert(v, nc.mk_var(v)); var2nex.insert(v, nc.mk_var(v));

View file

@ -286,11 +286,9 @@ struct solver::imp {
bool check_constraint(unsigned idx) { bool check_constraint(unsigned idx) {
auto& c = lra.constraints()[idx]; auto& c = lra.constraints()[idx];
auto& pm = m_nlsat->pm();
auto k = c.kind(); auto k = c.kind();
auto offset = -c.rhs(); auto offset = -c.rhs();
auto lhs = c.coeffs(); auto lhs = c.coeffs();
auto sz = lhs.size();
scoped_anum val(am()), mon(am()); scoped_anum val(am()), mon(am());
am().set(val, offset.to_mpq()); am().set(val, offset.to_mpq());

View file

@ -1091,7 +1091,7 @@ public:
void restart_eh() { void restart_eh() {
m_arith_eq_adapter.restart_eh(); m_arith_eq_adapter.restart_eh();
#if 0 #if 1
// experiment // experiment
if (m_lia) { if (m_lia) {
std::function<bool(unsigned)> is_root = [&](unsigned j) { std::function<bool(unsigned)> is_root = [&](unsigned j) {