mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Java API: a first version that compiles. This is still untested.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
fb947f50fb
commit
c6303fc8f5
153 changed files with 10063 additions and 9851 deletions
228
src/api/java/AST.java
Normal file
228
src/api/java/AST.java
Normal file
|
@ -0,0 +1,228 @@
|
|||
/**
|
||||
* This file was automatically generated from AST.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* The abstract syntax tree (AST) class.
|
||||
**/
|
||||
public class AST extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Comparison operator. <param name="a">An AST</param> <param name="b">An
|
||||
* AST</param>
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are from
|
||||
* the same context and represent the same sort; false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Comparison operator. <param name="a">An AST</param> <param name="b">An
|
||||
* AST</param>
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are not
|
||||
* from the same context or represent different sorts; false
|
||||
* otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Object comparison.
|
||||
**/
|
||||
public boolean Equals(Object o)
|
||||
{
|
||||
AST casted = (AST) o;
|
||||
if (casted == null)
|
||||
return false;
|
||||
return this == casted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object Comparison. <param name="other">Another AST</param>
|
||||
*
|
||||
* @return Negative if the object should be sorted before <paramref
|
||||
* name="other"/>, positive if after else zero.
|
||||
**/
|
||||
public int CompareTo(Object other) throws Z3Exception
|
||||
{
|
||||
if (other == null)
|
||||
return 1;
|
||||
AST oAST = (AST) other;
|
||||
if (oAST == null)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
if (Id() < oAST.Id())
|
||||
return -1;
|
||||
else if (Id() > oAST.Id())
|
||||
return +1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The AST's hash code.
|
||||
*
|
||||
* @return A hash code
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
{
|
||||
return (int) Native.getAstHash(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for the AST (unique among all ASTs).
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
{
|
||||
return Native.getAstId(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates (copies) the AST to the Context <paramref name="ctx"/>. <param
|
||||
* name="ctx">A context</param>
|
||||
*
|
||||
* @return A copy of the AST which is associated with <paramref name="ctx"/>
|
||||
**/
|
||||
public AST Translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
|
||||
if (Context() == ctx)
|
||||
return this;
|
||||
else
|
||||
return new AST(ctx, Native.translate(Context().nCtx(),
|
||||
NativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the AST.
|
||||
**/
|
||||
public Z3_ast_kind ASTKind()
|
||||
{
|
||||
return Z3_ast_kind.fromInt(Native.getAstKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is an Expr
|
||||
**/
|
||||
public boolean IsExpr() throws Z3Exception
|
||||
{
|
||||
switch (ASTKind())
|
||||
{
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
case Z3_QUANTIFIER_AST:
|
||||
case Z3_VAR_AST:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a BoundVariable
|
||||
**/
|
||||
public boolean IsVar() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_VAR_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Quantifier
|
||||
**/
|
||||
public boolean IsQuantifier() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Sort
|
||||
**/
|
||||
public boolean IsSort() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_SORT_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a FunctionDeclaration
|
||||
**/
|
||||
public boolean IsFuncDecl() throws Z3Exception
|
||||
{
|
||||
return this.ASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the AST.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the AST in s-expression notation.
|
||||
**/
|
||||
public String SExpr() throws Z3Exception
|
||||
{
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
AST(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
AST(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST IncRef()");
|
||||
if (Context() == null)
|
||||
throw new Z3Exception("inc() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("inc() called on null AST");
|
||||
Context().AST_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST DecRef()");
|
||||
if (Context() == null)
|
||||
throw new Z3Exception("dec() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("dec() called on null AST");
|
||||
Context().AST_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
|
||||
static AST Create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
case Z3_FUNC_DECL_AST:
|
||||
return new FuncDecl(ctx, obj);
|
||||
case Z3_QUANTIFIER_AST:
|
||||
return new Quantifier(ctx, obj);
|
||||
case Z3_SORT_AST:
|
||||
return Sort.Create(ctx, obj);
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
case Z3_VAR_AST:
|
||||
return Expr.Create(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown AST kind");
|
||||
}
|
||||
}
|
||||
}
|
19
src/api/java/ASTDecRefQueue.java
Normal file
19
src/api/java/ASTDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
public class ASTDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.incRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.decRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
116
src/api/java/ASTMap.java
Normal file
116
src/api/java/ASTMap.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* This file was automatically generated from ASTMap.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Map from AST to AST
|
||||
**/
|
||||
class ASTMap extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Checks whether the map contains the key <paramref name="k"/>. <param
|
||||
* name="k">An AST</param>
|
||||
*
|
||||
* @return True if <paramref name="k"/> is a key in the map, false
|
||||
* otherwise.
|
||||
**/
|
||||
public boolean Contains(AST k)
|
||||
{
|
||||
|
||||
return Native.astMapContains(Context().nCtx(), NativeObject(),
|
||||
k.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the value associated with the key <paramref name="k"/>. <remarks>
|
||||
* This function signs an error when <paramref name="k"/> is not a key in
|
||||
* the map. </remarks> <param name="k">An AST</param>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public AST Find(AST k) throws Z3Exception
|
||||
{
|
||||
return new AST(Context(), Native.astMapFind(Context().nCtx(),
|
||||
NativeObject(), k.NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores or replaces a new key/value pair in the map. <param name="k">The
|
||||
* key AST</param> <param name="v">The value AST</param>
|
||||
**/
|
||||
public void Insert(AST k, AST v)
|
||||
{
|
||||
|
||||
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(),
|
||||
v.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases the key <paramref name="k"/> from the map. <param name="k">An
|
||||
* AST</param>
|
||||
**/
|
||||
public void Erase(AST k)
|
||||
{
|
||||
|
||||
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all keys from the map.
|
||||
**/
|
||||
public void Reset()
|
||||
{
|
||||
Native.astMapReset(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the map
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.astMapSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The keys stored in the map.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ASTVector Keys() throws Z3Exception
|
||||
{
|
||||
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string representation of the map.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astMapToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ASTMap(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
ASTMap(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkAstMap(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTMap_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTMap_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
104
src/api/java/ASTVector.java
Normal file
104
src/api/java/ASTVector.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
/**
|
||||
* This file was automatically generated from ASTVector.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Vectors of ASTs.
|
||||
**/
|
||||
class ASTVector extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The size of the vector
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.astVectorSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the i-th object in the vector. <remarks>May throw an
|
||||
* IndexOutOfBoundsException when <paramref name="i"/> is out of
|
||||
* range.</remarks> <param name="i">Index</param>
|
||||
*
|
||||
* @return An AST
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public AST get(int i) throws Z3Exception
|
||||
{
|
||||
return new AST(Context(), Native.astVectorGet(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
}
|
||||
|
||||
public void set(int i, AST value)
|
||||
{
|
||||
|
||||
Native.astVectorSet(Context().nCtx(), NativeObject(), i,
|
||||
value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the vector to <paramref name="newSize"/>. <param
|
||||
* name="newSize">The new size of the vector.</param>
|
||||
**/
|
||||
public void Resize(int newSize)
|
||||
{
|
||||
Native.astVectorResize(Context().nCtx(), NativeObject(), newSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the AST <paramref name="a"/> to the back of the vector. The size is
|
||||
* increased by 1. <param name="a">An AST</param>
|
||||
**/
|
||||
public void Push(AST a)
|
||||
{
|
||||
|
||||
Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates all ASTs in the vector to <paramref name="ctx"/>. <param
|
||||
* name="ctx">A context</param>
|
||||
*
|
||||
* @return A new ASTVector
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ASTVector Translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
return new ASTVector(Context(), Native.astVectorTranslate(Context()
|
||||
.nCtx(), NativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string representation of the vector.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astVectorToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ASTVector(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
ASTVector(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkAstVector(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTVector_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ASTVector_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
59
src/api/java/AlgebraicNum.java
Normal file
59
src/api/java/AlgebraicNum.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This file was automatically generated from AlgebraicNum.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Algebraic numbers
|
||||
**/
|
||||
public class AlgebraicNum extends ArithExpr
|
||||
{
|
||||
/**
|
||||
* Return a upper bound for a given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||
* <seealso cref="Expr.IsAlgebraicNumber"/> <param name="precision">the
|
||||
* precision of the result</param>
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToUpper(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberUpper(Context()
|
||||
.nCtx(), NativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a lower bound for the given real algebraic number. The interval
|
||||
* isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||
* <seealso cref="Expr.IsAlgebraicNumber"/> <param name="precision"></param>
|
||||
*
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToLower(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberLower(Context()
|
||||
.nCtx(), NativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation in decimal notation. <remarks>The result
|
||||
* has at most <paramref name="precision"/> decimal places.</remarks>
|
||||
**/
|
||||
public String ToDecimal(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(),
|
||||
precision);
|
||||
}
|
||||
|
||||
AlgebraicNum(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
|
||||
}
|
||||
}
|
75
src/api/java/ApplyResult.java
Normal file
75
src/api/java/ApplyResult.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* This file was automatically generated from ApplyResult.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* ApplyResult objects represent the result of an application of a tactic to a
|
||||
* goal. It contains the subgoals that were produced.
|
||||
**/
|
||||
public class ApplyResult extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The number of Subgoals.
|
||||
**/
|
||||
public int NumSubgoals()
|
||||
{
|
||||
return Native.applyResultGetNumSubgoals(Context().nCtx(),
|
||||
NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the subgoals from the ApplyResult.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Goal[] Subgoals() throws Z3Exception
|
||||
{
|
||||
int n = NumSubgoals();
|
||||
Goal[] res = new Goal[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a model for the subgoal <paramref name="i"/> into a model for the
|
||||
* original goal <code>g</code>, that the ApplyResult was obtained from.
|
||||
*
|
||||
* @return A model for <code>g</code>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Model ConvertModel(int i, Model m) throws Z3Exception
|
||||
{
|
||||
return new Model(Context(), Native.applyResultConvertModel(Context()
|
||||
.nCtx(), NativeObject(), i, m.NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the ApplyResult.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.applyResultToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ApplyResult(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ApplyResult_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ApplyResult_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/ApplyResultDecRefQueue.java
Normal file
19
src/api/java/ApplyResultDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ApplyResultDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.applyResultIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.applyResultDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
26
src/api/java/ArithExpr.java
Normal file
26
src/api/java/ArithExpr.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* This file was automatically generated from ArithExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
* **/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Arithmetic expressions (int/real)
|
||||
**/
|
||||
public class ArithExpr extends Expr
|
||||
{
|
||||
/**
|
||||
* Constructor for ArithExpr </summary>
|
||||
**/
|
||||
protected ArithExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
ArithExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
18
src/api/java/ArithSort.java
Normal file
18
src/api/java/ArithSort.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* This file was automatically generated from ArithSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* An arithmetic sort, i.e., Int or Real.
|
||||
**/
|
||||
public class ArithSort extends Sort
|
||||
{
|
||||
ArithSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
};
|
27
src/api/java/ArrayExpr.java
Normal file
27
src/api/java/ArrayExpr.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This file was automatically generated from ArrayExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
|
||||
/**
|
||||
* Array expressions
|
||||
**/
|
||||
public class ArrayExpr extends Expr
|
||||
{
|
||||
/**
|
||||
* Constructor for ArrayExpr </summary>
|
||||
**/
|
||||
protected ArrayExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
ArrayExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
44
src/api/java/ArraySort.java
Normal file
44
src/api/java/ArraySort.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* This file was automatically generated from ArraySort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Array sorts.
|
||||
**/
|
||||
public class ArraySort extends Sort
|
||||
{
|
||||
/**
|
||||
* The domain of the array sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort Domain() throws Z3Exception
|
||||
{
|
||||
return Sort.Create(Context(),
|
||||
Native.getArraySortDomain(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of the array sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort Range() throws Z3Exception
|
||||
{
|
||||
return Sort.Create(Context(),
|
||||
Native.getArraySortRange(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
ArraySort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkArraySort(ctx.nCtx(), domain.NativeObject(),
|
||||
range.NativeObject()));
|
||||
}
|
||||
};
|
19
src/api/java/AstMapDecRefQueue.java
Normal file
19
src/api/java/AstMapDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ASTMapDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astMapIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astMapDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
19
src/api/java/AstVectorDecRefQueue.java
Normal file
19
src/api/java/AstVectorDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ASTVectorDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astVectorIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astVectorDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
36
src/api/java/BitVecExpr.java
Normal file
36
src/api/java/BitVecExpr.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Bit-vector expressions
|
||||
**/
|
||||
public class BitVecExpr extends Expr
|
||||
{
|
||||
|
||||
/**
|
||||
* The size of the sort of a bit-vector term.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int SortSize() throws Z3Exception
|
||||
{
|
||||
return ((BitVecSort) Sort()).Size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for BitVecExpr </summary>
|
||||
**/
|
||||
protected BitVecExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
BitVecExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
62
src/api/java/BitVecNum.java
Normal file
62
src/api/java/BitVecNum.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecNum.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* Bit-vector numerals
|
||||
**/
|
||||
public class BitVecNum extends BitVecExpr
|
||||
{
|
||||
/**
|
||||
* Retrieve the int value.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
{
|
||||
Native.IntPtr res = new Native.IntPtr();
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int");
|
||||
return res.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the 64-bit int value.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public long Long() throws Z3Exception
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int64");
|
||||
return res.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the BigInteger value.
|
||||
**/
|
||||
public BigInteger BigInteger()
|
||||
{
|
||||
return new BigInteger(this.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the numeral.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
BitVecNum(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
25
src/api/java/BitVecSort.java
Normal file
25
src/api/java/BitVecSort.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Bit-vector sorts.
|
||||
**/
|
||||
public class BitVecSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The size of the bit-vector sort.
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.getBvSortSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
BitVecSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
};
|
30
src/api/java/BoolExpr.java
Normal file
30
src/api/java/BoolExpr.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* This file was automatically generated from BoolExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Boolean expressions
|
||||
**/
|
||||
public class BoolExpr extends Expr
|
||||
{
|
||||
/**
|
||||
* Constructor for BoolExpr </summary>
|
||||
**/
|
||||
protected BoolExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for BoolExpr </summary>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
BoolExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
16
src/api/java/BoolSort.java
Normal file
16
src/api/java/BoolSort.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* This file was automatically generated from BoolSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* A Boolean sort.
|
||||
**/
|
||||
public class BoolSort extends Sort
|
||||
{
|
||||
BoolSort(Context ctx, long obj) throws Z3Exception { super(ctx, obj); { }}
|
||||
BoolSort(Context ctx) throws Z3Exception { super(ctx, Native.mkBoolSort(ctx.nCtx())); { }}
|
||||
};
|
107
src/api/java/Constructor.java
Normal file
107
src/api/java/Constructor.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
/**
|
||||
* This file was automatically generated from Constructor.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Constructors are used for datatype sorts.
|
||||
**/
|
||||
public class Constructor extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The number of fields of the constructor.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int NumFields() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declaration of the constructor.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl ConstructorDecl() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return m_constructorDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declaration of the tester.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl TesterDecl() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return m_testerDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declarations of the accessors
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] AccessorDecls() throws Z3Exception
|
||||
{
|
||||
init();
|
||||
return m_accessorDecls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
protected void finalize()
|
||||
{
|
||||
Native.delConstructor(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
private int n = 0;
|
||||
private FuncDecl m_testerDecl = null;
|
||||
private FuncDecl m_constructorDecl = null;
|
||||
private FuncDecl[] m_accessorDecls = null;
|
||||
|
||||
Constructor(Context ctx, Symbol name, Symbol recognizer,
|
||||
Symbol[] fieldNames, Sort[] sorts, int[] sortRefs)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
n = AST.ArrayLength(fieldNames);
|
||||
|
||||
if (n != AST.ArrayLength(sorts))
|
||||
throw new Z3Exception(
|
||||
"Number of field names does not match number of sorts");
|
||||
if (sortRefs != null && sortRefs.length != n)
|
||||
throw new Z3Exception(
|
||||
"Number of field names does not match number of sort refs");
|
||||
|
||||
if (sortRefs == null)
|
||||
sortRefs = new int[n];
|
||||
|
||||
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.NativeObject(),
|
||||
recognizer.NativeObject(), n, Symbol.ArrayToNative(fieldNames),
|
||||
Sort.ArrayToNative(sorts), sortRefs));
|
||||
|
||||
}
|
||||
|
||||
private void init() throws Z3Exception
|
||||
{
|
||||
if (m_testerDecl != null)
|
||||
return;
|
||||
Native.LongPtr constructor = new Native.LongPtr();
|
||||
Native.LongPtr tester = new Native.LongPtr();
|
||||
long[] accessors = new long[n];
|
||||
Native.queryConstructor(Context().nCtx(), NativeObject(), n,
|
||||
constructor, tester, accessors);
|
||||
m_constructorDecl = new FuncDecl(Context(), constructor.value);
|
||||
m_testerDecl = new FuncDecl(Context(), tester.value);
|
||||
m_accessorDecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
m_accessorDecls[i] = new FuncDecl(Context(), accessors[i]);
|
||||
}
|
||||
|
||||
}
|
35
src/api/java/ConstructorList.java
Normal file
35
src/api/java/ConstructorList.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This file was automatically generated from ConstructorList.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Lists of constructors
|
||||
**/
|
||||
public class ConstructorList extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
protected void finalize()
|
||||
{
|
||||
Native.delConstructorList(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ConstructorList(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
ConstructorList(Context ctx, Constructor[] constructors) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
setNativeObject(Native.mkConstructorList(Context().nCtx(),
|
||||
(int) constructors.length,
|
||||
Constructor.ArrayToNative(constructors)));
|
||||
}
|
||||
}
|
3112
src/api/java/Context.java
Normal file
3112
src/api/java/Context.java
Normal file
File diff suppressed because it is too large
Load diff
26
src/api/java/DatatypeExpr.java
Normal file
26
src/api/java/DatatypeExpr.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* This file was automatically generated from DatatypeExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Datatype expressions
|
||||
**/
|
||||
public class DatatypeExpr extends Expr
|
||||
{
|
||||
/**
|
||||
* Constructor for DatatypeExpr </summary>
|
||||
**/
|
||||
protected DatatypeExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
DatatypeExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
91
src/api/java/DatatypeSort.java
Normal file
91
src/api/java/DatatypeSort.java
Normal file
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* This file was automatically generated from DatatypeSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Datatype sorts.
|
||||
**/
|
||||
public class DatatypeSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The number of constructors of the datatype sort.
|
||||
**/
|
||||
public int NumConstructors()
|
||||
{
|
||||
return Native.getDatatypeSortNumConstructors(Context().nCtx(),
|
||||
NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The constructors.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Constructors() throws Z3Exception
|
||||
{
|
||||
int n = NumConstructors();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getDatatypeSortConstructor(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The recognizers.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Recognizers() throws Z3Exception
|
||||
{
|
||||
int n = NumConstructors();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getDatatypeSortRecognizer(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The constructor accessors.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[][] Accessors() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumConstructors();
|
||||
FuncDecl[][] res = new FuncDecl[n][];
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
FuncDecl fd = new FuncDecl(Context(),
|
||||
Native.getDatatypeSortConstructor(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
int ds = fd.DomainSize();
|
||||
FuncDecl[] tmp = new FuncDecl[ds];
|
||||
for (int j = 0; j < ds; j++)
|
||||
tmp[j] = new FuncDecl(Context(),
|
||||
Native.getDatatypeSortConstructorAccessor(Context()
|
||||
.nCtx(), NativeObject(), i, j));
|
||||
res[i] = tmp;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
DatatypeSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
DatatypeSort(Context ctx, Symbol name, Constructor[] constructors)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkDatatype(ctx.nCtx(), name.NativeObject(),
|
||||
(int) constructors.length, ArrayToNative(constructors)));
|
||||
|
||||
}
|
||||
};
|
64
src/api/java/EnumSort.java
Normal file
64
src/api/java/EnumSort.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* This file was automatically generated from EnumSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Enumeration sorts.
|
||||
**/
|
||||
public class EnumSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The function declarations of the constants in the enumeration.
|
||||
**/
|
||||
public FuncDecl[] ConstDecls()
|
||||
{
|
||||
|
||||
return _constdecls;
|
||||
}
|
||||
|
||||
/**
|
||||
* The constants in the enumeration.
|
||||
**/
|
||||
public Expr[] Consts()
|
||||
{
|
||||
|
||||
return _consts;
|
||||
}
|
||||
|
||||
/**
|
||||
* The test predicates for the constants in the enumeration.
|
||||
**/
|
||||
public FuncDecl[] TesterDecls()
|
||||
{
|
||||
|
||||
return _testerdecls;
|
||||
}
|
||||
|
||||
private FuncDecl[] _constdecls = null, _testerdecls = null;
|
||||
private Expr[] _consts = null;
|
||||
|
||||
EnumSort(Context ctx, Symbol name, Symbol[] enumNames) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
int n = enumNames.length;
|
||||
long[] n_constdecls = new long[n];
|
||||
long[] n_testers = new long[n];
|
||||
setNativeObject(Native.mkEnumerationSort(ctx.nCtx(),
|
||||
name.NativeObject(), (int) n, Symbol.ArrayToNative(enumNames),
|
||||
n_constdecls, n_testers));
|
||||
_constdecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_constdecls[i] = new FuncDecl(ctx, n_constdecls[i]);
|
||||
_testerdecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_testerdecls[i] = new FuncDecl(ctx, n_testers[i]);
|
||||
_consts = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
_consts[i] = ctx.MkApp(_constdecls[i], null);
|
||||
}
|
||||
};
|
1807
src/api/java/Expr.java
Normal file
1807
src/api/java/Expr.java
Normal file
File diff suppressed because it is too large
Load diff
34
src/api/java/FiniteDomainSort.java
Normal file
34
src/api/java/FiniteDomainSort.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* This file was automatically generated from FiniteDomainSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Finite domain sorts.
|
||||
**/
|
||||
public class FiniteDomainSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The size of the finite domain sort.
|
||||
**/
|
||||
public long Size()
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
Native.getFiniteDomainSortSize(Context().nCtx(), NativeObject(), res);
|
||||
return res.value;
|
||||
}
|
||||
|
||||
FiniteDomainSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.NativeObject(),
|
||||
size));
|
||||
}
|
||||
}
|
327
src/api/java/Fixedpoint.java
Normal file
327
src/api/java/Fixedpoint.java
Normal file
|
@ -0,0 +1,327 @@
|
|||
/**
|
||||
* This file was automatically generated from Fixedpoint.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Object for managing fixedpoints
|
||||
**/
|
||||
public class Fixedpoint extends Z3Object
|
||||
{
|
||||
|
||||
/**
|
||||
* A string that describes all available fixedpoint solver parameters.
|
||||
**/
|
||||
public String Help()
|
||||
{
|
||||
|
||||
return Native.fixedpointGetHelp(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the fixedpoint solver parameters.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void setParameters(Params value) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(value);
|
||||
Native.fixedpointSetParams(Context().nCtx(), NativeObject(),
|
||||
value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves parameter descriptions for Fixedpoint solver.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.fixedpointGetParamDescrs(
|
||||
Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a constraint (or multiple) into the fixedpoint solver.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(constraints);
|
||||
for (BoolExpr a : constraints)
|
||||
{
|
||||
Native.fixedpointAssert(Context().nCtx(), NativeObject(),
|
||||
a.NativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register predicate as recursive relation.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void RegisterRelation(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(f);
|
||||
Native.fixedpointRegisterRelation(Context().nCtx(), NativeObject(),
|
||||
f.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add rule into the fixedpoint solver.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void AddRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(rule);
|
||||
Native.fixedpointAddRule(Context().nCtx(), NativeObject(),
|
||||
rule.NativeObject(), AST.GetNativeObject(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add table fact to the fixedpoint solver.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void AddFact(FuncDecl pred, int[] args) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(pred);
|
||||
Native.fixedpointAddFact(Context().nCtx(), NativeObject(),
|
||||
pred.NativeObject(), (int) args.length, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the fixedpoint solver. A query is a conjunction of constraints. The
|
||||
* constraints may include the recursively defined relations. The query is
|
||||
* satisfiable if there is an instance of the query variables and a
|
||||
* derivation for it. The query is unsatisfiable if there are no derivations
|
||||
* satisfying the query variables.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Status Query(BoolExpr query) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(query);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(Context().nCtx(),
|
||||
NativeObject(), query.NativeObject()));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
return Status.SATISFIABLE;
|
||||
case Z3_L_FALSE:
|
||||
return Status.UNSATISFIABLE;
|
||||
default:
|
||||
return Status.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the fixedpoint solver. A query is an array of relations. The query
|
||||
* is satisfiable if there is an instance of some relation that is
|
||||
* non-empty. The query is unsatisfiable if there are no derivations
|
||||
* satisfying any of the relations.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Status Query(FuncDecl[] relations) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(relations);
|
||||
Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(Context()
|
||||
.nCtx(), NativeObject(), AST.ArrayLength(relations), AST
|
||||
.ArrayToNative(relations)));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
return Status.SATISFIABLE;
|
||||
case Z3_L_FALSE:
|
||||
return Status.UNSATISFIABLE;
|
||||
default:
|
||||
return Status.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a backtracking point. <seealso cref="Pop"/>
|
||||
**/
|
||||
public void Push()
|
||||
{
|
||||
Native.fixedpointPush(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Backtrack one backtracking point. <remarks>Note that an exception is
|
||||
* thrown if Pop is called without a corresponding <code>Push</code>
|
||||
* </remarks> <seealso cref="Push"/>
|
||||
**/
|
||||
public void Pop()
|
||||
{
|
||||
Native.fixedpointPop(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update named rule into in the fixedpoint solver.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void UpdateRule(BoolExpr rule, Symbol name) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(rule);
|
||||
Native.fixedpointUpdateRule(Context().nCtx(), NativeObject(),
|
||||
rule.NativeObject(), AST.GetNativeObject(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve satisfying instance or instances of solver, or definitions for
|
||||
* the recursive predicates that show unsatisfiability.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr GetAnswer() throws Z3Exception
|
||||
{
|
||||
long ans = Native.fixedpointGetAnswer(Context().nCtx(), NativeObject());
|
||||
return (ans == 0) ? null : Expr.Create(Context(), ans);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve explanation why fixedpoint engine returned status Unknown.
|
||||
**/
|
||||
public String GetReasonUnknown()
|
||||
{
|
||||
|
||||
return Native.fixedpointGetReasonUnknown(Context().nCtx(),
|
||||
NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the number of levels explored for a given predicate.
|
||||
**/
|
||||
public int GetNumLevels(FuncDecl predicate)
|
||||
{
|
||||
return Native.fixedpointGetNumLevels(Context().nCtx(), NativeObject(),
|
||||
predicate.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the cover of a predicate.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr GetCoverDelta(int level, FuncDecl predicate) throws Z3Exception
|
||||
{
|
||||
long res = Native.fixedpointGetCoverDelta(Context().nCtx(),
|
||||
NativeObject(), level, predicate.NativeObject());
|
||||
return (res == 0) ? null : Expr.Create(Context(), res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add <tt>property</tt> about the <tt>predicate</tt>. The property is added
|
||||
* at <tt>level</tt>.
|
||||
**/
|
||||
public void AddCover(int level, FuncDecl predicate, Expr property)
|
||||
{
|
||||
Native.fixedpointAddCover(Context().nCtx(), NativeObject(), level,
|
||||
predicate.NativeObject(), property.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve internal string representation of fixedpoint object.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.fixedpointToString(Context().nCtx(), NativeObject(), 0,
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instrument the Datalog engine on which table representation to use for
|
||||
* recursive predicate.
|
||||
**/
|
||||
public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds)
|
||||
{
|
||||
|
||||
Native.fixedpointSetPredicateRepresentation(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject(), AST.ArrayLength(kinds),
|
||||
Symbol.ArrayToNative(kinds));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert benchmark given as set of axioms, rules and queries to a string.
|
||||
**/
|
||||
public String toString(BoolExpr[] queries)
|
||||
{
|
||||
|
||||
return Native.fixedpointToString(Context().nCtx(), NativeObject(),
|
||||
AST.ArrayLength(queries), AST.ArrayToNative(queries));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve set of rules added to fixedpoint context.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Rules() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector v = new ASTVector(Context(), Native.fixedpointGetRules(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = v.Size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), v.get(i).NativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve set of assertions added to fixedpoint context.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Assertions() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector v = new ASTVector(Context(), Native.fixedpointGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = v.Size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), v.get(i).NativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
Fixedpoint(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
Fixedpoint(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFixedpoint(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Fixedpoint_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Fixedpoint_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/FixedpointDecRefQueue.java
Normal file
19
src/api/java/FixedpointDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class FixedpointDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.fixedpointIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.fixedpointDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
379
src/api/java/FuncDecl.java
Normal file
379
src/api/java/FuncDecl.java
Normal file
|
@ -0,0 +1,379 @@
|
|||
/**
|
||||
* This file was automatically generated from FuncDecl.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Function declarations.
|
||||
**/
|
||||
public class FuncDecl extends AST
|
||||
{
|
||||
/**
|
||||
* Comparison operator.
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> share the
|
||||
* same context and are equal, false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Comparison operator.
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> do not
|
||||
* share the same context or are not equal, false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Object comparison.
|
||||
**/
|
||||
public boolean Equals(Object o)
|
||||
{
|
||||
FuncDecl casted = (FuncDecl) o;
|
||||
if (casted == null)
|
||||
return false;
|
||||
return this == casted;
|
||||
}
|
||||
|
||||
/**
|
||||
* A hash code.
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
{
|
||||
return super.GetHashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representations of the function declaration.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.funcDeclToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unique identifier for the function declaration.
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
{
|
||||
return Native.getFuncDeclId(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The arity of the function declaration
|
||||
**/
|
||||
public int Arity() throws Z3Exception
|
||||
{
|
||||
return Native.getArity(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the domain of the function declaration <seealso
|
||||
* cref="Arity"/>
|
||||
**/
|
||||
public int DomainSize()
|
||||
{
|
||||
return Native.getDomainSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The domain of the function declaration
|
||||
**/
|
||||
public Sort[] Domain() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = DomainSize();
|
||||
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(),
|
||||
Native.getDomain(Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of the function declaration
|
||||
**/
|
||||
public Sort Range() throws Z3Exception
|
||||
{
|
||||
|
||||
return Sort.Create(Context(),
|
||||
Native.getRange(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the function declaration.
|
||||
**/
|
||||
public Z3_decl_kind DeclKind() throws Z3Exception
|
||||
{
|
||||
return Z3_decl_kind.fromInt(Native.getDeclKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the function declaration
|
||||
**/
|
||||
public Symbol Name() throws Z3Exception
|
||||
{
|
||||
|
||||
return Symbol.Create(Context(),
|
||||
Native.getDeclName(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of parameters of the function declaration
|
||||
**/
|
||||
public int NumParameters() throws Z3Exception
|
||||
{
|
||||
return Native.getDeclNumParameters(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The parameters of the function declaration
|
||||
**/
|
||||
public Parameter[] Parameters() throws Z3Exception
|
||||
{
|
||||
|
||||
int num = NumParameters();
|
||||
Parameter[] res = new Parameter[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Z3_parameter_kind k = Z3_parameter_kind.fromInt(Native
|
||||
.getDeclParameterKind(Context().nCtx(), NativeObject(), i));
|
||||
switch (k)
|
||||
{
|
||||
case Z3_PARAMETER_INT:
|
||||
res[i] = new Parameter(k, Native.getDeclIntParameter(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
break;
|
||||
case Z3_PARAMETER_DOUBLE:
|
||||
res[i] = new Parameter(k, Native.getDeclDoubleParameter(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
break;
|
||||
case Z3_PARAMETER_SYMBOL:
|
||||
res[i] = new Parameter(k, Symbol.Create(Context(), Native
|
||||
.getDeclSymbolParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_SORT:
|
||||
res[i] = new Parameter(k, Sort.Create(Context(), Native
|
||||
.getDeclSortParameter(Context().nCtx(), NativeObject(),
|
||||
i)));
|
||||
break;
|
||||
case Z3_PARAMETER_AST:
|
||||
res[i] = new Parameter(k, new AST(Context(),
|
||||
Native.getDeclAstParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_FUNC_DECL:
|
||||
res[i] = new Parameter(k, new FuncDecl(Context(),
|
||||
Native.getDeclFuncDeclParameter(Context().nCtx(),
|
||||
NativeObject(), i)));
|
||||
break;
|
||||
case Z3_PARAMETER_RATIONAL:
|
||||
res[i] = new Parameter(k, Native.getDeclRationalParameter(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
break;
|
||||
default:
|
||||
throw new Z3Exception(
|
||||
"Unknown function declaration parameter kind encountered");
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function declarations can have Parameters associated with them.
|
||||
**/
|
||||
public class Parameter
|
||||
{
|
||||
private Z3_parameter_kind kind;
|
||||
private int i;
|
||||
private double d;
|
||||
private Symbol sym;
|
||||
private Sort srt;
|
||||
private AST ast;
|
||||
private FuncDecl fd;
|
||||
private String r;
|
||||
|
||||
/**
|
||||
* The int value of the parameter.</summary>
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT)
|
||||
throw new Z3Exception("parameter is not an int");
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* The double value of the parameter.</summary>
|
||||
**/
|
||||
public double Double() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE)
|
||||
throw new Z3Exception("parameter is not a double ");
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Symbol value of the parameter.</summary>
|
||||
**/
|
||||
public Symbol Symbol() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL)
|
||||
throw new Z3Exception("parameter is not a Symbol");
|
||||
return sym;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Sort value of the parameter.</summary>
|
||||
**/
|
||||
public Sort Sort() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT)
|
||||
throw new Z3Exception("parameter is not a Sort");
|
||||
return srt;
|
||||
}
|
||||
|
||||
/**
|
||||
* The AST value of the parameter.</summary>
|
||||
**/
|
||||
public AST AST() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST)
|
||||
throw new Z3Exception("parameter is not an AST");
|
||||
return ast;
|
||||
}
|
||||
|
||||
/**
|
||||
* The FunctionDeclaration value of the parameter.</summary>
|
||||
**/
|
||||
public FuncDecl FuncDecl() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL)
|
||||
throw new Z3Exception("parameter is not a function declaration");
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* The rational string value of the parameter.</summary>
|
||||
**/
|
||||
public String Rational() throws Z3Exception
|
||||
{
|
||||
if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL)
|
||||
throw new Z3Exception("parameter is not a rational String");
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the parameter.
|
||||
**/
|
||||
public Z3_parameter_kind ParameterKind() throws Z3Exception
|
||||
{
|
||||
return kind;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, int i)
|
||||
{
|
||||
this.kind = k;
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, double d)
|
||||
{
|
||||
this.kind = k;
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, Symbol s)
|
||||
{
|
||||
this.kind = k;
|
||||
this.sym = s;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, Sort s)
|
||||
{
|
||||
this.kind = k;
|
||||
this.srt = s;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, AST a)
|
||||
{
|
||||
this.kind = k;
|
||||
this.ast = a;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, FuncDecl fd)
|
||||
{
|
||||
this.kind = k;
|
||||
this.fd = fd;
|
||||
}
|
||||
|
||||
Parameter(Z3_parameter_kind k, String r)
|
||||
{
|
||||
this.kind = k;
|
||||
this.r = r;
|
||||
}
|
||||
}
|
||||
|
||||
FuncDecl(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
|
||||
}
|
||||
|
||||
FuncDecl(Context ctx, Symbol name, Sort[] domain, Sort range)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.NativeObject(),
|
||||
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||
range.NativeObject()));
|
||||
|
||||
}
|
||||
|
||||
FuncDecl(Context ctx, String prefix, Sort[] domain, Sort range)
|
||||
throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix,
|
||||
AST.ArrayLength(domain), AST.ArrayToNative(domain),
|
||||
range.NativeObject()));
|
||||
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST
|
||||
.toInt())
|
||||
throw new Z3Exception(
|
||||
"Underlying object is not a function declaration");
|
||||
super.CheckNativeObject(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create expression that applies function to arguments. <param
|
||||
* name="args"></param>
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
/* operator this[] not translated */
|
||||
|
||||
/**
|
||||
* Create expression that applies function to arguments. <param
|
||||
* name="args"></param>
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
public Expr Apply(Expr[] args) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(args);
|
||||
return Expr.Create(Context(), this, args);
|
||||
}
|
||||
|
||||
}
|
185
src/api/java/FuncInterp.java
Normal file
185
src/api/java/FuncInterp.java
Normal file
|
@ -0,0 +1,185 @@
|
|||
/**
|
||||
* This file was automatically generated from FuncInterp.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* A function interpretation is represented as a finite map and an 'else' value.
|
||||
* Each entry in the finite map represents the value of a function given a set
|
||||
* of arguments.
|
||||
**/
|
||||
public class FuncInterp extends Z3Object
|
||||
{
|
||||
/**
|
||||
* An Entry object represents an element in the finite map used to encode a
|
||||
* function interpretation.
|
||||
**/
|
||||
public class Entry extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Return the (symbolic) value of this entry.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Value() throws Z3Exception
|
||||
{
|
||||
return Expr.Create(Context(),
|
||||
Native.funcEntryGetValue(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of arguments of the entry.
|
||||
**/
|
||||
public int NumArgs()
|
||||
{
|
||||
return Native.funcEntryGetNumArgs(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The arguments of the function entry.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] Args() throws Z3Exception
|
||||
{
|
||||
int n = NumArgs();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), Native.funcEntryGetArg(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the function entry.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
int n = NumArgs();
|
||||
String res = "[";
|
||||
Expr[] args = Args();
|
||||
for (int i = 0; i < n; i++)
|
||||
res += args[i] + ", ";
|
||||
return res + Value() + "]";
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return new String("Z3Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Entry(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncEntry_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncEntry_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The number of entries in the function interpretation.
|
||||
**/
|
||||
public int NumEntries()
|
||||
{
|
||||
return Native.funcInterpGetNumEntries(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The entries in the function interpretation
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Entry[] Entries() throws Z3Exception
|
||||
{
|
||||
int n = NumEntries();
|
||||
Entry[] res = new Entry[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Entry(Context(), Native.funcInterpGetEntry(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The (symbolic) `else' value of the function interpretation.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Else() throws Z3Exception
|
||||
{
|
||||
return Expr.Create(Context(),
|
||||
Native.funcInterpGetElse(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The arity of the function interpretation
|
||||
**/
|
||||
public int Arity()
|
||||
{
|
||||
return Native.funcInterpGetArity(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the function interpretation.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
String res = "";
|
||||
res += "[";
|
||||
for (Entry e : Entries())
|
||||
{
|
||||
int n = e.NumArgs();
|
||||
if (n > 1)
|
||||
res += "[";
|
||||
Expr[] args = e.Args();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i != 0)
|
||||
res += ", ";
|
||||
res += args[i];
|
||||
}
|
||||
if (n > 1)
|
||||
res += "]";
|
||||
res += " -> " + e.Value() + ", ";
|
||||
}
|
||||
res += "else -> " + Else();
|
||||
res += "]";
|
||||
return res;
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return new String("Z3Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
FuncInterp(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncInterp_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().FuncInterp_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/FuncInterpDecRefQueue.java
Normal file
19
src/api/java/FuncInterpDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class FuncInterpDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.funcInterpIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.funcInterpDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
19
src/api/java/FuncInterpEntryDecRefQueue.java
Normal file
19
src/api/java/FuncInterpEntryDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class FuncInterpEntryDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.funcEntryIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.funcEntryDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
211
src/api/java/Goal.java
Normal file
211
src/api/java/Goal.java
Normal file
|
@ -0,0 +1,211 @@
|
|||
/**
|
||||
* This file was automatically generated from Goal.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* A goal (aka problem). A goal is essentially a set of formulas, that can be
|
||||
* solved and/or transformed using tactics and solvers.
|
||||
**/
|
||||
public class Goal extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The precision of the goal. <remarks> Goals can be transformed using over
|
||||
* and under approximations. An under approximation is applied when the
|
||||
* objective is to find a model for a given goal. An over approximation is
|
||||
* applied when the objective is to find a proof for a given goal.
|
||||
* </remarks>
|
||||
**/
|
||||
public Z3_goal_prec Precision()
|
||||
{
|
||||
return Z3_goal_prec.fromInt(Native.goalPrecision(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is precise.
|
||||
**/
|
||||
public boolean IsPrecise()
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_PRECISE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is an under-approximation.
|
||||
**/
|
||||
public boolean IsUnderApproximation()
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is an over-approximation.
|
||||
**/
|
||||
public boolean IsOverApproximation()
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_OVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is garbage (i.e., the product of over- and
|
||||
* under-approximations).
|
||||
**/
|
||||
public boolean IsGarbage()
|
||||
{
|
||||
return Precision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the <paramref name="constraints"/> to the given goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraints);
|
||||
for (BoolExpr c : constraints)
|
||||
{
|
||||
// It was an assume, now made an assert just to be sure we do not
|
||||
// regress
|
||||
Native.goalAssert(Context().nCtx(), NativeObject(),
|
||||
c.NativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal contains `false'.
|
||||
**/
|
||||
public boolean Inconsistent()
|
||||
{
|
||||
return Native.goalInconsistent(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The depth of the goal. <remarks> This tracks how many transformations
|
||||
* were applied to it. </remarks>
|
||||
**/
|
||||
public int Depth()
|
||||
{
|
||||
return Native.goalDepth(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases all formulas from the given goal.
|
||||
**/
|
||||
public void Reset()
|
||||
{
|
||||
Native.goalReset(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of formulas in the goal.
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.goalSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The formulas in the goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Formulas() throws Z3Exception
|
||||
{
|
||||
int n = Size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), Native.goalFormula(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of formulas, subformulas and terms in the goal.
|
||||
**/
|
||||
public int NumExprs()
|
||||
{
|
||||
return Native.goalNumExprs(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal is empty, and it is precise or the product of
|
||||
* an under approximation.
|
||||
**/
|
||||
public boolean IsDecidedSat()
|
||||
{
|
||||
return Native.goalIsDecidedSat(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the goal contains `false', and it is precise or the
|
||||
* product of an over approximation.
|
||||
**/
|
||||
public boolean IsDecidedUnsat()
|
||||
{
|
||||
return Native.goalIsDecidedUnsat(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates (copies) the Goal to the target Context <paramref
|
||||
* name="ctx"/>.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Goal Translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
return new Goal(ctx, Native.goalTranslate(Context().nCtx(),
|
||||
NativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplifies the goal. <remarks>Essentially invokes the `simplify' tactic
|
||||
* on the goal.</remarks>
|
||||
**/
|
||||
public Goal Simplify(Params p) throws Z3Exception
|
||||
{
|
||||
Tactic t = Context().MkTactic("simplify");
|
||||
ApplyResult res = t.Apply(this, p);
|
||||
|
||||
if (res.NumSubgoals() == 0)
|
||||
throw new Z3Exception("No subgoals");
|
||||
else
|
||||
return res.Subgoals()[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Goal to string conversion.
|
||||
*
|
||||
* @return A string representation of the Goal.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.goalToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
Goal(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
Goal(Context ctx, boolean models, boolean unsatCores, boolean proofs) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkGoal(ctx.nCtx(), (models) ? true : false,
|
||||
(unsatCores) ? true : false, (proofs) ? true : false));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Goal_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Goal_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
|
||||
}
|
19
src/api/java/GoalDecRefQueue.java
Normal file
19
src/api/java/GoalDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class GoalDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.goalIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.goalDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
48
src/api/java/IDecRefQueue.java
Normal file
48
src/api/java/IDecRefQueue.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* This file was automatically generated from IDecRefQueue.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
abstract class IDecRefQueue
|
||||
{
|
||||
protected Object m_lock = new Object();
|
||||
protected LinkedList<Long> m_queue = new LinkedList<Long>();
|
||||
final int m_move_limit = 1024;
|
||||
|
||||
public abstract void IncRef(Context ctx, long obj);
|
||||
|
||||
public abstract void DecRef(Context ctx, long obj);
|
||||
|
||||
public void IncAndClear(Context ctx, long o)
|
||||
{
|
||||
IncRef(ctx, o);
|
||||
if (m_queue.size() >= m_move_limit)
|
||||
Clear(ctx);
|
||||
}
|
||||
|
||||
public void Add(long o)
|
||||
{
|
||||
if (o == 0)
|
||||
return;
|
||||
|
||||
synchronized (m_lock)
|
||||
{
|
||||
m_queue.add(o);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear(Context ctx)
|
||||
{
|
||||
synchronized (m_lock)
|
||||
{
|
||||
for (Long o : m_queue)
|
||||
DecRef(ctx, o);
|
||||
m_queue.clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,5 +21,7 @@ package com.Microsoft.Z3;
|
|||
|
||||
public class IDisposable
|
||||
{
|
||||
public void Dispose() throws Z3Exception {}
|
||||
public void Dispose() throws Z3Exception
|
||||
{
|
||||
}
|
||||
}
|
26
src/api/java/IntExpr.java
Normal file
26
src/api/java/IntExpr.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* This file was automatically generated from IntExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Int expressions
|
||||
**/
|
||||
public class IntExpr extends ArithExpr
|
||||
{
|
||||
/**
|
||||
* Constructor for IntExpr </summary>
|
||||
**/
|
||||
protected IntExpr(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
IntExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
59
src/api/java/IntNum.java
Normal file
59
src/api/java/IntNum.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This file was automatically generated from IntNum.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* Integer Numerals
|
||||
**/
|
||||
public class IntNum extends IntExpr
|
||||
{
|
||||
|
||||
IntNum(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the int value.
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
{
|
||||
Native.IntPtr res = new Native.IntPtr();
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int");
|
||||
return res.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the 64-bit int value.
|
||||
**/
|
||||
public long Int64() throws Z3Exception
|
||||
{
|
||||
Native.LongPtr res = new Native.LongPtr();
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int64");
|
||||
return res.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the BigInteger value.
|
||||
**/
|
||||
public BigInteger BigInteger() throws Z3Exception
|
||||
{
|
||||
return new BigInteger(this.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the numeral.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
}
|
23
src/api/java/IntSort.java
Normal file
23
src/api/java/IntSort.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* This file was automatically generated from IntSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* An Integer sort
|
||||
**/
|
||||
public class IntSort extends ArithSort
|
||||
{
|
||||
IntSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
IntSort(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkIntSort(ctx.nCtx()));
|
||||
}
|
||||
}
|
44
src/api/java/IntSymbol.java
Normal file
44
src/api/java/IntSymbol.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* This file was automatically generated from IntSymbol.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Numbered symbols
|
||||
**/
|
||||
public class IntSymbol extends Symbol
|
||||
{
|
||||
/**
|
||||
* The int value of the symbol. <remarks>Throws an exception if the symbol
|
||||
* is not of int kind. </remarks>
|
||||
**/
|
||||
public int Int() throws Z3Exception
|
||||
{
|
||||
if (!IsIntSymbol())
|
||||
throw new Z3Exception("Int requested from non-Int symbol");
|
||||
return Native.getSymbolInt(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
IntSymbol(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
IntSymbol(Context ctx, int i) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkIntSymbol(ctx.nCtx(), i));
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL
|
||||
.toInt())
|
||||
throw new Z3Exception("Symbol is not of integer kind");
|
||||
super.CheckNativeObject(obj);
|
||||
}
|
||||
}
|
101
src/api/java/ListSort.java
Normal file
101
src/api/java/ListSort.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* This file was automatically generated from ListSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* List sorts.
|
||||
**/
|
||||
public class ListSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The declaration of the nil function of this list sort.
|
||||
**/
|
||||
public FuncDecl NilDecl()
|
||||
{
|
||||
|
||||
return nilDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The empty list.
|
||||
**/
|
||||
public Expr Nil()
|
||||
{
|
||||
|
||||
return nilConst;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the isNil function of this list sort.
|
||||
**/
|
||||
public FuncDecl IsNilDecl()
|
||||
{
|
||||
|
||||
return isNilDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the cons function of this list sort.
|
||||
**/
|
||||
public FuncDecl ConsDecl()
|
||||
{
|
||||
|
||||
return consDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the isCons function of this list sort.
|
||||
*
|
||||
**/
|
||||
public FuncDecl IsConsDecl()
|
||||
{
|
||||
|
||||
return isConsDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the head function of this list sort.
|
||||
**/
|
||||
public FuncDecl HeadDecl()
|
||||
{
|
||||
|
||||
return headDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The declaration of the tail function of this list sort.
|
||||
**/
|
||||
public FuncDecl TailDecl()
|
||||
{
|
||||
|
||||
return tailDecl;
|
||||
}
|
||||
|
||||
private FuncDecl nilDecl, isNilDecl, consDecl, isConsDecl, headDecl,
|
||||
tailDecl;
|
||||
private Expr nilConst;
|
||||
|
||||
ListSort(Context ctx, Symbol name, Sort elemSort) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
Native.LongPtr inil = new Native.LongPtr(), iisnil = new Native.LongPtr();
|
||||
Native.LongPtr icons = new Native.LongPtr(), iiscons = new Native.LongPtr();
|
||||
Native.LongPtr ihead = new Native.LongPtr(), itail = new Native.LongPtr();
|
||||
|
||||
setNativeObject(Native.mkListSort(ctx.nCtx(), name.NativeObject(),
|
||||
elemSort.NativeObject(), inil, iisnil, icons, iiscons, ihead,
|
||||
itail));
|
||||
nilDecl = new FuncDecl(ctx, inil.value);
|
||||
isNilDecl = new FuncDecl(ctx, iisnil.value);
|
||||
consDecl = new FuncDecl(ctx, icons.value);
|
||||
isConsDecl = new FuncDecl(ctx, iiscons.value);
|
||||
headDecl = new FuncDecl(ctx, ihead.value);
|
||||
tailDecl = new FuncDecl(ctx, itail.value);
|
||||
nilConst = ctx.MkConst(nilDecl);
|
||||
}
|
||||
};
|
60
src/api/java/Log.java
Normal file
60
src/api/java/Log.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* This file was automatically generated from Log.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Interaction logging for Z3. <remarks> Note that this is a global, static log
|
||||
* and if multiple Context objects are created, it logs the interaction with all
|
||||
* of them. </remarks>
|
||||
**/
|
||||
public final class Log
|
||||
{
|
||||
private boolean m_is_open = false;
|
||||
|
||||
/**
|
||||
* Open an interaction log file. <param name="filename">the name of the file
|
||||
* to open</param>
|
||||
*
|
||||
* @return True if opening the log file succeeds, false otherwise.
|
||||
**/
|
||||
public boolean Open(String filename)
|
||||
{
|
||||
m_is_open = true;
|
||||
return Native.openLog(filename) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the interaction log.
|
||||
**/
|
||||
public void Close()
|
||||
{
|
||||
m_is_open = false;
|
||||
Native.closeLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the user-provided string <paramref name="s"/> to the interaction
|
||||
* log.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Append(String s) throws Z3Exception
|
||||
{
|
||||
if (!m_is_open)
|
||||
throw new Z3Exception("Log cannot be closed.");
|
||||
Native.appendLog(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the interaction log is opened.
|
||||
*
|
||||
* @return True if the interaction log is open, false otherwise.
|
||||
**/
|
||||
public boolean isOpen()
|
||||
{
|
||||
return m_is_open;
|
||||
}
|
||||
}
|
291
src/api/java/Model.java
Normal file
291
src/api/java/Model.java
Normal file
|
@ -0,0 +1,291 @@
|
|||
/**
|
||||
* This file was automatically generated from Model.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* A Model contains interpretations (assignments) of constants and functions.
|
||||
**/
|
||||
public class Model extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Retrieves the interpretation (the assignment) of <paramref name="a"/> in
|
||||
* the model. <param name="a">A Constant</param>
|
||||
*
|
||||
* @return An expression if the constant has an interpretation in the model,
|
||||
* null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr ConstInterp(Expr a) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(a);
|
||||
return ConstInterp(a.FuncDecl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the interpretation (the assignment) of <paramref name="f"/> in
|
||||
* the model. <param name="f">A function declaration of zero arity</param>
|
||||
*
|
||||
* @return An expression if the function has an interpretation in the model,
|
||||
* null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr ConstInterp(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(f);
|
||||
if (f.Arity() != 0
|
||||
|| Native.getSortKind(Context().nCtx(),
|
||||
Native.getRange(Context().nCtx(), f.NativeObject())) == Z3_sort_kind.Z3_ARRAY_SORT
|
||||
.toInt())
|
||||
throw new Z3Exception(
|
||||
"Non-zero arity functions and arrays have FunctionInterpretations as a model. Use FuncInterp.");
|
||||
|
||||
long n = Native.modelGetConstInterp(Context().nCtx(), NativeObject(),
|
||||
f.NativeObject());
|
||||
if (n == 0)
|
||||
return null;
|
||||
else
|
||||
return Expr.Create(Context(), n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the interpretation (the assignment) of a non-constant <paramref
|
||||
* name="f"/> in the model. <param name="f">A function declaration of
|
||||
* non-zero arity</param>
|
||||
*
|
||||
* @return A FunctionInterpretation if the function has an interpretation in
|
||||
* the model, null otherwise.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncInterp FuncInterp(FuncDecl f) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(f);
|
||||
|
||||
Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(Context()
|
||||
.nCtx(), Native.getRange(Context().nCtx(), f.NativeObject())));
|
||||
|
||||
if (f.Arity() == 0)
|
||||
{
|
||||
long n = Native.modelGetConstInterp(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject());
|
||||
|
||||
if (sk == Z3_sort_kind.Z3_ARRAY_SORT)
|
||||
{
|
||||
if (n == 0)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
if (Native.isAsArray(Context().nCtx(), n) ^ true)
|
||||
throw new Z3Exception(
|
||||
"Argument was not an array constant");
|
||||
long fd = Native.getAsArrayFuncDecl(Context().nCtx(), n);
|
||||
return FuncInterp(new FuncDecl(Context(), fd));
|
||||
}
|
||||
} else
|
||||
{
|
||||
throw new Z3Exception(
|
||||
"Constant functions do not have a function interpretation; use ConstInterp");
|
||||
}
|
||||
} else
|
||||
{
|
||||
long n = Native.modelGetFuncInterp(Context().nCtx(),
|
||||
NativeObject(), f.NativeObject());
|
||||
if (n == 0)
|
||||
return null;
|
||||
else
|
||||
return new FuncInterp(Context(), n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of constants that have an interpretation in the model.
|
||||
**/
|
||||
public int NumConsts()
|
||||
{
|
||||
return Native.modelGetNumConsts(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declarations of the constants in the model.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] ConstDecls() throws Z3Exception
|
||||
{
|
||||
int n = NumConsts();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of function interpretations in the model.
|
||||
**/
|
||||
public int NumFuncs()
|
||||
{
|
||||
return Native.modelGetNumFuncs(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declarations of the function interpretations in the model.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] FuncDecls() throws Z3Exception
|
||||
{
|
||||
int n = NumFuncs();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetFuncDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* All symbols that have an interpretation in the model.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] Decls() throws Z3Exception
|
||||
{
|
||||
int nFuncs = NumFuncs();
|
||||
int nConsts = NumConsts();
|
||||
int n = nFuncs + nConsts;
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < nConsts; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
for (int i = 0; i < nFuncs; i++)
|
||||
res[nConsts + i] = new FuncDecl(Context(), Native.modelGetFuncDecl(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A ModelEvaluationFailedException is thrown when an expression cannot be
|
||||
* evaluated by the model.
|
||||
**/
|
||||
@SuppressWarnings("serial")
|
||||
public class ModelEvaluationFailedException extends Z3Exception
|
||||
{
|
||||
/**
|
||||
* An exception that is thrown when model evaluation fails.
|
||||
**/
|
||||
public ModelEvaluationFailedException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the expression <paramref name="t"/> in the current model.
|
||||
* <remarks> This function may fail if <paramref name="t"/> contains
|
||||
* quantifiers, is partial (MODEL_PARTIAL enabled), or if <paramref
|
||||
* name="t"/> is not well-sorted. In this case a
|
||||
* <code>ModelEvaluationFailedException</code> is thrown. </remarks> <param
|
||||
* name="t">An expression</param> <param name="completion"> When this flag
|
||||
* is enabled, a model value will be assigned to any constant or function
|
||||
* that does not have an interpretation in the model. </param>
|
||||
*
|
||||
* @return The evaluation of <paramref name="t"/> in the model.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Eval(Expr t, boolean completion) throws Z3Exception
|
||||
{
|
||||
Native.LongPtr v = new Native.LongPtr();
|
||||
if (Native.modelEval(Context().nCtx(), NativeObject(),
|
||||
t.NativeObject(), (completion) ? true : false, v) ^ true)
|
||||
throw new ModelEvaluationFailedException();
|
||||
else
|
||||
return Expr.Create(Context(), v.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for <code>Eval</code>.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Evaluate(Expr t, boolean completion) throws Z3Exception
|
||||
{
|
||||
return Eval(t, completion);
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of uninterpreted sorts that the model has an interpretation
|
||||
* for.
|
||||
**/
|
||||
public int NumSorts()
|
||||
{
|
||||
return Native.modelGetNumSorts(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The uninterpreted sorts that the model has an interpretation for.
|
||||
* <remarks> Z3 also provides an intepretation 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. </remarks>
|
||||
* <seealso cref="NumSorts"/> <seealso cref="SortUniverse"/>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] Sorts() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumSorts();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(),
|
||||
Native.modelGetSort(Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The finite set of distinct values that represent the interpretation for
|
||||
* sort <paramref name="s"/>. <seealso cref="Sorts"/> <param name="s">An
|
||||
* uninterpreted sort</param>
|
||||
*
|
||||
* @return An array of expressions, where each is an element of the universe
|
||||
* of <paramref name="s"/>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] SortUniverse(Sort s) throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector nUniv = new ASTVector(Context(), Native.modelGetSortUniverse(
|
||||
Context().nCtx(), NativeObject(), s.NativeObject()));
|
||||
int n = nUniv.Size();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), nUniv.get(i).NativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion of models to strings.
|
||||
*
|
||||
* @return A string representation of the model.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.modelToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
Model(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Model_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Model_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/ModelDecRefQueue.java
Normal file
19
src/api/java/ModelDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ModelDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.modelIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.modelDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
|
@ -5,7 +5,7 @@ public final class Native {
|
|||
public static class LongPtr { public long value; }
|
||||
public static class StringPtr { public String value; }
|
||||
public static class errorHandler { public long ptr; }
|
||||
static { System.loadLibrary("<mk_util.JavaDLLComponent instance at 0x0256D828>"); }
|
||||
static { System.loadLibrary("<mk_util.JavaDLLComponent instance at 0x026CDA08>"); }
|
||||
public static native long mkConfig();
|
||||
public static native void delConfig(long a0);
|
||||
public static native void setParamValue(long a0, String a1, String a2);
|
||||
|
@ -15,7 +15,7 @@ public final class Native {
|
|||
public static native void incRef(long a0, long a1);
|
||||
public static native void decRef(long a0, long a1);
|
||||
public static native void updateParamValue(long a0, String a1, String a2);
|
||||
public static native boolean getParamValue(long a0, String a1, String a2);
|
||||
public static native boolean getParamValue(long a0, String a1, StringPtr a2);
|
||||
public static native void interrupt(long a0);
|
||||
public static native long mkParams(long a0);
|
||||
public static native void paramsIncRef(long a0, long a1);
|
||||
|
@ -41,16 +41,16 @@ public final class Native {
|
|||
public static native long mkBvSort(long a0, int a1);
|
||||
public static native long mkFiniteDomainSort(long a0, long a1, long a2);
|
||||
public static native long mkArraySort(long a0, long a1, long a2);
|
||||
public static native long mkTupleSort(long a0, long a1, int a2, long[] a3, long[] a4, Long a5, long[] a6);
|
||||
public static native long mkTupleSort(long a0, long a1, int a2, long[] a3, long[] a4, LongPtr a5, long[] a6);
|
||||
public static native long mkEnumerationSort(long a0, long a1, int a2, long[] a3, long[] a4, long[] a5);
|
||||
public static native long mkListSort(long a0, long a1, long a2, Long a3, Long a4, Long a5, Long a6, Long a7, Long a8);
|
||||
public static native long mkListSort(long a0, long a1, long a2, LongPtr a3, LongPtr a4, LongPtr a5, LongPtr a6, LongPtr a7, LongPtr a8);
|
||||
public static native long mkConstructor(long a0, long a1, long a2, int a3, long[] a4, long[] a5, int[] a6);
|
||||
public static native void delConstructor(long a0, long a1);
|
||||
public static native long mkDatatype(long a0, long a1, int a2, long[] a3);
|
||||
public static native long mkConstructorList(long a0, int a1, long[] a2);
|
||||
public static native void delConstructorList(long a0, long a1);
|
||||
public static native void mkDatatypes(long a0, int a1, long[] a2, long[] a3, long[] a4);
|
||||
public static native void queryConstructor(long a0, long a1, int a2, Long a3, Long a4, long[] a5);
|
||||
public static native void queryConstructor(long a0, long a1, int a2, LongPtr a3, LongPtr a4, long[] a5);
|
||||
public static native long mkFuncDecl(long a0, long a1, int a2, long[] a3, long a4);
|
||||
public static native long mkApp(long a0, long a1, int a2, long[] a3);
|
||||
public static native long mkConst(long a0, long a1, long a2);
|
||||
|
@ -171,7 +171,7 @@ public final class Native {
|
|||
public static native boolean isEqSort(long a0, long a1, long a2);
|
||||
public static native int getSortKind(long a0, long a1);
|
||||
public static native int getBvSortSize(long a0, long a1);
|
||||
public static native boolean getFiniteDomainSortSize(long a0, long a1, Long a2);
|
||||
public static native boolean getFiniteDomainSortSize(long a0, long a1, LongPtr a2);
|
||||
public static native long getArraySortDomain(long a0, long a1);
|
||||
public static native long getArraySortRange(long a0, long a1);
|
||||
public static native long getTupleSortMkDecl(long a0, long a1);
|
||||
|
@ -221,12 +221,12 @@ public final class Native {
|
|||
public static native String getNumeralDecimalString(long a0, long a1, int a2);
|
||||
public static native long getNumerator(long a0, long a1);
|
||||
public static native long getDenominator(long a0, long a1);
|
||||
public static native boolean getNumeralSmall(long a0, long a1, Long a2, Long a3);
|
||||
public static native boolean getNumeralInt(long a0, long a1, Integer a2);
|
||||
public static native boolean getNumeralUint(long a0, long a1, Integer a2);
|
||||
public static native boolean getNumeralUint64(long a0, long a1, Long a2);
|
||||
public static native boolean getNumeralInt64(long a0, long a1, Long a2);
|
||||
public static native boolean getNumeralRationalInt64(long a0, long a1, Long a2, Long a3);
|
||||
public static native boolean getNumeralSmall(long a0, long a1, LongPtr a2, LongPtr a3);
|
||||
public static native boolean getNumeralInt(long a0, long a1, IntPtr a2);
|
||||
public static native boolean getNumeralUint(long a0, long a1, IntPtr a2);
|
||||
public static native boolean getNumeralUint64(long a0, long a1, LongPtr a2);
|
||||
public static native boolean getNumeralInt64(long a0, long a1, LongPtr a2);
|
||||
public static native boolean getNumeralRationalInt64(long a0, long a1, LongPtr a2, LongPtr a3);
|
||||
public static native long getAlgebraicNumberLower(long a0, long a1, int a2);
|
||||
public static native long getAlgebraicNumberUpper(long a0, long a1, int a2);
|
||||
public static native long patternToAst(long a0, long a1);
|
||||
|
@ -253,7 +253,7 @@ public final class Native {
|
|||
public static native long translate(long a0, long a1, long a2);
|
||||
public static native void modelIncRef(long a0, long a1);
|
||||
public static native void modelDecRef(long a0, long a1);
|
||||
public static native boolean modelEval(long a0, long a1, long a2, boolean a3, Long a4);
|
||||
public static native boolean modelEval(long a0, long a1, long a2, boolean a3, LongPtr a4);
|
||||
public static native long modelGetConstInterp(long a0, long a1, long a2);
|
||||
public static native long modelGetFuncInterp(long a0, long a1, long a2);
|
||||
public static native int modelGetNumConsts(long a0, long a1);
|
||||
|
@ -304,7 +304,7 @@ public final class Native {
|
|||
public static native void setError(long a0, int a1);
|
||||
public static native String getErrorMsg(int a0);
|
||||
public static native String getErrorMsgEx(long a0, int a1);
|
||||
public static native void getVersion(Integer a0, Integer a1, Integer a2, Integer a3);
|
||||
public static native void getVersion(IntPtr a0, IntPtr a1, IntPtr a2, IntPtr a3);
|
||||
public static native void enableTrace(String a0);
|
||||
public static native void disableTrace(String a0);
|
||||
public static native void resetMemory();
|
||||
|
@ -456,9 +456,9 @@ public final class Native {
|
|||
public static native int getNumScopes(long a0);
|
||||
public static native void persistAst(long a0, long a1, int a2);
|
||||
public static native void assertCnstr(long a0, long a1);
|
||||
public static native int checkAndGetModel(long a0, Long a1);
|
||||
public static native int checkAndGetModel(long a0, LongPtr a1);
|
||||
public static native int check(long a0);
|
||||
public static native int checkAssumptions(long a0, int a1, long[] a2, Long a3, Long a4, Integer a5, long[] a6);
|
||||
public static native int checkAssumptions(long a0, int a1, long[] a2, LongPtr a3, LongPtr a4, IntPtr a5, long[] a6);
|
||||
public static native int getImpliedEqualities(long a0, int a1, long[] a2, int[] a3);
|
||||
public static native void delModel(long a0, long a1);
|
||||
public static native void softCheckCancel(long a0);
|
||||
|
@ -477,16 +477,16 @@ public final class Native {
|
|||
public static native long getModelConstant(long a0, long a1, int a2);
|
||||
public static native int getModelNumFuncs(long a0, long a1);
|
||||
public static native long getModelFuncDecl(long a0, long a1, int a2);
|
||||
public static native boolean evalFuncDecl(long a0, long a1, long a2, Long a3);
|
||||
public static native boolean isArrayValue(long a0, long a1, long a2, Integer a3);
|
||||
public static native void getArrayValue(long a0, long a1, long a2, int a3, long[] a4, long[] a5, Long a6);
|
||||
public static native boolean evalFuncDecl(long a0, long a1, long a2, LongPtr a3);
|
||||
public static native boolean isArrayValue(long a0, long a1, long a2, IntPtr a3);
|
||||
public static native void getArrayValue(long a0, long a1, long a2, int a3, long[] a4, long[] a5, LongPtr a6);
|
||||
public static native long getModelFuncElse(long a0, long a1, int a2);
|
||||
public static native int getModelFuncNumEntries(long a0, long a1, int a2);
|
||||
public static native int getModelFuncEntryNumArgs(long a0, long a1, int a2, int a3);
|
||||
public static native long getModelFuncEntryArg(long a0, long a1, int a2, int a3, int a4);
|
||||
public static native long getModelFuncEntryValue(long a0, long a1, int a2, int a3);
|
||||
public static native boolean eval(long a0, long a1, long a2, Long a3);
|
||||
public static native boolean evalDecl(long a0, long a1, long a2, int a3, long[] a4, Long a5);
|
||||
public static native boolean eval(long a0, long a1, long a2, LongPtr a3);
|
||||
public static native boolean evalDecl(long a0, long a1, long a2, int a3, long[] a4, LongPtr a5);
|
||||
public static native String contextToString(long a0);
|
||||
public static native String statisticsToString(long a0);
|
||||
public static native long getContextAssignment(long a0);
|
85
src/api/java/ParamDescrs.java
Normal file
85
src/api/java/ParamDescrs.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* This file was automatically generated from ParamDescrs.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* A ParamDescrs describes a set of parameters.
|
||||
**/
|
||||
public class ParamDescrs extends Z3Object
|
||||
{
|
||||
/**
|
||||
* validate a set of parameters.
|
||||
**/
|
||||
public void Validate(Params p)
|
||||
{
|
||||
|
||||
Native.paramsValidate(Context().nCtx(), p.NativeObject(),
|
||||
NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve kind of parameter.
|
||||
**/
|
||||
public Z3_param_kind GetKind(Symbol name)
|
||||
{
|
||||
|
||||
return Z3_param_kind.fromInt(Native.paramDescrsGetKind(
|
||||
Context().nCtx(), NativeObject(), name.NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all names of parameters.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Symbol[] Names() throws Z3Exception
|
||||
{
|
||||
int sz = Native.paramDescrsSize(Context().nCtx(), NativeObject());
|
||||
Symbol[] names = new Symbol[sz];
|
||||
for (int i = 0; i < sz; ++i)
|
||||
{
|
||||
names[i] = Symbol.Create(Context(), Native.paramDescrsGetName(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the ParamDescrs.
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.paramDescrsSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string representation of the ParamDescrs.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.paramDescrsToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ParamDescrs(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ParamDescrs_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().ParamDescrs_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/ParamDescrsDecRefQueue.java
Normal file
19
src/api/java/ParamDescrsDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ParamDescrsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.paramDescrsIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.paramDescrsDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
102
src/api/java/Params.java
Normal file
102
src/api/java/Params.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* This file was automatically generated from Params.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* A ParameterSet represents a configuration in the form of Symbol/value pairs.
|
||||
**/
|
||||
public class Params extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, boolean value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetBool(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), (value) ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, double value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetDouble(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(Symbol name, Symbol value) throws Z3Exception
|
||||
{
|
||||
|
||||
Native.paramsSetSymbol(Context().nCtx(), NativeObject(),
|
||||
name.NativeObject(), value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, boolean value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetBool(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), (value) ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, int value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetUint(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, double value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetDouble(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter setting.
|
||||
**/
|
||||
public void Add(String name, Symbol value) throws Z3Exception
|
||||
{
|
||||
Native.paramsSetSymbol(Context().nCtx(), NativeObject(), Context()
|
||||
.MkSymbol(name).NativeObject(), value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the parameter set.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.paramsToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
Params(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkParams(ctx.nCtx()));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Params_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Params_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/ParamsDecRefQueue.java
Normal file
19
src/api/java/ParamsDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ParamsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.paramsIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.paramsDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
51
src/api/java/Pattern.java
Normal file
51
src/api/java/Pattern.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* This file was automatically generated from Pattern.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Patterns comprise a list of terms. The list should be non-empty. If the list
|
||||
* comprises of more than one term, it is also called a multi-pattern.
|
||||
**/
|
||||
public class Pattern extends AST
|
||||
{
|
||||
/**
|
||||
* The number of terms in the pattern.
|
||||
**/
|
||||
public int NumTerms()
|
||||
{
|
||||
return Native.getPatternNumTerms(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The terms in the pattern.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] Terms() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumTerms();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(),
|
||||
Native.getPattern(Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the pattern.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.patternToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
Pattern(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
63
src/api/java/Probe.java
Normal file
63
src/api/java/Probe.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* This file was automatically generated from Probe.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Probes are used to inspect a goal (aka problem) and collect information that
|
||||
* may be used to decide which solver and/or preprocessing step will be used.
|
||||
* The complete list of probes may be obtained using the procedures
|
||||
* <code>Context.NumProbes</code> and <code>Context.ProbeNames</code>. It may
|
||||
* also be obtained using the command <code>(help-tactics)</code> in the SMT 2.0
|
||||
* front-end.
|
||||
**/
|
||||
public class Probe extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Execute the probe over the goal.
|
||||
*
|
||||
* @return A probe always produce a double value. "Boolean" probes return
|
||||
* 0.0 for false, and a value different from 0.0 for true.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public double Apply(Goal g) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(g);
|
||||
return Native.probeApply(Context().nCtx(), NativeObject(),
|
||||
g.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the probe to a goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public double get(Goal g) throws Z3Exception
|
||||
{
|
||||
return Apply(g);
|
||||
}
|
||||
|
||||
Probe(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
Probe(Context ctx, String name) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkProbe(ctx.nCtx(), name));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Probe_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Probe_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/ProbeDecRefQueue.java
Normal file
19
src/api/java/ProbeDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class ProbeDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.probeIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.probeDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
213
src/api/java/Quantifier.java
Normal file
213
src/api/java/Quantifier.java
Normal file
|
@ -0,0 +1,213 @@
|
|||
/**
|
||||
* This file was automatically generated from Quantifier.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Quantifier expressions.
|
||||
**/
|
||||
public class Quantifier extends BoolExpr
|
||||
{
|
||||
/**
|
||||
* Indicates whether the quantifier is universal.
|
||||
**/
|
||||
public boolean IsUniversal()
|
||||
{
|
||||
return Native.isQuantifierForall(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the quantifier is existential.
|
||||
**/
|
||||
public boolean IsExistential()
|
||||
{
|
||||
return !IsUniversal();
|
||||
}
|
||||
|
||||
/**
|
||||
* The weight of the quantifier.
|
||||
**/
|
||||
public int Weight()
|
||||
{
|
||||
return Native.getQuantifierWeight(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of patterns.
|
||||
**/
|
||||
public int NumPatterns()
|
||||
{
|
||||
return Native
|
||||
.getQuantifierNumPatterns(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The patterns.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Pattern[] Patterns() throws Z3Exception
|
||||
{
|
||||
int n = NumPatterns();
|
||||
Pattern[] res = new Pattern[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Pattern(Context(), Native.getQuantifierPatternAst(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of no-patterns.
|
||||
**/
|
||||
public int NumNoPatterns()
|
||||
{
|
||||
return Native.getQuantifierNumNoPatterns(Context().nCtx(),
|
||||
NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The no-patterns.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Pattern[] NoPatterns() throws Z3Exception
|
||||
{
|
||||
int n = NumNoPatterns();
|
||||
Pattern[] res = new Pattern[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Pattern(Context(), Native.getQuantifierNoPatternAst(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of bound variables.
|
||||
**/
|
||||
public int NumBound()
|
||||
{
|
||||
return Native.getQuantifierNumBound(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The symbols for the bound variables.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Symbol[] BoundVariableNames() throws Z3Exception
|
||||
{
|
||||
int n = NumBound();
|
||||
Symbol[] res = new Symbol[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Symbol.Create(Context(), Native.getQuantifierBoundName(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The sorts of the bound variables.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] BoundVariableSorts() throws Z3Exception
|
||||
{
|
||||
int n = NumBound();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(), Native.getQuantifierBoundSort(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The body of the quantifier.
|
||||
*
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr Body() throws Z3Exception
|
||||
{
|
||||
return new BoolExpr(Context(), Native.getQuantifierBody(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
Quantifier(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names,
|
||||
Expr body, int weight, Pattern[] patterns, Expr[] noPatterns,
|
||||
Symbol quantifierID, Symbol skolemID) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
Context().CheckContextMatch(patterns);
|
||||
Context().CheckContextMatch(noPatterns);
|
||||
Context().CheckContextMatch(sorts);
|
||||
Context().CheckContextMatch(names);
|
||||
Context().CheckContextMatch(body);
|
||||
|
||||
if (sorts.length != names.length)
|
||||
throw new Z3Exception(
|
||||
"Number of sorts does not match number of names");
|
||||
|
||||
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||
{
|
||||
setNativeObject(Native.mkQuantifier(ctx.nCtx(), (isForall) ? true
|
||||
: false, weight, AST.ArrayLength(patterns), AST
|
||||
.ArrayToNative(patterns), AST.ArrayLength(sorts), AST
|
||||
.ArrayToNative(sorts), Symbol.ArrayToNative(names), body
|
||||
.NativeObject()));
|
||||
} else
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierEx(ctx.nCtx(), (isForall) ? true
|
||||
: false, weight, AST.GetNativeObject(quantifierID), AST
|
||||
.GetNativeObject(skolemID), AST.ArrayLength(patterns), AST
|
||||
.ArrayToNative(patterns), AST.ArrayLength(noPatterns), AST
|
||||
.ArrayToNative(noPatterns), AST.ArrayLength(sorts), AST
|
||||
.ArrayToNative(sorts), Symbol.ArrayToNative(names), body
|
||||
.NativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
Quantifier(Context ctx, boolean isForall, Expr[] bound, Expr body,
|
||||
int weight, Pattern[] patterns, Expr[] noPatterns,
|
||||
Symbol quantifierID, Symbol skolemID) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
Context().CheckContextMatch(noPatterns);
|
||||
Context().CheckContextMatch(patterns);
|
||||
// Context().CheckContextMatch(bound);
|
||||
Context().CheckContextMatch(body);
|
||||
|
||||
if (noPatterns == null && quantifierID == null && skolemID == null)
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierConst(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight, AST.ArrayLength(bound),
|
||||
AST.ArrayToNative(bound), AST.ArrayLength(patterns),
|
||||
AST.ArrayToNative(patterns), body.NativeObject()));
|
||||
} else
|
||||
{
|
||||
setNativeObject(Native.mkQuantifierConstEx(ctx.nCtx(),
|
||||
(isForall) ? true : false, weight,
|
||||
AST.GetNativeObject(quantifierID),
|
||||
AST.GetNativeObject(skolemID), AST.ArrayLength(bound),
|
||||
AST.ArrayToNative(bound), AST.ArrayLength(patterns),
|
||||
AST.ArrayToNative(patterns), AST.ArrayLength(noPatterns),
|
||||
AST.ArrayToNative(noPatterns), body.NativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
Quantifier(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST
|
||||
.toInt())
|
||||
throw new Z3Exception("Underlying object is not a quantifier");
|
||||
super.CheckNativeObject(obj);
|
||||
}
|
||||
}
|
73
src/api/java/RatNum.java
Normal file
73
src/api/java/RatNum.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* This file was automatically generated from RatNum.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
/**
|
||||
* Rational Numerals
|
||||
**/
|
||||
public class RatNum extends RealExpr
|
||||
{
|
||||
/**
|
||||
* The numerator of a rational numeral.
|
||||
**/
|
||||
public IntNum Numerator() throws Z3Exception
|
||||
{
|
||||
return new IntNum(Context(), Native.getNumerator(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The denominator of a rational numeral.
|
||||
**/
|
||||
public IntNum Denominator() throws Z3Exception
|
||||
{
|
||||
return new IntNum(Context(), Native.getDenominator(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the numerator of the rational to a BigInteger
|
||||
**/
|
||||
public BigInteger BigIntNumerator() throws Z3Exception
|
||||
{
|
||||
IntNum n = Numerator();
|
||||
return new BigInteger(n.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the denominator of the rational to a BigInteger
|
||||
**/
|
||||
public BigInteger BigIntDenominator() throws Z3Exception
|
||||
{
|
||||
IntNum n = Denominator();
|
||||
return new BigInteger(n.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation in decimal notation. <remarks>The result
|
||||
* has at most <paramref name="precision"/> decimal places.</remarks>
|
||||
**/
|
||||
public String ToDecimalString(int precision) throws Z3Exception
|
||||
{
|
||||
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(),
|
||||
precision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the numeral.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
RatNum(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
26
src/api/java/RealExpr.java
Normal file
26
src/api/java/RealExpr.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* This file was automatically generated from RealExpr.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Real expressions
|
||||
**/
|
||||
public class RealExpr extends ArithExpr
|
||||
{
|
||||
/**
|
||||
* Constructor for RealExpr </summary>
|
||||
**/
|
||||
protected RealExpr(Context ctx)
|
||||
{
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
RealExpr(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
23
src/api/java/RealSort.java
Normal file
23
src/api/java/RealSort.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* This file was automatically generated from RealSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* A real sort
|
||||
**/
|
||||
public class RealSort extends ArithSort
|
||||
{
|
||||
RealSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
RealSort(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkRealSort(ctx.nCtx()));
|
||||
}
|
||||
}
|
46
src/api/java/RelationSort.java
Normal file
46
src/api/java/RelationSort.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* This file was automatically generated from RelationSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Relation sorts.
|
||||
**/
|
||||
public class RelationSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The arity of the relation sort.
|
||||
**/
|
||||
public int Arity()
|
||||
{
|
||||
return Native.getRelationArity(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The sorts of the columns of the relation sort.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Sort[] ColumnSorts() throws Z3Exception
|
||||
{
|
||||
|
||||
if (m_columnSorts != null)
|
||||
return m_columnSorts;
|
||||
|
||||
int n = Arity();
|
||||
Sort[] res = new Sort[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Sort.Create(Context(), Native.getRelationColumn(Context()
|
||||
.nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
private Sort[] m_columnSorts = null;
|
||||
|
||||
RelationSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
}
|
23
src/api/java/SetSort.java
Normal file
23
src/api/java/SetSort.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* This file was automatically generated from SetSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Set sorts.
|
||||
**/
|
||||
public class SetSort extends Sort
|
||||
{
|
||||
SetSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
SetSort(Context ctx, Sort ty) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkSetSort(ctx.nCtx(), ty.NativeObject()));
|
||||
}
|
||||
}
|
242
src/api/java/Solver.java
Normal file
242
src/api/java/Solver.java
Normal file
|
@ -0,0 +1,242 @@
|
|||
/**
|
||||
* This file was automatically generated from Solver.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Solvers.
|
||||
**/
|
||||
public class Solver extends Z3Object
|
||||
{
|
||||
/**
|
||||
* A string that describes all available solver parameters.
|
||||
**/
|
||||
public String Help()
|
||||
{
|
||||
return Native.solverGetHelp(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the solver parameters.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void setParameters(Params value) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(value);
|
||||
Native.solverSetParams(Context().nCtx(), NativeObject(),
|
||||
value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves parameter descriptions for solver.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.solverGetParamDescrs(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The current number of backtracking points (scopes). <seealso cref="Pop"/>
|
||||
* <seealso cref="Push"/>
|
||||
**/
|
||||
public int NumScopes()
|
||||
{
|
||||
return Native.solverGetNumScopes(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a backtracking point. <seealso cref="Pop"/>
|
||||
**/
|
||||
public void Push()
|
||||
{
|
||||
Native.solverPush(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Backtracks <paramref name="n"/> backtracking points. <remarks>Note that
|
||||
* an exception is thrown if <paramref name="n"/> is not smaller than
|
||||
* <code>NumScopes</code></remarks> <seealso cref="Push"/>
|
||||
**/
|
||||
public void Pop(int n)
|
||||
{
|
||||
Native.solverPop(Context().nCtx(), NativeObject(), n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the Solver. <remarks>This removes all assertions from the
|
||||
* solver.</remarks>
|
||||
**/
|
||||
public void Reset()
|
||||
{
|
||||
Native.solverReset(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert a constraint (or multiple) into the solver.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public void Assert(BoolExpr[] constraints) throws Z3Exception
|
||||
{
|
||||
Context().CheckContextMatch(constraints);
|
||||
for (BoolExpr a : constraints)
|
||||
{
|
||||
Native.solverAssert(Context().nCtx(), NativeObject(),
|
||||
a.NativeObject());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of assertions in the solver.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public int NumAssertions() throws Z3Exception
|
||||
{
|
||||
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
return ass.Size();
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of asserted formulas.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public BoolExpr[] Assertions() throws Z3Exception
|
||||
{
|
||||
ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = ass.Size();
|
||||
BoolExpr[] res = new BoolExpr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new BoolExpr(Context(), ass.get(i).NativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the assertions in the solver are consistent or not.
|
||||
* <remarks> <seealso cref="Model"/> <seealso cref="UnsatCore"/> <seealso
|
||||
* cref="Proof"/> </remarks>
|
||||
**/
|
||||
public Status Check(Expr[] assumptions)
|
||||
{
|
||||
Z3_lbool r;
|
||||
if (assumptions == null)
|
||||
r = Z3_lbool.fromInt(Native.solverCheck(Context().nCtx(),
|
||||
NativeObject()));
|
||||
else
|
||||
r = Z3_lbool.fromInt(Native.solverCheckAssumptions(
|
||||
Context().nCtx(), NativeObject(), (int) assumptions.length,
|
||||
AST.ArrayToNative(assumptions)));
|
||||
switch (r)
|
||||
{
|
||||
case Z3_L_TRUE:
|
||||
return Status.SATISFIABLE;
|
||||
case Z3_L_FALSE:
|
||||
return Status.UNSATISFIABLE;
|
||||
default:
|
||||
return Status.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The model of the last <code>Check</code>. <remarks> The result is
|
||||
* <code>null</code> if <code>Check</code> was not invoked before, if its
|
||||
* results was not <code>SATISFIABLE</code>, or if model production is not
|
||||
* enabled. </remarks>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Model Model() throws Z3Exception
|
||||
{
|
||||
long x = Native.solverGetModel(Context().nCtx(), NativeObject());
|
||||
if (x == 0)
|
||||
return null;
|
||||
else
|
||||
return new Model(Context(), x);
|
||||
}
|
||||
|
||||
/**
|
||||
* The proof of the last <code>Check</code>. <remarks> The result is
|
||||
* <code>null</code> if <code>Check</code> was not invoked before, if its
|
||||
* results was not <code>UNSATISFIABLE</code>, or if proof production is
|
||||
* disabled. </remarks>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr Proof() throws Z3Exception
|
||||
{
|
||||
long x = Native.solverGetProof(Context().nCtx(), NativeObject());
|
||||
if (x == 0)
|
||||
return null;
|
||||
else
|
||||
return Expr.Create(Context(), x);
|
||||
}
|
||||
|
||||
/**
|
||||
* The unsat core of the last <code>Check</code>. <remarks> The unsat core
|
||||
* is a subset of <code>Assertions</code> The result is empty if
|
||||
* <code>Check</code> was not invoked before, if its results was not
|
||||
* <code>UNSATISFIABLE</code>, or if core production is disabled. </remarks>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Expr[] UnsatCore() throws Z3Exception
|
||||
{
|
||||
|
||||
ASTVector core = new ASTVector(Context(), Native.solverGetUnsatCore(
|
||||
Context().nCtx(), NativeObject()));
|
||||
int n = core.Size();
|
||||
Expr[] res = new Expr[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Expr.Create(Context(), core.get(i).NativeObject());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A brief justification of why the last call to <code>Check</code> returned
|
||||
* <code>UNKNOWN</code>.
|
||||
**/
|
||||
public String ReasonUnknown()
|
||||
{
|
||||
|
||||
return Native.solverGetReasonUnknown(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Solver statistics.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Statistics Statistics() throws Z3Exception
|
||||
{
|
||||
return new Statistics(Context(), Native.solverGetStatistics(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the solver.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.solverToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
Solver(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Solver_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Solver_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/SolverDecRefQueue.java
Normal file
19
src/api/java/SolverDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class SolverDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.solverIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.solverDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
143
src/api/java/Sort.java
Normal file
143
src/api/java/Sort.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
/**
|
||||
* This file was automatically generated from Sort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* The Sort class implements type information for ASTs.
|
||||
**/
|
||||
public class Sort extends AST
|
||||
{
|
||||
/**
|
||||
* Comparison operator. <param name="a">A Sort</param> <param name="b">A
|
||||
* Sort</param>
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are from
|
||||
* the same context and represent the same sort; false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Comparison operator. <param name="a">A Sort</param> <param name="b">A
|
||||
* Sort</param>
|
||||
*
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are not
|
||||
* from the same context or represent different sorts; false
|
||||
* otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Equality operator for objects of type Sort. <param name="o"></param>
|
||||
*
|
||||
* @return
|
||||
**/
|
||||
public boolean Equals(Object o)
|
||||
{
|
||||
Sort casted = (Sort) o;
|
||||
if (casted == null)
|
||||
return false;
|
||||
return this == casted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash code generation for Sorts
|
||||
*
|
||||
* @return A hash code
|
||||
**/
|
||||
public int GetHashCode() throws Z3Exception
|
||||
{
|
||||
return super.GetHashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unique identifier for the sort.
|
||||
**/
|
||||
public int Id() throws Z3Exception
|
||||
{
|
||||
return Native.getSortId(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the sort.
|
||||
**/
|
||||
public Z3_sort_kind SortKind() throws Z3Exception
|
||||
{
|
||||
return Z3_sort_kind.fromInt(Native.getSortKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the sort
|
||||
**/
|
||||
public Symbol Name() throws Z3Exception
|
||||
{
|
||||
return Symbol.Create(Context(),
|
||||
Native.getSortName(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the sort.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.sortToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort constructor
|
||||
**/
|
||||
protected Sort(Context ctx) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Sort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST
|
||||
.toInt())
|
||||
throw new Z3Exception("Underlying object is not a sort");
|
||||
super.CheckNativeObject(obj);
|
||||
}
|
||||
|
||||
static Sort Create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
case Z3_ARRAY_SORT:
|
||||
return new ArraySort(ctx, obj);
|
||||
case Z3_BOOL_SORT:
|
||||
return new BoolSort(ctx, obj);
|
||||
case Z3_BV_SORT:
|
||||
return new BitVecSort(ctx, obj);
|
||||
case Z3_DATATYPE_SORT:
|
||||
return new DatatypeSort(ctx, obj);
|
||||
case Z3_INT_SORT:
|
||||
return new IntSort(ctx, obj);
|
||||
case Z3_REAL_SORT:
|
||||
return new RealSort(ctx, obj);
|
||||
case Z3_UNINTERPRETED_SORT:
|
||||
return new UninterpretedSort(ctx, obj);
|
||||
case Z3_FINITE_DOMAIN_SORT:
|
||||
return new FiniteDomainSort(ctx, obj);
|
||||
case Z3_RELATION_SORT:
|
||||
return new RelationSort(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown sort kind");
|
||||
}
|
||||
}
|
||||
}
|
190
src/api/java/Statistics.java
Normal file
190
src/api/java/Statistics.java
Normal file
|
@ -0,0 +1,190 @@
|
|||
/**
|
||||
* This file was automatically generated from Statistics.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Objects of this class track statistical information about solvers.
|
||||
**/
|
||||
public class Statistics extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Statistical data is organized into pairs of [Key, Entry], where every
|
||||
* Entry is either a <code>DoubleEntry</code> or a <code>UIntEntry</code>
|
||||
**/
|
||||
public class Entry
|
||||
{
|
||||
/**
|
||||
* The key of the entry.
|
||||
**/
|
||||
public String Key;
|
||||
|
||||
/**
|
||||
* The uint-value of the entry.
|
||||
**/
|
||||
public int UIntValue()
|
||||
{
|
||||
return m_int;
|
||||
}
|
||||
|
||||
/**
|
||||
* The double-value of the entry.
|
||||
**/
|
||||
public double DoubleValue()
|
||||
{
|
||||
return m_double;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the entry is uint-valued.
|
||||
**/
|
||||
public boolean IsUInt()
|
||||
{
|
||||
return m_is_int;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the entry is double-valued.
|
||||
**/
|
||||
public boolean IsDouble()
|
||||
{
|
||||
return m_is_double;
|
||||
}
|
||||
|
||||
/**
|
||||
* The string representation of the the entry's value.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public String Value() throws Z3Exception
|
||||
{
|
||||
if (IsUInt())
|
||||
return Integer.toString(m_int);
|
||||
else if (IsDouble())
|
||||
return Double.toString(m_double);
|
||||
else
|
||||
throw new Z3Exception("Unknown statistical entry type");
|
||||
}
|
||||
|
||||
/**
|
||||
* The string representation of the Entry.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Key + ": " + Value();
|
||||
} catch (Z3Exception e)
|
||||
{
|
||||
return new String("Z3Exception: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean m_is_int = false;
|
||||
private boolean m_is_double = false;
|
||||
private int m_int = 0;
|
||||
private double m_double = 0.0;
|
||||
|
||||
Entry(String k, int v)
|
||||
{
|
||||
Key = k;
|
||||
m_is_int = true;
|
||||
m_int = v;
|
||||
}
|
||||
|
||||
Entry(String k, double v)
|
||||
{
|
||||
Key = k;
|
||||
m_is_double = true;
|
||||
m_double = v;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the statistical data.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.statsToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of statistical data.
|
||||
**/
|
||||
public int Size()
|
||||
{
|
||||
return Native.statsSize(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The data entries.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Entry[] Entries() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = Size();
|
||||
Entry[] res = new Entry[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
Entry e;
|
||||
String k = Native.statsGetKey(Context().nCtx(), NativeObject(), i);
|
||||
if (Native.statsIsUint(Context().nCtx(), NativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetUintValue(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
else if (Native.statsIsDouble(Context().nCtx(), NativeObject(), i))
|
||||
e = new Entry(k, Native.statsGetDoubleValue(Context().nCtx(),
|
||||
NativeObject(), i));
|
||||
else
|
||||
throw new Z3Exception("Unknown data entry value");
|
||||
res[i] = e;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The statistical counters.
|
||||
**/
|
||||
public String[] Keys()
|
||||
{
|
||||
int n = Size();
|
||||
String[] res = new String[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = Native.statsGetKey(Context().nCtx(), NativeObject(), i);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of a particular statistical counter. <remarks>Returns null if
|
||||
* the key is unknown.</remarks>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Entry get(String key) throws Z3Exception
|
||||
{
|
||||
int n = Size();
|
||||
Entry[] es = Entries();
|
||||
for (int i = 0; i < n; i++)
|
||||
if (es[i].Key == key)
|
||||
return es[i];
|
||||
return null;
|
||||
}
|
||||
|
||||
Statistics(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Statistics_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Statistics_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/StatisticsDecRefQueue.java
Normal file
19
src/api/java/StatisticsDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class StatisticsDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.statsIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.statsDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
42
src/api/java/Status.java
Normal file
42
src/api/java/Status.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* This file was automatically generated from Status.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Status values.
|
||||
**/
|
||||
public enum Status
|
||||
{
|
||||
// / Used to signify an unsatisfiable status.
|
||||
UNSATISFIABLE(1),
|
||||
|
||||
// / Used to signify an unknown status.
|
||||
UNKNOWN(0),
|
||||
|
||||
// / Used to signify a satisfiable status.
|
||||
SATISFIABLE(1);
|
||||
|
||||
private final int intValue;
|
||||
|
||||
Status(int v)
|
||||
{
|
||||
this.intValue = v;
|
||||
}
|
||||
|
||||
public static final Status fromInt(int v)
|
||||
{
|
||||
for (Status k : values())
|
||||
if (k.intValue == v)
|
||||
return k;
|
||||
return values()[0];
|
||||
}
|
||||
|
||||
public final int toInt()
|
||||
{
|
||||
return this.intValue;
|
||||
}
|
||||
}
|
43
src/api/java/StringSymbol.java
Normal file
43
src/api/java/StringSymbol.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* This file was automatically generated from StringSymbol.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Named symbols
|
||||
**/
|
||||
public class StringSymbol extends Symbol
|
||||
{
|
||||
/**
|
||||
* The string value of the symbol. <remarks>Throws an exception if the
|
||||
* symbol is not of string kind.</remarks>
|
||||
**/
|
||||
public String String() throws Z3Exception
|
||||
{
|
||||
return Native.getSymbolString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
StringSymbol(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
StringSymbol(Context ctx, String s) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkStringSymbol(ctx.nCtx(), s));
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL
|
||||
.toInt())
|
||||
throw new Z3Exception("Symbol is not of String kind");
|
||||
|
||||
super.CheckNativeObject(obj);
|
||||
}
|
||||
}
|
81
src/api/java/Symbol.java
Normal file
81
src/api/java/Symbol.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* This file was automatically generated from Symbol.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/**
|
||||
* Symbols are used to name several term and type constructors.
|
||||
**/
|
||||
public class Symbol extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The kind of the symbol (int or string)
|
||||
**/
|
||||
protected Z3_symbol_kind Kind()
|
||||
{
|
||||
return Z3_symbol_kind.fromInt(Native.getSymbolKind(Context().nCtx(),
|
||||
NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the symbol is of Int kind
|
||||
**/
|
||||
public boolean IsIntSymbol()
|
||||
{
|
||||
return Kind() == Z3_symbol_kind.Z3_INT_SYMBOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the symbol is of string kind.
|
||||
**/
|
||||
public boolean IsStringSymbol()
|
||||
{
|
||||
return Kind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the symbol.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (IsIntSymbol())
|
||||
return Integer.toString(((IntSymbol) this).Int());
|
||||
else if (IsStringSymbol())
|
||||
return ((StringSymbol) this).String();
|
||||
else
|
||||
return new String(
|
||||
"Z3Exception: Unknown symbol kind encountered.");
|
||||
} catch (Z3Exception ex)
|
||||
{
|
||||
return new String("Z3Exception: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Symbol constructor
|
||||
**/
|
||||
protected Symbol(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
static Symbol Create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
case Z3_INT_SYMBOL:
|
||||
return new IntSymbol(ctx, obj);
|
||||
case Z3_STRING_SYMBOL:
|
||||
return new StringSymbol(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown symbol kind encountered");
|
||||
}
|
||||
}
|
||||
}
|
98
src/api/java/Tactic.java
Normal file
98
src/api/java/Tactic.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
* This file was automatically generated from Tactic.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Tactics are the basic building block for creating custom solvers for specific
|
||||
* problem domains. The complete list of tactics may be obtained using
|
||||
* <code>Context.NumTactics</code> and <code>Context.TacticNames</code>. It may
|
||||
* also be obtained using the command <code>(help-tactics)</code> in the SMT 2.0
|
||||
* front-end.
|
||||
**/
|
||||
public class Tactic extends Z3Object
|
||||
{
|
||||
/**
|
||||
* A string containing a description of parameters accepted by the tactic.
|
||||
**/
|
||||
public String Help()
|
||||
{
|
||||
return Native.tacticGetHelp(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves parameter descriptions for Tactics.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ParamDescrs ParameterDescriptions() throws Z3Exception
|
||||
{
|
||||
return new ParamDescrs(Context(), Native.tacticGetParamDescrs(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the tactic over the goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ApplyResult Apply(Goal g, Params p) throws Z3Exception
|
||||
{
|
||||
|
||||
Context().CheckContextMatch(g);
|
||||
if (p == null)
|
||||
return new ApplyResult(Context(), Native.tacticApply(Context()
|
||||
.nCtx(), NativeObject(), g.NativeObject()));
|
||||
else
|
||||
{
|
||||
Context().CheckContextMatch(p);
|
||||
return new ApplyResult(Context(),
|
||||
Native.tacticApplyEx(Context().nCtx(), NativeObject(),
|
||||
g.NativeObject(), p.NativeObject()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the tactic to a goal.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public ApplyResult get(Goal g) throws Z3Exception
|
||||
{
|
||||
|
||||
return Apply(g, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a solver that is implemented using the given tactic. <seealso
|
||||
* cref="Context.MkSolver(Tactic)"/>
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public Solver Solver() throws Z3Exception
|
||||
{
|
||||
|
||||
return Context().MkSolver(this);
|
||||
}
|
||||
|
||||
Tactic(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
Tactic(Context ctx, String name) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkTactic(ctx.nCtx(), name));
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Tactic_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
Context().Tactic_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
19
src/api/java/TacticDecRefQueue.java
Normal file
19
src/api/java/TacticDecRefQueue.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) 2012 Microsoft Corporation
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
class TacticDecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.tacticIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.tacticDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
58
src/api/java/TupleSort.java
Normal file
58
src/api/java/TupleSort.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* This file was automatically generated from TupleSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Tuple sorts.
|
||||
**/
|
||||
public class TupleSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The constructor function of the tuple.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl MkDecl() throws Z3Exception
|
||||
{
|
||||
|
||||
return new FuncDecl(Context(), Native.getTupleSortMkDecl(Context()
|
||||
.nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of fields in the tuple.
|
||||
**/
|
||||
public int NumFields()
|
||||
{
|
||||
return Native.getTupleSortNumFields(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The field declarations.
|
||||
* @throws Z3Exception
|
||||
**/
|
||||
public FuncDecl[] FieldDecls() throws Z3Exception
|
||||
{
|
||||
|
||||
int n = NumFields();
|
||||
FuncDecl[] res = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new FuncDecl(Context(), Native.getTupleSortFieldDecl(
|
||||
Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
TupleSort(Context ctx, Symbol name, int numFields, Symbol[] fieldNames,
|
||||
Sort[] fieldSorts) throws Z3Exception
|
||||
{
|
||||
super(ctx);
|
||||
|
||||
Native.LongPtr t = new Native.LongPtr();
|
||||
setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.NativeObject(),
|
||||
numFields, Symbol.ArrayToNative(fieldNames),
|
||||
AST.ArrayToNative(fieldSorts), t, new long[numFields]));
|
||||
}
|
||||
};
|
23
src/api/java/UninterpretedSort.java
Normal file
23
src/api/java/UninterpretedSort.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* This file was automatically generated from UninterpretedSort.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Uninterpreted Sorts
|
||||
**/
|
||||
public class UninterpretedSort extends Sort
|
||||
{
|
||||
UninterpretedSort(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
super(ctx, obj);
|
||||
}
|
||||
|
||||
UninterpretedSort(Context ctx, Symbol s) throws Z3Exception
|
||||
{
|
||||
super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.NativeObject()));
|
||||
}
|
||||
}
|
68
src/api/java/Version.java
Normal file
68
src/api/java/Version.java
Normal file
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* This file was automatically generated from Version.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Version information. <remarks>Note that this class is static.</remarks>
|
||||
**/
|
||||
public final class Version
|
||||
{
|
||||
Version()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The major version
|
||||
**/
|
||||
public int Major()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
return major.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minor version
|
||||
**/
|
||||
public int Minor()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
return minor.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The build version
|
||||
**/
|
||||
public int Build()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
return build.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The revision
|
||||
**/
|
||||
public int Revision()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
return revision.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the version information.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr();
|
||||
Native.getVersion(major, minor, build, revision);
|
||||
return Integer.toString(major.value) + "." + Integer.toString(minor.value) + "."
|
||||
+ Integer.toString(build.value) + "." + Integer.toString(revision.value);
|
||||
}
|
||||
}
|
40
src/api/java/Z3Exception.java
Normal file
40
src/api/java/Z3Exception.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* This file was automatically generated from Z3Exception.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
/**
|
||||
* The exception base class for error reporting from Z3
|
||||
**/
|
||||
@SuppressWarnings("serial")
|
||||
public class Z3Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
**/
|
||||
public Z3Exception()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
**/
|
||||
public Z3Exception(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
**/
|
||||
public Z3Exception(String message, Exception inner)
|
||||
{
|
||||
super(message, inner);
|
||||
}
|
||||
}
|
116
src/api/java/Z3Object.java
Normal file
116
src/api/java/Z3Object.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* This file was automatically generated from Z3Object.cs
|
||||
* w/ further modifications by:
|
||||
* @author Christoph M. Wintersteiger (cwinter)
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
/**
|
||||
* Internal base class for interfacing with native Z3 objects. Should not be
|
||||
* used externally.
|
||||
**/
|
||||
public class Z3Object extends IDisposable
|
||||
{
|
||||
/**
|
||||
* Finalizer.
|
||||
**/
|
||||
protected void finalize() throws Z3Exception
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposes of the underlying native Z3 object.
|
||||
**/
|
||||
public void Dispose() throws Z3Exception
|
||||
{
|
||||
if (m_n_obj != 0)
|
||||
{
|
||||
DecRef(m_n_obj);
|
||||
m_n_obj = 0;
|
||||
}
|
||||
|
||||
if (m_ctx != null)
|
||||
{
|
||||
m_ctx.m_refCount--;
|
||||
m_ctx = null;
|
||||
}
|
||||
}
|
||||
|
||||
private Context m_ctx = null;
|
||||
private long m_n_obj = 0;
|
||||
|
||||
Z3Object(Context ctx)
|
||||
{
|
||||
ctx.m_refCount++;
|
||||
m_ctx = ctx;
|
||||
}
|
||||
|
||||
Z3Object(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
ctx.m_refCount++;
|
||||
m_ctx = ctx;
|
||||
IncRef(obj);
|
||||
m_n_obj = obj;
|
||||
}
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
void CheckNativeObject(long obj) throws Z3Exception
|
||||
{
|
||||
}
|
||||
|
||||
long NativeObject()
|
||||
{
|
||||
return m_n_obj;
|
||||
}
|
||||
|
||||
void setNativeObject(long value) throws Z3Exception
|
||||
{
|
||||
if (value != 0)
|
||||
{
|
||||
CheckNativeObject(value);
|
||||
IncRef(value);
|
||||
}
|
||||
if (m_n_obj != 0)
|
||||
{
|
||||
DecRef(m_n_obj);
|
||||
}
|
||||
m_n_obj = value;
|
||||
}
|
||||
|
||||
static long GetNativeObject(Z3Object s)
|
||||
{
|
||||
if (s == null)
|
||||
return 0;
|
||||
return s.NativeObject();
|
||||
}
|
||||
|
||||
Context Context()
|
||||
{
|
||||
return m_ctx;
|
||||
}
|
||||
|
||||
static long[] ArrayToNative(Z3Object[] a)
|
||||
{
|
||||
if (a == null)
|
||||
return null;
|
||||
long[] an = new long[a.length];
|
||||
for (int i = 0; i < a.length; i++)
|
||||
if (a[i] != null)
|
||||
an[i] = a[i].NativeObject();
|
||||
return an;
|
||||
}
|
||||
|
||||
static int ArrayLength(Z3Object[] a)
|
||||
{
|
||||
return (a == null) ? 0 : (int) a.length;
|
||||
}
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from AST.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
/* using System.Collections; */
|
||||
/* using System.Collections.Generic; */
|
||||
|
||||
/**
|
||||
* The abstract syntax tree (AST) class.
|
||||
**/
|
||||
public class AST extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Comparison operator.
|
||||
* <param name="a">An AST</param>
|
||||
* <param name="b">An AST</param>
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are from the same context
|
||||
* and represent the same sort; false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Comparison operator.
|
||||
* <param name="a">An AST</param>
|
||||
* <param name="b">An AST</param>
|
||||
* @return True if <paramref name="a"/> and <paramref name="b"/> are not from the same context
|
||||
* or represent different sorts; false otherwise.
|
||||
**/
|
||||
/* Overloaded operators are not translated. */
|
||||
|
||||
/**
|
||||
* Object comparison.
|
||||
**/
|
||||
public boolean Equals(Object o)
|
||||
{
|
||||
AST casted = (AST) o;
|
||||
if (casted == null) return false;
|
||||
return this == casted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object Comparison.
|
||||
* <param name="other">Another AST</param>
|
||||
* @return Negative if the object should be sorted before <paramref name="other"/>, positive if after else zero.
|
||||
**/
|
||||
public int CompareTo(Object other)
|
||||
{
|
||||
if (other == null) return 1;
|
||||
AST oAST = (AST) other;
|
||||
if (oAST == null)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
if (Id() < oAST.Id())
|
||||
return -1;
|
||||
else if (Id() > oAST.Id())
|
||||
return +1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The AST's hash code.
|
||||
* @return A hash code
|
||||
**/
|
||||
public int GetHashCode()
|
||||
{
|
||||
return (int)Native.getAstHash(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A unique identifier for the AST (unique among all ASTs).
|
||||
**/
|
||||
public int Id() { return Native.getAstId(Context().nCtx(), NativeObject()); }
|
||||
|
||||
/**
|
||||
* Translates (copies) the AST to the Context <paramref name="ctx"/>.
|
||||
* <param name="ctx">A context</param>
|
||||
* @return A copy of the AST which is associated with <paramref name="ctx"/>
|
||||
**/
|
||||
public AST Translate(Context ctx) throws Z3Exception
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (Context() == ctx)
|
||||
return this;
|
||||
else
|
||||
return new AST(ctx, Native.translate(Context().nCtx(), NativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The kind of the AST.
|
||||
**/
|
||||
public Z3_ast_kind ASTKind() { return Z3_ast_kind.fromInt(Native.getAstKind(Context().nCtx(), NativeObject())); }
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is an Expr
|
||||
**/
|
||||
public boolean IsExpr()
|
||||
{
|
||||
switch (ASTKind())
|
||||
{
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
case Z3_QUANTIFIER_AST:
|
||||
case Z3_VAR_AST: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a BoundVariable
|
||||
**/
|
||||
public boolean IsVar() { return this.ASTKind() == Z3_ast_kind.Z3_VAR_AST; }
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Quantifier
|
||||
**/
|
||||
public boolean IsQuantifier() { return this.ASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST; }
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a Sort
|
||||
**/
|
||||
public boolean IsSort() { return this.ASTKind() == Z3_ast_kind.Z3_SORT_AST; }
|
||||
|
||||
/**
|
||||
* Indicates whether the AST is a FunctionDeclaration
|
||||
**/
|
||||
public boolean IsFuncDecl() { return this.ASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST; }
|
||||
|
||||
/**
|
||||
* A string representation of the AST.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the AST in s-expression notation.
|
||||
**/
|
||||
public String SExpr()
|
||||
{
|
||||
|
||||
|
||||
return Native.astToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
AST(Context ctx) { super(ctx); { }}
|
||||
AST(Context ctx, long obj) throws Z3Exception { super(ctx, obj); { }}
|
||||
|
||||
class DecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.incRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.decRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
||||
|
||||
void IncRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST IncRef()");
|
||||
if (Context() == null)
|
||||
throw new Z3Exception("inc() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("inc() called on null AST");
|
||||
Context().AST_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o) throws Z3Exception
|
||||
{
|
||||
// Console.WriteLine("AST DecRef()");
|
||||
if (Context() == null)
|
||||
throw new Z3Exception("dec() called on null context");
|
||||
if (o == 0)
|
||||
throw new Z3Exception("dec() called on null AST");
|
||||
Context().AST_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
|
||||
static AST Create(Context ctx, long obj) throws Z3Exception
|
||||
{
|
||||
|
||||
|
||||
|
||||
switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)))
|
||||
{
|
||||
case Z3_FUNC_DECL_AST: return new FuncDecl(ctx, obj);
|
||||
case Z3_QUANTIFIER_AST: return new Quantifier(ctx, obj);
|
||||
case Z3_SORT_AST: return Sort.Create(ctx, obj);
|
||||
case Z3_APP_AST:
|
||||
case Z3_NUMERAL_AST:
|
||||
case Z3_VAR_AST: return Expr.Create(ctx, obj);
|
||||
default:
|
||||
throw new Z3Exception("Unknown AST kind");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ASTMap.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* Map from AST to AST
|
||||
**/
|
||||
class ASTMap extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Checks whether the map contains the key <paramref name="k"/>.
|
||||
* <param name="k">An AST</param>
|
||||
* @return True if <paramref name="k"/> is a key in the map, false otherwise.
|
||||
**/
|
||||
public boolean Contains(AST k)
|
||||
{
|
||||
|
||||
|
||||
return Native.astMapContains(Context().nCtx(), NativeObject(), k.NativeObject()) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the value associated with the key <paramref name="k"/>.
|
||||
* <remarks>
|
||||
* This function signs an error when <paramref name="k"/> is not a key in the map.
|
||||
* </remarks>
|
||||
* <param name="k">An AST</param>
|
||||
**/
|
||||
public AST Find(AST k)
|
||||
{
|
||||
|
||||
|
||||
|
||||
return new AST(Context(), Native.astMapFind(Context().nCtx(), NativeObject(), k.NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores or replaces a new key/value pair in the map.
|
||||
* <param name="k">The key AST</param>
|
||||
* <param name="v">The value AST</param>
|
||||
**/
|
||||
public void Insert(AST k, AST v)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(), v.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Erases the key <paramref name="k"/> from the map.
|
||||
* <param name="k">An AST</param>
|
||||
**/
|
||||
public void Erase(AST k)
|
||||
{
|
||||
|
||||
|
||||
Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all keys from the map.
|
||||
**/
|
||||
public void Reset()
|
||||
{
|
||||
Native.astMapReset(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* The size of the map
|
||||
**/
|
||||
public int Size() { return Native.astMapSize(Context().nCtx(), NativeObject()); }
|
||||
|
||||
/**
|
||||
* The keys stored in the map.
|
||||
**/
|
||||
public ASTVector Keys()
|
||||
{
|
||||
return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string representation of the map.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astMapToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ASTMap(Context ctx, long obj)
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
ASTMap(Context ctx)
|
||||
{ super(ctx, Native.mkAstMap(ctx.nCtx()));
|
||||
|
||||
}
|
||||
|
||||
class DecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astMapIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astMapDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
||||
|
||||
void IncRef(long o)
|
||||
{
|
||||
Context().ASTMap_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o)
|
||||
{
|
||||
Context().ASTMap_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ASTVector.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* Vectors of ASTs.
|
||||
**/
|
||||
class ASTVector extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The size of the vector
|
||||
**/
|
||||
public int Size() { return Native.astVectorSize(Context().nCtx(), NativeObject()); }
|
||||
|
||||
/**
|
||||
* Retrieves the i-th object in the vector.
|
||||
* <remarks>May throw an IndexOutOfBoundsException when <paramref name="i"/> is out of range.</remarks>
|
||||
* <param name="i">Index</param>
|
||||
* @return An AST
|
||||
**/
|
||||
public AST get(int i)
|
||||
{
|
||||
|
||||
|
||||
return new AST(Context(), Native.astVectorGet(Context().nCtx(), NativeObject(), i));
|
||||
}
|
||||
public void set(int i, AST value)
|
||||
{
|
||||
|
||||
|
||||
Native.astVectorSet(Context().nCtx(), NativeObject(), i, value.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the vector to <paramref name="newSize"/>.
|
||||
* <param name="newSize">The new size of the vector.</param>
|
||||
**/
|
||||
public void Resize(int newSize)
|
||||
{
|
||||
Native.astVectorResize(Context().nCtx(), NativeObject(), newSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the AST <paramref name="a"/> to the back of the vector. The size
|
||||
* is increased by 1.
|
||||
* <param name="a">An AST</param>
|
||||
**/
|
||||
public void Push(AST a)
|
||||
{
|
||||
|
||||
|
||||
Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates all ASTs in the vector to <paramref name="ctx"/>.
|
||||
* <param name="ctx">A context</param>
|
||||
* @return A new ASTVector
|
||||
**/
|
||||
public ASTVector Translate(Context ctx)
|
||||
{
|
||||
|
||||
|
||||
|
||||
return new ASTVector(Context(), Native.astVectorTranslate(Context().nCtx(), NativeObject(), ctx.nCtx()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a string representation of the vector.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.astVectorToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ASTVector(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
ASTVector(Context ctx) { super(ctx, Native.mkAstVector(ctx.nCtx())); { }}
|
||||
|
||||
class DecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astVectorIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.astVectorDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
||||
|
||||
void IncRef(long o)
|
||||
{
|
||||
Context().ASTVector_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o)
|
||||
{
|
||||
Context().ASTVector_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from AlgebraicNum.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
|
||||
/* using System.Numerics; */
|
||||
|
||||
/**
|
||||
* Algebraic numbers
|
||||
**/
|
||||
public class AlgebraicNum extends ArithExpr
|
||||
{
|
||||
/**
|
||||
* Return a upper bound for a given real algebraic number.
|
||||
* The interval isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||
* <seealso cref="Expr.IsAlgebraicNumber"/>
|
||||
* <param name="precision">the precision of the result</param>
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToUpper(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberUpper(Context().nCtx(), NativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a lower bound for the given real algebraic number.
|
||||
* The interval isolating the number is smaller than 1/10^<paramref name="precision"/>.
|
||||
* <seealso cref="Expr.IsAlgebraicNumber"/>
|
||||
* <param name="precision"></param>
|
||||
* @return A numeral Expr of sort Real
|
||||
**/
|
||||
public RatNum ToLower(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
|
||||
return new RatNum(Context(), Native.getAlgebraicNumberLower(Context().nCtx(), NativeObject(), precision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation in decimal notation.
|
||||
* <remarks>The result has at most <paramref name="precision"/> decimal places.</remarks>
|
||||
**/
|
||||
public String ToDecimal(int precision) throws Z3Exception
|
||||
{
|
||||
|
||||
|
||||
return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(), precision);
|
||||
}
|
||||
|
||||
AlgebraicNum(Context ctx, long obj) throws Z3Exception
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ApplyResult.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* ApplyResult objects represent the result of an application of a
|
||||
* tactic to a goal. It contains the subgoals that were produced.
|
||||
**/
|
||||
public class ApplyResult extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The number of Subgoals.
|
||||
**/
|
||||
public int NumSubgoals() { return Native.applyResultGetNumSubgoals(Context().nCtx(), NativeObject()); }
|
||||
|
||||
/**
|
||||
* Retrieves the subgoals from the ApplyResult.
|
||||
**/
|
||||
public Goal[] Subgoals()
|
||||
{
|
||||
|
||||
|
||||
|
||||
int n = NumSubgoals();
|
||||
Goal[] res = new Goal[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context().nCtx(), NativeObject(), i));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a model for the subgoal <paramref name="i"/> into a model for the original
|
||||
* goal <code>g</code>, that the ApplyResult was obtained from.
|
||||
* @return A model for <code>g</code>
|
||||
**/
|
||||
public Model ConvertModel(int i, Model m)
|
||||
{
|
||||
|
||||
|
||||
|
||||
return new Model(Context(), Native.applyResultConvertModel(Context().nCtx(), NativeObject(), i, m.NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the ApplyResult.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.applyResultToString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ApplyResult(Context ctx, long obj)
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
|
||||
class DecRefQueue extends IDecRefQueue
|
||||
{
|
||||
public void IncRef(Context ctx, long obj)
|
||||
{
|
||||
Native.applyResultIncRef(ctx.nCtx(), obj);
|
||||
}
|
||||
|
||||
public void DecRef(Context ctx, long obj)
|
||||
{
|
||||
Native.applyResultDecRef(ctx.nCtx(), obj);
|
||||
}
|
||||
};
|
||||
|
||||
void IncRef(long o)
|
||||
{
|
||||
Context().ApplyResult_DRQ().IncAndClear(Context(), o);
|
||||
super.IncRef(o);
|
||||
}
|
||||
|
||||
void DecRef(long o)
|
||||
{
|
||||
Context().ApplyResult_DRQ().Add(o);
|
||||
super.DecRef(o);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ArithExpr.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
/* using System.Collections.Generic; */
|
||||
/* using System.Linq; */
|
||||
/* using System.Text; */
|
||||
|
||||
|
||||
/**
|
||||
* Arithmetic expressions (int/real)
|
||||
**/
|
||||
public class ArithExpr extends Expr
|
||||
{
|
||||
/** Constructor for ArithExpr </summary>
|
||||
**/
|
||||
protected ArithExpr(Context ctx)
|
||||
{ super(ctx);
|
||||
|
||||
}
|
||||
ArithExpr(Context ctx, long obj) throws Z3Exception
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ArithSort.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* An arithmetic sort, i.e., Int or Real.
|
||||
**/
|
||||
public class ArithSort extends Sort
|
||||
{
|
||||
ArithSort(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ArrayExpr.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
/* using System.Collections.Generic; */
|
||||
/* using System.Linq; */
|
||||
/* using System.Text; */
|
||||
|
||||
|
||||
/**
|
||||
* Array expressions
|
||||
**/
|
||||
public class ArrayExpr extends Expr
|
||||
{
|
||||
/** Constructor for ArrayExpr </summary>
|
||||
**/
|
||||
protected ArrayExpr(Context ctx)
|
||||
{ super(ctx);
|
||||
|
||||
}
|
||||
ArrayExpr(Context ctx, long obj)
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ArraySort.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* Array sorts.
|
||||
**/
|
||||
public class ArraySort extends Sort
|
||||
{
|
||||
/**
|
||||
* The domain of the array sort.
|
||||
**/
|
||||
public Sort Domain()
|
||||
{
|
||||
|
||||
|
||||
return Sort.Create(Context(), Native.getArraySortDomain(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The range of the array sort.
|
||||
**/
|
||||
public Sort Range()
|
||||
{
|
||||
|
||||
|
||||
return Sort.Create(Context(), Native.getArraySortRange(Context().nCtx(), NativeObject()));
|
||||
}
|
||||
|
||||
ArraySort(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
ArraySort(Context ctx, Sort domain, Sort range)
|
||||
{ super(ctx, Native.mkArraySort(ctx.nCtx(), domain.NativeObject(), range.NativeObject()));
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecExpr.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
/* using System.Collections.Generic; */
|
||||
/* using System.Linq; */
|
||||
/* using System.Text; */
|
||||
|
||||
|
||||
/**
|
||||
* Bit-vector expressions
|
||||
**/
|
||||
public class BitVecExpr extends Expr
|
||||
{
|
||||
|
||||
/**
|
||||
* The size of the sort of a bit-vector term.
|
||||
**/
|
||||
public int SortSize() { return ((BitVecSort)Sort()).Size(); }
|
||||
|
||||
/** Constructor for BitVecExpr </summary>
|
||||
**/
|
||||
protected BitVecExpr(Context ctx) { super(ctx); { }}
|
||||
BitVecExpr(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecNum.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
|
||||
/* using System.Numerics; */
|
||||
|
||||
/**
|
||||
* Bit-vector numerals
|
||||
**/
|
||||
public class BitVecNum extends BitVecExpr
|
||||
{
|
||||
/**
|
||||
* Retrieve the 64-bit unsigned integer value.
|
||||
**/
|
||||
public long UInt64()
|
||||
{
|
||||
long res = 0;
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not a 64 bit unsigned");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the int value.
|
||||
**/
|
||||
public int Int()
|
||||
{
|
||||
int res = 0;
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the 64-bit int value.
|
||||
**/
|
||||
public long Int64()
|
||||
{
|
||||
long res = 0;
|
||||
if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not an int64");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the int value.
|
||||
**/
|
||||
public int UInt()
|
||||
{
|
||||
int res = 0;
|
||||
if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true)
|
||||
throw new Z3Exception("Numeral is not a int");
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the BigInteger value.
|
||||
**/
|
||||
public BigInteger BigInteger()
|
||||
{
|
||||
return new BigInteger(this.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the numeral.
|
||||
**/
|
||||
public String toString()
|
||||
{
|
||||
return Native.getNumeralString(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
BitVecNum(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from BitVecSort.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* Bit-vector sorts.
|
||||
**/
|
||||
public class BitVecSort extends Sort
|
||||
{
|
||||
/**
|
||||
* The size of the bit-vector sort.
|
||||
**/
|
||||
public int Size() { return Native.getBvSortSize(Context().nCtx(), NativeObject()); }
|
||||
|
||||
BitVecSort(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from BoolExpr.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
/* using System; */
|
||||
/* using System.Collections.Generic; */
|
||||
/* using System.Linq; */
|
||||
/* using System.Text; */
|
||||
|
||||
|
||||
/**
|
||||
* Boolean expressions
|
||||
**/
|
||||
public class BoolExpr extends Expr
|
||||
{
|
||||
/** Constructor for BoolExpr </summary>
|
||||
**/
|
||||
protected BoolExpr(Context ctx) { super(ctx); { }}
|
||||
/** Constructor for BoolExpr </summary>
|
||||
**/
|
||||
BoolExpr(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from BoolSort.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* A Boolean sort.
|
||||
**/
|
||||
public class BoolSort extends Sort
|
||||
{
|
||||
BoolSort(Context ctx, long obj) { super(ctx, obj); { }}
|
||||
BoolSort(Context ctx) { super(ctx, Native.mkBoolSort(ctx.nCtx())); { }}
|
||||
};
|
|
@ -1,121 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from Constructor.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
|
||||
/**
|
||||
* Constructors are used for datatype sorts.
|
||||
**/
|
||||
public class Constructor extends Z3Object
|
||||
{
|
||||
/**
|
||||
* The number of fields of the constructor.
|
||||
**/
|
||||
public int NumFields()
|
||||
{
|
||||
init();
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declaration of the constructor.
|
||||
**/
|
||||
public FuncDecl ConstructorDecl()
|
||||
{
|
||||
|
||||
init();
|
||||
return m_constructorDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declaration of the tester.
|
||||
**/
|
||||
public FuncDecl TesterDecl()
|
||||
{
|
||||
|
||||
init();
|
||||
return m_testerDecl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function declarations of the accessors
|
||||
**/
|
||||
public FuncDecl[] AccessorDecls()
|
||||
{
|
||||
|
||||
init();
|
||||
return m_accessorDecls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
protected void finalize()
|
||||
{
|
||||
Native.delConstructor(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
|
||||
private void ObjectInvariant()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int n = 0;
|
||||
private FuncDecl m_testerDecl = null;
|
||||
private FuncDecl m_constructorDecl = null;
|
||||
private FuncDecl[] m_accessorDecls = null;
|
||||
|
||||
Constructor(Context ctx, Symbol name, Symbol recognizer, Symbol[] fieldNames,
|
||||
Sort[] sorts, int[] sortRefs)
|
||||
{ super(ctx);
|
||||
|
||||
|
||||
|
||||
|
||||
n = AST.ArrayLength(fieldNames);
|
||||
|
||||
if (n != AST.ArrayLength(sorts))
|
||||
throw new Z3Exception("Number of field names does not match number of sorts");
|
||||
if (sortRefs != null && sortRefs.length != n)
|
||||
throw new Z3Exception("Number of field names does not match number of sort refs");
|
||||
|
||||
if (sortRefs == null) sortRefs = new int[n];
|
||||
|
||||
setNativeObject(Native.mkConstructor(ctx.nCtx(), name.NativeObject(), recognizer.NativeObject(),
|
||||
n,
|
||||
Symbol.ArrayToNative(fieldNames),
|
||||
Sort.ArrayToNative(sorts),
|
||||
sortRefs));
|
||||
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if (m_testerDecl != null) return;
|
||||
long constructor = 0;
|
||||
long tester = 0;
|
||||
long[] accessors = new long[n];
|
||||
Native.queryConstructor(Context().nCtx(), NativeObject(), n, constructor, tester, accessors);
|
||||
m_constructorDecl = new FuncDecl(Context(), constructor);
|
||||
m_testerDecl = new FuncDecl(Context(), tester);
|
||||
m_accessorDecls = new FuncDecl[n];
|
||||
for (int i = 0; i < n; i++)
|
||||
m_accessorDecls[i] = new FuncDecl(Context(), accessors[i]);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated from ConstructorList.cs
|
||||
**/
|
||||
|
||||
package com.Microsoft.Z3;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.lang.Exception;
|
||||
import com.Microsoft.Z3.Enumerations.*;
|
||||
|
||||
/* using System; */
|
||||
/* using System.Collections.Generic; */
|
||||
/* using System.Linq; */
|
||||
/* using System.Text; */
|
||||
|
||||
|
||||
/**
|
||||
* Lists of constructors
|
||||
**/
|
||||
public class ConstructorList extends Z3Object
|
||||
{
|
||||
/**
|
||||
* Destructor.
|
||||
**/
|
||||
protected void finalize()
|
||||
{
|
||||
Native.delConstructorList(Context().nCtx(), NativeObject());
|
||||
}
|
||||
|
||||
ConstructorList(Context ctx, long obj)
|
||||
{ super(ctx, obj);
|
||||
|
||||
}
|
||||
|
||||
ConstructorList(Context ctx, Constructor[] constructors)
|
||||
{ super(ctx);
|
||||
|
||||
|
||||
|
||||
setNativeObject(Native.mkConstructorList(Context().nCtx(), (int)constructors.length, Constructor.ArrayToNative(constructors)));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue