3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-25 18:15:32 +00:00

add cube mode

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-09-24 10:53:57 -07:00
commit ae9a6664d4
144 changed files with 6012 additions and 3174 deletions

View file

@ -131,7 +131,7 @@ public class ASTVector extends Z3Object {
Expr[] res = new Expr[n];
for (int i = 0; i < n; i++)
res[i] = Expr.create(getContext(), get(i).getNativeObject());
return res;
return res;
}
/**

View file

@ -22,57 +22,57 @@ package com.microsoft.z3;
**/
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^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision the precision of the result
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toUpper(int precision)
{
/**
* Return a upper bound for a given real algebraic number. The interval
* isolating the number is smaller than 1/10^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision the precision of the result
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toUpper(int precision)
{
return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
.nCtx(), getNativeObject(), precision));
}
return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext()
.nCtx(), getNativeObject(), precision));
}
/**
* Return a lower bound for the given real algebraic number. The interval
* isolating the number is smaller than 1/10^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision precision
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toLower(int precision)
{
/**
* Return a lower bound for the given real algebraic number. The interval
* isolating the number is smaller than 1/10^{@code precision}.
*
* @see Expr#isAlgebraicNumber
* @param precision precision
*
* @return A numeral Expr of sort Real
* @throws Z3Exception on error
**/
public RatNum toLower(int precision)
{
return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
.nCtx(), getNativeObject(), precision));
}
return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext()
.nCtx(), getNativeObject(), precision));
}
/**
* Returns a string representation in decimal notation.
* Remarks: The result has at most {@code precision} decimal places.
* @param precision precision
* @return String
* @throws Z3Exception on error
**/
public String toDecimal(int precision)
{
/**
* Returns a string representation in decimal notation.
* Remarks: The result has at most {@code precision} decimal places.
* @param precision precision
* @return String
* @throws Z3Exception on error
**/
public String toDecimal(int precision)
{
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
precision);
}
return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(),
precision);
}
AlgebraicNum(Context ctx, long obj)
{
super(ctx, obj);
AlgebraicNum(Context ctx, long obj)
{
super(ctx, obj);
}
}
}

View file

