21 using System.Diagnostics.Contracts;
23 namespace Microsoft.Z3
30 [ContractVerification(
true)]
43 get {
return (
Z3_goal_prec)Native.Z3_goal_precision(Context.nCtx, NativeObject); }
56 public bool IsUnderApproximation
64 public bool IsOverApproximation
82 Contract.Requires(constraints != null);
83 Contract.Requires(Contract.ForAll(constraints, c => c != null));
85 Context.CheckContextMatch(constraints);
88 Contract.Assert(c != null);
89 Native.Z3_goal_assert(Context.nCtx, NativeObject, c.NativeObject);
104 public bool Inconsistent
106 get {
return Native.Z3_goal_inconsistent(Context.nCtx, NativeObject) != 0; }
117 get {
return Native.Z3_goal_depth(Context.nCtx, NativeObject); }
125 Native.Z3_goal_reset(Context.nCtx, NativeObject);
133 get {
return Native.Z3_goal_size(Context.nCtx, NativeObject); }
143 Contract.Ensures(Contract.Result<
BoolExpr[]>() != null);
147 for (uint i = 0; i < n; i++)
158 get {
return Native.Z3_goal_num_exprs(Context.nCtx, NativeObject); }
164 public bool IsDecidedSat
166 get {
return Native.Z3_goal_is_decided_sat(Context.nCtx, NativeObject) != 0; }
172 public bool IsDecidedUnsat
174 get {
return Native.Z3_goal_is_decided_unsat(Context.nCtx, NativeObject) != 0; }
182 Contract.Requires(ctx != null);
193 Tactic t = Context.MkTactic(
"simplify");
196 if (res.NumSubgoals == 0)
199 return res.Subgoals[0];
208 return Native.Z3_goal_to_string(Context.nCtx, NativeObject);
218 return Context.MkTrue();
222 return Context.MkAnd(Formulas);
227 internal Goal(
Context ctx, IntPtr obj) : base(ctx, obj) { Contract.Requires(ctx != null); }
229 internal Goal(Context ctx,
bool models,
bool unsatCores,
bool proofs)
230 : base(ctx, Native.
Z3_mk_goal(ctx.nCtx, (models) ? 1 : 0, (unsatCores) ? 1 : 0, (proofs) ? 1 : 0))
232 Contract.Requires(ctx != null);
235 internal class DecRefQueue : IDecRefQueue
237 public DecRefQueue() : base() { }
238 public DecRefQueue(uint move_limit) : base(move_limit) { }
239 internal override void IncRef(Context ctx, IntPtr obj)
241 Native.Z3_goal_inc_ref(ctx.nCtx, obj);
244 internal override void DecRef(Context ctx, IntPtr obj)
246 Native.Z3_goal_dec_ref(ctx.nCtx, obj);
250 internal override void IncRef(IntPtr o)
252 Context.Goal_DRQ.IncAndClear(Context, o);
256 internal override void DecRef(IntPtr o)
258 Context.Goal_DRQ.Add(o);
void Reset()
Erases all formulas from the given goal.
void Add(params BoolExpr[] constraints)
Alias for Assert.
BoolExpr AsBoolExpr()
Goal to BoolExpr conversion.
Z3_goal Z3_API Z3_mk_goal(Z3_context c, Z3_bool models, Z3_bool unsat_cores, Z3_bool proofs)
Create a goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or trans...
override string ToString()
Goal to string conversion.
static Z3_ast Z3_goal_formula(Z3_context a0, Z3_goal a1, uint a2)
Tactics are the basic building block for creating custom solvers for specific problem domains...
void Assert(params BoolExpr[] constraints)
Adds the constraints to the given goal.
static Z3_goal Z3_goal_translate(Z3_context a0, Z3_goal a1, Z3_context a2)
ApplyResult objects represent the result of an application of a tactic to a goal. It contains the sub...
A Params objects represents a configuration in the form of Symbol/value pairs.
The main interaction with Z3 happens via the Context.
The exception base class for error reporting from Z3
Internal base class for interfacing with native Z3 objects. Should not be used externally.
Goal Simplify(Params p=null)
Simplifies the goal.
A goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or transformed ...
Goal Translate(Context ctx)
Translates (copies) the Goal to the target Context ctx .