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

Public Member Functions

boolean equals (Object o)
 
int compareTo (Object other)
 
int hashCode ()
 
int getId ()
 
AST translate (Context ctx)
 
Z3_ast_kind getASTKind ()
 
boolean isExpr ()
 
boolean isApp ()
 
boolean isVar ()
 
boolean isQuantifier ()
 
boolean isSort ()
 
boolean isFuncDecl ()
 
String toString ()
 
String getSExpr ()
 
- Public Member Functions inherited from Z3Object
void dispose ()
 
- Public Member Functions inherited from IDisposable
void dispose ()
 

Additional Inherited Members

- Protected Member Functions inherited from Z3Object
void finalize ()
 

Detailed Description

The abstract syntax tree (AST) class.

Definition at line 25 of file AST.java.

Member Function Documentation

int compareTo ( Object  other)
inline

Object Comparison.

Parameters
otherAnother AST
Returns
Negative if the object should be sorted before
other
, positive if after else zero.
Exceptions
Z3Exceptionon error

Definition at line 57 of file AST.java.

58  {
59  if (other == null)
60  return 1;
61 
62  AST oAST = null;
63  try
64  {
65  oAST = AST.class.cast(other);
66  } catch (ClassCastException e)
67  {
68  return 1;
69  }
70 
71  if (getId() < oAST.getId())
72  return -1;
73  else if (getId() > oAST.getId())
74  return +1;
75  else
76  return 0;
77  }
boolean equals ( Object  o)
inline

Object comparison.

Parameters
oanother AST

Definition at line 34 of file AST.java.

35  {
36  AST casted = null;
37 
38  try
39  {
40  casted = AST.class.cast(o);
41  } catch (ClassCastException e)
42  {
43  return false;
44  }
45 
46  return this.getNativeObject() == casted.getNativeObject();
47  }
Z3_ast_kind getASTKind ( )
inline

The kind of the AST.

Exceptions
Z3Exceptionon error

Definition at line 124 of file AST.java.

Referenced by AST.isApp(), AST.isExpr(), AST.isFuncDecl(), AST.isQuantifier(), AST.isSort(), and AST.isVar().

125  {
126  return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
127  getNativeObject()));
128  }
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
int getId ( )
inline

A unique identifier for the AST (unique among all ASTs).

Exceptions
Z3Exceptionon error

Definition at line 98 of file AST.java.

Referenced by AST.compareTo().

99  {
100  return Native.getAstId(getContext().nCtx(), getNativeObject());
101  }
String getSExpr ( )
inline

A string representation of the AST in s-expression notation.

Definition at line 212 of file AST.java.

213  {
214  return Native.astToString(getContext().nCtx(), getNativeObject());
215  }
int hashCode ( )
inline

The AST's hash code.

Returns
A hash code

Definition at line 84 of file AST.java.

85  {
86  int r = 0;
87  try {
88  Native.getAstHash(getContext().nCtx(), getNativeObject());
89  }
90  catch (Z3Exception ex) {}
91  return r;
92  }
boolean isApp ( )
inline

Indicates whether the AST is an application

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 154 of file AST.java.

Referenced by Expr.isAdd(), Expr.isAnd(), Expr.isArithmeticNumeral(), Expr.isArrayMap(), Expr.isAsArray(), Expr.isBVAdd(), Expr.isBVAND(), Expr.isBVBitOne(), Expr.isBVBitZero(), Expr.isBVCarry(), Expr.isBVComp(), Expr.isBVConcat(), Expr.isBVExtract(), Expr.isBVMul(), Expr.isBVNAND(), Expr.isBVNOR(), Expr.isBVNOT(), Expr.isBVNumeral(), Expr.isBVOR(), Expr.isBVReduceAND(), Expr.isBVReduceOR(), Expr.isBVRepeat(), Expr.isBVRotateLeft(), Expr.isBVRotateLeftExtended(), Expr.isBVRotateRight(), Expr.isBVRotateRightExtended(), Expr.isBVSDiv(), Expr.isBVSGE(), Expr.isBVSGT(), Expr.isBVShiftLeft(), Expr.isBVShiftRightArithmetic(), Expr.isBVShiftRightLogical(), Expr.isBVSignExtension(), Expr.isBVSLE(), Expr.isBVSLT(), Expr.isBVSMod(), Expr.isBVSRem(), Expr.isBVSub(), Expr.isBVToInt(), Expr.isBVUDiv(), Expr.isBVUGE(), Expr.isBVUGT(), Expr.isBVULE(), Expr.isBVULT(), Expr.isBVUMinus(), Expr.isBVURem(), Expr.isBVXNOR(), Expr.isBVXOR(), Expr.isBVXOR3(), Expr.isBVZeroExtension(), Expr.isConst(), Expr.isConstantArray(), Expr.isDefaultArray(), Expr.isDistinct(), Expr.isDiv(), Expr.isEmptyRelation(), Expr.isEq(), Expr.isFalse(), Expr.isFiniteDomainLT(), Expr.isGE(), Expr.isGT(), Expr.isIDiv(), Expr.isIff(), Expr.isImplies(), Expr.isIntToBV(), Expr.isIntToReal(), Expr.isIsEmptyRelation(), Expr.isITE(), Expr.isLabel(), Expr.isLabelLit(), Expr.isLE(), Expr.isLT(), Expr.isModulus(), Expr.isMul(), Expr.isNot(), Expr.isOEQ(), Expr.isOr(), Expr.isProofAndElimination(), Expr.isProofApplyDef(), Expr.isProofAsserted(), Expr.isProofCNFStar(), Expr.isProofCommutativity(), Expr.isProofDefAxiom(), Expr.isProofDefIntro(), Expr.isProofDER(), Expr.isProofDistributivity(), Expr.isProofElimUnusedVars(), Expr.isProofGoal(), Expr.isProofHypothesis(), Expr.isProofIFFFalse(), Expr.isProofIFFOEQ(), Expr.isProofIFFTrue(), Expr.isProofLemma(), Expr.isProofModusPonens(), Expr.isProofModusPonensOEQ(), Expr.isProofMonotonicity(), Expr.isProofNNFNeg(), Expr.isProofNNFPos(), Expr.isProofNNFStar(), Expr.isProofOrElimination(), Expr.isProofPullQuant(), Expr.isProofPullQuantStar(), Expr.isProofPushQuant(), Expr.isProofQuantInst(), Expr.isProofQuantIntro(), Expr.isProofReflexivity(), Expr.isProofRewrite(), Expr.isProofRewriteStar(), Expr.isProofSkolemize(), Expr.isProofSymmetry(), Expr.isProofTheoryLemma(), Expr.isProofTransitivity(), Expr.isProofTransitivityStar(), Expr.isProofTrue(), Expr.isProofUnitResolution(), Expr.isRealIsInt(), Expr.isRealToInt(), Expr.isRelationalJoin(), Expr.isRelationClone(), Expr.isRelationComplement(), Expr.isRelationFilter(), Expr.isRelationNegationFilter(), Expr.isRelationProject(), Expr.isRelationRename(), Expr.isRelationSelect(), Expr.isRelationStore(), Expr.isRelationUnion(), Expr.isRelationWiden(), Expr.isRemainder(), FPRMNum.isRNA(), FPRMNum.isRNE(), FPRMNum.isRoundNearestTiesToAway(), FPRMNum.isRoundNearestTiesToEven(), FPRMNum.isRoundTowardNegative(), FPRMNum.isRoundTowardPositive(), FPRMNum.isRoundTowardZero(), FPRMNum.isRTN(), FPRMNum.isRTP(), FPRMNum.isRTZ(), Expr.isSelect(), Expr.isSetComplement(), Expr.isSetDifference(), Expr.isSetIntersect(), Expr.isSetSubset(), Expr.isSetUnion(), Expr.isStore(), Expr.isSub(), Expr.isTrue(), Expr.isUMinus(), Expr.isXor(), and Expr.update().

155  {
156  return this.getASTKind() == Z3_ast_kind.Z3_APP_AST;
157  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
boolean isExpr ( )
inline

Indicates whether the AST is an Expr

Exceptions
Z3Exceptionon error
Z3Exceptionon error

Definition at line 135 of file AST.java.

Referenced by Expr.isBool().

136  {
137  switch (getASTKind())
138  {
139  case Z3_APP_AST:
140  case Z3_NUMERAL_AST:
141  case Z3_QUANTIFIER_AST:
142  case Z3_VAR_AST:
143  return true;
144  default:
145  return false;
146  }
147  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
boolean isFuncDecl ( )
inline

Indicates whether the AST is a FunctionDeclaration

Definition at line 190 of file AST.java.

191  {
192  return this.getASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
193  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
boolean isQuantifier ( )
inline

Indicates whether the AST is a Quantifier

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 174 of file AST.java.

175  {
176  return this.getASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
177  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
boolean isSort ( )
inline

Indicates whether the AST is a Sort

Definition at line 182 of file AST.java.

183  {
184  return this.getASTKind() == Z3_ast_kind.Z3_SORT_AST;
185  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
boolean isVar ( )
inline

Indicates whether the AST is a BoundVariable.

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 164 of file AST.java.

Referenced by Expr.getIndex().

165  {
166  return this.getASTKind() == Z3_ast_kind.Z3_VAR_AST;
167  }
Z3_ast_kind getASTKind()
Definition: AST.java:124
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:214
String toString ( )
inline

A string representation of the AST.

Definition at line 198 of file AST.java.

199  {
200  try
201  {
202  return Native.astToString(getContext().nCtx(), getNativeObject());
203  } catch (Z3Exception e)
204  {
205  return "Z3Exception: " + e.getMessage();
206  }
207  }
AST translate ( Context  ctx)
inline

Translates (copies) the AST to the Context

ctx

.

Parameters
ctxA context
Returns
A copy of the AST which is associated with
ctx
Exceptions
Z3Exceptionon error

Definition at line 110 of file AST.java.

111  {
112 
113  if (getContext() == ctx)
114  return this;
115  else
116  return new AST(ctx, Native.translate(getContext().nCtx(),
117  getNativeObject(), ctx.nCtx()));
118  }