37 return Object.ReferenceEquals(a, b) ||
38 (!Object.ReferenceEquals(a,
null) &&
39 !Object.ReferenceEquals(b,
null) &&
40 a.Context.nCtx == b.Context.nCtx &&
41 Native.Z3_is_eq_func_decl(a.Context.nCtx, a.NativeObject, b.NativeObject) != 0);
56 public override bool Equals(
object o)
59 if (casted ==
null)
return false;
60 return this == casted;
68 return base.GetHashCode();
76 return Native.Z3_func_decl_to_string(
Context.nCtx, NativeObject);
84 get {
return Native.Z3_get_func_decl_id(
Context.nCtx, NativeObject); }
92 get {
return Native.Z3_get_arity(
Context.nCtx, NativeObject); }
101 get {
return Native.Z3_get_domain_size(
Context.nCtx, NativeObject); }
111 Contract.Ensures(Contract.Result<
Sort[]>() !=
null);
116 for (uint i = 0; i < n; i++)
129 Contract.Ensures(Contract.Result<
Sort>() !=
null);
149 Contract.Ensures(Contract.Result<
Symbol>() !=
null);
159 get {
return Native.Z3_get_decl_num_parameters(
Context.nCtx, NativeObject); }
169 Contract.Ensures(Contract.Result<
Parameter[]>() !=
null);
173 for (uint i = 0; i < num; i++)
179 res[i] =
new Parameter(k, Native.Z3_get_decl_int_parameter(
Context.nCtx, NativeObject, i));
182 res[i] =
new Parameter(k, Native.Z3_get_decl_double_parameter(
Context.nCtx, NativeObject, i));
197 res[i] =
new Parameter(k, Native.Z3_get_decl_rational_parameter(
Context.nCtx, NativeObject, i));
200 throw new Z3Exception(
"Unknown function declaration parameter kind encountered");
213 readonly
private int i;
214 readonly
private double d;
215 readonly
private Symbol sym;
216 readonly
private Sort srt;
217 readonly
private AST ast;
219 readonly
private string r;
287 internal FuncDecl(Context ctx, IntPtr obj)
290 Contract.Requires(ctx !=
null);
293 internal FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
294 : base(ctx, Native.
Z3_mk_func_decl(ctx.nCtx, name.NativeObject, AST.ArrayLength(domain), AST.ArrayToNative(domain), range.NativeObject))
296 Contract.Requires(ctx !=
null);
297 Contract.Requires(name !=
null);
298 Contract.Requires(range !=
null);
301 internal FuncDecl(Context ctx,
string prefix, Sort[] domain, Sort range)
302 : base(ctx, Native.
Z3_mk_fresh_func_decl(ctx.nCtx, prefix, AST.ArrayLength(domain), AST.ArrayToNative(domain), range.NativeObject))
304 Contract.Requires(ctx !=
null);
305 Contract.Requires(range !=
null);
309 internal override void CheckNativeObject(IntPtr obj)
311 if (Native.Z3_get_ast_kind(Context.nCtx, obj) != (uint)
Z3_ast_kind.Z3_FUNC_DECL_AST)
312 throw new Z3Exception(
"Underlying object is not a function declaration");
313 base.CheckNativeObject(obj);
323 public Expr
this[params Expr[]
args]
327 Contract.Requires(
args ==
null || Contract.ForAll(
args, a => a !=
null));
340 Contract.Requires(
args ==
null || Contract.ForAll(
args, a => a !=
null));
Z3_func_decl Z3_API Z3_mk_fresh_func_decl(Z3_context c, Z3_string prefix, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a fresh constant or function.
AST AST
The AST value of the parameter.
uint DomainSize
The size of the domain of the function declaration Arity
Expr this[params Expr[] args
Create expression that applies function to arguments.
uint NumParameters
The number of parameters of the function declaration
uint Arity
The arity of the function declaration
new uint Id
Returns a unique identifier for the function declaration.
override bool Equals(object o)
Object comparison.
Symbol Symbol
The Symbol value of the parameter.
FuncDecl FuncDecl
The FunctionDeclaration value of the parameter.
Z3_decl_kind DeclKind
The kind of the function declaration.
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
string Rational
The rational string value of the parameter.
static bool operator !=(FuncDecl a, FuncDecl b)
Comparison operator.
double Double
The double value of the parameter.
Sort Sort
The Sort value of the parameter.
override int GetHashCode()
A hash code.
Parameter [] Parameters
The parameters of the function declaration
Function declarations can have Parameters associated with them.
Expr Apply(params Expr[] args)
Create expression that applies function to arguments.
int Int
The int value of the parameter.
Sort Range
The range of the function declaration
Z3_parameter_kind
The different kinds of parameters that can be associated with function symbols.
The main interaction with Z3 happens via the Context.
The Sort class implements type information for ASTs.
Symbol Name
The name of the function declaration
The exception base class for error reporting from Z3
The abstract syntax tree (AST) class.
Z3_parameter_kind ParameterKind
The kind of the parameter.
Sort [] Domain
The domain of the function declaration
Symbols are used to name several term and type constructors.
static bool operator==(FuncDecl a, FuncDecl b)
Comparison operator.
override string ToString()
A string representations of the function declaration.
Z3_decl_kind
The different kinds of interpreted function kinds.