18 package com.microsoft.z3;
35 if (o ==
this)
return true;
36 if (!(o instanceof
FuncDecl))
return false;
40 (getContext().nCtx() == other.getContext().nCtx()) &&
44 other.getNativeObject()));
50 return Native.funcDeclToString(getContext().nCtx(), getNativeObject());
59 return Native.getFuncDeclId(getContext().nCtx(), getNativeObject());
67 return Native.getArity(getContext().nCtx(), getNativeObject());
76 return Native.getDomainSize(getContext().nCtx(), getNativeObject());
88 for (
int i = 0; i < n; i++)
89 res[i] =
Sort.create(getContext(),
90 Native.getDomain(getContext().nCtx(), getNativeObject(), i));
100 return Sort.create(getContext(),
101 Native.getRange(getContext().nCtx(), getNativeObject()));
109 return Z3_decl_kind.fromInt(Native.getDeclKind(getContext().nCtx(),
119 return Symbol.create(getContext(),
120 Native.getDeclName(getContext().nCtx(), getNativeObject()));
128 return Native.getDeclNumParameters(getContext().nCtx(), getNativeObject());
139 for (
int i = 0; i < num; i++)
142 .getDeclParameterKind(getContext().nCtx(), getNativeObject(), i));
146 res[i] =
new Parameter(k, Native.getDeclIntParameter(getContext()
147 .nCtx(), getNativeObject(), i));
150 res[i] =
new Parameter(k, Native.getDeclDoubleParameter(
151 getContext().nCtx(), getNativeObject(), i));
155 .getDeclSymbolParameter(getContext().nCtx(),
156 getNativeObject(), i)));
160 .getDeclSortParameter(getContext().nCtx(), getNativeObject(),
165 Native.getDeclAstParameter(getContext().nCtx(),
166 getNativeObject(), i)));
170 Native.getDeclFuncDeclParameter(getContext().nCtx(),
171 getNativeObject(), i)));
174 res[i] =
new Parameter(k, Native.getDeclRationalParameter(
175 getContext().nCtx(), getNativeObject(), i));
179 "Unknown function declaration parameter kind encountered");
215 throw new Z3Exception(
"parameter is not a double ");
225 throw new Z3Exception(
"parameter is not a Symbol");
255 throw new Z3Exception(
"parameter is not a function declaration");
265 throw new Z3Exception(
"parameter is not a rational String");
320 FuncDecl(Context ctx,
long obj)
326 FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
329 super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.getNativeObject(),
330 AST.arrayLength(domain), AST.arrayToNative(domain),
331 range.getNativeObject()));
335 FuncDecl(Context ctx,
String prefix, Sort[] domain, Sort range)
338 super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix,
339 AST.arrayLength(domain), AST.arrayToNative(domain),
340 range.getNativeObject()));
344 void checkNativeObject(
long obj)
346 if (Native.getAstKind(getContext().nCtx(), obj) !=
Z3_ast_kind.Z3_FUNC_DECL_AST
348 throw new Z3Exception(
349 "Underlying object is not a function declaration");
350 super.checkNativeObject(obj);
358 getContext().checkContextMatch(args);
359 return Expr.create(getContext(),
this, args);
Z3_parameter_kind getParameterKind()
Expr apply(Expr ... args)
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Z3_decl_kind getDeclKind()
Z3_parameter_kind
The different kinds of parameters that can be associated with function symbols.
Parameter [] getParameters()
Z3_decl_kind
The different kinds of interpreted function kinds.
def String(name, ctx=None)