Skip to content

Commit 9fa2a6f

Browse files
committed
experiment with custom branching solver approach
1 parent e20e8f6 commit 9fa2a6f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/halmos/sevm.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
sat,
5151
simplify,
5252
unsat,
53+
unknown,
54+
substitute,
5355
)
5456
from z3.z3util import is_expr_var
5557

@@ -1403,7 +1405,16 @@ 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 (new_result := self.quick_custom_check(simplify(new_cond))):
1410+
return new_result
1411+
1412+
# some examples where the quick custom solver fails to prove unsat:
1413+
# - inequality: x == 0 vs not (x >= 0)
1414+
# - congruence closure: x == 2 vs map[x] == 0 and map[2] == 1
1415+
# - bitvector: extract(31, 31, x) == 0 vs x != 0 and extract(i, i, x) == 0 for all 0 <= i <= 30
1416+
1417+
return unknown
14071418

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

0 commit comments

Comments
 (0)