Skip to content

Commit 3744a89

Browse files
committed
experiment with custom branching solver approach
1 parent e20e8f6 commit 3744a89

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/halmos/sevm.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
is_true,
5050
sat,
5151
simplify,
52+
substitute,
53+
unknown,
5254
unsat,
5355
)
5456
from z3.z3util import is_expr_var
@@ -1403,7 +1405,18 @@ def check(self, cond: Any) -> Any:
14031405
if result := self.quick_custom_check(cond):
14041406
return result
14051407

1406-
return self.path.check(cond)
1408+
new_cond = substitute(cond, *self.path.concretization.substitution.items())
1409+
if not eq(new_cond, cond) and (
1410+
new_result := self.quick_custom_check(simplify(new_cond))
1411+
):
1412+
return new_result
1413+
1414+
# some examples where the quick custom solver fails to prove unsat:
1415+
# - inequality: x == 0 vs not (x >= 0)
1416+
# - congruence closure: x == 2 vs map[x] == 0 and map[2] == 1
1417+
# - bitvector: extract(31, 31, x) == 0 vs x != 0 and extract(i, i, x) == 0 for all 0 <= i <= 30
1418+
1419+
return unknown
14071420

14081421
def select(
14091422
self, array: Any, key: Word, arrays: dict, symbolic: bool = False

0 commit comments

Comments
 (0)