mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
update managed APIs for lambda-based array models #2400
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
659be6940b
commit
2d4e9a0f67
|
@ -363,10 +363,10 @@ namespace test_mapi
|
||||||
|
|
||||||
Console.WriteLine("Model = " + s.Model);
|
Console.WriteLine("Model = " + s.Model);
|
||||||
|
|
||||||
//Console.WriteLine("Interpretation of MyArray:\n" + s.Model.ConstInterp(aex.FuncDecl));
|
Console.WriteLine("Interpretation of MyArray:\n" + s.Model.ConstInterp(aex.FuncDecl));
|
||||||
Console.WriteLine("Interpretation of x:\n" + s.Model.ConstInterp(xc));
|
Console.WriteLine("Interpretation of x:\n" + s.Model.ConstInterp(xc));
|
||||||
Console.WriteLine("Interpretation of f:\n" + s.Model.FuncInterp(fd));
|
Console.WriteLine("Interpretation of f:\n" + s.Model.FuncInterp(fd));
|
||||||
//Console.WriteLine("Interpretation of MyArray as Term:\n" + s.Model.ConstInterp(aex.FuncDecl));
|
Console.WriteLine("Interpretation of MyArray as Term:\n" + s.Model.ConstInterp(aex.FuncDecl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -51,9 +51,8 @@ namespace Microsoft.Z3
|
||||||
Debug.Assert(f != null);
|
Debug.Assert(f != null);
|
||||||
|
|
||||||
Context.CheckContextMatch(f);
|
Context.CheckContextMatch(f);
|
||||||
if (f.Arity != 0 ||
|
if (f.Arity != 0)
|
||||||
Native.Z3_get_sort_kind(Context.nCtx, Native.Z3_get_range(Context.nCtx, f.NativeObject)) == (uint)Z3_sort_kind.Z3_ARRAY_SORT)
|
throw new Z3Exception("Non-zero arity functions have FunctionInterpretations as a model. Use FuncInterp.");
|
||||||
throw new Z3Exception("Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
|
|
||||||
|
|
||||||
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
|
IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject);
|
||||||
if (n == IntPtr.Zero)
|
if (n == IntPtr.Zero)
|
||||||
|
|
|
@ -50,12 +50,9 @@ public class Model extends Z3Object {
|
||||||
public Expr getConstInterp(FuncDecl f)
|
public Expr getConstInterp(FuncDecl f)
|
||||||
{
|
{
|
||||||
getContext().checkContextMatch(f);
|
getContext().checkContextMatch(f);
|
||||||
if (f.getArity() != 0
|
if (f.getArity() != 0)
|
||||||
|| Native.getSortKind(getContext().nCtx(),
|
|
||||||
Native.getRange(getContext().nCtx(), f.getNativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT
|
|
||||||
.toInt())
|
|
||||||
throw new Z3Exception(
|
throw new Z3Exception(
|
||||||
"Non-zero arity functions and arrays have FunctionInterpretations as a model. Use getFuncInterp.");
|
"Non-zero arity functions have FunctionInterpretations as a model. Use getFuncInterp.");
|
||||||
|
|
||||||
long n = Native.modelGetConstInterp(getContext().nCtx(), getNativeObject(),
|
long n = Native.modelGetConstInterp(getContext().nCtx(), getNativeObject(),
|
||||||
f.getNativeObject());
|
f.getNativeObject());
|
||||||
|
|
Loading…
Reference in a new issue