18 package com.microsoft.z3;
32 return Native.isQuantifierForall(getContext().nCtx(), getNativeObject());
48 return Native.getQuantifierWeight(getContext().nCtx(), getNativeObject());
57 .getQuantifierNumPatterns(getContext().nCtx(), getNativeObject());
69 for (
int i = 0; i < n; i++)
70 res[i] =
new Pattern(getContext(), Native.getQuantifierPatternAst(
71 getContext().nCtx(), getNativeObject(), i));
80 return Native.getQuantifierNumNoPatterns(getContext().nCtx(),
93 for (
int i = 0; i < n; i++)
94 res[i] =
new Pattern(getContext(), Native.getQuantifierNoPatternAst(
95 getContext().nCtx(), getNativeObject(), i));
104 return Native.getQuantifierNumBound(getContext().nCtx(), getNativeObject());
116 for (
int i = 0; i < n; i++)
117 res[i] =
Symbol.create(getContext(), Native.getQuantifierBoundName(
118 getContext().nCtx(), getNativeObject(), i));
131 for (
int i = 0; i < n; i++)
132 res[i] =
Sort.create(getContext(), Native.getQuantifierBoundSort(
133 getContext().nCtx(), getNativeObject(), i));
144 return new BoolExpr(getContext(), Native.getQuantifierBody(getContext()
145 .nCtx(), getNativeObject()));
160 ctx.checkContextMatch(patterns);
161 ctx.checkContextMatch(noPatterns);
162 ctx.checkContextMatch(sorts);
163 ctx.checkContextMatch(names);
164 ctx.checkContextMatch(body);
166 if (sorts.length != names.length) {
168 "Number of sorts does not match number of names");
172 if (noPatterns ==
null && quantifierID ==
null && skolemID ==
null) {
173 nativeObj = Native.mkQuantifier(ctx.nCtx(), (isForall), weight,
AST.arrayLength(patterns),
AST 174 .arrayToNative(patterns),
AST.arrayLength(sorts),
AST 175 .arrayToNative(sorts),
Symbol.arrayToNative(names), body
178 nativeObj = Native.mkQuantifierEx(ctx.nCtx(),
179 (isForall), weight,
AST.getNativeObject(quantifierID),
180 AST.getNativeObject(skolemID),
181 AST.arrayLength(patterns),
AST.arrayToNative(patterns),
182 AST.arrayLength(noPatterns),
AST.arrayToNative(noPatterns),
183 AST.arrayLength(sorts),
AST.arrayToNative(sorts),
184 Symbol.arrayToNative(names),
185 body.getNativeObject());
205 ctx.checkContextMatch(noPatterns);
206 ctx.checkContextMatch(patterns);
207 ctx.checkContextMatch(body);
210 if (noPatterns ==
null && quantifierID ==
null && skolemID ==
null) {
211 nativeObj = Native.mkQuantifierConst(ctx.nCtx(),
212 isForall, weight,
AST.arrayLength(bound),
213 AST.arrayToNative(bound),
AST.arrayLength(patterns),
214 AST.arrayToNative(patterns), body.getNativeObject());
216 nativeObj = Native.mkQuantifierConstEx(ctx.nCtx(),
218 AST.getNativeObject(quantifierID),
219 AST.getNativeObject(skolemID),
AST.arrayLength(bound),
220 AST.arrayToNative(bound),
AST.arrayLength(patterns),
221 AST.arrayToNative(patterns),
AST.arrayLength(noPatterns),
222 AST.arrayToNative(noPatterns), body.getNativeObject());
233 void checkNativeObject(
long obj) {
234 if (Native.getAstKind(getContext().nCtx(), obj) !=
Z3_ast_kind.Z3_QUANTIFIER_AST
236 throw new Z3Exception(
"Underlying object is not a quantifier");
238 super.checkNativeObject(obj);
static Quantifier of(Context ctx, boolean isForall, Expr[] bound, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID)
static Quantifier of(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID)
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Symbol [] getBoundVariableNames()
Pattern [] getNoPatterns()
Sort [] getBoundVariableSorts()