From 2d4e9a0f67983e8dca9a84666d0ff5f31fb5cb09 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Sat, 13 Jul 2019 16:20:36 -0400 Subject: [PATCH] update managed APIs for lambda-based array models #2400 Signed-off-by: Nikolaj Bjorner --- examples/dotnet/Program.cs | 4 ++-- src/api/dotnet/Model.cs | 5 ++--- src/api/java/Model.java | 7 ++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/examples/dotnet/Program.cs b/examples/dotnet/Program.cs index 47906add4..bee44e1e7 100644 --- a/examples/dotnet/Program.cs +++ b/examples/dotnet/Program.cs @@ -363,10 +363,10 @@ namespace test_mapi 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 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)); } /// diff --git a/src/api/dotnet/Model.cs b/src/api/dotnet/Model.cs index c0cb091b0..0238ff974 100644 --- a/src/api/dotnet/Model.cs +++ b/src/api/dotnet/Model.cs @@ -51,9 +51,8 @@ namespace Microsoft.Z3 Debug.Assert(f != null); Context.CheckContextMatch(f); - 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 and arrays have FunctionInterpretations as a model. Use FuncInterp."); + if (f.Arity != 0) + throw new Z3Exception("Non-zero arity functions have FunctionInterpretations as a model. Use FuncInterp."); IntPtr n = Native.Z3_model_get_const_interp(Context.nCtx, NativeObject, f.NativeObject); if (n == IntPtr.Zero) diff --git a/src/api/java/Model.java b/src/api/java/Model.java index 8dc8d794b..4c9abef7a 100644 --- a/src/api/java/Model.java +++ b/src/api/java/Model.java @@ -50,12 +50,9 @@ public class Model extends Z3Object { public Expr getConstInterp(FuncDecl f) { getContext().checkContextMatch(f); - if (f.getArity() != 0 - || Native.getSortKind(getContext().nCtx(), - Native.getRange(getContext().nCtx(), f.getNativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT - .toInt()) + if (f.getArity() != 0) 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(), f.getNativeObject());