From c791694af8947a0ca817180287c6288486e52e53 Mon Sep 17 00:00:00 2001 From: Ruijie Fang <57693513+ruijiefang@users.noreply.github.com> Date: Mon, 29 Sep 2025 21:48:33 -0500 Subject: [PATCH] Distinguish betwee Lambda and Quantifier in Expr.java --- src/api/java/Expr.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/java/Expr.java b/src/api/java/Expr.java index 60826665d..96e2e2c38 100644 --- a/src/api/java/Expr.java +++ b/src/api/java/Expr.java @@ -2148,8 +2148,15 @@ public class Expr extends AST static Expr create(Context ctx, long obj) { Z3_ast_kind k = Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)); - if (k == Z3_ast_kind.Z3_QUANTIFIER_AST) - return new Quantifier(ctx, obj); + if (k == Z3_ast_kind.Z3_QUANTIFIER_AST) { + // a quantifier AST is a lambda iff it is neither a forall nor an exists. + boolean isLambda = !Native.isQuantifierExists(ctx, obj) && !Native.isQuantifierForall(ctx, obj); + if (isLambda) { + return new Lambda(ctx, obj); + } else { + return new Quantifier(ctx, obj); + } + } long s = Native.getSort(ctx.nCtx(), obj); Z3_sort_kind sk = Z3_sort_kind .fromInt(Native.getSortKind(ctx.nCtx(), s));