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

Merge pull request #276 from kenmcmil/issue260

issue #260 -- support timeout in Z3_compute_interpolant
This commit is contained in:
Nikolaj Bjorner 2015-10-28 20:30:15 -07:00
commit d83f8d08f3
2 changed files with 52 additions and 14 deletions

View file

@ -7560,6 +7560,10 @@ def tree_interpolant(pat,p=None,ctx=None):
If pat is satisfiable, raises an object of class ModelRef
that represents a model of pat.
If neither a proof of unsatisfiability nor a model is obtained
(for example, because of a timeout, or because models are disabled)
then None is returned.
If parameters p are supplied, these are used in creating the
solver that determines satisfiability.
@ -7585,7 +7589,9 @@ def tree_interpolant(pat,p=None,ctx=None):
res = Z3_compute_interpolant(ctx.ref(),f.as_ast(),p.params,ptr,mptr)
if res == Z3_L_FALSE:
return AstVector(ptr[0],ctx)
raise ModelRef(mptr[0], ctx)
if mptr[0]:
raise ModelRef(mptr[0], ctx)
return None
def binary_interpolant(a,b,p=None,ctx=None):
"""Compute an interpolant for a binary conjunction.
@ -7600,6 +7606,10 @@ def binary_interpolant(a,b,p=None,ctx=None):
If a & b is satisfiable, raises an object of class ModelRef
that represents a model of a &b.
If neither a proof of unsatisfiability nor a model is obtained
(for example, because of a timeout, or because models are disabled)
then None is returned.
If parameters p are supplied, these are used in creating the
solver that determines satisfiability.
@ -7608,7 +7618,8 @@ def binary_interpolant(a,b,p=None,ctx=None):
Not(x >= 0)
"""
f = And(Interpolant(a),b)
return tree_interpolant(f,p,ctx)[0]
ti = tree_interpolant(f,p,ctx)
return ti[0] if ti != None else None
def sequence_interpolant(v,p=None,ctx=None):
"""Compute interpolant for a sequence of formulas.
@ -7626,6 +7637,10 @@ def sequence_interpolant(v,p=None,ctx=None):
If a & b is satisfiable, raises an object of class ModelRef
that represents a model of a & b.
If neither a proof of unsatisfiability nor a model is obtained
(for example, because of a timeout, or because models are disabled)
then None is returned.
If parameters p are supplied, these are used in creating the
solver that determines satisfiability.