Z3
Public Member Functions
Goal Class Reference
+ Inheritance diagram for Goal:

Public Member Functions

Z3_goal_prec getPrecision ()
 
boolean isPrecise ()
 
boolean isUnderApproximation ()
 
boolean isOverApproximation ()
 
boolean isGarbage ()
 
void add (BoolExpr ... constraints)
 
boolean inconsistent ()
 
int getDepth ()
 
void reset ()
 
int size ()
 
BoolExpr [] getFormulas ()
 
int getNumExprs ()
 
boolean isDecidedSat ()
 
boolean isDecidedUnsat ()
 
Goal translate (Context ctx)
 
Goal simplify ()
 
Goal simplify (Params p)
 
String toString ()
 
BoolExpr AsBoolExpr ()
 

Detailed Description

A goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or transformed using tactics and solvers.

Definition at line 26 of file Goal.java.

Member Function Documentation

§ add()

void add ( BoolExpr ...  constraints)
inline

Adds the

constraints

to the given goal.

Exceptions
Z3Exception

Definition at line 79 of file Goal.java.

Referenced by Fixedpoint.__iadd__(), and Optimize.__iadd__().

80  {
81  getContext().checkContextMatch(constraints);
82  for (BoolExpr c : constraints)
83  {
84  Native.goalAssert(getContext().nCtx(), getNativeObject(),
85  c.getNativeObject());
86  }
87  }

§ AsBoolExpr()

BoolExpr AsBoolExpr ( )
inline

Goal to BoolExpr conversion.

Returns a string representation of the Goal.

Definition at line 222 of file Goal.java.

222  {
223  int n = size();
224  if (n == 0) {
225  return getContext().mkTrue();
226  } else if (n == 1) {
227  return getFormulas()[0];
228  } else {
229  return getContext().mkAnd(getFormulas());
230  }
231  }
BoolExpr mkAnd(BoolExpr... t)
Definition: Context.java:757
BoolExpr [] getFormulas()
Definition: Goal.java:128

§ getDepth()

int getDepth ( )
inline

The depth of the goal. Remarks: This tracks how many transformations were applied to it.

Definition at line 102 of file Goal.java.

103  {
104  return Native.goalDepth(getContext().nCtx(), getNativeObject());
105  }

§ getFormulas()

BoolExpr [] getFormulas ( )
inline

The formulas in the goal.

Exceptions
Z3Exception

Definition at line 128 of file Goal.java.

Referenced by Goal.AsBoolExpr().

129  {
130  int n = size();
131  BoolExpr[] res = new BoolExpr[n];
132  for (int i = 0; i < n; i++)
133  res[i] = new BoolExpr(getContext(), Native.goalFormula(getContext()
134  .nCtx(), getNativeObject(), i));
135  return res;
136  }

§ getNumExprs()

int getNumExprs ( )
inline

The number of formulas, subformulas and terms in the goal.

Definition at line 141 of file Goal.java.

142  {
143  return Native.goalNumExprs(getContext().nCtx(), getNativeObject());
144  }

§ getPrecision()

Z3_goal_prec getPrecision ( )
inline

The precision of the goal. Remarks: Goals can be transformed using over and under approximations. An under approximation is applied when the objective is to find a model for a given goal. An over approximation is applied when the objective is to find a proof for a given goal.

Definition at line 35 of file Goal.java.

Referenced by Goal.isGarbage(), Goal.isOverApproximation(), Goal.isPrecise(), and Goal.isUnderApproximation().

36  {
37  return Z3_goal_prec.fromInt(Native.goalPrecision(getContext().nCtx(),
38  getNativeObject()));
39  }
Z3_goal_prec
A Goal is essentially a set of formulas. Z3 provide APIs for building strategies/tactics for solving ...
Definition: z3_api.h:1349

§ inconsistent()

boolean inconsistent ( )
inline

Indicates whether the goal contains `false'.

Definition at line 92 of file Goal.java.

93  {
94  return Native.goalInconsistent(getContext().nCtx(), getNativeObject());
95  }

§ isDecidedSat()

boolean isDecidedSat ( )
inline

Indicates whether the goal is empty, and it is precise or the product of an under approximation.

Definition at line 150 of file Goal.java.

151  {
152  return Native.goalIsDecidedSat(getContext().nCtx(), getNativeObject());
153  }

§ isDecidedUnsat()

boolean isDecidedUnsat ( )
inline

Indicates whether the goal contains `false', and it is precise or the product of an over approximation.

