diff options
author | Alex Ozdemir <aozdemir@hmc.edu> | 2020-10-21 11:40:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 13:40:02 -0500 |
commit | e4a3d7e78b72d4a8c6704f346540893bab4e00ef (patch) | |
tree | 8028371019bf1644a90d37cd9dc71e9b88c8ed8e /src | |
parent | cbd61aa8ee07e10846a3e69ea4ba4e42f0a16394 (diff) |
(proof-new) arith: dedup literals in flattenImpl (#5320)
TheoryArithPrivte uses flattenImplication to turn implications into
clauses. This commit ensures that said clause does not have duplicate
terms. This is important because when we write proofs related to the
clause, the proof machinery doesn't like duplicates.
Diffstat (limited to 'src')
-rw-r--r-- | src/theory/arith/theory_arith_private.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/theory/arith/theory_arith_private.cpp b/src/theory/arith/theory_arith_private.cpp index 4422bb2db..e4fa4a82c 100644 --- a/src/theory/arith/theory_arith_private.cpp +++ b/src/theory/arith/theory_arith_private.cpp @@ -4541,23 +4541,40 @@ bool TheoryArithPrivate::tryToPropagate(RowIndex ridx, bool rowUp, ArithVar v, b Node flattenImplication(Node imp){ NodeBuilder<> nb(kind::OR); + std::unordered_set<Node, NodeHashFunction> included; Node left = imp[0]; Node right = imp[1]; if(left.getKind() == kind::AND){ for(Node::iterator i = left.begin(), iend = left.end(); i != iend; ++i) { - nb << (*i).negate(); + if (!included.count((*i).negate())) + { + nb << (*i).negate(); + included.insert((*i).negate()); + } } }else{ - nb << left.negate(); + if (!included.count(left.negate())) + { + nb << left.negate(); + included.insert(left.negate()); + } } if(right.getKind() == kind::OR){ for(Node::iterator i = right.begin(), iend = right.end(); i != iend; ++i) { - nb << *i; + if (!included.count(*i)) + { + nb << *i; + included.insert(*i); + } } }else{ - nb << right; + if (!included.count(right)) + { + nb << right; + included.insert(right); + } } return nb; |