mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
update to vector format
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cb7e53aae4
commit
454e12fc49
17 changed files with 47 additions and 46 deletions
|
@ -529,11 +529,11 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(Z3_L_UNDEF);
|
||||
}
|
||||
|
||||
Z3_ast Z3_API Z3_solver_cube(Z3_context c, Z3_solver s, unsigned cutoff) {
|
||||
Z3_ast_vector Z3_API Z3_solver_cube(Z3_context c, Z3_solver s, unsigned cutoff) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_solver_cube(c, s, cutoff);
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
expr_ref result(m);
|
||||
expr_ref_vector result(m);
|
||||
unsigned timeout = to_solver(s)->m_params.get_uint("timeout", mk_c(c)->get_timeout());
|
||||
unsigned rlimit = to_solver(s)->m_params.get_uint("rlimit", mk_c(c)->get_rlimit());
|
||||
bool use_ctrl_c = to_solver(s)->m_params.get_bool("ctrl_c", false);
|
||||
|
@ -544,15 +544,19 @@ extern "C" {
|
|||
scoped_timer timer(timeout, &eh);
|
||||
scoped_rlimit _rlimit(mk_c(c)->m().limit(), rlimit);
|
||||
try {
|
||||
result = to_solver_ref(s)->cube(cutoff);
|
||||
result.append(to_solver_ref(s)->cube(cutoff));
|
||||
}
|
||||
catch (z3_exception & ex) {
|
||||
mk_c(c)->handle_exception(ex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
mk_c(c)->save_ast_trail(result);
|
||||
RETURN_Z3(of_ast(result));
|
||||
Z3_ast_vector_ref * v = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
|
||||
mk_c(c)->save_object(v);
|
||||
for (expr* e : result) {
|
||||
v->m_ast_vector.push_back(e);
|
||||
}
|
||||
RETURN_Z3(of_ast_vector(v));
|
||||
Z3_CATCH_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -362,20 +362,19 @@ namespace Microsoft.Z3
|
|||
/// <summary>
|
||||
/// Return a set of cubes.
|
||||
/// </summary>
|
||||
public IEnumerable<BoolExpr> Cube()
|
||||
public IEnumerable<BoolExpr[]> Cube()
|
||||
{
|
||||
while (true) {
|
||||
var lvl = BacktrackLevel;
|
||||
BacktrackLevel = uint.MaxValue;
|
||||
BoolExpr r = (BoolExpr)Expr.Create(Context, Native.Z3_solver_cube(Context.nCtx, NativeObject, lvl));
|
||||
if (r.IsFalse) {
|
||||
ASTVector r = new ASTVector(Context, Native.Z3_solver_cube(Context.nCtx, NativeObject, lvl));
|
||||
if (r.Size == 1 && ((Expr)r[0]).IsFalse) {
|
||||
break;
|
||||
}
|
||||
if (r.IsTrue) {
|
||||
yield return r;
|
||||
break;
|
||||
yield return r.ToBoolExprArray();
|
||||
if (r.Size == 0) {
|
||||
break;
|
||||
}
|
||||
yield return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6289,13 +6289,12 @@ class Solver(Z3PPObject):
|
|||
while True:
|
||||
lvl = self.backtrack_level
|
||||
self.backtrack_level = 4000000000
|
||||
r = _to_expr_ref(Z3_solver_cube(self.ctx.ref(), self.solver, lvl), self.ctx)
|
||||
if (is_false(r)):
|
||||
r = AstVector(Z3_solver_cube(self.ctx.ref(), self.solver, lvl), self.ctx)
|
||||
if (len(r) == 1 and is_false(r[0])):
|
||||
return
|
||||
if (is_true(r)):
|
||||
yield r
|
||||
yield r
|
||||
if (len(r) == 0):
|
||||
return
|
||||
yield r
|
||||
|
||||
def proof(self):
|
||||
"""Return a proof for the last `check()`. Proof construction must be enabled."""
|
||||
|
|
|
@ -6235,10 +6235,10 @@ extern "C" {
|
|||
The last argument is a backtracking level. It instructs the cube process to backtrack below
|
||||
the indicated level for the next cube.
|
||||
|
||||
def_API('Z3_solver_cube', AST, (_in(CONTEXT), _in(SOLVER), _in(UINT)))
|
||||
def_API('Z3_solver_cube', AST_VECTOR, (_in(CONTEXT), _in(SOLVER), _in(UINT)))
|
||||
*/
|
||||
|
||||
Z3_ast Z3_API Z3_solver_cube(Z3_context c, Z3_solver s, unsigned backtrack_level);
|
||||
Z3_ast_vector Z3_API Z3_solver_cube(Z3_context c, Z3_solver s, unsigned backtrack_level);
|
||||
|
||||
/**
|
||||
\brief Retrieve the model for the last #Z3_solver_check or #Z3_solver_check_assumptions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue