3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00

expose incremental cubing over API

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-09-28 15:05:10 -07:00
parent e507a6ccd1
commit a625301a41
10 changed files with 63 additions and 68 deletions

View file

@ -6294,10 +6294,33 @@ class Solver(Z3PPObject):
candidates = _cs
return _to_expr_ref(Z3_solver_lookahead(self.ctx.ref(), self.solver, candidates), self.ctx)
def cube(self):
"""Get set of cubes"""
rounds = 0
while True:
r = _to_expr_ref(Z3_solver_cube(self.ctx.ref(), self.solver), self.ctx)
if (is_false(r)):
if (rounds == 0):
yield r
return
if (is_true(r)):
yield r
return
rounds += 1
yield r
def proof(self):
"""Return a proof for the last `check()`. Proof construction must be enabled."""
return _to_expr_ref(Z3_solver_get_proof(self.ctx.ref(), self.solver), self.ctx)
def from_file(self, filename):
"""Parse assertions from a file"""
self.add([f for f in parse_smt2_file(filename)])
def from_string(self, s):
"""Parse assertions from a string"""
self.add([f for f in parse_smt2_string(s)])
def assertions(self):
"""Return an AST vector containing all added constraints.