Definition at line 159 of file Goal.java.

160  {
161  return Native
162  .goalIsDecidedUnsat(getContext().nCtx(), getNativeObject());
163  }

§ isGarbage()

boolean isGarbage ( )
inline

Indicates whether the goal is garbage (i.e., the product of over- and under-approximations).

Definition at line 69 of file Goal.java.

70  {
72  }
Z3_goal_prec
A Goal is essentially a set of formulas. Z3 provide APIs for building strategies/tactics for solving ...
Definition: z3_api.h:1349
Z3_goal_prec getPrecision()
Definition: Goal.java:35

§ isOverApproximation()

boolean isOverApproximation ( )
inline

Indicates whether the goal is an over-approximation.

Definition at line 60 of file Goal.java.

61  {
63  }
Z3_goal_prec
A Goal is essentially a set of formulas. Z3 provide APIs for building strategies/tactics for solving ...
Definition: z3_api.h:1349
Z3_goal_prec getPrecision()
Definition: Goal.java:35

§ isPrecise()

boolean isPrecise ( )
inline

Indicates whether the goal is precise.

Definition at line 44 of file Goal.java.

45  {
47  }
Z3_goal_prec
A Goal is essentially a set of formulas. Z3 provide APIs for building strategies/tactics for solving ...
Definition: z3_api.h:1349
Z3_goal_prec getPrecision()
Definition: Goal.java:35

§ isUnderApproximation()

boolean isUnderApproximation ( )
inline

Indicates whether the goal is an under-approximation.

Definition at line 52 of file Goal.java.

53  {
55  }
Z3_goal_prec
A Goal is essentially a set of formulas. Z3 provide APIs for building strategies/tactics for solving ...
Definition: z3_api.h:1349
Z3_goal_prec getPrecision()
Definition: Goal.java:35

§ reset()

void reset ( )
inline

Erases all formulas from the given goal.

Definition at line 110 of file Goal.java.

111  {
112  Native.goalReset(getContext().nCtx(), getNativeObject());
113  }

§ simplify() [1/2]

Goal simplify ( )
inline

Simplifies the goal. Remarks: Essentially invokes the `simplify' tactic on the goal.

Definition at line 181 of file Goal.java.

182  {
183  Tactic t = getContext().mkTactic("simplify");
184  ApplyResult res = t.apply(this);
185 
186  if (res.getNumSubgoals() == 0)
187  throw new Z3Exception("No subgoals");
188  else
189  return res.getSubgoals()[0];
190  }
ApplyResult apply(Goal g)
Definition: Tactic.java:50
Tactic mkTactic(String name)
Definition: Context.java:2623

§ simplify() [2/2]

Goal simplify ( Params  p)
inline

Simplifies the goal. Remarks: Essentially invokes the `simplify' tactic on the goal.

Definition at line 197 of file Goal.java.

198  {
199  Tactic t = getContext().mkTactic("simplify");
200  ApplyResult res = t.apply(this, p);
201 
202  if (res.getNumSubgoals() == 0)
203  throw new Z3Exception("No subgoals");
204  else
205  return res.getSubgoals()[0];
206  }
ApplyResult apply(Goal g)
Definition: Tactic.java:50
Tactic mkTactic(String name)
Definition: Context.java:2623

§ size()

int size ( )
inline

The number of formulas in the goal.

Definition at line 118 of file Goal.java.

Referenced by Goal.AsBoolExpr(), and Goal.getFormulas().

119  {
120  return Native.goalSize(getContext().nCtx(), getNativeObject());
121  }

§ toString()

String toString ( )
inline

Goal to string conversion.

Returns
A string representation of the Goal.

Definition at line 213 of file Goal.java.

213  {
214  return Native.goalToString(getContext().nCtx(), getNativeObject());
215  }

§ translate()

Goal translate ( Context  ctx)
inline

Translates (copies) the Goal to the target Context

ctx

.

Exceptions
Z3Exception

Definition at line 170 of file Goal.java.

171  {
172  return new Goal(ctx, Native.goalTranslate(getContext().nCtx(),
173  getNativeObject(), ctx.nCtx()));
174  }