-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
The following test fails with Z3:
BooleanFormula var1 = bmgr.makeVariable("var1");
BooleanFormula var2 = bmgr.makeVariable("var2");
BooleanFormula var3 = bmgr.makeVariable("var3");
BooleanFormula var4 = bmgr.makeVariable("var4");
assertThat(bmgr.and(bmgr.and(var1, var2), bmgr.and(var3, var4)))
.isEqualTo(bmgr.and(var1, var2, var3, var4));(It also fails with some other solvers because JavaSMT is missing simplifications, but this is a different issue.)
The problem with Z3 is that both bmgr.and(bmgr.and(var1, var2), bmgr.and(var3, var4)) and bmgr.and(var1, var2, var3, var4) create the same formula, specifically (and var1 var2 var3 var4), but that equals() on these two instances returns false. Objects representing the same syntactic formula should compare as equal.
(This even works in other cases. If I call bmgr.and(bmgr.and(var1, var2), bmgr.and(var3, var4)) twice, I do get formula instances that compare as equal, just in the above case not.)