A Model contains interpretations (assignments) of constants and functions. More...
A Model contains interpretations (assignments) of constants and functions.
Definition at line 36 of file NativeModel.cs.
◆ ConstFuncInterp()Retrieves the interpretation (the assignment) of f in the model.
Definition at line 51 of file NativeModel.cs.
53 if(Native.Z3_get_arity(ntvContext.nCtx, f) != 0)
54 throw newZ3Exception(
"Non-zero arity functions have FunctionInterpretations as a model. Use FuncInterp.");
56 returnNative.Z3_model_get_const_interp(ntvContext.nCtx, NativeObject, f);
◆ ConstInterp()Retrieves the interpretation (the assignment) of a in the model.
Disposes of the underlying native Z3 object.
Definition at line 368 of file NativeModel.cs.
370 if(NativeObject != IntPtr.Zero)
372Native.Z3_model_dec_ref(ntvContext.nCtx, NativeObject);
373NativeObject = IntPtr.Zero;
375GC.SuppressFinalize(
this);
◆ Double()Evaluate expression to a double, assuming it is a numeral already.
Definition at line 232 of file NativeModel.cs.
234var r =
Eval(t,
true);
235 returnNative.Z3_get_numeral_double(ntvContext.nCtx, r);
Z3_ast Eval(Z3_ast t, bool completion=false)
Evaluates the expression t in the current model.
◆ Eval()Evaluates the expression t in the current model.
This function may fail if t contains quantifiers, is partial (MODEL_PARTIAL enabled), or if t is not well-sorted. In this case a ModelEvaluationFailedException
is thrown.
Definition at line 214 of file NativeModel.cs.
217IntPtr v = IntPtr.Zero;
218 if(Native.Z3_model_eval(ntvContext.nCtx, NativeObject, t, (
byte)(completion ? 1 : 0), ref v) == (
byte)0)
219 throw newModelEvaluationFailedException();
Referenced by NativeModel.Double(), and NativeModel.TryGetArrayValue().
◆ Evaluate() ◆ FuncInterp()Retrieves the interpretation (the assignment) of a non-constant f in the model.
Definition at line 64 of file NativeModel.cs.
68 if(Native.Z3_get_arity(ntvContext.nCtx, f) == 0)
70IntPtr n = Native.Z3_model_get_const_interp(ntvContext.nCtx, NativeObject, f);
78 if(Native.Z3_is_as_array(ntvContext.nCtx, n) == 0)
79 throw newZ3Exception(
"Argument was not an array constant");
80var fd = Native.Z3_get_as_array_func_decl(ntvContext.nCtx, n);
81 return newNativeFuncInterp(ntvContext,
this, f, fd);
86 throw newZ3Exception(
"Constant functions do not have a function interpretation; use ConstInterp");
91IntPtr n = Native.Z3_model_get_func_interp(ntvContext.nCtx, NativeObject, f);
95 return newNativeFuncInterp(ntvContext,
this, f, n);
Z3_sort_kind
The different kinds of Z3 types (See Z3_get_sort_kind).
◆ ToString() override string ToString ( ) inlineConversion of models to strings.
Definition at line 339 of file NativeModel.cs.
341 returnNative.Z3_model_to_string(ntvContext.nCtx, NativeObject);
◆ TryGetArrayValue()Convert the interpretation of t into a sequence of array updates
Definition at line 272 of file NativeModel.cs.
274var r =
Eval(t,
true);
276var updates =
newDictionary<Z3_ast, Z3_ast>();
286result =
newArrayValue();
287result.Else = ntvContext.GetAppArg(r, 0);
288result.Updates = updates.ToArray();
289result.Domain = updates.Keys.ToArray();
290result.Range = updates.Values.ToArray();
295Debug.Assert(ntvContext.
GetNumArgs(r) == 3);
296updates[ntvContext.GetAppArg(r, 1)] = ntvContext.GetAppArg(r, 2);
297r = ntvContext.GetAppArg(r, 0);
Z3_ast_kind GetAstKind(Z3_ast ast)
Get the AST kind from IntPtr
uint GetNumArgs(Z3_app app)
Return number of arguments for app
Z3_decl_kind GetDeclKind(Z3_func_decl decl)
Get the Decl kind from IntPtr
Z3_func_decl GetAppDecl(Z3_ast ast)
Get App Decl from IntPtr
Z3_ast_kind
The different kinds of Z3 AST (abstract syntax trees). That is, terms, formulas and types.
Z3_decl_kind
The different kinds of interpreted function kinds.
System.IntPtr Z3_func_decl
◆ ConstDeclsThe function declarations of the constants in the model.
Definition at line 113 of file NativeModel.cs.
120 for(uint i = 0; i < n; i++)
121res[i] = Native.Z3_model_get_const_decl(ntvContext.nCtx, NativeObject, i);
uint NumConsts
The number of constants that have an interpretation in the model.
◆ ConstsEnumerate constants in model.
Definition at line 130 of file NativeModel.cs.
135 for(uint i = 0; i < nc; ++i)
137var f = Native.Z3_model_get_const_decl(ntvContext.nCtx, NativeObject, i);
138IntPtr n = Native.Z3_model_get_const_interp(ntvContext.nCtx, NativeObject, f);
139 if(n == IntPtr.Zero)
continue;
140yield
return newKeyValuePair<Z3_func_decl, Z3_ast>(f, n);
◆ DeclsAll symbols that have an interpretation in the model.
Definition at line 172 of file NativeModel.cs.
179uint n = nFuncs + nConsts;
181 for(uint i = 0; i < nConsts; i++)
182res[i] = Native.Z3_model_get_const_decl(ntvContext.nCtx, NativeObject, i);
183 for(uint i = 0; i < nFuncs; i++)
184res[nConsts + i] = Native.Z3_model_get_func_decl(ntvContext.nCtx, NativeObject, i);
uint NumFuncs
The number of function interpretations in the model.
◆ FuncDeclsThe function declarations of the function interpretations in the model.
Definition at line 156 of file NativeModel.cs.
163 for(uint i = 0; i < n; i++)
164res[i] = Native.Z3_model_get_func_decl(ntvContext.nCtx, NativeObject, i);
◆ NumConstsThe number of constants that have an interpretation in the model.
Definition at line 104 of file NativeModel.cs.
106 get{
returnNative.Z3_model_get_num_consts(ntvContext.nCtx, NativeObject); }
◆ NumFuncsThe number of function interpretations in the model.
Definition at line 148 of file NativeModel.cs.
150 get{
returnNative.Z3_model_get_num_funcs(ntvContext.nCtx, NativeObject); }
◆ NumSortsThe number of uninterpreted sorts that the model has an interpretation for.
Definition at line 309 of file NativeModel.cs.
309{
get{
returnNative.Z3_model_get_num_sorts(ntvContext.nCtx, NativeObject); } }
◆ SortsThe uninterpreted sorts that the model has an interpretation for.
Z3 also provides an interpretation for uninterpreted sorts used in a formula. The interpretation for a sort is a finite set of distinct values. We say this finite set is the "universe" of the sort.
Definition at line 321 of file NativeModel.cs.
328 for(uint i = 0; i < n; i++)
329res[i] = Native.Z3_model_get_sort(ntvContext.nCtx, NativeObject, i);
uint NumSorts
The number of uninterpreted sorts that the model has an interpretation for.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4