mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
toward order lemma
Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
parent
a5c146a740
commit
4db4a8da3f
3 changed files with 109 additions and 84 deletions
|
@ -102,18 +102,14 @@ struct vars_equivalence {
|
|||
m_equivs.clear();
|
||||
m_tree.clear();
|
||||
}
|
||||
// it also returns (j, 1)
|
||||
vector<index_with_sign> get_equivalent_vars(lpvar j) const {
|
||||
vector<index_with_sign> ret;
|
||||
|
||||
rational val = m_vvr(j);
|
||||
for (lpvar j : m_vars_by_abs_values.find(abs(val))->second) {
|
||||
if (val.is_pos())
|
||||
ret.push_back(index_with_sign(j, rational(1)));
|
||||
else
|
||||
ret.push_back(index_with_sign(j, rational(-1)));
|
||||
}
|
||||
return ret;
|
||||
|
||||
svector<lpvar> get_vars_with_the_same_abs_val(const rational& v) const {
|
||||
svector<unsigned> ret;
|
||||
auto it = m_vars_by_abs_values.find(abs(v));
|
||||
if (it == m_vars_by_abs_values.end())
|
||||
return ret;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
unsigned size() const { return static_cast<unsigned>(m_tree.size()); }
|
||||
|
@ -187,6 +183,20 @@ struct vars_equivalence {
|
|||
}
|
||||
}
|
||||
|
||||
// Finds the root var which is equivalent to j.
|
||||
// The sign is flipped if needed
|
||||
lpvar map_to_root(lpvar j) const {
|
||||
while (true) {
|
||||
auto it = m_tree.find(j);
|
||||
if (it == m_tree.end())
|
||||
return j;
|
||||
if (it->second == static_cast<unsigned>(-1))
|
||||
return j;
|
||||
const equiv & e = m_equivs[it->second];
|
||||
j = get_parent_node(j, e);
|
||||
}
|
||||
}
|
||||
|
||||
void add_equiv_exp(unsigned j, expl_set& exp) const {
|
||||
while (true) {
|
||||
auto it = m_tree.find(j);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue