forked from Z3Prover/doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nikolaj Bjorner <[email protected]>
- Loading branch information
1 parent
c43fe1a
commit e0f0911
Showing
3 changed files
with
117 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from z3 import * | ||
|
||
def mk_lit(m, x): | ||
if is_true(m.eval(x)): | ||
return x | ||
else: | ||
return Not(x) | ||
|
||
def pogo(A, B, xs): | ||
while sat == A.check(): | ||
m = A.model() | ||
L = [mk_lit(m, x) for x in xs] | ||
if unsat == B.check(L): | ||
notL = Not(And(B.unsat_core())) | ||
yield notL | ||
A.add(notL) | ||
else: | ||
print("expecting unsat") | ||
break | ||
|
||
A = SolverFor("QF_FD") | ||
B = SolverFor("QF_FD") | ||
a1, a2, b1, b2, x1, x2 = Bools('a1 a2 b1 b2 x1 x2') | ||
A.add(a1 == x1, a2 == a1, a2 == x2) | ||
B.add(b1 == x1, b2 != b1, b2 == x2) | ||
print(list(pogo(A, B, [x1, x2]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters