Fixes #4644. This commit fixes an issue where the set `d_unconstrained`
in the unconstrained simplification pass was not computed correctly. The
problem was that visiting the same term multiple times did not remove
the variables appearing in that term from the visited-once set. A simple
example that triggers the issue is the following:
```
(set-logic ALL)
(declare-fun a () Bool)
(declare-fun b () Bool)
(assert (not (= a b)))
(assert (= a (= a b)))
(check-sat)
```
After running `UnconstrainedSimplifier::visitAll()` on both assertions,
we end up with `[b]` as our `d_unconstrained` set. We end up inferring
the substitution `(= a b) --> b` and get `(not b)` and `b`, which is
unsat even though the original problem is sat.
This commit fixes the issue by visiting all the children of a node if we
visit a node for a second time. This makes sure that we remove any
children from the visisted-once set.
{
d_unconstrained.erase(current);
}
+ else
+ {
+ // Also erase the children from the visited-once set when we visit a
+ // node a second time, otherwise variables in this node are not
+ // erased from the set of unconstrained variables.
+ for (TNode childNode : current)
+ {
+ toVisit.push_back(unc_preprocess_stack_element(childNode, current));
+ }
+ }
}
++find->second;
continue;
regress0/unconstrained/bvult5.smt2
regress0/unconstrained/geq.smt2
regress0/unconstrained/gt.smt2
+ regress0/unconstrained/issue4644.smt2
regress0/unconstrained/ite.smt2
regress0/unconstrained/leq.smt2
regress0/unconstrained/lt.smt2
--- /dev/null
+; COMMAND-LINE: --unconstrained-simp
+(set-logic ALL)
+(declare-fun a () Bool)
+(declare-fun b () Bool)
+(declare-fun c () Bool)
+(assert (distinct a c))
+(assert (= a b (= b c)))
+(set-info :status sat)
+(check-sat)