3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-20 20:05:51 +00:00

Add missing AST query methods to Java API (#8977)

* add Expr.isGround() to Java API

Expose Z3_is_ground as a public method on Expr. Returns true when the
expression contains no free variables.

* add Expr.isLambda() to Java API

Expose Z3_is_lambda as a public method on Expr. Returns true when the
expression is a lambda quantifier.

* add AST.getDepth() to Java API

Expose Z3_get_depth as a public method on AST. Returns the maximum
number of nodes on any path from root to leaf.

* add ArraySort.getArity() to Java API

Expose Z3_get_array_arity as a public method on ArraySort. Returns
the number of dimensions of a multi-dimensional array sort.

* add DatatypeSort.isRecursive() to Java API

Expose Z3_is_recursive_datatype_sort as a public method on
DatatypeSort. Returns true when the datatype refers to itself.

* add FPExpr.isNumeral() to Java API

Expose Z3_fpa_is_numeral as a public method on FPExpr. Returns true
when the expression is a concrete floating-point value.

* add isGroundExample test to JavaExample

Test Expr.isGround() on constants, variables, and compound
expressions.

* add astDepthExample test to JavaExample

Test AST.getDepth() on leaf nodes and nested expressions to verify
the depth computation.

* add arrayArityExample test to JavaExample

Test ArraySort.getArity() on single-domain and multi-domain array
sorts.

* add recursiveDatatypeExample test to JavaExample

Test DatatypeSort.isRecursive() on a recursive list datatype and a
non-recursive pair datatype.

* add fpNumeralExample test to JavaExample

Test FPExpr.isNumeral() on a floating point constant and a symbolic
variable.

* add isLambdaExample test to JavaExample

Test Expr.isLambda() on a lambda expression and a plain variable.
This commit is contained in:
Angelica Moreira 2026-03-14 10:13:42 -07:00 committed by GitHub
parent 6e5971641f
commit b8e15f2121
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 205 additions and 1 deletions

View file

@ -306,6 +306,26 @@ public class Expr<R extends Sort> extends AST
return Native.isAlgebraicNumber(getContext().nCtx(), getNativeObject());
}
/**
* Indicates whether the term is ground (contains no free variables).
* @throws Z3Exception on error
* @return a boolean
**/
public boolean isGround()
{
return Native.isGround(getContext().nCtx(), getNativeObject());
}
/**
* Indicates whether the term is a lambda expression.
* @throws Z3Exception on error
* @return a boolean
**/
public boolean isLambda()
{
return Native.isLambda(getContext().nCtx(), getNativeObject());
}
/**
* Indicates whether the term has Boolean sort.
* @throws Z3Exception on error