3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00
z3/src/math/polysat/var_constraint.h
Jakob Rath f7e476a4a0
Polysat: fixes in solver, forbidden intervals for eq_constraint (#5240)
* Rename to neg_cond

* Add some logging utilities

* Implement case of forbidden interval covering the whole domain

* Implement diseq_narrow

* Do not activate constraint if we are in a conflict state

* comments

* Assert that lemma isn't undefined

* Update revert_decision to work in the case where narrowing causes propagation

* Fix case of non-disjunctive lemma from forbidden intervals

* Conflict should not leak outside user scope

* Add guard to decide(), some notes

* Add test case

* Add constraints to watchlist of unassigned variable during propagation

* Move common propagation functionality into base class

* Combine eq/diseq narrow

* Compute forbidden interval for equality constraints by considering them as p <=u 0 (or p >u 0 for disequalities)
2021-05-03 09:30:17 -07:00

42 lines
1.1 KiB
C++

/*++
Copyright (c) 2021 Microsoft Corporation
Module Name:
polysat var_constraint
Abstract:
Var constraints restrict viable values.
The main way var-constraints interact with the solver is to
narrow m_viable during initialization.
Author:
Nikolaj Bjorner (nbjorner) 2021-03-19
Jakob Rath 2021-04-6
--*/
#pragma once
#include "math/dd/dd_bdd.h"
#include "math/polysat/constraint.h"
namespace polysat {
class var_constraint : public constraint {
pvar m_var;
bdd m_viable;
public:
var_constraint(unsigned lvl, bool_var bvar, csign_t sign, pvar v, bdd const & b, p_dependency_ref const& dep):
constraint(lvl, bvar, sign, dep, ckind_t::bit_t), m_var(v), m_viable(b) {}
~var_constraint() override {}
std::ostream& display(std::ostream& out) const override;
constraint* resolve(solver& s, pvar v) override;
void narrow(solver& s) override;
bool is_always_false() override;
bool is_currently_false(solver& s) override;
bool is_currently_true(solver& s) override;
};
}