3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 22:23:22 +00:00

Implement mini_quip

This commit is contained in:
Huanyi Chen 2018-12-29 15:44:42 -05:00
parent 83e3a79bd1
commit 19471f9fa3
2 changed files with 786 additions and 72 deletions

View file

@ -395,75 +395,3 @@ test("data/horn3.smt2")
test("data/horn4.smt2")
test("data/horn5.smt2")
# test("data/horn6.smt2") # takes long time to finish
"""
# TBD: Quip variant of IC3
must = True
may = False
class QGoal:
def __init__(self, cube, parent, level, must):
self.level = level
self.cube = cube
self.parent = parent
self.must = must
class Quip(MiniIC3):
# prev & tras -> r', such that r' intersects with cube
def add_reachable(self, prev, cube):
s = fd_solver()
s.add(self.trans)
s.add(prev)
s.add(Or(cube))
is_sat = s.check()
assert is_sat == sat
m = s.model();
result = self.values2literals(m, cube)
assert result
self.reachable.add(result)
# A state s0 and level f0 such that
# not(s0) is f0-1 inductive
def quip_blocked(self, s0, f0):
self.push_heap(QGoal(self.next(s0), None, f0, must))
while self.goals:
f, g = heapq.heappop(self.goals)
sys.stdout.write("%d." % f)
sys.stdout.flush()
if f == 0:
if g.must:
print("")
return g
self.add_reachable(self.init, p.parent.cube)
continue
# TBD
return None
def run(self):
if not check_disjoint(self.init, self.bad):
return "goal is reached in initial state"
level = 0
while True:
inv = self.is_valid()
if inv is not None:
return inv
is_sat, cube = self.unfold()
if is_sat == unsat:
level += 1
print("Unfold %d" % level)
sys.stdout.flush()
self.add_solver()
elif is_sat == sat:
cex = self.quipie_blocked(cube, level)
if cex is not None:
return cex
else:
return is_sat
"""