Skip to content

Commit

Permalink
update managed APIs for lambda-based array models #2400
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Jul 13, 2019
1 parent 659be69 commit 2d4e9a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/dotnet/Program.cs
Expand Up @@ -363,10 +363,10 @@ static void ArrayExample1(Context ctx)

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));
}

/// <summary>
Expand Down
5 changes: 2 additions & 3 deletions src/api/dotnet/Model.cs
Expand Up @@ -51,9 +51,8 @@ public Expr ConstInterp(FuncDecl f)
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)
Expand Down
7 changes: 2 additions & 5 deletions src/api/java/Model.java
Expand Up @@ -50,12 +50,9 @@ public Expr getConstInterp(Expr a)
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());
Expand Down

0 comments on commit 2d4e9a0

Please sign in to comment.