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

Public Member Functions

boolean equals (Object o)
 
int compareTo (AST 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 ()
 

Detailed Description

The abstract syntax tree (AST) class.

Definition at line 25 of file AST.java.

Member Function Documentation

§ compareTo()

int compareTo ( AST  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 53 of file AST.java.

54  {
55  if (other == null) {
56  return 1;
57  }
58  return Integer.compare(getId(), other.getId());
59  }

§ equals()

boolean equals ( Object  o)
inline

Object comparison.

Parameters
oanother AST

Definition at line 33 of file AST.java.

34  {
35  if (o == this) return true;
36  if (!(o instanceof AST)) return false;
37  AST casted = (AST) o;
38 
39  return
40  (getContext().nCtx() == casted.getContext().nCtx()) &&
41  (Native.isEqAst(getContext().nCtx(), getNativeObject(), casted.getNativeObject()));
42  }

§ getASTKind()

Z3_ast_kind getASTKind ( )
inline

The kind of the AST.

Exceptions
Z3Exceptionon error

Definition at line 103 of file AST.java.

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

104  {
105  return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(),
106  getNativeObject()));
107  }
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ getId()

int getId ( )
inline

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

Exceptions
Z3Exceptionon error

Definition at line 76 of file AST.java.

Referenced by AST.compareTo().

77  {
78  return Native.getAstId(getContext().nCtx(), getNativeObject());
79  }

§ getSExpr()

String getSExpr ( )
inline

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

Definition at line 185 of file AST.java.

186  {
187  return Native.astToString(getContext().nCtx(), getNativeObject());
188  }

§ hashCode()

int hashCode ( )
inline

The AST's hash code.

Returns
A hash code

Definition at line 67 of file AST.java.

68  {
69  return Native.getAstHash(getContext().nCtx(), getNativeObject());
70  }

§ isApp()

boolean isApp ( )
inline

Indicates whether the AST is an application

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 133 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().

134  {
135  return this.getASTKind() == Z3_ast_kind.Z3_APP_AST;
136  }
Z3_ast_kind getASTKind()
Definition: AST.java:103
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ isExpr()

boolean isExpr ( )
inline

Indicates whether the AST is an Expr

Exceptions
Z3Exceptionon error
Z3Exceptionon error

Definition at line 114 of file AST.java.

Referenced by Expr.isBool().

115  {
116  switch (getASTKind())
117  {
118  case Z3_APP_AST:
119  case Z3_NUMERAL_AST:
120  case Z3_QUANTIFIER_AST:
121  case Z3_VAR_AST:
122  return true;
123  default:
124  return false;
125  }
126  }
Z3_ast_kind getASTKind()
Definition: AST.java:103

§ isFuncDecl()

boolean isFuncDecl ( )
inline

Indicates whether the AST is a FunctionDeclaration

Definition at line 169 of file AST.java.

170  {
171  return this.getASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
172  }
Z3_ast_kind getASTKind()
Definition: AST.java:103
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ isQuantifier()

boolean isQuantifier ( )
inline

Indicates whether the AST is a Quantifier

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 153 of file AST.java.

154  {
155  return this.getASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
156  }
Z3_ast_kind getASTKind()
Definition: AST.java:103
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ isSort()

boolean isSort ( )
inline

Indicates whether the AST is a Sort

Definition at line 161 of file AST.java.

162  {
163  return this.getASTKind() == Z3_ast_kind.Z3_SORT_AST;
164  }
Z3_ast_kind getASTKind()
Definition: AST.java:103
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ isVar()

boolean isVar ( )
inline

Indicates whether the AST is a BoundVariable.

Returns
a boolean
Exceptions
Z3Exceptionon error

Definition at line 143 of file AST.java.

Referenced by Expr.getIndex().

144  {
145  return this.getASTKind() == Z3_ast_kind.Z3_VAR_AST;
146  }
Z3_ast_kind getASTKind()
Definition: AST.java:103
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types...
Definition: z3_api.h:183

§ toString()

String toString ( )
inline

A string representation of the AST.

Definition at line 178 of file AST.java.

178  {
179  return Native.astToString(getContext().nCtx(), getNativeObject());
180  }

§ translate()

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 88 of file AST.java.

89  {
90 
91  if (getContext() == ctx) {
92  return this;
93  } else {
94  return new AST(ctx, Native.translate(getContext().nCtx(),
95  getNativeObject(), ctx.nCtx()));
96  }
97  }