mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
* arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * arrays Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fill Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * update drat and fix euf bugs Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * const qualifiers Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * reorg ba Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * reorg Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * build warnings Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
/*++
|
|
Copyright (c) 2017 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
ba_constraint.cpp
|
|
|
|
Abstract:
|
|
|
|
Interface for constraints.
|
|
|
|
Author:
|
|
|
|
Nikolaj Bjorner (nbjorner) 2017-01-30
|
|
|
|
--*/
|
|
|
|
#include "sat/smt/ba_constraint.h"
|
|
|
|
namespace ba {
|
|
|
|
unsigned constraint::fold_max_var(unsigned w) const {
|
|
if (lit() != sat::null_literal) w = std::max(w, lit().var());
|
|
for (unsigned i = 0; i < size(); ++i) w = std::max(w, get_lit(i).var());
|
|
return w;
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& out, constraint const& cnstr) {
|
|
if (cnstr.lit() != sat::null_literal) out << cnstr.lit() << " == ";
|
|
return cnstr.display(out);
|
|
}
|
|
|
|
bool constraint::is_watched(solver_interface const& s, literal lit) const {
|
|
return s.get_wlist(~lit).contains(sat::watched(cindex()));
|
|
}
|
|
|
|
void constraint::unwatch_literal(solver_interface& s, literal lit) {
|
|
sat::watched w(cindex());
|
|
s.get_wlist(~lit).erase(w);
|
|
SASSERT(!is_watched(s, lit));
|
|
}
|
|
|
|
void constraint::watch_literal(solver_interface& s, literal lit) {
|
|
if (is_pure() && lit == ~this->lit()) return;
|
|
SASSERT(!is_watched(s, lit));
|
|
sat::watched w(cindex());
|
|
s.get_wlist(~lit).push_back(w);
|
|
}
|
|
|
|
void constraint::nullify_tracking_literal(solver_interface& s) {
|
|
if (lit() != sat::null_literal) {
|
|
unwatch_literal(s, lit());
|
|
unwatch_literal(s, ~lit());
|
|
nullify_literal();
|
|
}
|
|
}
|
|
|
|
}
|