3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-23 06:13:40 +00:00

NativeModel: TryGetArrayValue (#5881)

* WiP:  Disposable, MkAdd, MkApp, MkBool, MkBoolSort, MkBound, MkBvSort, MkFalse, MkTrue, MkIntSort

* WiP: Native z3 mk_ functions

* WiP: mk_ functions for NativeContext

* WiP: add utility functions for getting values

* WiP: Adding more native utility functions

* native model pull

* WiP: NativeContext additions for array access

* WiP: use Z3_symbol in place of managed Symbol

* WiP: add solver, model, and array methods

* WiP: MkSimpleSolver, MkReal

* WiP: GetDomain GetRange

* WiP: MkExists

* Override for MkFuncDecl

* MkConstArray, MkSelect

* WiP: code cleanup

* migrate Context reference to NativeContext

* remove local signing from PR

* minor code cleanup

* Sorts to properties, fix usings,

* make IntSort property

* sort using

* IntSort, RealSort - properties

* WiP: get array value update

Co-authored-by: jfleisher <jofleish@microsoft.com>
This commit is contained in:
John Fleisher 2022-03-03 16:06:30 -05:00 committed by GitHub
parent 248a3676af
commit 35d26bc282
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 54 deletions

View file

@ -235,7 +235,7 @@ namespace Microsoft.Z3
public Z3_ast MkReal(string v)
{
Debug.Assert(!string.IsNullOrEmpty(v));
return Native.Z3_mk_numeral(nCtx, v, MkRealSort());
return Native.Z3_mk_numeral(nCtx, v, RealSort);
}
/// <summary>
@ -304,10 +304,14 @@ namespace Microsoft.Z3
#region Sort
public Z3_sort MkIntSort() => Native.Z3_mk_int_sort(nCtx);
public Z3_sort MkBoolSort() => Native.Z3_mk_bool_sort(nCtx);
/// <summary>
/// Sorts return same ptr for subsequent calls
/// </summary>
public Z3_sort IntSort => Native.Z3_mk_int_sort(nCtx);
public Z3_sort BoolSort => Native.Z3_mk_bool_sort(nCtx);
public Z3_sort RealSort => Native.Z3_mk_real_sort(nCtx);
public Z3_sort MkBvSort(uint size) => Native.Z3_mk_bv_sort(nCtx, size);
public Z3_sort MkRealSort() => Native.Z3_mk_real_sort(nCtx);
public Z3_sort MkListSort(string name, Z3_sort elemSort,
out Z3_func_decl inil, out Z3_func_decl iisnil,
@ -1086,17 +1090,24 @@ namespace Microsoft.Z3
/// <returns></returns>
public Z3_ast[] GetAppArgs(Z3_app app)
{
Debug.Assert(app != IntPtr.Zero);
var numArgs = Native.Z3_get_app_num_args(nCtx, app);
var numArgs = GetNumArgs(app);
var args = new Z3_ast[numArgs];
for (uint i = 0; i < numArgs; i++)
{
args[i] = Native.Z3_get_app_arg(nCtx, app, i);
args[i] = GetAppArg(app, i);
}
return args;
}
public uint GetNumArgs(Z3_app app)
{
Debug.Assert(app != IntPtr.Zero);
return Native.Z3_get_app_num_args(nCtx, app);
}
internal Z3_ast GetAppArg(Z3_app app, uint i) => Native.Z3_get_app_arg(nCtx, app, i);
/// <summary>
/// Get App Decl from IntPtr
/// </summary>