@ -1898,8 +1898,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkEmptySeq(Sort s)
{
checkContextMatch(s);
return (SeqExpr) Expr.create(this, Native.mkSeqEmpty(nCtx(), s.getNativeObject()));
checkContextMatch(s);
return (SeqExpr) Expr.create(this, Native.mkSeqEmpty(nCtx(), s.getNativeObject()));
}
/**
@ -1907,8 +1907,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkUnit(Expr elem)
{
checkContextMatch(elem);
return (SeqExpr) Expr.create(this, Native.mkSeqUnit(nCtx(), elem.getNativeObject()));
checkContextMatch(elem);
return (SeqExpr) Expr.create(this, Native.mkSeqUnit(nCtx(), elem.getNativeObject()));
}
/**
@ -1916,7 +1916,7 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkString(String s)
{
return (SeqExpr) Expr.create(this, Native.mkString(nCtx(), s));
return (SeqExpr) Expr.create(this, Native.mkString(nCtx(), s));
}
/**
@ -1924,8 +1924,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkConcat(SeqExpr... t)
{
checkContextMatch(t);
return (SeqExpr) Expr.create(this, Native.mkSeqConcat(nCtx(), t.length, AST.arrayToNative(t)));
checkContextMatch(t);
return (SeqExpr) Expr.create(this, Native.mkSeqConcat(nCtx(), t.length, AST.arrayToNative(t)));
}
@ -1934,8 +1934,8 @@ public class Context implements AutoCloseable {
*/
public IntExpr mkLength(SeqExpr s)
{
checkContextMatch(s);
return (IntExpr) Expr.create(this, Native.mkSeqLength(nCtx(), s.getNativeObject()));
checkContextMatch(s);
return (IntExpr) Expr.create(this, Native.mkSeqLength(nCtx(), s.getNativeObject()));
}
/**
@ -1943,8 +1943,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkPrefixOf(SeqExpr s1, SeqExpr s2)
{
checkContextMatch(s1, s2);
return (BoolExpr) Expr.create(this, Native.mkSeqPrefix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
checkContextMatch(s1, s2);
return (BoolExpr) Expr.create(this, Native.mkSeqPrefix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
}
/**
@ -1952,8 +1952,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkSuffixOf(SeqExpr s1, SeqExpr s2)
{
checkContextMatch(s1, s2);
return (BoolExpr)Expr.create(this, Native.mkSeqSuffix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
checkContextMatch(s1, s2);
return (BoolExpr)Expr.create(this, Native.mkSeqSuffix(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
}
/**
@ -1961,8 +1961,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkContains(SeqExpr s1, SeqExpr s2)
{
checkContextMatch(s1, s2);
return (BoolExpr) Expr.create(this, Native.mkSeqContains(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
checkContextMatch(s1, s2);
return (BoolExpr) Expr.create(this, Native.mkSeqContains(nCtx(), s1.getNativeObject(), s2.getNativeObject()));
}
/**
@ -1970,8 +1970,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkAt(SeqExpr s, IntExpr index)
{
checkContextMatch(s, index);
return (SeqExpr) Expr.create(this, Native.mkSeqAt(nCtx(), s.getNativeObject(), index.getNativeObject()));
checkContextMatch(s, index);
return (SeqExpr) Expr.create(this, Native.mkSeqAt(nCtx(), s.getNativeObject(), index.getNativeObject()));
}
/**
@ -1979,8 +1979,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkExtract(SeqExpr s, IntExpr offset, IntExpr length)
{
checkContextMatch(s, offset, length);
return (SeqExpr) Expr.create(this, Native.mkSeqExtract(nCtx(), s.getNativeObject(), offset.getNativeObject(), length.getNativeObject()));
checkContextMatch(s, offset, length);
return (SeqExpr) Expr.create(this, Native.mkSeqExtract(nCtx(), s.getNativeObject(), offset.getNativeObject(), length.getNativeObject()));
}
/**
@ -1988,8 +1988,8 @@ public class Context implements AutoCloseable {
*/
public IntExpr mkIndexOf(SeqExpr s, SeqExpr substr, ArithExpr offset)
{
checkContextMatch(s, substr, offset);
return (IntExpr)Expr.create(this, Native.mkSeqIndex(nCtx(), s.getNativeObject(), substr.getNativeObject(), offset.getNativeObject()));
checkContextMatch(s, substr, offset);
return (IntExpr)Expr.create(this, Native.mkSeqIndex(nCtx(), s.getNativeObject(), substr.getNativeObject(), offset.getNativeObject()));
}
/**
@ -1997,8 +1997,8 @@ public class Context implements AutoCloseable {
*/
public SeqExpr mkReplace(SeqExpr s, SeqExpr src, SeqExpr dst)
{
checkContextMatch(s, src, dst);
return (SeqExpr) Expr.create(this, Native.mkSeqReplace(nCtx(), s.getNativeObject(), src.getNativeObject(), dst.getNativeObject()));
checkContextMatch(s, src, dst);
return (SeqExpr) Expr.create(this, Native.mkSeqReplace(nCtx(), s.getNativeObject(), src.getNativeObject(), dst.getNativeObject()));
}
/**
@ -2006,8 +2006,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkToRe(SeqExpr s)
{
checkContextMatch(s);
return (ReExpr) Expr.create(this, Native.mkSeqToRe(nCtx(), s.getNativeObject()));
checkContextMatch(s);
return (ReExpr) Expr.create(this, Native.mkSeqToRe(nCtx(), s.getNativeObject()));
}
@ -2016,8 +2016,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkInRe(SeqExpr s, ReExpr re)
{
checkContextMatch(s, re);
return (BoolExpr) Expr.create(this, Native.mkSeqInRe(nCtx(), s.getNativeObject(), re.getNativeObject()));
checkContextMatch(s, re);
return (BoolExpr) Expr.create(this, Native.mkSeqInRe(nCtx(), s.getNativeObject(), re.getNativeObject()));
}
/**
@ -2025,8 +2025,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkStar(ReExpr re)
{
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReStar(nCtx(), re.getNativeObject()));
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReStar(nCtx(), re.getNativeObject()));
}
/**
@ -2034,7 +2034,7 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkLoop(ReExpr re, int lo, int hi)
{
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, hi));
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, hi));
}
/**
@ -2042,7 +2042,7 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkLoop(ReExpr re, int lo)
{
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, 0));
return (ReExpr) Expr.create(this, Native.mkReLoop(nCtx(), re.getNativeObject(), lo, 0));
}
@ -2051,8 +2051,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkPlus(ReExpr re)
{
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkRePlus(nCtx(), re.getNativeObject()));
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkRePlus(nCtx(), re.getNativeObject()));
}
/**
@ -2060,8 +2060,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkOption(ReExpr re)
{
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReOption(nCtx(), re.getNativeObject()));
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReOption(nCtx(), re.getNativeObject()));
}
@ -2070,8 +2070,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkComplement(ReExpr re)
{
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReComplement(nCtx(), re.getNativeObject()));
checkContextMatch(re);
return (ReExpr) Expr.create(this, Native.mkReComplement(nCtx(), re.getNativeObject()));
}
/**
@ -2079,8 +2079,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkConcat(ReExpr... t)
{
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReConcat(nCtx(), t.length, AST.arrayToNative(t)));
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReConcat(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
@ -2088,8 +2088,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkUnion(ReExpr... t)
{
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReUnion(nCtx(), t.length, AST.arrayToNative(t)));
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReUnion(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
@ -2097,8 +2097,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr mkIntersect(ReExpr... t)
{
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReIntersect(nCtx(), t.length, AST.arrayToNative(t)));
checkContextMatch(t);
return (ReExpr) Expr.create(this, Native.mkReIntersect(nCtx(), t.length, AST.arrayToNative(t)));
}
/**
@ -2106,8 +2106,8 @@ public class Context implements AutoCloseable {
*/
public ReExpr MkRange(SeqExpr lo, SeqExpr hi)
{
checkContextMatch(lo, hi);
return (ReExpr) Expr.create(this, Native.mkReRange(nCtx(), lo.getNativeObject(), hi.getNativeObject()));
checkContextMatch(lo, hi);
return (ReExpr) Expr.create(this, Native.mkReRange(nCtx(), lo.getNativeObject(), hi.getNativeObject()));
}
@ -2116,8 +2116,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkAtMost(BoolExpr[] args, int k)
{
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkAtmost(nCtx(), args.length, AST.arrayToNative(args), k));
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkAtmost(nCtx(), args.length, AST.arrayToNative(args), k));
}
/**
@ -2125,8 +2125,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkAtLeast(BoolExpr[] args, int k)
{
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkAtleast(nCtx(), args.length, AST.arrayToNative(args), k));
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkAtleast(nCtx(), args.length, AST.arrayToNative(args), k));
}
/**
@ -2134,8 +2134,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkPBLe(int[] coeffs, BoolExpr[] args, int k)
{
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPble(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPble(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
}
/**
@ -2143,8 +2143,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkPBGe(int[] coeffs, BoolExpr[] args, int k)
{
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPbge(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPbge(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
}
/**
@ -2152,8 +2152,8 @@ public class Context implements AutoCloseable {
*/
public BoolExpr mkPBEq(int[] coeffs, BoolExpr[] args, int k)
{
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPbeq(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
checkContextMatch(args);
return (BoolExpr) Expr.create(this, Native.mkPbeq(nCtx(), args.length, AST.arrayToNative(args), coeffs, k));
}
@ -3990,15 +3990,15 @@ public class Context implements AutoCloseable {
void checkContextMatch(Z3Object other1, Z3Object other2)
{
checkContextMatch(other1);
checkContextMatch(other2);
checkContextMatch(other1);
checkContextMatch(other2);
}
void checkContextMatch(Z3Object other1, Z3Object other2, Z3Object other3)
{
checkContextMatch(other1);
checkContextMatch(other2);
checkContextMatch(other3);
checkContextMatch(other1);
checkContextMatch(other2);
checkContextMatch(other3);
}
void checkContextMatch(Z3Object[] arr)

View file

@ -65,7 +65,7 @@ public class EnumSort extends Sort
**/
public Expr getConst(int inx)
{
return getContext().mkApp(getConstDecl(inx));
return getContext().mkApp(getConstDecl(inx));
}
/**

View file

@ -1287,7 +1287,7 @@ public class Expr extends AST
*/
public String getString()
{
return Native.getString(getContext().nCtx(), getNativeObject());
return Native.getString(getContext().nCtx(), getNativeObject());
}
/**

View file

@ -200,7 +200,7 @@ public class Model extends Z3Object {
* Remarks: This function may fail if {@code t} contains
* quantifiers, is partial (MODEL_PARTIAL enabled), or if {@code t} is not well-sorted. In this case a
* {@code ModelEvaluationFailedException} is thrown.
* @param t the expression to evaluate
* @param t the expression to evaluate
* @param completion An expression {@code 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.

View file

@ -213,7 +213,7 @@ public class Optimize extends Z3Object {
* Declare an arithmetical maximization objective.
* Return a handle to the objective. The handle is used as
* to retrieve the values of objectives after calling Check.
**/
**/
public Handle MkMaximize(ArithExpr e)
{
return new Handle(this, Native.optimizeMaximize(getContext().nCtx(), getNativeObject(), e.getNativeObject()));
@ -285,8 +285,7 @@ public class Optimize extends Z3Object {
**/
public String getReasonUnknown()
{
return Native.optimizeGetReasonUnknown(getContext().nCtx(),
getNativeObject());
return Native.optimizeGetReasonUnknown(getContext().nCtx(), getNativeObject());
}
/**
@ -304,7 +303,7 @@ public class Optimize extends Z3Object {
*/
public void fromFile(String file)
{
Native.optimizeFromFile(getContext().nCtx(), getNativeObject(), file);
Native.optimizeFromFile(getContext().nCtx(), getNativeObject(), file);
}
/**
@ -312,7 +311,7 @@ public class Optimize extends Z3Object {
*/
public void fromString(String s)
{
Native.optimizeFromString(getContext().nCtx(), getNativeObject(), s);
Native.optimizeFromString(getContext().nCtx(), getNativeObject(), s);
}

View file

@ -49,7 +49,7 @@ public class ParamDescrs extends Z3Object {
public String getDocumentation(Symbol name)
{
return Native.paramDescrsGetDocumentation(getContext().nCtx(), getNativeObject(), name.getNativeObject());
return Native.paramDescrsGetDocumentation(getContext().nCtx(), getNativeObject(), name.getNativeObject());
}
/**

View file

@ -302,7 +302,7 @@ public class Solver extends Z3Object {
*/
public Solver translate(Context ctx)
{
return new Solver(ctx, Native.solverTranslate(getContext().nCtx(), getNativeObject(), ctx.nCtx()));
return new Solver(ctx, Native.solverTranslate(getContext().nCtx(), getNativeObject(), ctx.nCtx()));
}
/**

View file

@ -35,12 +35,8 @@ public class Sort extends AST
if (!(o instanceof Sort)) return false;
Sort other = (Sort) o;
return (getContext().nCtx() == other.getContext().nCtx()) &&
(Native.isEqSort(
getContext().nCtx(),
getNativeObject(),
other.getNativeObject()
));
return (getContext().nCtx() == other.getContext().nCtx()) &&
(Native.isEqSort(getContext().nCtx(), getNativeObject(), other.getNativeObject()));
}
/**