From 4b18c8f9c4c472ebd176e6535ca86e31b33d7304 Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Thu, 17 Jan 2013 19:31:02 +0000 Subject: [PATCH] Java API: syntactic adjustments, getters, setters, ... convenience parameters, etc. Signed-off-by: Christoph M. Wintersteiger --- examples/java/JavaExample.java | 1623 +++++++++--------- src/api/java/AST.java | 87 +- src/api/java/ASTDecRefQueue.java | 6 +- src/api/java/ASTMap.java | 50 +- src/api/java/ASTVector.java | 40 +- src/api/java/AlgebraicNum.java | 16 +- src/api/java/ApplyResult.java | 34 +- src/api/java/ApplyResultDecRefQueue.java | 4 +- src/api/java/ArraySort.java | 16 +- src/api/java/AstMapDecRefQueue.java | 4 +- src/api/java/AstVectorDecRefQueue.java | 4 +- src/api/java/BitVecExpr.java | 6 +- src/api/java/BitVecNum.java | 12 +- src/api/java/BitVecSort.java | 4 +- src/api/java/Constructor.java | 26 +- src/api/java/ConstructorList.java | 6 +- src/api/java/Context.java | 1604 +++++++++-------- src/api/java/DatatypeSort.java | 44 +- src/api/java/EnumSort.java | 10 +- src/api/java/Expr.java | 774 +++++---- src/api/java/FiniteDomainSort.java | 6 +- src/api/java/Fixedpoint.java | 163 +- src/api/java/FixedpointDecRefQueue.java | 4 +- src/api/java/FuncDecl.java | 164 +- src/api/java/FuncInterp.java | 80 +- src/api/java/FuncInterpDecRefQueue.java | 4 +- src/api/java/FuncInterpEntryDecRefQueue.java | 4 +- src/api/java/Global.java | 6 +- src/api/java/Goal.java | 126 +- src/api/java/GoalDecRefQueue.java | 4 +- src/api/java/IDecRefQueue.java | 20 +- src/api/java/IDisposable.java | 2 +- src/api/java/IntNum.java | 12 +- src/api/java/IntSymbol.java | 14 +- src/api/java/ListSort.java | 27 +- src/api/java/Log.java | 6 +- src/api/java/Model.java | 136 +- src/api/java/ModelDecRefQueue.java | 4 +- src/api/java/ParamDescrs.java | 38 +- src/api/java/ParamDescrsDecRefQueue.java | 4 +- src/api/java/Params.java | 56 +- src/api/java/ParamsDecRefQueue.java | 4 +- src/api/java/Pattern.java | 14 +- src/api/java/Probe.java | 29 +- src/api/java/ProbeDecRefQueue.java | 4 +- src/api/java/Quantifier.java | 126 +- src/api/java/RatNum.java | 26 +- src/api/java/RelationSort.java | 12 +- src/api/java/SetSort.java | 2 +- src/api/java/Solver.java | 183 +- src/api/java/SolverDecRefQueue.java | 4 +- src/api/java/Sort.java | 35 +- src/api/java/Statistics.java | 62 +- src/api/java/StatisticsDecRefQueue.java | 4 +- src/api/java/StringSymbol.java | 12 +- src/api/java/Symbol.java | 26 +- src/api/java/Tactic.java | 58 +- src/api/java/TacticDecRefQueue.java | 4 +- src/api/java/TupleSort.java | 24 +- src/api/java/UninterpretedSort.java | 2 +- src/api/java/Version.java | 8 +- src/api/java/Z3Exception.java | 1 - src/api/java/Z3Object.java | 34 +- 63 files changed, 2939 insertions(+), 2985 deletions(-) diff --git a/examples/java/JavaExample.java b/examples/java/JavaExample.java index b3cb939ac..a26c21d65 100644 --- a/examples/java/JavaExample.java +++ b/examples/java/JavaExample.java @@ -41,10 +41,10 @@ class JavaExample // / // / Where, finvis a fresh function declaration. - public BoolExpr InjAxiom(Context ctx, FuncDecl f, int i) throws Z3Exception + public BoolExpr injAxiom(Context ctx, FuncDecl f, int i) throws Z3Exception { - Sort[] domain = f.Domain(); - int sz = f.DomainSize(); + Sort[] domain = f.getDomain(); + int sz = f.getDomainSize(); if (i >= sz) { @@ -53,9 +53,9 @@ class JavaExample } /* declare the i-th inverse of f: finv */ - Sort finv_domain = f.Range(); + Sort finv_domain = f.getRange(); Sort finv_range = domain[i]; - FuncDecl finv = ctx.MkFuncDecl("f_fresh", finv_domain, finv_range); + FuncDecl finv = ctx.mkFuncDecl("f_fresh", finv_domain, finv_range); /* allocate temporary arrays */ Expr[] xs = new Expr[sz]; @@ -67,25 +67,25 @@ class JavaExample for (int j = 0; j < sz; j++) { types[j] = domain[j]; - names[j] = ctx.MkSymbol("x_" + Integer.toString(j)); - xs[j] = ctx.MkBound(j, types[j]); + names[j] = ctx.mkSymbol("x_" + Integer.toString(j)); + xs[j] = ctx.mkBound(j, types[j]); } Expr x_i = xs[i]; /* create f(x_0, ..., x_i, ..., x_{n-1}) */ - Expr fxs = f.Apply(xs); + Expr fxs = f.apply(xs); /* create f_inv(f(x_0, ..., x_i, ..., x_{n-1})) */ - Expr finv_fxs = finv.Apply(fxs); + Expr finv_fxs = finv.apply(fxs); /* create finv(f(x_0, ..., x_i, ..., x_{n-1})) = x_i */ - Expr eq = ctx.MkEq(finv_fxs, x_i); + Expr eq = ctx.mkEq(finv_fxs, x_i); /* use f(x_0, ..., x_i, ..., x_{n-1}) as the pattern for the quantifier */ - Pattern p = ctx.MkPattern(new Expr[] { fxs }); + Pattern p = ctx.mkPattern(fxs); /* create & assert quantifier */ - BoolExpr q = ctx.MkForall(types, /* types of quantified variables */ + BoolExpr q = ctx.mkForall(types, /* types of quantified variables */ names, /* names of quantified variables */ eq, 1, new Pattern[] { p } /* patterns */, null, null, null); @@ -101,11 +101,11 @@ class JavaExample // / // / Where, finvis a fresh function declaration. - public BoolExpr InjAxiomAbs(Context ctx, FuncDecl f, int i) + public BoolExpr injAxiomAbs(Context ctx, FuncDecl f, int i) throws Z3Exception { - Sort[] domain = f.Domain(); - int sz = f.DomainSize(); + Sort[] domain = f.getDomain(); + int sz = f.getDomainSize(); if (i >= sz) { @@ -114,9 +114,9 @@ class JavaExample } /* declare the i-th inverse of f: finv */ - Sort finv_domain = f.Range(); + Sort finv_domain = f.getRange(); Sort finv_range = domain[i]; - FuncDecl finv = ctx.MkFuncDecl("f_fresh", finv_domain, finv_range); + FuncDecl finv = ctx.mkFuncDecl("f_fresh", finv_domain, finv_range); /* allocate temporary arrays */ Expr[] xs = new Expr[sz]; @@ -124,24 +124,24 @@ class JavaExample /* fill types, names and xs */ for (int j = 0; j < sz; j++) { - xs[j] = ctx.MkConst("x_" + Integer.toString(j), domain[j]); + xs[j] = ctx.mkConst("x_" + Integer.toString(j), domain[j]); } Expr x_i = xs[i]; /* create f(x_0, ..., x_i, ..., x_{n-1}) */ - Expr fxs = f.Apply(xs); + Expr fxs = f.apply(xs); /* create f_inv(f(x_0, ..., x_i, ..., x_{n-1})) */ - Expr finv_fxs = finv.Apply(fxs); + Expr finv_fxs = finv.apply(fxs); /* create finv(f(x_0, ..., x_i, ..., x_{n-1})) = x_i */ - Expr eq = ctx.MkEq(finv_fxs, x_i); + Expr eq = ctx.mkEq(finv_fxs, x_i); /* use f(x_0, ..., x_i, ..., x_{n-1}) as the pattern for the quantifier */ - Pattern p = ctx.MkPattern(new Expr[] { fxs }); + Pattern p = ctx.mkPattern(fxs); /* create & assert quantifier */ - BoolExpr q = ctx.MkForall(xs, /* types of quantified variables */ + BoolExpr q = ctx.mkForall(xs, /* types of quantified variables */ eq, /* names of quantified variables */ 1, new Pattern[] { p } /* patterns */, null, null, null); @@ -154,10 +154,10 @@ class JavaExample // / This example uses the SMT-LIB parser to simplify the axiom // construction. // / - private BoolExpr CommAxiom(Context ctx, FuncDecl f) throws Exception + private BoolExpr commAxiom(Context ctx, FuncDecl f) throws Exception { - Sort t = f.Range(); - Sort[] dom = f.Domain(); + Sort t = f.getRange(); + Sort[] dom = f.getDomain(); if (dom.length != 2 || !t.equals(dom[0]) || !t.equals(dom[1])) { @@ -168,70 +168,70 @@ class JavaExample "function must be binary, and argument types must be equal to return type"); } - String bench = "(benchmark comm :formula (forall (x " + t.Name() - + ") (y " + t.Name() + ") (= (" + f.Name() + " x y) (" - + f.Name() + " y x))))"; - ctx.ParseSMTLIBString(bench, new Symbol[] { t.Name() }, - new Sort[] { t }, new Symbol[] { f.Name() }, + String bench = "(benchmark comm :formula (forall (x " + t.getName() + + ") (y " + t.getName() + ") (= (" + f.getName() + " x y) (" + + f.getName() + " y x))))"; + ctx.parseSMTLIBString(bench, new Symbol[] { t.getName() }, + new Sort[] { t }, new Symbol[] { f.getName() }, new FuncDecl[] { f }); - return ctx.SMTLIBFormulas()[0]; + return ctx.getSMTLIBFormulas()[0]; } // / "Hello world" example: create a Z3 logical context, and delete it. - public void SimpleExample() throws Z3Exception + public void simpleExample() throws Z3Exception { System.out.println("SimpleExample"); - Log.Append("SimpleExample"); + Log.append("SimpleExample"); { Context ctx = new Context(); /* do something with the context */ /* be kind to dispose manually and not wait for the GC. */ - ctx.Dispose(); + ctx.dispose(); } } - Model Check(Context ctx, BoolExpr f, Status sat) throws Z3Exception, + Model check(Context ctx, BoolExpr f, Status sat) throws Z3Exception, TestFailedException { - Solver s = ctx.MkSolver(); - s.Assert(f); - if (s.Check() != sat) + Solver s = ctx.mkSolver(); + s.assert_(f); + if (s.check() != sat) throw new TestFailedException(); if (sat == Status.SATISFIABLE) - return s.Model(); + return s.getModel(); else return null; } - void SolveTactical(Context ctx, Tactic t, Goal g, Status sat) + void solveTactical(Context ctx, Tactic t, Goal g, Status sat) throws Z3Exception, TestFailedException { - Solver s = ctx.MkSolver(t); + Solver s = ctx.mkSolver(t); System.out.println("\nTactical solver: " + s); - for (BoolExpr a : g.Formulas()) - s.Assert(a); + for (BoolExpr a : g.getFormulas()) + s.assert_(a); System.out.println("Solver: " + s); - if (s.Check() != sat) + if (s.check() != sat) throw new TestFailedException(); } - ApplyResult ApplyTactic(Context ctx, Tactic t, Goal g) throws Z3Exception + ApplyResult applyTactic(Context ctx, Tactic t, Goal g) throws Z3Exception { System.out.println("\nGoal: " + g); - ApplyResult res = t.Apply(g); + ApplyResult res = t.apply(g); System.out.println("Application result: " + res); Status q = Status.UNKNOWN; - for (Goal sg : res.Subgoals()) - if (sg.IsDecidedSat()) + for (Goal sg : res.getSubgoals()) + if (sg.isDecidedSat()) q = Status.SATISFIABLE; - else if (sg.IsDecidedUnsat()) + else if (sg.isDecidedUnsat()) q = Status.UNSATISFIABLE; switch (q) @@ -250,170 +250,156 @@ class JavaExample return res; } - void Prove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception, + void prove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception, TestFailedException { BoolExpr[] assumptions = new BoolExpr[0]; - Prove(ctx, f, useMBQI, assumptions); + prove(ctx, f, useMBQI, assumptions); } - void Prove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr assumption) - throws Z3Exception, TestFailedException - { - BoolExpr[] assumptions = { assumption }; - Prove(ctx, f, useMBQI, assumptions); - } - - void Prove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr[] assumptions) - throws Z3Exception, TestFailedException + void prove(Context ctx, BoolExpr f, boolean useMBQI, + BoolExpr... assumptions) throws Z3Exception, TestFailedException { System.out.println("Proving: " + f); - Solver s = ctx.MkSolver(); - Params p = ctx.MkParams(); - p.Add("mbqi", useMBQI); + Solver s = ctx.mkSolver(); + Params p = ctx.mkParams(); + p.add("mbqi", useMBQI); s.setParameters(p); for (BoolExpr a : assumptions) - s.Assert(a); - s.Assert(ctx.MkNot(f)); - Status q = s.Check(); + s.assert_(a); + s.assert_(ctx.mkNot(f)); + Status q = s.check(); switch (q) { case UNKNOWN: - System.out.println("Unknown because: " + s.ReasonUnknown()); + System.out.println("Unknown because: " + s.getReasonUnknown()); break; case SATISFIABLE: throw new TestFailedException(); case UNSATISFIABLE: - System.out.println("OK, proof: " + s.Proof()); + System.out.println("OK, proof: " + s.getProof()); break; } } - void Disprove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception, + void disprove(Context ctx, BoolExpr f, boolean useMBQI) throws Z3Exception, TestFailedException { BoolExpr[] a = {}; - Disprove(ctx, f, useMBQI, a); + disprove(ctx, f, useMBQI, a); } - void Disprove(Context ctx, BoolExpr f, boolean useMBQI, BoolExpr assumption) - throws Z3Exception, TestFailedException - { - BoolExpr[] a = { assumption }; - Disprove(ctx, f, useMBQI, a); - } - - void Disprove(Context ctx, BoolExpr f, boolean useMBQI, - BoolExpr[] assumptions) throws Z3Exception, TestFailedException + void disprove(Context ctx, BoolExpr f, boolean useMBQI, + BoolExpr... assumptions) throws Z3Exception, TestFailedException { System.out.println("Disproving: " + f); - Solver s = ctx.MkSolver(); - Params p = ctx.MkParams(); - p.Add("mbqi", useMBQI); + Solver s = ctx.mkSolver(); + Params p = ctx.mkParams(); + p.add("mbqi", useMBQI); s.setParameters(p); for (BoolExpr a : assumptions) - s.Assert(a); - s.Assert(ctx.MkNot(f)); - Status q = s.Check(); + s.assert_(a); + s.assert_(ctx.mkNot(f)); + Status q = s.check(); switch (q) { case UNKNOWN: - System.out.println("Unknown because: " + s.ReasonUnknown()); + System.out.println("Unknown because: " + s.getReasonUnknown()); break; case SATISFIABLE: - System.out.println("OK, model: " + s.Model()); + System.out.println("OK, model: " + s.getModel()); break; case UNSATISFIABLE: throw new TestFailedException(); } } - void ModelConverterTest(Context ctx) throws Z3Exception, + void modelConverterTest(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ModelConverterTest"); - ArithExpr xr = (ArithExpr) ctx.MkConst(ctx.MkSymbol("x"), - ctx.MkRealSort()); - ArithExpr yr = (ArithExpr) ctx.MkConst(ctx.MkSymbol("y"), - ctx.MkRealSort()); - Goal g4 = ctx.MkGoal(true, false, false); - g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1))); - g4.Assert(ctx.MkEq(yr, - ctx.MkAdd(new ArithExpr[] { xr, ctx.MkReal(1, 1) }))); - g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1))); + ArithExpr xr = (ArithExpr) ctx.mkConst(ctx.mkSymbol("x"), + ctx.mkRealSort()); + ArithExpr yr = (ArithExpr) ctx.mkConst(ctx.mkSymbol("y"), + ctx.mkRealSort()); + Goal g4 = ctx.mkGoal(true, false, false); + g4.assert_(ctx.mkGt(xr, ctx.mkReal(10, 1))); + g4.assert_(ctx.mkEq(yr, ctx.mkAdd(xr, ctx.mkReal(1, 1)))); + g4.assert_(ctx.mkGt(yr, ctx.mkReal(1, 1))); - ApplyResult ar = ApplyTactic(ctx, ctx.MkTactic("simplify"), g4); - if (ar.NumSubgoals() == 1 - && (ar.Subgoals()[0].IsDecidedSat() || ar.Subgoals()[0] - .IsDecidedUnsat())) + ApplyResult ar = applyTactic(ctx, ctx.mkTactic("simplify"), g4); + if (ar.getNumSubgoals() == 1 + && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] + .isDecidedUnsat())) throw new TestFailedException(); - ar = ApplyTactic(ctx, ctx.AndThen(ctx.MkTactic("simplify"), - ctx.MkTactic("solve-eqs"), null), g4); - if (ar.NumSubgoals() == 1 - && (ar.Subgoals()[0].IsDecidedSat() || ar.Subgoals()[0] - .IsDecidedUnsat())) + ar = applyTactic(ctx, ctx.andThen(ctx.mkTactic("simplify"), + ctx.mkTactic("solve-eqs")), g4); + if (ar.getNumSubgoals() == 1 + && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] + .isDecidedUnsat())) throw new TestFailedException(); - Solver s = ctx.MkSolver(); - for (BoolExpr e : ar.Subgoals()[0].Formulas()) - s.Assert(e); - Status q = s.Check(); + Solver s = ctx.mkSolver(); + for (BoolExpr e : ar.getSubgoals()[0].getFormulas()) + s.assert_(e); + Status q = s.check(); System.out.println("Solver says: " + q); - System.out.println("Model: \n" + s.Model()); + System.out.println("Model: \n" + s.getModel()); System.out.println("Converted Model: \n" - + ar.ConvertModel(0, s.Model())); + + ar.convertModel(0, s.getModel())); if (q != Status.SATISFIABLE) throw new TestFailedException(); } // / A simple array example. - void ArrayExample1(Context ctx) throws Z3Exception, TestFailedException + void arrayExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ArrayExample1"); - Log.Append("ArrayExample1"); + Log.append("ArrayExample1"); - Goal g = ctx.MkGoal(true, false, false); - ArraySort asort = ctx.MkArraySort(ctx.IntSort(), ctx.MkBitVecSort(32)); - ArrayExpr aex = (ArrayExpr) ctx.MkConst(ctx.MkSymbol("MyArray"), asort); - Expr sel = ctx.MkSelect(aex, ctx.MkInt(0)); - g.Assert(ctx.MkEq(sel, ctx.MkBV(42, 32))); - Symbol xs = ctx.MkSymbol("x"); - IntExpr xc = (IntExpr) ctx.MkConst(xs, ctx.IntSort()); + Goal g = ctx.mkGoal(true, false, false); + ArraySort asort = ctx.mkArraySort(ctx.getIntSort(), + ctx.mkBitVecSort(32)); + ArrayExpr aex = (ArrayExpr) ctx.mkConst(ctx.mkSymbol("MyArray"), asort); + Expr sel = ctx.mkSelect(aex, ctx.mkInt(0)); + g.assert_(ctx.mkEq(sel, ctx.mkBV(42, 32))); + Symbol xs = ctx.mkSymbol("x"); + IntExpr xc = (IntExpr) ctx.mkConst(xs, ctx.getIntSort()); - Symbol fname = ctx.MkSymbol("f"); - Sort[] domain = { ctx.IntSort() }; - FuncDecl fd = ctx.MkFuncDecl(fname, domain, ctx.IntSort()); - Expr[] fargs = { ctx.MkConst(xs, ctx.IntSort()) }; - IntExpr fapp = (IntExpr) ctx.MkApp(fd, fargs); + Symbol fname = ctx.mkSymbol("f"); + Sort[] domain = { ctx.getIntSort() }; + FuncDecl fd = ctx.mkFuncDecl(fname, domain, ctx.getIntSort()); + Expr[] fargs = { ctx.mkConst(xs, ctx.getIntSort()) }; + IntExpr fapp = (IntExpr) ctx.mkApp(fd, fargs); - g.Assert(ctx.MkEq(ctx.MkAdd(new ArithExpr[] { xc, fapp }), - ctx.MkInt(123))); + g.assert_(ctx.mkEq(ctx.mkAdd(xc, fapp), ctx.mkInt(123))); - Solver s = ctx.MkSolver(); - for (BoolExpr a : g.Formulas()) - s.Assert(a); + Solver s = ctx.mkSolver(); + for (BoolExpr a : g.getFormulas()) + s.assert_(a); System.out.println("Solver: " + s); - Status q = s.Check(); + Status q = s.check(); System.out.println("Status: " + q); if (q != Status.SATISFIABLE) throw new TestFailedException(); - System.out.println("Model = " + s.Model()); + System.out.println("Model = " + s.getModel()); System.out.println("Interpretation of MyArray:\n" - + s.Model().FuncInterp(aex.FuncDecl())); - System.out - .println("Interpretation of x:\n" + s.Model().ConstInterp(xc)); - System.out.println("Interpretation of f:\n" + s.Model().FuncInterp(fd)); + + s.getModel().getFuncInterp(aex.getFuncDecl())); + System.out.println("Interpretation of x:\n" + + s.getModel().getConstInterp(xc)); + System.out.println("Interpretation of f:\n" + + s.getModel().getFuncInterp(fd)); System.out.println("Interpretation of MyArray as Term:\n" - + s.Model().FuncInterp(aex.FuncDecl())); + + s.getModel().getFuncInterp(aex.getFuncDecl())); } // / Prove store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 @@ -421,48 +407,48 @@ class JavaExample // / This example demonstrates how to use the array // theory. - public void ArrayExample2(Context ctx) throws Z3Exception, + public void arrayExample2(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ArrayExample2"); - Log.Append("ArrayExample2"); + Log.append("ArrayExample2"); - Sort int_type = ctx.IntSort(); - Sort array_type = ctx.MkArraySort(int_type, int_type); + Sort int_type = ctx.getIntSort(); + Sort array_type = ctx.mkArraySort(int_type, int_type); - ArrayExpr a1 = (ArrayExpr) ctx.MkConst("a1", array_type); - ArrayExpr a2 = ctx.MkArrayConst("a2", int_type, int_type); - Expr i1 = ctx.MkConst("i1", int_type); - Expr i2 = ctx.MkConst("i2", int_type); - Expr i3 = ctx.MkConst("i3", int_type); - Expr v1 = ctx.MkConst("v1", int_type); - Expr v2 = ctx.MkConst("v2", int_type); + ArrayExpr a1 = (ArrayExpr) ctx.mkConst("a1", array_type); + ArrayExpr a2 = ctx.mkArrayConst("a2", int_type, int_type); + Expr i1 = ctx.mkConst("i1", int_type); + Expr i2 = ctx.mkConst("i2", int_type); + Expr i3 = ctx.mkConst("i3", int_type); + Expr v1 = ctx.mkConst("v1", int_type); + Expr v2 = ctx.mkConst("v2", int_type); - Expr st1 = ctx.MkStore(a1, i1, v1); - Expr st2 = ctx.MkStore(a2, i2, v2); + Expr st1 = ctx.mkStore(a1, i1, v1); + Expr st2 = ctx.mkStore(a2, i2, v2); - Expr sel1 = ctx.MkSelect(a1, i3); - Expr sel2 = ctx.MkSelect(a2, i3); + Expr sel1 = ctx.mkSelect(a1, i3); + Expr sel2 = ctx.mkSelect(a2, i3); /* create antecedent */ - BoolExpr antecedent = ctx.MkEq(st1, st2); + BoolExpr antecedent = ctx.mkEq(st1, st2); /* * create consequent: i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, * i3) */ - BoolExpr consequent = ctx.MkOr(new BoolExpr[] { ctx.MkEq(i1, i3), - ctx.MkEq(i2, i3), ctx.MkEq(sel1, sel2) }); + BoolExpr consequent = ctx.mkOr(ctx.mkEq(i1, i3), ctx.mkEq(i2, i3), + ctx.mkEq(sel1, sel2)); /* * prove store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = * i3 or select(a1, i3) = select(a2, i3)) */ - BoolExpr thm = ctx.MkImplies(antecedent, consequent); + BoolExpr thm = ctx.mkImplies(antecedent, consequent); System.out .println("prove: store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))"); System.out.println(thm); - Prove(ctx, thm, false); + prove(ctx, thm, false); } // / Show that distinct(a_0, ... , a_n) is @@ -471,39 +457,39 @@ class JavaExample // / This example also shows how to use the distinct // construct. - public void ArrayExample3(Context ctx) throws Z3Exception, + public void arrayExample3(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ArrayExample3"); - Log.Append("ArrayExample2"); + Log.append("ArrayExample2"); for (int n = 2; n <= 5; n++) { System.out.println("n = " + Integer.toString(n)); - Sort bool_type = ctx.MkBoolSort(); - Sort array_type = ctx.MkArraySort(bool_type, bool_type); + Sort bool_type = ctx.mkBoolSort(); + Sort array_type = ctx.mkArraySort(bool_type, bool_type); Expr[] a = new Expr[n]; /* create arrays */ for (int i = 0; i < n; i++) { - a[i] = ctx.MkConst("array_" + Integer.toString(i), array_type); + a[i] = ctx.mkConst("array_" + Integer.toString(i), array_type); } /* assert distinct(a[0], ..., a[n]) */ - BoolExpr d = ctx.MkDistinct(a); + BoolExpr d = ctx.mkDistinct(a); System.out.println(d); /* context is satisfiable if n < 5 */ - Model model = Check(ctx, d, n < 5 ? Status.SATISFIABLE + Model model = check(ctx, d, n < 5 ? Status.SATISFIABLE : Status.UNSATISFIABLE); if (n < 5) { for (int i = 0; i < n; i++) { System.out.println(a[i].toString() + " = " - + model.Evaluate(a[i], false)); + + model.evaluate(a[i], false)); } } } @@ -511,10 +497,10 @@ class JavaExample // / Sudoku solving example. - void SudokuExample(Context ctx) throws Z3Exception, TestFailedException + void sudokuExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("SudokuExample"); - Log.Append("SudokuExample"); + Log.append("SudokuExample"); // 9x9 matrix of integer variables IntExpr[][] X = new IntExpr[9][]; @@ -522,9 +508,9 @@ class JavaExample { X[i] = new IntExpr[9]; for (int j = 0; j < 9; j++) - X[i][j] = (IntExpr) ctx.MkConst( - ctx.MkSymbol("x_" + (i + 1) + "_" + (j + 1)), - ctx.IntSort()); + X[i][j] = (IntExpr) ctx.mkConst( + ctx.mkSymbol("x_" + (i + 1) + "_" + (j + 1)), + ctx.getIntSort()); } // each cell contains a value in {1, ..., 9} @@ -533,20 +519,19 @@ class JavaExample { cells_c[i] = new BoolExpr[9]; for (int j = 0; j < 9; j++) - cells_c[i][j] = ctx.MkAnd(new BoolExpr[] { - ctx.MkLe(ctx.MkInt(1), X[i][j]), - ctx.MkLe(X[i][j], ctx.MkInt(9)) }); + cells_c[i][j] = ctx.mkAnd(ctx.mkLe(ctx.mkInt(1), X[i][j]), + ctx.mkLe(X[i][j], ctx.mkInt(9))); } // each row contains a digit at most once BoolExpr[] rows_c = new BoolExpr[9]; for (int i = 0; i < 9; i++) - rows_c[i] = ctx.MkDistinct(X[i]); + rows_c[i] = ctx.mkDistinct(X[i]); // each column contains a digit at most once BoolExpr[] cols_c = new BoolExpr[9]; for (int j = 0; j < 9; j++) - cols_c[j] = ctx.MkDistinct(X[j]); + cols_c[j] = ctx.mkDistinct(X[j]); // each 3x3 square contains a digit at most once BoolExpr[][] sq_c = new BoolExpr[3][]; @@ -559,17 +544,17 @@ class JavaExample for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) square[3 * i + j] = X[3 * i0 + i][3 * j0 + j]; - sq_c[i0][j0] = ctx.MkDistinct(square); + sq_c[i0][j0] = ctx.mkDistinct(square); } } - BoolExpr sudoku_c = ctx.MkTrue(); + BoolExpr sudoku_c = ctx.mkTrue(); for (BoolExpr[] t : cells_c) - sudoku_c = ctx.MkAnd(new BoolExpr[] { ctx.MkAnd(t), sudoku_c }); - sudoku_c = ctx.MkAnd(new BoolExpr[] { ctx.MkAnd(rows_c), sudoku_c }); - sudoku_c = ctx.MkAnd(new BoolExpr[] { ctx.MkAnd(cols_c), sudoku_c }); + sudoku_c = ctx.mkAnd(ctx.mkAnd(t), sudoku_c); + sudoku_c = ctx.mkAnd(ctx.mkAnd(rows_c), sudoku_c); + sudoku_c = ctx.mkAnd(ctx.mkAnd(cols_c), sudoku_c); for (BoolExpr[] t : sq_c) - sudoku_c = ctx.MkAnd(new BoolExpr[] { ctx.MkAnd(t), sudoku_c }); + sudoku_c = ctx.mkAnd(ctx.mkAnd(t), sudoku_c); // sudoku instance, we use '0' for empty cells int[][] instance = { { 0, 0, 0, 0, 9, 4, 0, 3, 0 }, @@ -578,30 +563,27 @@ class JavaExample { 1, 0, 2, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 5, 2, 0 }, { 9, 0, 0, 0, 6, 5, 0, 0, 0 }, { 0, 4, 0, 9, 7, 0, 0, 0, 0 } }; - BoolExpr instance_c = ctx.MkTrue(); + BoolExpr instance_c = ctx.mkTrue(); for (int i = 0; i < 9; i++) for (int j = 0; j < 9; j++) - instance_c = ctx - .MkAnd(new BoolExpr[] { - instance_c, - (BoolExpr) ctx.MkITE( - ctx.MkEq(ctx.MkInt(instance[i][j]), - ctx.MkInt(0)), - ctx.MkTrue(), - ctx.MkEq(X[i][j], - ctx.MkInt(instance[i][j]))) }); + instance_c = ctx.mkAnd( + instance_c, + (BoolExpr) ctx.mkITE( + ctx.mkEq(ctx.mkInt(instance[i][j]), + ctx.mkInt(0)), ctx.mkTrue(), + ctx.mkEq(X[i][j], ctx.mkInt(instance[i][j])))); - Solver s = ctx.MkSolver(); - s.Assert(sudoku_c); - s.Assert(instance_c); + Solver s = ctx.mkSolver(); + s.assert_(sudoku_c); + s.assert_(instance_c); - if (s.Check() == Status.SATISFIABLE) + if (s.check() == Status.SATISFIABLE) { - Model m = s.Model(); + Model m = s.getModel(); Expr[][] R = new Expr[9][9]; for (int i = 0; i < 9; i++) for (int j = 0; j < 9; j++) - R[i][j] = m.Evaluate(X[i][j], false); + R[i][j] = m.evaluate(X[i][j], false); System.out.println("Sudoku solution:"); for (int i = 0; i < 9; i++) { @@ -618,10 +600,10 @@ class JavaExample // / A basic example of how to use quantifiers. - void QuantifierExample1(Context ctx) throws Z3Exception + void quantifierExample1(Context ctx) throws Z3Exception { System.out.println("QuantifierExample"); - Log.Append("QuantifierExample"); + Log.append("QuantifierExample"); Sort[] types = new Sort[3]; IntExpr[] xs = new IntExpr[3]; @@ -630,87 +612,78 @@ class JavaExample for (int j = 0; j < 3; j++) { - types[j] = ctx.IntSort(); - names[j] = ctx.MkSymbol("x_" + Integer.toString(j)); - xs[j] = (IntExpr) ctx.MkConst(names[j], types[j]); - vars[j] = (IntExpr) ctx.MkBound(2 - j, types[j]); // <-- vars + types[j] = ctx.getIntSort(); + names[j] = ctx.mkSymbol("x_" + Integer.toString(j)); + xs[j] = (IntExpr) ctx.mkConst(names[j], types[j]); + vars[j] = (IntExpr) ctx.mkBound(2 - j, types[j]); // <-- vars // reversed! } - Expr body_vars = ctx - .MkAnd(new BoolExpr[] { - ctx.MkEq( - ctx.MkAdd(new ArithExpr[] { vars[0], - ctx.MkInt(1) }), ctx.MkInt(2)), - ctx.MkEq( - ctx.MkAdd(new ArithExpr[] { vars[1], - ctx.MkInt(2) }), - ctx.MkAdd(new ArithExpr[] { vars[2], - ctx.MkInt(3) })) }); + Expr body_vars = ctx.mkAnd( + ctx.mkEq(ctx.mkAdd(vars[0], ctx.mkInt(1)), ctx.mkInt(2)), + ctx.mkEq(ctx.mkAdd(vars[1], ctx.mkInt(2)), + ctx.mkAdd(vars[2], ctx.mkInt(3)))); - Expr body_const = ctx.MkAnd(new BoolExpr[] { - ctx.MkEq(ctx.MkAdd(new ArithExpr[] { xs[0], ctx.MkInt(1) }), - ctx.MkInt(2)), - ctx.MkEq(ctx.MkAdd(new ArithExpr[] { xs[1], ctx.MkInt(2) }), - ctx.MkAdd(new ArithExpr[] { xs[2], ctx.MkInt(3) })) }); + Expr body_const = ctx.mkAnd( + ctx.mkEq(ctx.mkAdd(xs[0], ctx.mkInt(1)), ctx.mkInt(2)), + ctx.mkEq(ctx.mkAdd(xs[1], ctx.mkInt(2)), + ctx.mkAdd(xs[2], ctx.mkInt(3)))); - Expr x = ctx.MkForall(types, names, body_vars, 1, null, null, - ctx.MkSymbol("Q1"), ctx.MkSymbol("skid1")); + Expr x = ctx.mkForall(types, names, body_vars, 1, null, null, + ctx.mkSymbol("Q1"), ctx.mkSymbol("skid1")); System.out.println("Quantifier X: " + x.toString()); - Expr y = ctx.MkForall(xs, body_const, 1, null, null, - ctx.MkSymbol("Q2"), ctx.MkSymbol("skid2")); + Expr y = ctx.mkForall(xs, body_const, 1, null, null, + ctx.mkSymbol("Q2"), ctx.mkSymbol("skid2")); System.out.println("Quantifier Y: " + y.toString()); } - void QuantifierExample2(Context ctx) throws Z3Exception + void quantifierExample2(Context ctx) throws Z3Exception { System.out.println("QuantifierExample2"); - Log.Append("QuantifierExample2"); + Log.append("QuantifierExample2"); Expr q1, q2; - FuncDecl f = ctx.MkFuncDecl("f", ctx.IntSort(), ctx.IntSort()); - FuncDecl g = ctx.MkFuncDecl("g", ctx.IntSort(), ctx.IntSort()); + FuncDecl f = ctx.mkFuncDecl("f", ctx.getIntSort(), ctx.getIntSort()); + FuncDecl g = ctx.mkFuncDecl("g", ctx.getIntSort(), ctx.getIntSort()); // Quantifier with Exprs as the bound variables. { - Expr x = ctx.MkConst("x", ctx.IntSort()); - Expr y = ctx.MkConst("y", ctx.IntSort()); - Expr f_x = ctx.MkApp(f, new Expr[] { x }); - Expr f_y = ctx.MkApp(f, new Expr[] { y }); - Expr g_y = ctx.MkApp(g, new Expr[] { y }); - Pattern[] pats = new Pattern[] { ctx.MkPattern(new Expr[] { f_x, - g_y }) }; + Expr x = ctx.mkConst("x", ctx.getIntSort()); + Expr y = ctx.mkConst("y", ctx.getIntSort()); + Expr f_x = ctx.mkApp(f, x); + Expr f_y = ctx.mkApp(f, y); + Expr g_y = ctx.mkApp(g, y); + @SuppressWarnings("unused") + Pattern[] pats = new Pattern[] { ctx.mkPattern(f_x, g_y) }; Expr[] no_pats = new Expr[] { f_y }; Expr[] bound = new Expr[] { x, y }; - Expr body = ctx.MkAnd(new BoolExpr[] { ctx.MkEq(f_x, f_y), - ctx.MkEq(f_y, g_y) }); + Expr body = ctx.mkAnd(ctx.mkEq(f_x, f_y), ctx.mkEq(f_y, g_y)); - q1 = ctx.MkForall(bound, body, 1, null, no_pats, ctx.MkSymbol("q"), - ctx.MkSymbol("sk")); + q1 = ctx.mkForall(bound, body, 1, null, no_pats, ctx.mkSymbol("q"), + ctx.mkSymbol("sk")); System.out.println(q1); } // Quantifier with de-Brujin indices. { - Expr x = ctx.MkBound(1, ctx.IntSort()); - Expr y = ctx.MkBound(0, ctx.IntSort()); - Expr f_x = ctx.MkApp(f, new Expr[] { x }); - Expr f_y = ctx.MkApp(f, new Expr[] { y }); - Expr g_y = ctx.MkApp(g, new Expr[] { y }); - Pattern[] pats = new Pattern[] { ctx.MkPattern(new Expr[] { f_x, - g_y }) }; + Expr x = ctx.mkBound(1, ctx.getIntSort()); + Expr y = ctx.mkBound(0, ctx.getIntSort()); + Expr f_x = ctx.mkApp(f, x); + Expr f_y = ctx.mkApp(f, y); + Expr g_y = ctx.mkApp(g, y); + @SuppressWarnings("unused") + Pattern[] pats = new Pattern[] { ctx.mkPattern(f_x, g_y) }; Expr[] no_pats = new Expr[] { f_y }; - Symbol[] names = new Symbol[] { ctx.MkSymbol("x"), - ctx.MkSymbol("y") }; - Sort[] sorts = new Sort[] { ctx.IntSort(), ctx.IntSort() }; - Expr body = ctx.MkAnd(new BoolExpr[] { ctx.MkEq(f_x, f_y), - ctx.MkEq(f_y, g_y) }); + Symbol[] names = new Symbol[] { ctx.mkSymbol("x"), + ctx.mkSymbol("y") }; + Sort[] sorts = new Sort[] { ctx.getIntSort(), ctx.getIntSort() }; + Expr body = ctx.mkAnd(ctx.mkEq(f_x, f_y), ctx.mkEq(f_y, g_y)); - q2 = ctx.MkForall(sorts, names, body, 1, null, // pats, - no_pats, ctx.MkSymbol("q"), ctx.MkSymbol("sk")); + q2 = ctx.mkForall(sorts, names, body, 1, null, // pats, + no_pats, ctx.mkSymbol("q"), ctx.mkSymbol("sk")); System.out.println(q2); } @@ -721,11 +694,11 @@ class JavaExample // / f is injective in the second argument. - public void QuantifierExample3(Context ctx) throws Z3Exception, + public void quantifierExample3(Context ctx) throws Z3Exception, TestFailedException { System.out.println("QuantifierExample3"); - Log.Append("QuantifierExample3"); + Log.append("QuantifierExample3"); /* * If quantified formulas are asserted in a logical context, then the @@ -733,40 +706,41 @@ class JavaExample */ /* declare function f */ - Sort I = ctx.IntSort(); - FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I); + Sort I = ctx.getIntSort(); + FuncDecl f = ctx.mkFuncDecl("f", new Sort[] { I, I }, I); /* f is injective in the second argument. */ - BoolExpr inj = InjAxiom(ctx, f, 1); + BoolExpr inj = injAxiom(ctx, f, 1); /* create x, y, v, w, fxy, fwv */ - Expr x = ctx.MkIntConst("x"); - Expr y = ctx.MkIntConst("y"); - Expr v = ctx.MkIntConst("v"); - Expr w = ctx.MkIntConst("w"); - Expr fxy = ctx.MkApp(f, new Expr[] { x, y }); - Expr fwv = ctx.MkApp(f, new Expr[] { w, v }); + Expr x = ctx.mkIntConst("x"); + Expr y = ctx.mkIntConst("y"); + Expr v = ctx.mkIntConst("v"); + Expr w = ctx.mkIntConst("w"); + Expr fxy = ctx.mkApp(f, x, y); + Expr fwv = ctx.mkApp(f, w, v); /* f(x, y) = f(w, v) */ - BoolExpr p1 = ctx.MkEq(fxy, fwv); + BoolExpr p1 = ctx.mkEq(fxy, fwv); /* prove f(x, y) = f(w, v) implies y = v */ - BoolExpr p2 = ctx.MkEq(y, v); - Prove(ctx, p2, false, new BoolExpr[] { inj, p1 }); + BoolExpr p2 = ctx.mkEq(y, v); + prove(ctx, p2, false, inj, p1); /* disprove f(x, y) = f(w, v) implies x = w */ - BoolExpr p3 = ctx.MkEq(x, w); - Disprove(ctx, p3, false, new BoolExpr[] { inj, p1 }); + BoolExpr p3 = ctx.mkEq(x, w); + disprove(ctx, p3, false, inj, p1); } // / Prove that f(x, y) = f(w, v) implies y = v when // / f is injective in the second argument. - public void QuantifierExample4(Context ctx) throws Z3Exception, TestFailedException + public void quantifierExample4(Context ctx) throws Z3Exception, + TestFailedException { System.out.println("QuantifierExample4"); - Log.Append("QuantifierExample4"); + Log.append("QuantifierExample4"); /* * If quantified formulas are asserted in a logical context, then the @@ -774,140 +748,140 @@ class JavaExample */ /* declare function f */ - Sort I = ctx.IntSort(); - FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { I, I }, I); + Sort I = ctx.getIntSort(); + FuncDecl f = ctx.mkFuncDecl("f", new Sort[] { I, I }, I); /* f is injective in the second argument. */ - BoolExpr inj = InjAxiomAbs(ctx, f, 1); + BoolExpr inj = injAxiomAbs(ctx, f, 1); /* create x, y, v, w, fxy, fwv */ - Expr x = ctx.MkIntConst("x"); - Expr y = ctx.MkIntConst("y"); - Expr v = ctx.MkIntConst("v"); - Expr w = ctx.MkIntConst("w"); - Expr fxy = ctx.MkApp(f, new Expr[] { x, y }); - Expr fwv = ctx.MkApp(f, new Expr[] { w, v }); + Expr x = ctx.mkIntConst("x"); + Expr y = ctx.mkIntConst("y"); + Expr v = ctx.mkIntConst("v"); + Expr w = ctx.mkIntConst("w"); + Expr fxy = ctx.mkApp(f, x, y); + Expr fwv = ctx.mkApp(f, w, v); /* f(x, y) = f(w, v) */ - BoolExpr p1 = ctx.MkEq(fxy, fwv); + BoolExpr p1 = ctx.mkEq(fxy, fwv); /* prove f(x, y) = f(w, v) implies y = v */ - BoolExpr p2 = ctx.MkEq(y, v); - Prove(ctx, p2, false, new BoolExpr[] { inj, p1 }); + BoolExpr p2 = ctx.mkEq(y, v); + prove(ctx, p2, false, inj, p1); /* disprove f(x, y) = f(w, v) implies x = w */ - BoolExpr p3 = ctx.MkEq(x, w); - Disprove(ctx, p3, false, new BoolExpr[] { inj, p1 }); + BoolExpr p3 = ctx.mkEq(x, w); + disprove(ctx, p3, false, inj, p1); } // / Some basic tests. - void BasicTests(Context ctx) throws Z3Exception, TestFailedException + void basicTests(Context ctx) throws Z3Exception, TestFailedException { System.out.println("BasicTests"); - Symbol fname = ctx.MkSymbol("f"); - Symbol x = ctx.MkSymbol("x"); - Symbol y = ctx.MkSymbol("y"); + Symbol fname = ctx.mkSymbol("f"); + Symbol x = ctx.mkSymbol("x"); + Symbol y = ctx.mkSymbol("y"); - Sort bs = ctx.MkBoolSort(); + Sort bs = ctx.mkBoolSort(); Sort[] domain = { bs, bs }; - FuncDecl f = ctx.MkFuncDecl(fname, domain, bs); - Expr fapp = ctx.MkApp(f, - new Expr[] { ctx.MkConst(x, bs), ctx.MkConst(y, bs) }); + FuncDecl f = ctx.mkFuncDecl(fname, domain, bs); + Expr fapp = ctx.mkApp(f, ctx.mkConst(x, bs), ctx.mkConst(y, bs)); - Expr[] fargs2 = { ctx.MkFreshConst("cp", bs) }; + Expr[] fargs2 = { ctx.mkFreshConst("cp", bs) }; Sort[] domain2 = { bs }; - Expr fapp2 = ctx.MkApp(ctx.MkFreshFuncDecl("fp", domain2, bs), fargs2); + Expr fapp2 = ctx.mkApp(ctx.mkFreshFuncDecl("fp", domain2, bs), fargs2); - BoolExpr trivial_eq = ctx.MkEq(fapp, fapp); - BoolExpr nontrivial_eq = ctx.MkEq(fapp, fapp2); + BoolExpr trivial_eq = ctx.mkEq(fapp, fapp); + BoolExpr nontrivial_eq = ctx.mkEq(fapp, fapp2); - Goal g = ctx.MkGoal(true, false, false); - g.Assert(trivial_eq); - g.Assert(nontrivial_eq); + Goal g = ctx.mkGoal(true, false, false); + g.assert_(trivial_eq); + g.assert_(nontrivial_eq); System.out.println("Goal: " + g); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); - for (BoolExpr a : g.Formulas()) - solver.Assert(a); + for (BoolExpr a : g.getFormulas()) + solver.assert_(a); - if (solver.Check() != Status.SATISFIABLE) + if (solver.check() != Status.SATISFIABLE) throw new TestFailedException(); - ApplyResult ar = ApplyTactic(ctx, ctx.MkTactic("simplify"), g); - if (ar.NumSubgoals() == 1 - && (ar.Subgoals()[0].IsDecidedSat() || ar.Subgoals()[0] - .IsDecidedUnsat())) + ApplyResult ar = applyTactic(ctx, ctx.mkTactic("simplify"), g); + if (ar.getNumSubgoals() == 1 + && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] + .isDecidedUnsat())) throw new TestFailedException(); - ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedSat()) + ar = applyTactic(ctx, ctx.mkTactic("smt"), g); + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) throw new TestFailedException(); - g.Assert(ctx.MkEq(ctx.MkNumeral(1, ctx.MkBitVecSort(32)), - ctx.MkNumeral(2, ctx.MkBitVecSort(32)))); - ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedUnsat()) + g.assert_(ctx.mkEq(ctx.mkNumeral(1, ctx.mkBitVecSort(32)), + ctx.mkNumeral(2, ctx.mkBitVecSort(32)))); + ar = applyTactic(ctx, ctx.mkTactic("smt"), g); + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedUnsat()) throw new TestFailedException(); - Goal g2 = ctx.MkGoal(true, true, false); - ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedSat()) + Goal g2 = ctx.mkGoal(true, true, false); + ar = applyTactic(ctx, ctx.mkTactic("smt"), g2); + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) throw new TestFailedException(); - g2 = ctx.MkGoal(true, true, false); - g2.Assert(ctx.MkFalse()); - ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g2); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedUnsat()) + g2 = ctx.mkGoal(true, true, false); + g2.assert_(ctx.mkFalse()); + ar = applyTactic(ctx, ctx.mkTactic("smt"), g2); + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedUnsat()) throw new TestFailedException(); - Goal g3 = ctx.MkGoal(true, true, false); - Expr xc = ctx.MkConst(ctx.MkSymbol("x"), ctx.IntSort()); - Expr yc = ctx.MkConst(ctx.MkSymbol("y"), ctx.IntSort()); - g3.Assert(ctx.MkEq(xc, ctx.MkNumeral(1, ctx.IntSort()))); - g3.Assert(ctx.MkEq(yc, ctx.MkNumeral(2, ctx.IntSort()))); - BoolExpr constr = ctx.MkEq(xc, yc); - g3.Assert(constr); - ar = ApplyTactic(ctx, ctx.MkTactic("smt"), g3); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedUnsat()) + Goal g3 = ctx.mkGoal(true, true, false); + Expr xc = ctx.mkConst(ctx.mkSymbol("x"), ctx.getIntSort()); + Expr yc = ctx.mkConst(ctx.mkSymbol("y"), ctx.getIntSort()); + g3.assert_(ctx.mkEq(xc, ctx.mkNumeral(1, ctx.getIntSort()))); + g3.assert_(ctx.mkEq(yc, ctx.mkNumeral(2, ctx.getIntSort()))); + BoolExpr constr = ctx.mkEq(xc, yc); + g3.assert_(constr); + ar = applyTactic(ctx, ctx.mkTactic("smt"), g3); + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedUnsat()) throw new TestFailedException(); - ModelConverterTest(ctx); + modelConverterTest(ctx); // Real num/den test. - RatNum rn = ctx.MkReal(42, 43); - Expr inum = rn.Numerator(); - Expr iden = rn.Denominator(); + RatNum rn = ctx.mkReal(42, 43); + Expr inum = rn.getNumerator(); + Expr iden = rn.getDenominator(); System.out.println("Numerator: " + inum + " Denominator: " + iden); if (!inum.toString().equals("42") || !iden.toString().equals("43")) throw new TestFailedException(); - if (!rn.ToDecimalString(3).toString().equals("0.976?")) + if (!rn.toDecimalString(3).toString().equals("0.976?")) throw new TestFailedException(); - BigIntCheck(ctx, ctx.MkReal("-1231231232/234234333")); - BigIntCheck(ctx, ctx.MkReal("-123123234234234234231232/234234333")); - BigIntCheck(ctx, ctx.MkReal("-234234333")); - BigIntCheck(ctx, ctx.MkReal("234234333/2")); + bigIntCheck(ctx, ctx.mkReal("-1231231232/234234333")); + bigIntCheck(ctx, ctx.mkReal("-123123234234234234231232/234234333")); + bigIntCheck(ctx, ctx.mkReal("-234234333")); + bigIntCheck(ctx, ctx.mkReal("234234333/2")); String bn = "1234567890987654321"; - if (!ctx.MkInt(bn).BigInteger().toString().equals(bn)) + if (!ctx.mkInt(bn).getBigInteger().toString().equals(bn)) throw new TestFailedException(); - if (!ctx.MkBV(bn, 128).BigInteger().toString().equals(bn)) + if (!ctx.mkBV(bn, 128).getBigInteger().toString().equals(bn)) throw new TestFailedException(); - if (ctx.MkBV(bn, 32).BigInteger().toString().equals(bn)) + if (ctx.mkBV(bn, 32).getBigInteger().toString().equals(bn)) throw new TestFailedException(); // Error handling test. try { - IntExpr i = ctx.MkInt("1/2"); + @SuppressWarnings("unused") + IntExpr i = ctx.mkInt("1/2"); throw new TestFailedException(); // unreachable } catch (Z3Exception e) { @@ -916,17 +890,19 @@ class JavaExample // / Some basic expression casting tests. - void CastingTest(Context ctx) throws Z3Exception, TestFailedException + void castingTest(Context ctx) throws Z3Exception, TestFailedException { System.out.println("CastingTest"); - Sort[] domain = { ctx.BoolSort(), ctx.BoolSort() }; - FuncDecl f = ctx.MkFuncDecl("f", domain, ctx.BoolSort()); + Sort[] domain = { ctx.getBoolSort(), ctx.getBoolSort() }; + FuncDecl f = ctx.mkFuncDecl("f", domain, ctx.getBoolSort()); - AST upcast = ctx.MkFuncDecl(ctx.MkSymbol("q"), domain, ctx.BoolSort()); + AST upcast = ctx.mkFuncDecl(ctx.mkSymbol("q"), domain, + ctx.getBoolSort()); try { + @SuppressWarnings("unused") FuncDecl downcast = (FuncDecl) f; // OK } catch (ClassCastException e) { @@ -935,31 +911,34 @@ class JavaExample try { + @SuppressWarnings("unused") Expr uc = (Expr) upcast; throw new TestFailedException(); // should not be reachable! } catch (ClassCastException e) { } - Symbol s = ctx.MkSymbol(42); + Symbol s = ctx.mkSymbol(42); IntSymbol si = (s.getClass() == IntSymbol.class) ? (IntSymbol) s : null; if (si == null) throw new TestFailedException(); try { + @SuppressWarnings("unused") IntSymbol si2 = (IntSymbol) s; } catch (ClassCastException e) { throw new TestFailedException(); } - s = ctx.MkSymbol("abc"); + s = ctx.mkSymbol("abc"); StringSymbol ss = (s.getClass() == StringSymbol.class) ? (StringSymbol) s : null; if (ss == null) throw new TestFailedException(); try { + @SuppressWarnings("unused") StringSymbol ss2 = (StringSymbol) s; } catch (ClassCastException e) { @@ -967,13 +946,14 @@ class JavaExample } try { + @SuppressWarnings("unused") IntSymbol si2 = (IntSymbol) s; throw new TestFailedException(); // unreachable } catch (Exception e) { } - Sort srt = ctx.MkBitVecSort(32); + Sort srt = ctx.mkBitVecSort(32); BitVecSort bvs = null; try { @@ -983,23 +963,24 @@ class JavaExample throw new TestFailedException(); } - if (bvs.Size() != 32) + if (bvs.getSize() != 32) throw new TestFailedException(); - Expr q = ctx.MkAdd(new ArithExpr[] { ctx.MkInt(1), ctx.MkInt(2) }); - Expr q2 = q.Args()[1]; - Sort qs = q2.Sort(); + Expr q = ctx.mkAdd(ctx.mkInt(1), ctx.mkInt(2)); + Expr q2 = q.getArgs()[1]; + Sort qs = q2.getSort(); if (qs.getClass() != IntSort.class) throw new TestFailedException(); try { + @SuppressWarnings("unused") IntSort isrt = (IntSort) qs; } catch (ClassCastException e) { throw new TestFailedException(); } - AST a = ctx.MkInt(42); + AST a = ctx.mkInt(42); try { @@ -1036,16 +1017,17 @@ class JavaExample Expr[][] earr = new Expr[2][]; earr[0] = new Expr[2]; earr[1] = new Expr[2]; - earr[0][0] = ctx.MkTrue(); - earr[0][1] = ctx.MkTrue(); - earr[1][0] = ctx.MkFalse(); - earr[1][1] = ctx.MkFalse(); + earr[0][0] = ctx.mkTrue(); + earr[0][1] = ctx.mkTrue(); + earr[1][0] = ctx.mkFalse(); + earr[1][1] = ctx.mkFalse(); for (Expr[] ea : earr) for (Expr e : ea) { try { - Expr ns = ctx.MkNot((BoolExpr) e); + Expr ns = ctx.mkNot((BoolExpr) e); + @SuppressWarnings("unused") BoolExpr ens = (BoolExpr) ns; } catch (ClassCastException ex) { @@ -1056,23 +1038,23 @@ class JavaExample // / Shows how to read an SMT1 file. - void SMT1FileTest(String filename) throws Z3Exception + void smt1FileTest(String filename) throws Z3Exception { System.out.print("SMT File test "); { HashMap cfg = new HashMap(); Context ctx = new Context(cfg); - ctx.ParseSMTLIBFile(filename, null, null, null, null); + ctx.parseSMTLIBFile(filename, null, null, null, null); - BoolExpr a = ctx.MkAnd(ctx.SMTLIBFormulas()); + BoolExpr a = ctx.mkAnd(ctx.getSMTLIBFormulas()); System.out.println("read formula: " + a); } } // / Shows how to read an SMT2 file. - void SMT2FileTest(String filename) throws Z3Exception + void smt2FileTest(String filename) throws Z3Exception { Date before = new Date(); @@ -1083,7 +1065,7 @@ class JavaExample HashMap cfg = new HashMap(); cfg.put("model", "true"); Context ctx = new Context(cfg); - Expr a = ctx.ParseSMTLIB2File(filename, null, null, null, null); + Expr a = ctx.parseSMTLIB2File(filename, null, null, null, null); long t_diff = ((new Date()).getTime() - before.getTime()) / 1000; @@ -1100,8 +1082,8 @@ class JavaExample cnt++; if (cur.getClass() == Expr.class) - if (!(cur.IsVar())) - for (Expr c : ((Expr) cur).Args()) + if (!(cur.isVar())) + for (Expr c : ((Expr) cur).getArgs()) q.add(c); } System.out.println(cnt + " ASTs"); @@ -1114,120 +1096,120 @@ class JavaExample // / Shows how to use Solver(logic) // / - void LogicExample(Context ctx) throws Z3Exception, TestFailedException + void logicExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("LogicTest"); - Log.Append("LogicTest"); + Log.append("LogicTest"); Context.ToggleWarningMessages(true); - BitVecSort bvs = ctx.MkBitVecSort(32); - Expr x = ctx.MkConst("x", bvs); - Expr y = ctx.MkConst("y", bvs); - BoolExpr eq = ctx.MkEq(x, y); + BitVecSort bvs = ctx.mkBitVecSort(32); + Expr x = ctx.mkConst("x", bvs); + Expr y = ctx.mkConst("y", bvs); + BoolExpr eq = ctx.mkEq(x, y); // Use a solver for QF_BV - Solver s = ctx.MkSolver("QF_BV"); - s.Assert(eq); - Status res = s.Check(); + Solver s = ctx.mkSolver("QF_BV"); + s.assert_(eq); + Status res = s.check(); System.out.println("solver result: " + res); // Or perhaps a tactic for QF_BV - Goal g = ctx.MkGoal(true, false, false); - g.Assert(eq); + Goal g = ctx.mkGoal(true, false, false); + g.assert_(eq); - Tactic t = ctx.MkTactic("qfbv"); - ApplyResult ar = t.Apply(g); + Tactic t = ctx.mkTactic("qfbv"); + ApplyResult ar = t.apply(g); System.out.println("tactic result: " + ar); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedSat()) + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) throw new TestFailedException(); } // / Demonstrates how to use the ParOr tactic. - void ParOrExample(Context ctx) throws Z3Exception, TestFailedException + void parOrExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ParOrExample"); - Log.Append("ParOrExample"); + Log.append("ParOrExample"); - BitVecSort bvs = ctx.MkBitVecSort(32); - Expr x = ctx.MkConst("x", bvs); - Expr y = ctx.MkConst("y", bvs); - BoolExpr q = ctx.MkEq(x, y); + BitVecSort bvs = ctx.mkBitVecSort(32); + Expr x = ctx.mkConst("x", bvs); + Expr y = ctx.mkConst("y", bvs); + BoolExpr q = ctx.mkEq(x, y); - Goal g = ctx.MkGoal(true, false, false); - g.Assert(q); + Goal g = ctx.mkGoal(true, false, false); + g.assert_(q); - Tactic t1 = ctx.MkTactic("qfbv"); - Tactic t2 = ctx.MkTactic("qfbv"); - Tactic p = ctx.ParOr(new Tactic[] { t1, t2 }); + Tactic t1 = ctx.mkTactic("qfbv"); + Tactic t2 = ctx.mkTactic("qfbv"); + Tactic p = ctx.parOr(t1, t2); - ApplyResult ar = p.Apply(g); + ApplyResult ar = p.apply(g); - if (ar.NumSubgoals() != 1 || !ar.Subgoals()[0].IsDecidedSat()) + if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) throw new TestFailedException(); } - void BigIntCheck(Context ctx, RatNum r) throws Z3Exception + void bigIntCheck(Context ctx, RatNum r) throws Z3Exception { - System.out.println("Num: " + r.BigIntNumerator()); - System.out.println("Den: " + r.BigIntDenominator()); + System.out.println("Num: " + r.getBigIntNumerator()); + System.out.println("Den: " + r.getBigIntDenominator()); } // / Find a model for x xor y. - public void FindModelExample1(Context ctx) throws Z3Exception, + public void findModelExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("FindModelExample1"); - Log.Append("FindModelExample1"); + Log.append("FindModelExample1"); - BoolExpr x = ctx.MkBoolConst("x"); - BoolExpr y = ctx.MkBoolConst("y"); - BoolExpr x_xor_y = ctx.MkXor(x, y); + BoolExpr x = ctx.mkBoolConst("x"); + BoolExpr y = ctx.mkBoolConst("y"); + BoolExpr x_xor_y = ctx.mkXor(x, y); - Model model = Check(ctx, x_xor_y, Status.SATISFIABLE); - System.out.println("x = " + model.Evaluate(x, false) + ", y = " - + model.Evaluate(y, false)); + Model model = check(ctx, x_xor_y, Status.SATISFIABLE); + System.out.println("x = " + model.evaluate(x, false) + ", y = " + + model.evaluate(y, false)); } // / Find a model for x < y + 1, x > 2. // / Then, assert not(x = y), and find another model. - public void FindModelExample2(Context ctx) throws Z3Exception, + public void findModelExample2(Context ctx) throws Z3Exception, TestFailedException { System.out.println("FindModelExample2"); - Log.Append("FindModelExample2"); + Log.append("FindModelExample2"); - IntExpr x = ctx.MkIntConst("x"); - IntExpr y = ctx.MkIntConst("y"); - IntExpr one = ctx.MkInt(1); - IntExpr two = ctx.MkInt(2); + IntExpr x = ctx.mkIntConst("x"); + IntExpr y = ctx.mkIntConst("y"); + IntExpr one = ctx.mkInt(1); + IntExpr two = ctx.mkInt(2); - ArithExpr y_plus_one = ctx.MkAdd(new ArithExpr[] { y, one }); + ArithExpr y_plus_one = ctx.mkAdd(y, one); - BoolExpr c1 = ctx.MkLt(x, y_plus_one); - BoolExpr c2 = ctx.MkGt(x, two); + BoolExpr c1 = ctx.mkLt(x, y_plus_one); + BoolExpr c2 = ctx.mkGt(x, two); - BoolExpr q = ctx.MkAnd(new BoolExpr[] { c1, c2 }); + BoolExpr q = ctx.mkAnd(c1, c2); System.out.println("model for: x < y + 1, x > 2"); - Model model = Check(ctx, q, Status.SATISFIABLE); - System.out.println("x = " + model.Evaluate(x, false) + ", y =" - + model.Evaluate(y, false)); + Model model = check(ctx, q, Status.SATISFIABLE); + System.out.println("x = " + model.evaluate(x, false) + ", y =" + + model.evaluate(y, false)); /* assert not(x = y) */ - BoolExpr x_eq_y = ctx.MkEq(x, y); - BoolExpr c3 = ctx.MkNot(x_eq_y); + BoolExpr x_eq_y = ctx.mkEq(x, y); + BoolExpr c3 = ctx.mkNot(x_eq_y); - q = ctx.MkAnd(new BoolExpr[] { q, c3 }); + q = ctx.mkAnd(q, c3); System.out.println("model for: x < y + 1, x > 2, not(x = y)"); - model = Check(ctx, q, Status.SATISFIABLE); - System.out.println("x = " + model.Evaluate(x, false) + ", y = " - + model.Evaluate(y, false)); + model = check(ctx, q, Status.SATISFIABLE); + System.out.println("x = " + model.evaluate(x, false) + ", y = " + + model.evaluate(y, false)); } // / Prove x = y implies g(x) = g(y), and @@ -1235,43 +1217,43 @@ class JavaExample // / This function demonstrates how to create uninterpreted // / types and functions. - public void ProveExample1(Context ctx) throws Z3Exception, + public void proveExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ProveExample1"); - Log.Append("ProveExample1"); + Log.append("ProveExample1"); /* create uninterpreted type. */ - Sort U = ctx.MkUninterpretedSort(ctx.MkSymbol("U")); + Sort U = ctx.mkUninterpretedSort(ctx.mkSymbol("U")); /* declare function g */ - FuncDecl g = ctx.MkFuncDecl("g", U, U); + FuncDecl g = ctx.mkFuncDecl("g", U, U); /* create x and y */ - Expr x = ctx.MkConst("x", U); - Expr y = ctx.MkConst("y", U); + Expr x = ctx.mkConst("x", U); + Expr y = ctx.mkConst("y", U); /* create g(x), g(y) */ - Expr gx = g.Apply(x); - Expr gy = g.Apply(y); + Expr gx = g.apply(x); + Expr gy = g.apply(y); /* assert x = y */ - BoolExpr eq = ctx.MkEq(x, y); + BoolExpr eq = ctx.mkEq(x, y); /* prove g(x) = g(y) */ - BoolExpr f = ctx.MkEq(gx, gy); + BoolExpr f = ctx.mkEq(gx, gy); System.out.println("prove: x = y implies g(x) = g(y)"); - Prove(ctx, ctx.MkImplies(eq, f), false); + prove(ctx, ctx.mkImplies(eq, f), false); /* create g(g(x)) */ - Expr ggx = g.Apply(gx); + Expr ggx = g.apply(gx); /* disprove g(g(x)) = g(y) */ - f = ctx.MkEq(ggx, gy); + f = ctx.mkEq(ggx, gy); System.out.println("disprove: x = y implies g(g(x)) = g(y)"); - Disprove(ctx, ctx.MkImplies(eq, f), false); + disprove(ctx, ctx.mkImplies(eq, f), false); /* Print the model using the custom model printer */ - Model m = Check(ctx, ctx.MkNot(f), Status.SATISFIABLE); + Model m = check(ctx, ctx.mkNot(f), Status.SATISFIABLE); System.out.println(m); } @@ -1282,97 +1264,96 @@ class JavaExample // / This example demonstrates how to combine uninterpreted // functions // / and arithmetic. - public void ProveExample2(Context ctx) throws Z3Exception, + public void proveExample2(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ProveExample2"); - Log.Append("ProveExample2"); + Log.append("ProveExample2"); /* declare function g */ - Sort I = ctx.IntSort(); + Sort I = ctx.getIntSort(); - FuncDecl g = ctx.MkFuncDecl("g", I, I); + FuncDecl g = ctx.mkFuncDecl("g", I, I); /* create x, y, and z */ - IntExpr x = ctx.MkIntConst("x"); - IntExpr y = ctx.MkIntConst("y"); - IntExpr z = ctx.MkIntConst("z"); + IntExpr x = ctx.mkIntConst("x"); + IntExpr y = ctx.mkIntConst("y"); + IntExpr z = ctx.mkIntConst("z"); /* create gx, gy, gz */ - Expr gx = ctx.MkApp(g, x); - Expr gy = ctx.MkApp(g, y); - Expr gz = ctx.MkApp(g, z); + Expr gx = ctx.mkApp(g, x); + Expr gy = ctx.mkApp(g, y); + Expr gz = ctx.mkApp(g, z); /* create zero */ - IntExpr zero = ctx.MkInt(0); + IntExpr zero = ctx.mkInt(0); /* assert not(g(g(x) - g(y)) = g(z)) */ - ArithExpr gx_gy = ctx.MkSub(new ArithExpr[] { (IntExpr) gx, - (IntExpr) gy }); - Expr ggx_gy = ctx.MkApp(g, gx_gy); - BoolExpr eq = ctx.MkEq(ggx_gy, gz); - BoolExpr c1 = ctx.MkNot(eq); + ArithExpr gx_gy = ctx.mkSub((IntExpr) gx, (IntExpr) gy); + Expr ggx_gy = ctx.mkApp(g, gx_gy); + BoolExpr eq = ctx.mkEq(ggx_gy, gz); + BoolExpr c1 = ctx.mkNot(eq); /* assert x + z <= y */ - ArithExpr x_plus_z = ctx.MkAdd(new ArithExpr[] { x, z }); - BoolExpr c2 = ctx.MkLe(x_plus_z, y); + ArithExpr x_plus_z = ctx.mkAdd(x, z); + BoolExpr c2 = ctx.mkLe(x_plus_z, y); /* assert y <= x */ - BoolExpr c3 = ctx.MkLe(y, x); + BoolExpr c3 = ctx.mkLe(y, x); /* prove z < 0 */ - BoolExpr f = ctx.MkLt(z, zero); + BoolExpr f = ctx.mkLt(z, zero); System.out .println("prove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0"); - Prove(ctx, f, false, new BoolExpr[] { c1, c2, c3 }); + prove(ctx, f, false, c1, c2, c3); /* disprove z < -1 */ - IntExpr minus_one = ctx.MkInt(-1); - f = ctx.MkLt(z, minus_one); + IntExpr minus_one = ctx.mkInt(-1); + f = ctx.mkLt(z, minus_one); System.out .println("disprove: not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < -1"); - Disprove(ctx, f, false, new BoolExpr[] { c1, c2, c3 }); + disprove(ctx, f, false, c1, c2, c3); } // / Show how push & pop can be used to create "backtracking" points. // / This example also demonstrates how big numbers can be // / created in ctx. - public void PushPopExample1(Context ctx) throws Z3Exception, + public void pushPopExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("PushPopExample1"); - Log.Append("PushPopExample1"); + Log.append("PushPopExample1"); /* create a big number */ - IntSort int_type = ctx.IntSort(); + IntSort int_type = ctx.getIntSort(); IntExpr big_number = ctx - .MkInt("1000000000000000000000000000000000000000000000000000000"); + .mkInt("1000000000000000000000000000000000000000000000000000000"); /* create number 3 */ - IntExpr three = (IntExpr) ctx.MkNumeral("3", int_type); + IntExpr three = (IntExpr) ctx.mkNumeral("3", int_type); /* create x */ - IntExpr x = ctx.MkIntConst("x"); + IntExpr x = ctx.mkIntConst("x"); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); /* assert x >= "big number" */ - BoolExpr c1 = ctx.MkGe(x, big_number); + BoolExpr c1 = ctx.mkGe(x, big_number); System.out.println("assert: x >= 'big number'"); - solver.Assert(c1); + solver.assert_(c1); /* create a backtracking point */ System.out.println("push"); - solver.Push(); + solver.push(); /* assert x <= 3 */ - BoolExpr c2 = ctx.MkLe(x, three); + BoolExpr c2 = ctx.mkLe(x, three); System.out.println("assert: x <= 3"); - solver.Assert(c2); + solver.assert_(c2); /* context is inconsistent at this point */ - if (solver.Check() != Status.UNSATISFIABLE) + if (solver.check() != Status.UNSATISFIABLE) throw new TestFailedException(); /* @@ -1380,24 +1361,24 @@ class JavaExample * asserted after the last ctx.Push. */ System.out.println("pop"); - solver.Pop(1); + solver.pop(1); /* the context is consistent again. */ - if (solver.Check() != Status.SATISFIABLE) + if (solver.check() != Status.SATISFIABLE) throw new TestFailedException(); /* new constraints can be asserted... */ /* create y */ - IntExpr y = ctx.MkIntConst("y"); + IntExpr y = ctx.mkIntConst("y"); /* assert y > x */ - BoolExpr c3 = ctx.MkGt(y, x); + BoolExpr c3 = ctx.mkGt(y, x); System.out.println("assert: y > x"); - solver.Assert(c3); + solver.assert_(c3); /* the context is still consistent. */ - if (solver.Check() != Status.SATISFIABLE) + if (solver.check() != Status.SATISFIABLE) throw new TestFailedException(); } @@ -1405,33 +1386,34 @@ class JavaExample // / Check that the projection of a tuple // / returns the corresponding element. - public void TupleExample(Context ctx) throws Z3Exception, + public void tupleExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("TupleExample"); - Log.Append("TupleExample"); + Log.append("TupleExample"); - Sort int_type = ctx.IntSort(); - TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of + Sort int_type = ctx.getIntSort(); + TupleSort tuple = ctx.mkTupleSort(ctx.mkSymbol("mk_tuple"), // name of // tuple // constructor - new Symbol[] { ctx.MkSymbol("first"), ctx.MkSymbol("second") }, // names + new Symbol[] { ctx.mkSymbol("first"), ctx.mkSymbol("second") }, // names // of // projection // operators new Sort[] { int_type, int_type } // types of projection // operators ); - FuncDecl first = tuple.FieldDecls()[0]; // declarations are for - // projections - FuncDecl second = tuple.FieldDecls()[1]; - Expr x = ctx.MkConst("x", int_type); - Expr y = ctx.MkConst("y", int_type); - Expr n1 = tuple.MkDecl().Apply(new Expr[] { x, y }); - Expr n2 = first.Apply(n1); - BoolExpr n3 = ctx.MkEq(x, n2); + FuncDecl first = tuple.getFieldDecls()[0]; // declarations are for + // projections + @SuppressWarnings("unused") + FuncDecl second = tuple.getFieldDecls()[1]; + Expr x = ctx.mkConst("x", int_type); + Expr y = ctx.mkConst("y", int_type); + Expr n1 = tuple.mkDecl().apply(x, y); + Expr n2 = first.apply(n1); + BoolExpr n3 = ctx.mkEq(x, n2); System.out.println("Tuple example: " + n3); - Prove(ctx, n3, false); + prove(ctx, n3, false); } // / Simple bit-vector example. @@ -1440,132 +1422,133 @@ class JavaExample // / This example disproves that x - 10 <= 0 IFF x <= 10 for (32-bit) // machine integers // / - public void BitvectorExample1(Context ctx) throws Z3Exception, + public void bitvectorExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("BitvectorExample1"); - Log.Append("BitvectorExample1"); + Log.append("BitvectorExample1"); - Sort bv_type = ctx.MkBitVecSort(32); - BitVecExpr x = (BitVecExpr) ctx.MkConst("x", bv_type); - BitVecNum zero = (BitVecNum) ctx.MkNumeral("0", bv_type); - BitVecNum ten = ctx.MkBV(10, 32); - BitVecExpr x_minus_ten = ctx.MkBVSub(x, ten); + Sort bv_type = ctx.mkBitVecSort(32); + BitVecExpr x = (BitVecExpr) ctx.mkConst("x", bv_type); + BitVecNum zero = (BitVecNum) ctx.mkNumeral("0", bv_type); + BitVecNum ten = ctx.mkBV(10, 32); + BitVecExpr x_minus_ten = ctx.mkBVSub(x, ten); /* bvsle is signed less than or equal to */ - BoolExpr c1 = ctx.MkBVSLE(x, ten); - BoolExpr c2 = ctx.MkBVSLE(x_minus_ten, zero); - BoolExpr thm = ctx.MkIff(c1, c2); + BoolExpr c1 = ctx.mkBVSLE(x, ten); + BoolExpr c2 = ctx.mkBVSLE(x_minus_ten, zero); + BoolExpr thm = ctx.mkIff(c1, c2); System.out .println("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers"); - Disprove(ctx, thm, false); + disprove(ctx, thm, false); } // / Find x and y such that: x ^ y - 103 == x * y - public void BitvectorExample2(Context ctx) throws Z3Exception, + public void bitvectorExample2(Context ctx) throws Z3Exception, TestFailedException { System.out.println("BitvectorExample2"); - Log.Append("BitvectorExample2"); + Log.append("BitvectorExample2"); /* construct x ^ y - 103 == x * y */ - Sort bv_type = ctx.MkBitVecSort(32); - BitVecExpr x = ctx.MkBVConst("x", 32); - BitVecExpr y = ctx.MkBVConst("y", 32); - BitVecExpr x_xor_y = ctx.MkBVXOR(x, y); - BitVecExpr c103 = (BitVecNum) ctx.MkNumeral("103", bv_type); - BitVecExpr lhs = ctx.MkBVSub(x_xor_y, c103); - BitVecExpr rhs = ctx.MkBVMul(x, y); - BoolExpr ctr = ctx.MkEq(lhs, rhs); + Sort bv_type = ctx.mkBitVecSort(32); + BitVecExpr x = ctx.mkBVConst("x", 32); + BitVecExpr y = ctx.mkBVConst("y", 32); + BitVecExpr x_xor_y = ctx.mkBVXOR(x, y); + BitVecExpr c103 = (BitVecNum) ctx.mkNumeral("103", bv_type); + BitVecExpr lhs = ctx.mkBVSub(x_xor_y, c103); + BitVecExpr rhs = ctx.mkBVMul(x, y); + BoolExpr ctr = ctx.mkEq(lhs, rhs); System.out .println("find values of x and y, such that x ^ y - 103 == x * y"); /* find a model (i.e., values for x an y that satisfy the constraint */ - Model m = Check(ctx, ctr, Status.SATISFIABLE); + Model m = check(ctx, ctr, Status.SATISFIABLE); System.out.println(m); } // / Demonstrates how to use the SMTLIB parser. - public void ParserExample1(Context ctx) throws Z3Exception, + public void parserExample1(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ParserExample1"); - Log.Append("ParserExample1"); + Log.append("ParserExample1"); - ctx.ParseSMTLIBString( + ctx.parseSMTLIBString( "(benchmark tst :extrafuns ((x Int) (y Int)) :formula (> x y) :formula (> x 0))", null, null, null, null); - for (BoolExpr f : ctx.SMTLIBFormulas()) + for (BoolExpr f : ctx.getSMTLIBFormulas()) System.out.println("formula " + f); - Model m = Check(ctx, ctx.MkAnd(ctx.SMTLIBFormulas()), + @SuppressWarnings("unused") + Model m = check(ctx, ctx.mkAnd(ctx.getSMTLIBFormulas()), Status.SATISFIABLE); } // / Demonstrates how to initialize the parser symbol table. - public void ParserExample2(Context ctx) throws Z3Exception, + public void parserExample2(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ParserExample2"); - Log.Append("ParserExample2"); + Log.append("ParserExample2"); - Symbol[] declNames = { ctx.MkSymbol("a"), ctx.MkSymbol("b") }; - FuncDecl a = ctx.MkConstDecl(declNames[0], ctx.MkIntSort()); - FuncDecl b = ctx.MkConstDecl(declNames[1], ctx.MkIntSort()); + Symbol[] declNames = { ctx.mkSymbol("a"), ctx.mkSymbol("b") }; + FuncDecl a = ctx.mkConstDecl(declNames[0], ctx.mkIntSort()); + FuncDecl b = ctx.mkConstDecl(declNames[1], ctx.mkIntSort()); FuncDecl[] decls = new FuncDecl[] { a, b }; - ctx.ParseSMTLIBString("(benchmark tst :formula (> a b))", null, null, + ctx.parseSMTLIBString("(benchmark tst :formula (> a b))", null, null, declNames, decls); - BoolExpr f = ctx.SMTLIBFormulas()[0]; + BoolExpr f = ctx.getSMTLIBFormulas()[0]; System.out.println("formula: " + f); - Check(ctx, f, Status.SATISFIABLE); + check(ctx, f, Status.SATISFIABLE); } // / Demonstrates how to initialize the parser symbol table. - public void ParserExample3(Context ctx) throws Exception + public void parserExample3(Context ctx) throws Exception { System.out.println("ParserExample3"); - Log.Append("ParserExample3"); + Log.append("ParserExample3"); /* declare function g */ - Sort I = ctx.MkIntSort(); - FuncDecl g = ctx.MkFuncDecl("g", new Sort[] { I, I }, I); + Sort I = ctx.mkIntSort(); + FuncDecl g = ctx.mkFuncDecl("g", new Sort[] { I, I }, I); - BoolExpr ca = CommAxiom(ctx, g); + BoolExpr ca = commAxiom(ctx, g); - ctx.ParseSMTLIBString( + ctx.parseSMTLIBString( "(benchmark tst :formula (forall (x Int) (y Int) (implies (= x y) (= (gg x 0) (gg 0 y)))))", - null, null, new Symbol[] { ctx.MkSymbol("gg") }, + null, null, new Symbol[] { ctx.mkSymbol("gg") }, new FuncDecl[] { g }); - BoolExpr thm = ctx.SMTLIBFormulas()[0]; + BoolExpr thm = ctx.getSMTLIBFormulas()[0]; System.out.println("formula: " + thm); - Prove(ctx, thm, false, ca); + prove(ctx, thm, false, ca); } // / Display the declarations, assumptions and formulas in a SMT-LIB string. - public void ParserExample4(Context ctx) throws Z3Exception + public void parserExample4(Context ctx) throws Z3Exception { System.out.println("ParserExample4"); - Log.Append("ParserExample4"); + Log.append("ParserExample4"); - ctx.ParseSMTLIBString( + ctx.parseSMTLIBString( "(benchmark tst :extrafuns ((x Int) (y Int)) :assumption (= x 20) :formula (> x y) :formula (> x 0))", null, null, null, null); - for (FuncDecl decl : ctx.SMTLIBDecls()) + for (FuncDecl decl : ctx.getSMTLIBDecls()) { System.out.println("Declaration: " + decl); } - for (BoolExpr f : ctx.SMTLIBAssumptions()) + for (BoolExpr f : ctx.getSMTLIBAssumptions()) { System.out.println("Assumption: " + f); } - for (BoolExpr f : ctx.SMTLIBFormulas()) + for (BoolExpr f : ctx.getSMTLIBFormulas()) { System.out.println("Formula: " + f); } @@ -1575,13 +1558,13 @@ class JavaExample // support. // / - public void ParserExample5(Context ctx) + public void parserExample5(Context ctx) { System.out.println("ParserExample5"); try { - ctx.ParseSMTLIBString( + ctx.parseSMTLIBString( /* * the following string has a parsing error: missing * parenthesis @@ -1596,141 +1579,138 @@ class JavaExample // / Create an ite-Expr (if-then-else Exprs). - public void ITEExample(Context ctx) throws Z3Exception + public void iteExample(Context ctx) throws Z3Exception { System.out.println("ITEExample"); - Log.Append("ITEExample"); + Log.append("ITEExample"); - BoolExpr f = ctx.MkFalse(); - Expr one = ctx.MkInt(1); - Expr zero = ctx.MkInt(0); - Expr ite = ctx.MkITE(f, one, zero); + BoolExpr f = ctx.mkFalse(); + Expr one = ctx.mkInt(1); + Expr zero = ctx.mkInt(0); + Expr ite = ctx.mkITE(f, one, zero); System.out.println("Expr: " + ite); } // / Create an enumeration data type. - public void EnumExample(Context ctx) throws Z3Exception, + public void enumExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("EnumExample"); - Log.Append("EnumExample"); + Log.append("EnumExample"); - Symbol name = ctx.MkSymbol("fruit"); + Symbol name = ctx.mkSymbol("fruit"); - EnumSort fruit = ctx.MkEnumSort(name, - new Symbol[] { ctx.MkSymbol("apple"), ctx.MkSymbol("banana"), - ctx.MkSymbol("orange") }); + EnumSort fruit = ctx.mkEnumSort(name, ctx.mkSymbol("apple"), + ctx.mkSymbol("banana"), ctx.mkSymbol("orange")); - System.out.println((fruit.Consts()[0])); - System.out.println((fruit.Consts()[1])); - System.out.println((fruit.Consts()[2])); + System.out.println((fruit.getConsts()[0])); + System.out.println((fruit.getConsts()[1])); + System.out.println((fruit.getConsts()[2])); - System.out.println((fruit.TesterDecls()[0])); - System.out.println((fruit.TesterDecls()[1])); - System.out.println((fruit.TesterDecls()[2])); + System.out.println((fruit.getTesterDecls()[0])); + System.out.println((fruit.getTesterDecls()[1])); + System.out.println((fruit.getTesterDecls()[2])); - Expr apple = fruit.Consts()[0]; - Expr banana = fruit.Consts()[1]; - Expr orange = fruit.Consts()[2]; + Expr apple = fruit.getConsts()[0]; + Expr banana = fruit.getConsts()[1]; + Expr orange = fruit.getConsts()[2]; /* Apples are different from oranges */ - Prove(ctx, ctx.MkNot(ctx.MkEq(apple, orange)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(apple, orange)), false); /* Apples pass the apple test */ - Prove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], apple), false); + prove(ctx, (BoolExpr) ctx.mkApp(fruit.getTesterDecls()[0], apple), + false); /* Oranges fail the apple test */ - Disprove(ctx, (BoolExpr) ctx.MkApp(fruit.TesterDecls()[0], orange), + disprove(ctx, (BoolExpr) ctx.mkApp(fruit.getTesterDecls()[0], orange), false); - Prove(ctx, (BoolExpr) ctx.MkNot((BoolExpr) ctx.MkApp( - fruit.TesterDecls()[0], orange)), false); + prove(ctx, + (BoolExpr) ctx.mkNot((BoolExpr) ctx.mkApp( + fruit.getTesterDecls()[0], orange)), false); - Expr fruity = ctx.MkConst("fruity", fruit); + Expr fruity = ctx.mkConst("fruity", fruit); /* If something is fruity, then it is an apple, banana, or orange */ - Prove(ctx, - ctx.MkOr(new BoolExpr[] { ctx.MkEq(fruity, apple), - ctx.MkEq(fruity, banana), ctx.MkEq(fruity, orange) }), - false); + prove(ctx, + ctx.mkOr(ctx.mkEq(fruity, apple), ctx.mkEq(fruity, banana), + ctx.mkEq(fruity, orange)), false); } // / Create a list datatype. - public void ListExample(Context ctx) throws Z3Exception, + public void listExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ListExample"); - Log.Append("ListExample"); + Log.append("ListExample"); Sort int_ty; ListSort int_list; Expr nil, l1, l2, x, y, u, v; BoolExpr fml, fml1; - int_ty = ctx.MkIntSort(); + int_ty = ctx.mkIntSort(); - int_list = ctx.MkListSort(ctx.MkSymbol("int_list"), int_ty); + int_list = ctx.mkListSort(ctx.mkSymbol("int_list"), int_ty); - nil = ctx.MkConst(int_list.NilDecl()); - l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { ctx.MkInt(1), nil }); - l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { ctx.MkInt(2), nil }); + nil = ctx.mkConst(int_list.getNilDecl()); + l1 = ctx.mkApp(int_list.getConsDecl(), ctx.mkInt(1), nil); + l2 = ctx.mkApp(int_list.getConsDecl(), ctx.mkInt(2), nil); /* nil != cons(1, nil) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(nil, l1)), false); /* cons(2,nil) != cons(1, nil) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(l1, l2)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(l1, l2)), false); /* cons(x,nil) = cons(y, nil) => x = y */ - x = ctx.MkConst("x", int_ty); - y = ctx.MkConst("y", int_ty); - l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, nil }); - l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, nil }); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false); + x = ctx.mkConst("x", int_ty); + y = ctx.mkConst("y", int_ty); + l1 = ctx.mkApp(int_list.getConsDecl(), x, nil); + l2 = ctx.mkApp(int_list.getConsDecl(), y, nil); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(x, y)), false); /* cons(x,u) = cons(x, v) => u = v */ - u = ctx.MkConst("u", int_list); - v = ctx.MkConst("v", int_list); - l1 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { x, u }); - l2 = ctx.MkApp(int_list.ConsDecl(), new Expr[] { y, v }); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false); + u = ctx.mkConst("u", int_list); + v = ctx.mkConst("v", int_list); + l1 = ctx.mkApp(int_list.getConsDecl(), x, u); + l2 = ctx.mkApp(int_list.getConsDecl(), y, v); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(u, v)), false); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(x, y)), false); /* is_nil(u) or is_cons(u) */ - Prove(ctx, - ctx.MkOr(new BoolExpr[] { - (BoolExpr) ctx.MkApp(int_list.IsNilDecl(), - new Expr[] { u }), - (BoolExpr) ctx.MkApp(int_list.IsConsDecl(), - new Expr[] { u }) }), false); + prove(ctx, ctx.mkOr((BoolExpr) ctx.mkApp(int_list.getIsNilDecl(), u), + (BoolExpr) ctx.mkApp(int_list.getIsConsDecl(), u)), false); /* occurs check u != cons(x,u) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(u, l1)), false); /* destructors: is_cons(u) => u = cons(head(u),tail(u)) */ - fml1 = ctx.MkEq(u, ctx.MkApp(int_list.ConsDecl(), - new Expr[] { ctx.MkApp(int_list.HeadDecl(), new Expr[] { u }), - ctx.MkApp(int_list.TailDecl(), new Expr[] { u }) })); - fml = ctx.MkImplies( - (BoolExpr) ctx.MkApp(int_list.IsConsDecl(), new Expr[] { u }), + fml1 = ctx.mkEq( + u, + ctx.mkApp(int_list.getConsDecl(), + ctx.mkApp(int_list.getHeadDecl(), u), + ctx.mkApp(int_list.getTailDecl(), u))); + fml = ctx.mkImplies((BoolExpr) ctx.mkApp(int_list.getIsConsDecl(), u), fml1); System.out.println("Formula " + fml); - Prove(ctx, fml, false); + prove(ctx, fml, false); - Disprove(ctx, fml1, false); + disprove(ctx, fml1, false); } // / Create a binary tree datatype. - public void TreeExample(Context ctx) throws Z3Exception, + public void treeExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("TreeExample"); - Log.Append("TreeExample"); + Log.append("TreeExample"); Sort cell; FuncDecl nil_decl, is_nil_decl, cons_decl, is_cons_decl, car_decl, cdr_decl; @@ -1741,60 +1721,56 @@ class JavaExample int[] sort_refs = new int[] { 0, 0 }; Constructor nil_con, cons_con; - nil_con = ctx.MkConstructor("nil", "is_nil", null, null, null); - cons_con = ctx.MkConstructor("cons", "is_cons", head_tail, sorts, + nil_con = ctx.mkConstructor("nil", "is_nil", null, null, null); + cons_con = ctx.mkConstructor("cons", "is_cons", head_tail, sorts, sort_refs); Constructor[] constructors = new Constructor[] { nil_con, cons_con }; - cell = ctx.MkDatatypeSort("cell", constructors); + cell = ctx.mkDatatypeSort("cell", constructors); nil_decl = nil_con.ConstructorDecl(); - is_nil_decl = nil_con.TesterDecl(); + is_nil_decl = nil_con.getTesterDecl(); cons_decl = cons_con.ConstructorDecl(); - is_cons_decl = cons_con.TesterDecl(); - FuncDecl[] cons_accessors = cons_con.AccessorDecls(); + is_cons_decl = cons_con.getTesterDecl(); + FuncDecl[] cons_accessors = cons_con.getAccessorDecls(); car_decl = cons_accessors[0]; cdr_decl = cons_accessors[1]; - nil = ctx.MkConst(nil_decl); - l1 = ctx.MkApp(cons_decl, new Expr[] { nil, nil }); - l2 = ctx.MkApp(cons_decl, new Expr[] { l1, nil }); + nil = ctx.mkConst(nil_decl); + l1 = ctx.mkApp(cons_decl, nil, nil); + l2 = ctx.mkApp(cons_decl, l1, nil); /* nil != cons(nil, nil) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(nil, l1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(nil, l1)), false); /* cons(x,u) = cons(x, v) => u = v */ - u = ctx.MkConst("u", cell); - v = ctx.MkConst("v", cell); - x = ctx.MkConst("x", cell); - y = ctx.MkConst("y", cell); - l1 = ctx.MkApp(cons_decl, new Expr[] { x, u }); - l2 = ctx.MkApp(cons_decl, new Expr[] { y, v }); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false); + u = ctx.mkConst("u", cell); + v = ctx.mkConst("v", cell); + x = ctx.mkConst("x", cell); + y = ctx.mkConst("y", cell); + l1 = ctx.mkApp(cons_decl, x, u); + l2 = ctx.mkApp(cons_decl, y, v); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(u, v)), false); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(x, y)), false); /* is_nil(u) or is_cons(u) */ - Prove(ctx, - ctx.MkOr(new BoolExpr[] { - (BoolExpr) ctx.MkApp(is_nil_decl, new Expr[] { u }), - (BoolExpr) ctx.MkApp(is_cons_decl, new Expr[] { u }) }), - false); + prove(ctx, + ctx.mkOr((BoolExpr) ctx.mkApp(is_nil_decl, u), + (BoolExpr) ctx.mkApp(is_cons_decl, u)), false); /* occurs check u != cons(x,u) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(u, l1)), false); /* destructors: is_cons(u) => u = cons(car(u),cdr(u)) */ - fml1 = ctx.MkEq( + fml1 = ctx.mkEq( u, - ctx.MkApp( - cons_decl, - new Expr[] { ctx.MkApp(car_decl, u), - ctx.MkApp(cdr_decl, u) })); - fml = ctx.MkImplies((BoolExpr) ctx.MkApp(is_cons_decl, u), fml1); + ctx.mkApp(cons_decl, ctx.mkApp(car_decl, u), + ctx.mkApp(cdr_decl, u))); + fml = ctx.mkImplies((BoolExpr) ctx.mkApp(is_cons_decl, u), fml1); System.out.println("Formula " + fml); - Prove(ctx, fml, false); + prove(ctx, fml, false); - Disprove(ctx, fml1, false); + disprove(ctx, fml1, false); } // / Create a forest of trees. @@ -1803,15 +1779,18 @@ class JavaExample // / forest ::= nil | cons(tree, forest) // / tree ::= nil | cons(forest, forest) // / - public void ForestExample(Context ctx) throws Z3Exception, + public void forestExample(Context ctx) throws Z3Exception, TestFailedException { System.out.println("ForestExample"); - Log.Append("ForestExample"); + Log.append("ForestExample"); Sort tree, forest; + @SuppressWarnings("unused") FuncDecl nil1_decl, is_nil1_decl, cons1_decl, is_cons1_decl, car1_decl, cdr1_decl; + @SuppressWarnings("unused") FuncDecl nil2_decl, is_nil2_decl, cons2_decl, is_cons2_decl, car2_decl, cdr2_decl; + @SuppressWarnings("unused") Expr nil1, nil2, t1, t2, t3, t4, f1, f2, f3, l1, l2, x, y, u, v; // @@ -1826,41 +1805,41 @@ class JavaExample // array // points to 'forest', which has index 0. // - Symbol[] head_tail1 = new Symbol[] { ctx.MkSymbol("head"), - ctx.MkSymbol("tail") }; + Symbol[] head_tail1 = new Symbol[] { ctx.mkSymbol("head"), + ctx.mkSymbol("tail") }; Sort[] sorts1 = new Sort[] { null, null }; int[] sort1_refs = new int[] { 1, 0 }; // the first item points to a // tree, the second to a forest - Symbol[] head_tail2 = new Symbol[] { ctx.MkSymbol("car"), - ctx.MkSymbol("cdr") }; + Symbol[] head_tail2 = new Symbol[] { ctx.mkSymbol("car"), + ctx.mkSymbol("cdr") }; Sort[] sorts2 = new Sort[] { null, null }; int[] sort2_refs = new int[] { 0, 0 }; // both items point to the forest // datatype. Constructor nil1_con, cons1_con, nil2_con, cons2_con; Constructor[] constructors1 = new Constructor[2], constructors2 = new Constructor[2]; - Symbol[] sort_names = { ctx.MkSymbol("forest"), ctx.MkSymbol("tree") }; + Symbol[] sort_names = { ctx.mkSymbol("forest"), ctx.mkSymbol("tree") }; /* build a forest */ - nil1_con = ctx.MkConstructor(ctx.MkSymbol("nil"), - ctx.MkSymbol("is_nil"), null, null, null); - cons1_con = ctx.MkConstructor(ctx.MkSymbol("cons1"), - ctx.MkSymbol("is_cons1"), head_tail1, sorts1, sort1_refs); + nil1_con = ctx.mkConstructor(ctx.mkSymbol("nil"), + ctx.mkSymbol("is_nil"), null, null, null); + cons1_con = ctx.mkConstructor(ctx.mkSymbol("cons1"), + ctx.mkSymbol("is_cons1"), head_tail1, sorts1, sort1_refs); constructors1[0] = nil1_con; constructors1[1] = cons1_con; /* build a tree */ - nil2_con = ctx.MkConstructor(ctx.MkSymbol("nil2"), - ctx.MkSymbol("is_nil2"), null, null, null); - cons2_con = ctx.MkConstructor(ctx.MkSymbol("cons2"), - ctx.MkSymbol("is_cons2"), head_tail2, sorts2, sort2_refs); + nil2_con = ctx.mkConstructor(ctx.mkSymbol("nil2"), + ctx.mkSymbol("is_nil2"), null, null, null); + cons2_con = ctx.mkConstructor(ctx.mkSymbol("cons2"), + ctx.mkSymbol("is_cons2"), head_tail2, sorts2, sort2_refs); constructors2[0] = nil2_con; constructors2[1] = cons2_con; Constructor[][] clists = new Constructor[][] { constructors1, constructors2 }; - Sort[] sorts = ctx.MkDatatypeSorts(sort_names, clists); + Sort[] sorts = ctx.mkDatatypeSorts(sort_names, clists); forest = sorts[0]; tree = sorts[1]; @@ -1870,81 +1849,81 @@ class JavaExample // functions, testers, and field accessors. // nil1_decl = nil1_con.ConstructorDecl(); - is_nil1_decl = nil1_con.TesterDecl(); + is_nil1_decl = nil1_con.getTesterDecl(); cons1_decl = cons1_con.ConstructorDecl(); - is_cons1_decl = cons1_con.TesterDecl(); - FuncDecl[] cons1_accessors = cons1_con.AccessorDecls(); + is_cons1_decl = cons1_con.getTesterDecl(); + FuncDecl[] cons1_accessors = cons1_con.getAccessorDecls(); car1_decl = cons1_accessors[0]; cdr1_decl = cons1_accessors[1]; nil2_decl = nil2_con.ConstructorDecl(); - is_nil2_decl = nil2_con.TesterDecl(); + is_nil2_decl = nil2_con.getTesterDecl(); cons2_decl = cons2_con.ConstructorDecl(); - is_cons2_decl = cons2_con.TesterDecl(); - FuncDecl[] cons2_accessors = cons2_con.AccessorDecls(); + is_cons2_decl = cons2_con.getTesterDecl(); + FuncDecl[] cons2_accessors = cons2_con.getAccessorDecls(); car2_decl = cons2_accessors[0]; cdr2_decl = cons2_accessors[1]; - nil1 = ctx.MkConst(nil1_decl); - nil2 = ctx.MkConst(nil2_decl); - f1 = ctx.MkApp(cons1_decl, new Expr[] { nil2, nil1 }); - t1 = ctx.MkApp(cons2_decl, new Expr[] { nil1, nil1 }); - t2 = ctx.MkApp(cons2_decl, new Expr[] { f1, nil1 }); - t3 = ctx.MkApp(cons2_decl, new Expr[] { f1, f1 }); - t4 = ctx.MkApp(cons2_decl, new Expr[] { nil1, f1 }); - f2 = ctx.MkApp(cons1_decl, new Expr[] { t1, nil1 }); - f3 = ctx.MkApp(cons1_decl, new Expr[] { t1, f1 }); + nil1 = ctx.mkConst(nil1_decl); + nil2 = ctx.mkConst(nil2_decl); + f1 = ctx.mkApp(cons1_decl, nil2, nil1); + t1 = ctx.mkApp(cons2_decl, nil1, nil1); + t2 = ctx.mkApp(cons2_decl, f1, nil1); + t3 = ctx.mkApp(cons2_decl, f1, f1); + t4 = ctx.mkApp(cons2_decl, nil1, f1); + f2 = ctx.mkApp(cons1_decl, t1, nil1); + f3 = ctx.mkApp(cons1_decl, t1, f1); /* nil != cons(nil,nil) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(nil1, f1)), false); - Prove(ctx, ctx.MkNot(ctx.MkEq(nil2, t1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(nil1, f1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(nil2, t1)), false); /* cons(x,u) = cons(x, v) => u = v */ - u = ctx.MkConst("u", forest); - v = ctx.MkConst("v", forest); - x = ctx.MkConst("x", tree); - y = ctx.MkConst("y", tree); - l1 = ctx.MkApp(cons1_decl, new Expr[] { x, u }); - l2 = ctx.MkApp(cons1_decl, new Expr[] { y, v }); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(u, v)), false); - Prove(ctx, ctx.MkImplies(ctx.MkEq(l1, l2), ctx.MkEq(x, y)), false); + u = ctx.mkConst("u", forest); + v = ctx.mkConst("v", forest); + x = ctx.mkConst("x", tree); + y = ctx.mkConst("y", tree); + l1 = ctx.mkApp(cons1_decl, x, u); + l2 = ctx.mkApp(cons1_decl, y, v); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(u, v)), false); + prove(ctx, ctx.mkImplies(ctx.mkEq(l1, l2), ctx.mkEq(x, y)), false); /* is_nil(u) or is_cons(u) */ - Prove(ctx, ctx.MkOr(new BoolExpr[] { - (BoolExpr) ctx.MkApp(is_nil1_decl, new Expr[] { u }), - (BoolExpr) ctx.MkApp(is_cons1_decl, new Expr[] { u }) }), false); + prove(ctx, + ctx.mkOr((BoolExpr) ctx.mkApp(is_nil1_decl, u), + (BoolExpr) ctx.mkApp(is_cons1_decl, u)), false); /* occurs check u != cons(x,u) */ - Prove(ctx, ctx.MkNot(ctx.MkEq(u, l1)), false); + prove(ctx, ctx.mkNot(ctx.mkEq(u, l1)), false); } // / Demonstrate how to use #Eval. - public void EvalExample1(Context ctx) throws Z3Exception + public void evalExample1(Context ctx) throws Z3Exception { System.out.println("EvalExample1"); - Log.Append("EvalExample1"); + Log.append("EvalExample1"); - IntExpr x = ctx.MkIntConst("x"); - IntExpr y = ctx.MkIntConst("y"); - IntExpr two = ctx.MkInt(2); + IntExpr x = ctx.mkIntConst("x"); + IntExpr y = ctx.mkIntConst("y"); + IntExpr two = ctx.mkInt(2); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); /* assert x < y */ - solver.Assert(ctx.MkLt(x, y)); + solver.assert_(ctx.mkLt(x, y)); /* assert x > 2 */ - solver.Assert(ctx.MkGt(x, two)); + solver.assert_(ctx.mkGt(x, two)); /* find model for the constraints above */ Model model = null; - if (Status.SATISFIABLE == solver.Check()) + if (Status.SATISFIABLE == solver.check()) { - model = solver.Model(); + model = solver.getModel(); System.out.println(model); System.out.println("\nevaluating x+y"); - Expr v = model.Evaluate(ctx.MkAdd(new ArithExpr[] { x, y }), false); + Expr v = model.evaluate(ctx.mkAdd(x, y), false); if (v != null) { System.out.println("result = " + (v)); @@ -1960,47 +1939,47 @@ class JavaExample // / Demonstrate how to use #Eval on tuples. - public void EvalExample2(Context ctx) throws Z3Exception + public void evalExample2(Context ctx) throws Z3Exception { System.out.println("EvalExample2"); - Log.Append("EvalExample2"); + Log.append("EvalExample2"); - Sort int_type = ctx.IntSort(); - TupleSort tuple = ctx.MkTupleSort(ctx.MkSymbol("mk_tuple"), // name of + Sort int_type = ctx.getIntSort(); + TupleSort tuple = ctx.mkTupleSort(ctx.mkSymbol("mk_tuple"), // name of // tuple // constructor - new Symbol[] { ctx.MkSymbol("first"), ctx.MkSymbol("second") }, // names + new Symbol[] { ctx.mkSymbol("first"), ctx.mkSymbol("second") }, // names // of // projection // operators new Sort[] { int_type, int_type } // types of projection // operators ); - FuncDecl first = tuple.FieldDecls()[0]; // declarations are for - // projections - FuncDecl second = tuple.FieldDecls()[1]; - Expr tup1 = ctx.MkConst("t1", tuple); - Expr tup2 = ctx.MkConst("t2", tuple); + FuncDecl first = tuple.getFieldDecls()[0]; // declarations are for + // projections + FuncDecl second = tuple.getFieldDecls()[1]; + Expr tup1 = ctx.mkConst("t1", tuple); + Expr tup2 = ctx.mkConst("t2", tuple); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); /* assert tup1 != tup2 */ - solver.Assert(ctx.MkNot(ctx.MkEq(tup1, tup2))); + solver.assert_(ctx.mkNot(ctx.mkEq(tup1, tup2))); /* assert first tup1 = first tup2 */ - solver.Assert(ctx.MkEq(ctx.MkApp(first, tup1), ctx.MkApp(first, tup2))); + solver.assert_(ctx.mkEq(ctx.mkApp(first, tup1), ctx.mkApp(first, tup2))); /* find model for the constraints above */ Model model = null; - if (Status.SATISFIABLE == solver.Check()) + if (Status.SATISFIABLE == solver.check()) { - model = solver.Model(); + model = solver.getModel(); System.out.println(model); System.out.println("evaluating tup1 " - + (model.Evaluate(tup1, false))); + + (model.evaluate(tup1, false))); System.out.println("evaluating tup2 " - + (model.Evaluate(tup2, false))); + + (model.evaluate(tup2, false))); System.out.println("evaluating second(tup2) " - + (model.Evaluate(ctx.MkApp(second, tup2), false))); + + (model.evaluate(ctx.mkApp(second, tup2), false))); } else { System.out.println("BUG, the constraints are satisfiable."); @@ -2011,8 +1990,8 @@ class JavaExample // / control the size of models. // / Note: this test is specialized to 32-bit bitvectors. - public void CheckSmall(Context ctx, Solver solver, BitVecExpr[] to_minimize) - throws Z3Exception + public void checkSmall(Context ctx, Solver solver, + BitVecExpr... to_minimize) throws Z3Exception { int num_Exprs = to_minimize.length; int[] upper = new int[num_Exprs]; @@ -2027,7 +2006,7 @@ class JavaExample int last_upper = 0; while (some_work) { - solver.Push(); + solver.push(); boolean check_is_sat = true; while (check_is_sat && some_work) @@ -2035,11 +2014,11 @@ class JavaExample // Assert all feasible bounds. for (int i = 0; i < num_Exprs; ++i) { - solver.Assert(ctx.MkBVULE(to_minimize[i], - ctx.MkBV(upper[i], 32))); + solver.assert_(ctx.mkBVULE(to_minimize[i], + ctx.mkBV(upper[i], 32))); } - check_is_sat = Status.SATISFIABLE == solver.Check(); + check_is_sat = Status.SATISFIABLE == solver.check(); if (!check_is_sat) { if (last_index != -1) @@ -2048,13 +2027,13 @@ class JavaExample } break; } - System.out.println(solver.Model()); + System.out.println(solver.getModel()); // narrow the bounds based on the current model. for (int i = 0; i < num_Exprs; ++i) { - Expr v = solver.Model().Evaluate(to_minimize[i], false); - int ui = ((BitVecNum) v).Int(); + Expr v = solver.getModel().evaluate(to_minimize[i], false); + int ui = ((BitVecNum) v).getInt(); if (ui < upper[i]) { upper[i] = (int) ui; @@ -2071,113 +2050,111 @@ class JavaExample { last_upper = (upper[i] + lower[i]) / 2; last_index = i; - solver.Assert(ctx.MkBVULE(to_minimize[i], - ctx.MkBV(last_upper, 32))); + solver.assert_(ctx.mkBVULE(to_minimize[i], + ctx.mkBV(last_upper, 32))); some_work = true; break; } } } - solver.Pop(); + solver.pop(); } } // / Reduced-size model generation example. - public void FindSmallModelExample(Context ctx) throws Z3Exception + public void findSmallModelExample(Context ctx) throws Z3Exception { System.out.println("FindSmallModelExample"); - Log.Append("FindSmallModelExample"); + Log.append("FindSmallModelExample"); - BitVecExpr x = ctx.MkBVConst("x", 32); - BitVecExpr y = ctx.MkBVConst("y", 32); - BitVecExpr z = ctx.MkBVConst("z", 32); + BitVecExpr x = ctx.mkBVConst("x", 32); + BitVecExpr y = ctx.mkBVConst("y", 32); + BitVecExpr z = ctx.mkBVConst("z", 32); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); - solver.Assert(ctx.MkBVULE(x, ctx.MkBVAdd(y, z))); - CheckSmall(ctx, solver, new BitVecExpr[] { x, y, z }); + solver.assert_(ctx.mkBVULE(x, ctx.mkBVAdd(y, z))); + checkSmall(ctx, solver, x, y, z); } // / Simplifier example. - public void SimplifierExample(Context ctx) throws Z3Exception + public void simplifierExample(Context ctx) throws Z3Exception { System.out.println("SimplifierExample"); - Log.Append("SimplifierExample"); + Log.append("SimplifierExample"); - IntExpr x = ctx.MkIntConst("x"); - IntExpr y = ctx.MkIntConst("y"); - IntExpr z = ctx.MkIntConst("z"); - IntExpr u = ctx.MkIntConst("u"); + IntExpr x = ctx.mkIntConst("x"); + IntExpr y = ctx.mkIntConst("y"); + IntExpr z = ctx.mkIntConst("z"); + @SuppressWarnings("unused") + IntExpr u = ctx.mkIntConst("u"); - Expr t1 = ctx.MkAdd(new ArithExpr[] { - x, - ctx.MkSub(new ArithExpr[] { y, - ctx.MkAdd(new ArithExpr[] { x, z }) }) }); - Expr t2 = t1.Simplify(); + Expr t1 = ctx.mkAdd(x, ctx.mkSub(y, ctx.mkAdd(x, z))); + Expr t2 = t1.simplify(); System.out.println((t1) + " -> " + (t2)); } // / Extract unsatisfiable core example - public void UnsatCoreAndProofExample(Context ctx) throws Z3Exception + public void unsatCoreAndProofExample(Context ctx) throws Z3Exception { System.out.println("UnsatCoreAndProofExample"); - Log.Append("UnsatCoreAndProofExample"); + Log.append("UnsatCoreAndProofExample"); - Solver solver = ctx.MkSolver(); + Solver solver = ctx.mkSolver(); - BoolExpr pa = ctx.MkBoolConst("PredA"); - BoolExpr pb = ctx.MkBoolConst("PredB"); - BoolExpr pc = ctx.MkBoolConst("PredC"); - BoolExpr pd = ctx.MkBoolConst("PredD"); - BoolExpr p1 = ctx.MkBoolConst("P1"); - BoolExpr p2 = ctx.MkBoolConst("P2"); - BoolExpr p3 = ctx.MkBoolConst("P3"); - BoolExpr p4 = ctx.MkBoolConst("P4"); - BoolExpr[] assumptions = new BoolExpr[] { ctx.MkNot(p1), ctx.MkNot(p2), - ctx.MkNot(p3), ctx.MkNot(p4) }; - BoolExpr f1 = ctx.MkAnd(new BoolExpr[] { pa, pb, pc }); - BoolExpr f2 = ctx.MkAnd(new BoolExpr[] { pa, ctx.MkNot(pb), pc }); - BoolExpr f3 = ctx.MkOr(new BoolExpr[] { ctx.MkNot(pa), ctx.MkNot(pc) }); + BoolExpr pa = ctx.mkBoolConst("PredA"); + BoolExpr pb = ctx.mkBoolConst("PredB"); + BoolExpr pc = ctx.mkBoolConst("PredC"); + BoolExpr pd = ctx.mkBoolConst("PredD"); + BoolExpr p1 = ctx.mkBoolConst("P1"); + BoolExpr p2 = ctx.mkBoolConst("P2"); + BoolExpr p3 = ctx.mkBoolConst("P3"); + BoolExpr p4 = ctx.mkBoolConst("P4"); + BoolExpr[] assumptions = new BoolExpr[] { ctx.mkNot(p1), ctx.mkNot(p2), + ctx.mkNot(p3), ctx.mkNot(p4) }; + BoolExpr f1 = ctx.mkAnd(pa, pb, pc); + BoolExpr f2 = ctx.mkAnd(pa, ctx.mkNot(pb), pc); + BoolExpr f3 = ctx.mkOr(ctx.mkNot(pa), ctx.mkNot(pc)); BoolExpr f4 = pd; - solver.Assert(ctx.MkOr(new BoolExpr[] { f1, p1 })); - solver.Assert(ctx.MkOr(new BoolExpr[] { f2, p2 })); - solver.Assert(ctx.MkOr(new BoolExpr[] { f3, p3 })); - solver.Assert(ctx.MkOr(new BoolExpr[] { f4, p4 })); - Status result = solver.Check(assumptions); + solver.assert_(ctx.mkOr(f1, p1)); + solver.assert_(ctx.mkOr(f2, p2)); + solver.assert_(ctx.mkOr(f3, p3)); + solver.assert_(ctx.mkOr(f4, p4)); + Status result = solver.check(assumptions); if (result == Status.UNSATISFIABLE) { System.out.println("unsat"); - System.out.println("proof: " + solver.Proof()); + System.out.println("proof: " + solver.getProof()); System.out.println("core: "); - for (Expr c : solver.UnsatCore()) + for (Expr c : solver.getUnsatCore()) { System.out.println(c); } } } - public void FiniteDomainExample(Context ctx) throws Z3Exception + public void finiteDomainExample(Context ctx) throws Z3Exception { System.out.println("FiniteDomainExample"); - Log.Append("FiniteDomainExample"); + Log.append("FiniteDomainExample"); - FiniteDomainSort s = ctx.MkFiniteDomainSort("S", 10); - FiniteDomainSort t = ctx.MkFiniteDomainSort("T", 10); - Expr s1 = ctx.MkNumeral(1, s); - Expr t1 = ctx.MkNumeral(1, t); + FiniteDomainSort s = ctx.mkFiniteDomainSort("S", 10); + FiniteDomainSort t = ctx.mkFiniteDomainSort("T", 10); + Expr s1 = ctx.mkNumeral(1, s); + Expr t1 = ctx.mkNumeral(1, t); System.out.println(s); System.out.println(t); System.out.println(s1); - System.out.println(ctx.MkNumeral(2, s)); + System.out.println(ctx.mkNumeral(2, s)); System.out.println(t1); // But you cannot mix numerals of different sorts // even if the size of their domains are the same: - // System.out.println(ctx.MkEq(s1, t1)); + // System.out.println(ctx.mkEq(s1, t1)); } public static void main(String[] args) @@ -2186,59 +2163,59 @@ class JavaExample try { Context.ToggleWarningMessages(true); - Log.Open("test.log"); + Log.open("test.log"); System.out.print("Z3 Major Version: "); - System.out.println(Version.Major()); + System.out.println(Version.getMajor()); System.out.print("Z3 Full Version: "); System.out.println(Version.getString()); - p.SimpleExample(); + p.simpleExample(); { // These examples need model generation turned on. HashMap cfg = new HashMap(); cfg.put("model", "true"); Context ctx = new Context(cfg); - p.BasicTests(ctx); - p.CastingTest(ctx); - p.SudokuExample(ctx); - p.QuantifierExample1(ctx); - p.QuantifierExample2(ctx); - p.LogicExample(ctx); - p.ParOrExample(ctx); - p.FindModelExample1(ctx); - p.FindModelExample2(ctx); - p.PushPopExample1(ctx); - p.ArrayExample1(ctx); - p.ArrayExample3(ctx); - p.BitvectorExample1(ctx); - p.BitvectorExample2(ctx); - p.ParserExample1(ctx); - p.ParserExample2(ctx); - p.ParserExample4(ctx); - p.ParserExample5(ctx); - p.ITEExample(ctx); - p.EvalExample1(ctx); - p.EvalExample2(ctx); - p.FindSmallModelExample(ctx); - p.SimplifierExample(ctx); - p.FiniteDomainExample(ctx); + p.basicTests(ctx); + p.castingTest(ctx); + p.sudokuExample(ctx); + p.quantifierExample1(ctx); + p.quantifierExample2(ctx); + p.logicExample(ctx); + p.parOrExample(ctx); + p.findModelExample1(ctx); + p.findModelExample2(ctx); + p.pushPopExample1(ctx); + p.arrayExample1(ctx); + p.arrayExample3(ctx); + p.bitvectorExample1(ctx); + p.bitvectorExample2(ctx); + p.parserExample1(ctx); + p.parserExample2(ctx); + p.parserExample4(ctx); + p.parserExample5(ctx); + p.iteExample(ctx); + p.evalExample1(ctx); + p.evalExample2(ctx); + p.findSmallModelExample(ctx); + p.simplifierExample(ctx); + p.finiteDomainExample(ctx); } { // These examples need proof generation turned on. HashMap cfg = new HashMap(); cfg.put("proof", "true"); Context ctx = new Context(cfg); - p.ProveExample1(ctx); - p.ProveExample2(ctx); - p.ArrayExample2(ctx); - p.TupleExample(ctx); - p.ParserExample3(ctx); - p.EnumExample(ctx); - p.ListExample(ctx); - p.TreeExample(ctx); - p.ForestExample(ctx); - p.UnsatCoreAndProofExample(ctx); + p.proveExample1(ctx); + p.proveExample2(ctx); + p.arrayExample2(ctx); + p.tupleExample(ctx); + p.parserExample3(ctx); + p.enumExample(ctx); + p.listExample(ctx); + p.treeExample(ctx); + p.forestExample(ctx); + p.unsatCoreAndProofExample(ctx); } { // These examples need proof generation turned on and auto-config @@ -2247,11 +2224,11 @@ class JavaExample cfg.put("proof", "true"); cfg.put("auto-config", "false"); Context ctx = new Context(cfg); - p.QuantifierExample3(ctx); - p.QuantifierExample4(ctx); + p.quantifierExample3(ctx); + p.quantifierExample4(ctx); } - Log.Close(); + Log.close(); if (Log.isOpen()) System.out.println("Log is still open!"); } catch (Z3Exception ex) diff --git a/src/api/java/AST.java b/src/api/java/AST.java index 60ff48ecb..fa5cd8284 100644 --- a/src/api/java/AST.java +++ b/src/api/java/AST.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_ast_kind; /** * The abstract syntax tree (AST) class. @@ -47,7 +47,7 @@ public class AST extends Z3Object return false; } - return this.NativeObject() == casted.NativeObject(); + return this.getNativeObject() == casted.getNativeObject(); } /** @@ -70,9 +70,9 @@ public class AST extends Z3Object return 1; } - if (Id() < oAST.Id()) + if (getId() < oAST.getId()) return -1; - else if (Id() > oAST.Id()) + else if (getId() > oAST.getId()) return +1; else return 0; @@ -83,17 +83,22 @@ public class AST extends Z3Object * * @return A hash code **/ - public int GetHashCode() throws Z3Exception + public int hashCode() { - return (int) Native.getAstHash(Context().nCtx(), NativeObject()); + int r = 0; + try { + Native.getAstHash(getContext().nCtx(), getNativeObject()); + } + catch (Z3Exception ex) {} + return r; } /** * A unique identifier for the AST (unique among all ASTs). **/ - public int Id() throws Z3Exception + public int getId() throws Z3Exception { - return Native.getAstId(Context().nCtx(), NativeObject()); + return Native.getAstId(getContext().nCtx(), getNativeObject()); } /** @@ -102,31 +107,31 @@ public class AST extends Z3Object * * @return A copy of the AST which is associated with **/ - public AST Translate(Context ctx) throws Z3Exception + public AST translate(Context ctx) throws Z3Exception { - if (Context() == ctx) + if (getContext() == ctx) return this; else - return new AST(ctx, Native.translate(Context().nCtx(), - NativeObject(), ctx.nCtx())); + return new AST(ctx, Native.translate(getContext().nCtx(), + getNativeObject(), ctx.nCtx())); } /** * The kind of the AST. **/ - public Z3_ast_kind ASTKind() throws Z3Exception + public Z3_ast_kind getASTKind() throws Z3Exception { - return Z3_ast_kind.fromInt(Native.getAstKind(Context().nCtx(), - NativeObject())); + return Z3_ast_kind.fromInt(Native.getAstKind(getContext().nCtx(), + getNativeObject())); } /** * Indicates whether the AST is an Expr **/ - public boolean IsExpr() throws Z3Exception + public boolean isExpr() throws Z3Exception { - switch (ASTKind()) + switch (getASTKind()) { case Z3_APP_AST: case Z3_NUMERAL_AST: @@ -141,41 +146,41 @@ public class AST extends Z3Object /** * Indicates whether the AST is an application **/ - public boolean IsApp() throws Z3Exception + public boolean isApp() throws Z3Exception { - return this.ASTKind() == Z3_ast_kind.Z3_APP_AST; + return this.getASTKind() == Z3_ast_kind.Z3_APP_AST; } /** * Indicates whether the AST is a BoundVariable **/ - public boolean IsVar() throws Z3Exception + public boolean isVar() throws Z3Exception { - return this.ASTKind() == Z3_ast_kind.Z3_VAR_AST; + return this.getASTKind() == Z3_ast_kind.Z3_VAR_AST; } /** * Indicates whether the AST is a Quantifier **/ - public boolean IsQuantifier() throws Z3Exception + public boolean isQuantifier() throws Z3Exception { - return this.ASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST; + return this.getASTKind() == Z3_ast_kind.Z3_QUANTIFIER_AST; } /** * Indicates whether the AST is a Sort **/ - public boolean IsSort() throws Z3Exception + public boolean isSort() throws Z3Exception { - return this.ASTKind() == Z3_ast_kind.Z3_SORT_AST; + return this.getASTKind() == Z3_ast_kind.Z3_SORT_AST; } /** * Indicates whether the AST is a FunctionDeclaration **/ - public boolean IsFuncDecl() throws Z3Exception + public boolean isFuncDecl() throws Z3Exception { - return this.ASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST; + return this.getASTKind() == Z3_ast_kind.Z3_FUNC_DECL_AST; } /** @@ -185,7 +190,7 @@ public class AST extends Z3Object { try { - return Native.astToString(Context().nCtx(), NativeObject()); + return Native.astToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -195,9 +200,9 @@ public class AST extends Z3Object /** * A string representation of the AST in s-expression notation. **/ - public String SExpr() throws Z3Exception + public String getSExpr() throws Z3Exception { - return Native.astToString(Context().nCtx(), NativeObject()); + return Native.astToString(getContext().nCtx(), getNativeObject()); } AST(Context ctx) @@ -210,29 +215,29 @@ public class AST extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { // Console.WriteLine("AST IncRef()"); - if (Context() == null) + if (getContext() == 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); + getContext().ast_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { // Console.WriteLine("AST DecRef()"); - if (Context() == null) + if (getContext() == 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); + getContext().ast_DRQ().add(o); + super.decRef(o); } - static AST Create(Context ctx, long obj) throws Z3Exception + static AST create(Context ctx, long obj) throws Z3Exception { switch (Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj))) { @@ -241,11 +246,11 @@ public class AST extends Z3Object case Z3_QUANTIFIER_AST: return new Quantifier(ctx, obj); case Z3_SORT_AST: - return Sort.Create(ctx, obj); + return Sort.create(ctx, obj); case Z3_APP_AST: case Z3_NUMERAL_AST: case Z3_VAR_AST: - return Expr.Create(ctx, obj); + return Expr.create(ctx, obj); default: throw new Z3Exception("Unknown AST kind"); } diff --git a/src/api/java/ASTDecRefQueue.java b/src/api/java/ASTDecRefQueue.java index f66c54006..e0711363d 100644 --- a/src/api/java/ASTDecRefQueue.java +++ b/src/api/java/ASTDecRefQueue.java @@ -5,9 +5,9 @@ package com.microsoft.z3; -public class ASTDecRefQueue extends IDecRefQueue +class ASTDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ public class ASTDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/ASTMap.java b/src/api/java/ASTMap.java index c40c4c6b8..dbe7fbd02 100644 --- a/src/api/java/ASTMap.java +++ b/src/api/java/ASTMap.java @@ -18,11 +18,11 @@ class ASTMap extends Z3Object * @return True if is a key in the map, false * otherwise. **/ - public boolean Contains(AST k) throws Z3Exception + public boolean contains(AST k) throws Z3Exception { - return Native.astMapContains(Context().nCtx(), NativeObject(), - k.NativeObject()); + return Native.astMapContains(getContext().nCtx(), getNativeObject(), + k.getNativeObject()); } /** @@ -32,47 +32,47 @@ class ASTMap extends Z3Object * * @throws Z3Exception **/ - public AST Find(AST k) throws Z3Exception + public AST find(AST k) throws Z3Exception { - return new AST(Context(), Native.astMapFind(Context().nCtx(), - NativeObject(), k.NativeObject())); + return new AST(getContext(), Native.astMapFind(getContext().nCtx(), + getNativeObject(), k.getNativeObject())); } /** * Stores or replaces a new key/value pair in the map. The * key AST The value AST **/ - public void Insert(AST k, AST v) throws Z3Exception + public void insert(AST k, AST v) throws Z3Exception { - Native.astMapInsert(Context().nCtx(), NativeObject(), k.NativeObject(), - v.NativeObject()); + Native.astMapInsert(getContext().nCtx(), getNativeObject(), k.getNativeObject(), + v.getNativeObject()); } /** * Erases the key from the map. An * AST **/ - public void Erase(AST k) throws Z3Exception + public void erase(AST k) throws Z3Exception { - Native.astMapErase(Context().nCtx(), NativeObject(), k.NativeObject()); + Native.astMapErase(getContext().nCtx(), getNativeObject(), k.getNativeObject()); } /** * Removes all keys from the map. **/ - public void Reset() throws Z3Exception + public void reset() throws Z3Exception { - Native.astMapReset(Context().nCtx(), NativeObject()); + Native.astMapReset(getContext().nCtx(), getNativeObject()); } /** * The size of the map **/ - public int Size() throws Z3Exception + public int size() throws Z3Exception { - return Native.astMapSize(Context().nCtx(), NativeObject()); + return Native.astMapSize(getContext().nCtx(), getNativeObject()); } /** @@ -80,10 +80,10 @@ class ASTMap extends Z3Object * * @throws Z3Exception **/ - public ASTVector Keys() throws Z3Exception + public ASTVector getKeys() throws Z3Exception { - return new ASTVector(Context(), Native.astMapKeys(Context().nCtx(), - NativeObject())); + return new ASTVector(getContext(), Native.astMapKeys(getContext().nCtx(), + getNativeObject())); } /** @@ -93,7 +93,7 @@ class ASTMap extends Z3Object { try { - return Native.astMapToString(Context().nCtx(), NativeObject()); + return Native.astMapToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -110,15 +110,15 @@ class ASTMap extends Z3Object super(ctx, Native.mkAstMap(ctx.nCtx())); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().ASTMap_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().astmap_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().ASTMap_DRQ().Add(o); - super.DecRef(o); + getContext().astmap_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ASTVector.java b/src/api/java/ASTVector.java index 0e9cf1ae7..39e32f5d5 100644 --- a/src/api/java/ASTVector.java +++ b/src/api/java/ASTVector.java @@ -14,9 +14,9 @@ class ASTVector extends Z3Object /** * The size of the vector **/ - public int Size() throws Z3Exception + public int size() throws Z3Exception { - return Native.astVectorSize(Context().nCtx(), NativeObject()); + return Native.astVectorSize(getContext().nCtx(), getNativeObject()); } /** @@ -29,33 +29,33 @@ class ASTVector extends Z3Object **/ public AST get(int i) throws Z3Exception { - return new AST(Context(), Native.astVectorGet(Context().nCtx(), - NativeObject(), i)); + return new AST(getContext(), Native.astVectorGet(getContext().nCtx(), + getNativeObject(), i)); } public void set(int i, AST value) throws Z3Exception { - Native.astVectorSet(Context().nCtx(), NativeObject(), i, - value.NativeObject()); + Native.astVectorSet(getContext().nCtx(), getNativeObject(), i, + value.getNativeObject()); } /** * Resize the vector to . The new size of the vector. **/ - public void Resize(int newSize) throws Z3Exception + public void resize(int newSize) throws Z3Exception { - Native.astVectorResize(Context().nCtx(), NativeObject(), newSize); + Native.astVectorResize(getContext().nCtx(), getNativeObject(), newSize); } /** * Add the AST to the back of the vector. The size is * increased by 1. An AST **/ - public void Push(AST a) throws Z3Exception + public void push(AST a) throws Z3Exception { - Native.astVectorPush(Context().nCtx(), NativeObject(), a.NativeObject()); + Native.astVectorPush(getContext().nCtx(), getNativeObject(), a.getNativeObject()); } /** @@ -65,10 +65,10 @@ class ASTVector extends Z3Object * @return A new ASTVector * @throws Z3Exception **/ - public ASTVector Translate(Context ctx) throws Z3Exception + public ASTVector translate(Context ctx) throws Z3Exception { - return new ASTVector(Context(), Native.astVectorTranslate(Context() - .nCtx(), NativeObject(), ctx.nCtx())); + return new ASTVector(getContext(), Native.astVectorTranslate(getContext() + .nCtx(), getNativeObject(), ctx.nCtx())); } /** @@ -78,7 +78,7 @@ class ASTVector extends Z3Object { try { - return Native.astVectorToString(Context().nCtx(), NativeObject()); + return Native.astVectorToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -95,15 +95,15 @@ class ASTVector extends Z3Object super(ctx, Native.mkAstVector(ctx.nCtx())); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().ASTVector_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().astvector_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().ASTVector_DRQ().Add(o); - super.DecRef(o); + getContext().astvector_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/AlgebraicNum.java b/src/api/java/AlgebraicNum.java index 9aee64e65..eaeae933d 100644 --- a/src/api/java/AlgebraicNum.java +++ b/src/api/java/AlgebraicNum.java @@ -19,11 +19,11 @@ public class AlgebraicNum extends ArithExpr * * @return A numeral Expr of sort Real **/ - public RatNum ToUpper(int precision) throws Z3Exception + public RatNum toUpper(int precision) throws Z3Exception { - return new RatNum(Context(), Native.getAlgebraicNumberUpper(Context() - .nCtx(), NativeObject(), precision)); + return new RatNum(getContext(), Native.getAlgebraicNumberUpper(getContext() + .nCtx(), getNativeObject(), precision)); } /** @@ -33,21 +33,21 @@ public class AlgebraicNum extends ArithExpr * * @return A numeral Expr of sort Real **/ - public RatNum ToLower(int precision) throws Z3Exception + public RatNum toLower(int precision) throws Z3Exception { - return new RatNum(Context(), Native.getAlgebraicNumberLower(Context() - .nCtx(), NativeObject(), precision)); + return new RatNum(getContext(), Native.getAlgebraicNumberLower(getContext() + .nCtx(), getNativeObject(), precision)); } /** * Returns a string representation in decimal notation. The result * has at most decimal places. **/ - public String ToDecimal(int precision) throws Z3Exception + public String toDecimal(int precision) throws Z3Exception { - return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(), + return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(), precision); } diff --git a/src/api/java/ApplyResult.java b/src/api/java/ApplyResult.java index 31267b536..e6c6b89fd 100644 --- a/src/api/java/ApplyResult.java +++ b/src/api/java/ApplyResult.java @@ -15,10 +15,10 @@ public class ApplyResult extends Z3Object /** * The number of Subgoals. **/ - public int NumSubgoals() throws Z3Exception + public int getNumSubgoals() throws Z3Exception { - return Native.applyResultGetNumSubgoals(Context().nCtx(), - NativeObject()); + return Native.applyResultGetNumSubgoals(getContext().nCtx(), + getNativeObject()); } /** @@ -26,13 +26,13 @@ public class ApplyResult extends Z3Object * * @throws Z3Exception **/ - public Goal[] Subgoals() throws Z3Exception + public Goal[] getSubgoals() throws Z3Exception { - int n = NumSubgoals(); + int n = getNumSubgoals(); Goal[] res = new Goal[n]; for (int i = 0; i < n; i++) - res[i] = new Goal(Context(), Native.applyResultGetSubgoal(Context() - .nCtx(), NativeObject(), i)); + res[i] = new Goal(getContext(), + Native.applyResultGetSubgoal(getContext().nCtx(), getNativeObject(), i)); return res; } @@ -43,10 +43,10 @@ public class ApplyResult extends Z3Object * @return A model for g * @throws Z3Exception **/ - public Model ConvertModel(int i, Model m) throws Z3Exception + public Model convertModel(int i, Model m) throws Z3Exception { - return new Model(Context(), Native.applyResultConvertModel(Context() - .nCtx(), NativeObject(), i, m.NativeObject())); + return new Model(getContext(), + Native.applyResultConvertModel(getContext().nCtx(), getNativeObject(), i, m.getNativeObject())); } /** @@ -56,7 +56,7 @@ public class ApplyResult extends Z3Object { try { - return Native.applyResultToString(Context().nCtx(), NativeObject()); + return Native.applyResultToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -68,15 +68,15 @@ public class ApplyResult extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().ApplyResult_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().applyResult_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().ApplyResult_DRQ().Add(o); - super.DecRef(o); + getContext().applyResult_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ApplyResultDecRefQueue.java b/src/api/java/ApplyResultDecRefQueue.java index c459e85aa..275f4b8f0 100644 --- a/src/api/java/ApplyResultDecRefQueue.java +++ b/src/api/java/ApplyResultDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ApplyResultDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ApplyResultDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/ArraySort.java b/src/api/java/ArraySort.java index cd126443c..2ab8a9750 100644 --- a/src/api/java/ArraySort.java +++ b/src/api/java/ArraySort.java @@ -15,20 +15,20 @@ public class ArraySort extends Sort * The domain of the array sort. * @throws Z3Exception **/ - public Sort Domain() throws Z3Exception + public Sort getDomain() throws Z3Exception { - return Sort.Create(Context(), - Native.getArraySortDomain(Context().nCtx(), NativeObject())); + return Sort.create(getContext(), + Native.getArraySortDomain(getContext().nCtx(), getNativeObject())); } /** * The range of the array sort. * @throws Z3Exception **/ - public Sort Range() throws Z3Exception + public Sort getRange() throws Z3Exception { - return Sort.Create(Context(), - Native.getArraySortRange(Context().nCtx(), NativeObject())); + return Sort.create(getContext(), + Native.getArraySortRange(getContext().nCtx(), getNativeObject())); } ArraySort(Context ctx, long obj) throws Z3Exception @@ -38,7 +38,7 @@ public class ArraySort extends Sort ArraySort(Context ctx, Sort domain, Sort range) throws Z3Exception { - super(ctx, Native.mkArraySort(ctx.nCtx(), domain.NativeObject(), - range.NativeObject())); + super(ctx, Native.mkArraySort(ctx.nCtx(), domain.getNativeObject(), + range.getNativeObject())); } }; diff --git a/src/api/java/AstMapDecRefQueue.java b/src/api/java/AstMapDecRefQueue.java index d59074cdb..f4c6b2ab5 100644 --- a/src/api/java/AstMapDecRefQueue.java +++ b/src/api/java/AstMapDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ASTMapDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ASTMapDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/AstVectorDecRefQueue.java b/src/api/java/AstVectorDecRefQueue.java index d4b508a54..bdabcdcb1 100644 --- a/src/api/java/AstVectorDecRefQueue.java +++ b/src/api/java/AstVectorDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ASTVectorDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ASTVectorDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/BitVecExpr.java b/src/api/java/BitVecExpr.java index fb0f4d72a..9602ea3a0 100644 --- a/src/api/java/BitVecExpr.java +++ b/src/api/java/BitVecExpr.java @@ -16,15 +16,15 @@ public class BitVecExpr extends Expr * The size of the sort of a bit-vector term. * @throws Z3Exception **/ - public int SortSize() throws Z3Exception + public int getSortSize() throws Z3Exception { - return ((BitVecSort) Sort()).Size(); + return ((BitVecSort) getSort()).getSize(); } /** * Constructor for BitVecExpr **/ - protected BitVecExpr(Context ctx) + BitVecExpr(Context ctx) { super(ctx); } diff --git a/src/api/java/BitVecNum.java b/src/api/java/BitVecNum.java index 3560d5efa..7615308b7 100644 --- a/src/api/java/BitVecNum.java +++ b/src/api/java/BitVecNum.java @@ -18,10 +18,10 @@ public class BitVecNum extends BitVecExpr * * @throws Z3Exception **/ - public int Int() throws Z3Exception + public int getInt() throws Z3Exception { Native.IntPtr res = new Native.IntPtr(); - if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true) + if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true) throw new Z3Exception("Numeral is not an int"); return res.value; } @@ -31,10 +31,10 @@ public class BitVecNum extends BitVecExpr * * @throws Z3Exception **/ - public long Long() throws Z3Exception + public long getLong() throws Z3Exception { Native.LongPtr res = new Native.LongPtr(); - if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true) + if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true) throw new Z3Exception("Numeral is not an int64"); return res.value; } @@ -42,7 +42,7 @@ public class BitVecNum extends BitVecExpr /** * Retrieve the BigInteger value. **/ - public BigInteger BigInteger() + public BigInteger getBigInteger() { return new BigInteger(this.toString()); } @@ -54,7 +54,7 @@ public class BitVecNum extends BitVecExpr { try { - return Native.getNumeralString(Context().nCtx(), NativeObject()); + return Native.getNumeralString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); diff --git a/src/api/java/BitVecSort.java b/src/api/java/BitVecSort.java index 58781302e..c2ec4c26e 100644 --- a/src/api/java/BitVecSort.java +++ b/src/api/java/BitVecSort.java @@ -13,9 +13,9 @@ public class BitVecSort extends Sort /** * The size of the bit-vector sort. **/ - public int Size() throws Z3Exception + public int getSize() throws Z3Exception { - return Native.getBvSortSize(Context().nCtx(), NativeObject()); + return Native.getBvSortSize(getContext().nCtx(), getNativeObject()); } BitVecSort(Context ctx, long obj) throws Z3Exception diff --git a/src/api/java/Constructor.java b/src/api/java/Constructor.java index e267998a0..c12521bc5 100644 --- a/src/api/java/Constructor.java +++ b/src/api/java/Constructor.java @@ -15,7 +15,7 @@ public class Constructor extends Z3Object * The number of fields of the constructor. * @throws Z3Exception **/ - public int NumFields() throws Z3Exception + public int getNumFields() throws Z3Exception { init(); return n; @@ -35,7 +35,7 @@ public class Constructor extends Z3Object * The function declaration of the tester. * @throws Z3Exception **/ - public FuncDecl TesterDecl() throws Z3Exception + public FuncDecl getTesterDecl() throws Z3Exception { init(); return m_testerDecl; @@ -45,7 +45,7 @@ public class Constructor extends Z3Object * The function declarations of the accessors * @throws Z3Exception **/ - public FuncDecl[] AccessorDecls() throws Z3Exception + public FuncDecl[] getAccessorDecls() throws Z3Exception { init(); return m_accessorDecls; @@ -56,7 +56,7 @@ public class Constructor extends Z3Object **/ protected void finalize() throws Z3Exception { - Native.delConstructor(Context().nCtx(), NativeObject()); + Native.delConstructor(getContext().nCtx(), getNativeObject()); } private int n = 0; @@ -70,9 +70,9 @@ public class Constructor extends Z3Object { super(ctx); - n = AST.ArrayLength(fieldNames); + n = AST.arrayLength(fieldNames); - if (n != AST.ArrayLength(sorts)) + if (n != AST.arrayLength(sorts)) throw new Z3Exception( "Number of field names does not match number of sorts"); if (sortRefs != null && sortRefs.length != n) @@ -82,9 +82,9 @@ public class Constructor extends Z3Object if (sortRefs == null) sortRefs = new int[n]; - setNativeObject(Native.mkConstructor(ctx.nCtx(), name.NativeObject(), - recognizer.NativeObject(), n, Symbol.ArrayToNative(fieldNames), - Sort.ArrayToNative(sorts), sortRefs)); + setNativeObject(Native.mkConstructor(ctx.nCtx(), name.getNativeObject(), + recognizer.getNativeObject(), n, Symbol.arrayToNative(fieldNames), + Sort.arrayToNative(sorts), sortRefs)); } @@ -95,13 +95,13 @@ public class Constructor extends Z3Object Native.LongPtr constructor = new Native.LongPtr(); Native.LongPtr tester = new Native.LongPtr(); long[] accessors = new long[n]; - Native.queryConstructor(Context().nCtx(), NativeObject(), n, + Native.queryConstructor(getContext().nCtx(), getNativeObject(), n, constructor, tester, accessors); - m_constructorDecl = new FuncDecl(Context(), constructor.value); - m_testerDecl = new FuncDecl(Context(), tester.value); + m_constructorDecl = new FuncDecl(getContext(), constructor.value); + m_testerDecl = new FuncDecl(getContext(), tester.value); m_accessorDecls = new FuncDecl[n]; for (int i = 0; i < n; i++) - m_accessorDecls[i] = new FuncDecl(Context(), accessors[i]); + m_accessorDecls[i] = new FuncDecl(getContext(), accessors[i]); } } diff --git a/src/api/java/ConstructorList.java b/src/api/java/ConstructorList.java index 87b6bd4fd..a33276ebb 100644 --- a/src/api/java/ConstructorList.java +++ b/src/api/java/ConstructorList.java @@ -16,7 +16,7 @@ public class ConstructorList extends Z3Object **/ protected void finalize() throws Z3Exception { - Native.delConstructorList(Context().nCtx(), NativeObject()); + Native.delConstructorList(getContext().nCtx(), getNativeObject()); } ConstructorList(Context ctx, long obj) throws Z3Exception @@ -28,8 +28,8 @@ public class ConstructorList extends Z3Object { super(ctx); - setNativeObject(Native.mkConstructorList(Context().nCtx(), + setNativeObject(Native.mkConstructorList(getContext().nCtx(), (int) constructors.length, - Constructor.ArrayToNative(constructors))); + Constructor.arrayToNative(constructors))); } } diff --git a/src/api/java/Context.java b/src/api/java/Context.java index d6076b5ee..7a1a404af 100644 --- a/src/api/java/Context.java +++ b/src/api/java/Context.java @@ -6,8 +6,9 @@ package com.microsoft.z3; -import java.util.*; -import com.microsoft.z3.enumerations.*; +import java.util.Map; + +import com.microsoft.z3.enumerations.Z3_ast_print_mode; /** * The main interaction with Z3 happens via the Context. @@ -21,7 +22,7 @@ public class Context extends IDisposable { super(); m_ctx = Native.mkContextRc(0); - InitContext(); + initContext(); } /** @@ -35,7 +36,7 @@ public class Context extends IDisposable Native.setParamValue(cfg, kv.getKey(), kv.getValue()); m_ctx = Native.mkContextRc(cfg); Native.delConfig(cfg); - InitContext(); + initContext(); } private Context(long ctx, long refCount) @@ -50,7 +51,7 @@ public class Context extends IDisposable * passed to this function. The legal range of unsigned integers is 0 to * 2^30-1. **/ - public IntSymbol MkSymbol(int i) throws Z3Exception + public IntSymbol mkSymbol(int i) throws Z3Exception { return new IntSymbol(this, i); } @@ -58,7 +59,7 @@ public class Context extends IDisposable /** * Create a symbol using a string. **/ - public StringSymbol MkSymbol(String name) throws Z3Exception + public StringSymbol mkSymbol(String name) throws Z3Exception { return new StringSymbol(this, name); } @@ -72,7 +73,7 @@ public class Context extends IDisposable return null; Symbol[] result = new Symbol[names.length]; for (int i = 0; i < names.length; ++i) - result[i] = MkSymbol(names[i]); + result[i] = mkSymbol(names[i]); return result; } @@ -83,7 +84,7 @@ public class Context extends IDisposable /** * Retrieves the Boolean sort of the context. **/ - public BoolSort BoolSort() throws Z3Exception + public BoolSort getBoolSort() throws Z3Exception { if (m_boolSort == null) m_boolSort = new BoolSort(this); @@ -93,7 +94,7 @@ public class Context extends IDisposable /** * Retrieves the Integer sort of the context. **/ - public IntSort IntSort() throws Z3Exception + public IntSort getIntSort() throws Z3Exception { if (m_intSort == null) m_intSort = new IntSort(this); @@ -103,7 +104,7 @@ public class Context extends IDisposable /** * Retrieves the Real sort of the context. **/ - public RealSort RealSort() throws Z3Exception + public RealSort getRealSort() throws Z3Exception { if (m_realSort == null) m_realSort = new RealSort(this); @@ -113,7 +114,7 @@ public class Context extends IDisposable /** * Create a new Boolean sort. **/ - public BoolSort MkBoolSort() throws Z3Exception + public BoolSort mkBoolSort() throws Z3Exception { return new BoolSort(this); @@ -122,26 +123,26 @@ public class Context extends IDisposable /** * Create a new uninterpreted sort. **/ - public UninterpretedSort MkUninterpretedSort(Symbol s) throws Z3Exception + public UninterpretedSort mkUninterpretedSort(Symbol s) throws Z3Exception { - CheckContextMatch(s); + checkContextMatch(s); return new UninterpretedSort(this, s); } /** * Create a new uninterpreted sort. **/ - public UninterpretedSort MkUninterpretedSort(String str) throws Z3Exception + public UninterpretedSort mkUninterpretedSort(String str) throws Z3Exception { - return MkUninterpretedSort(MkSymbol(str)); + return mkUninterpretedSort(mkSymbol(str)); } /** * Create a new integer sort. **/ - public IntSort MkIntSort() throws Z3Exception + public IntSort mkIntSort() throws Z3Exception { return new IntSort(this); @@ -150,7 +151,7 @@ public class Context extends IDisposable /** * Create a real sort. **/ - public RealSort MkRealSort() throws Z3Exception + public RealSort mkRealSort() throws Z3Exception { return new RealSort(this); @@ -159,7 +160,7 @@ public class Context extends IDisposable /** * Create a new bit-vector sort. **/ - public BitVecSort MkBitVecSort(int size) throws Z3Exception + public BitVecSort mkBitVecSort(int size) throws Z3Exception { return new BitVecSort(this, Native.mkBvSort(nCtx(), size)); @@ -168,24 +169,24 @@ public class Context extends IDisposable /** * Create a new array sort. **/ - public ArraySort MkArraySort(Sort domain, Sort range) throws Z3Exception + public ArraySort mkArraySort(Sort domain, Sort range) throws Z3Exception { - CheckContextMatch(domain); - CheckContextMatch(range); + checkContextMatch(domain); + checkContextMatch(range); return new ArraySort(this, domain, range); } /** * Create a new tuple sort. **/ - public TupleSort MkTupleSort(Symbol name, Symbol[] fieldNames, + public TupleSort mkTupleSort(Symbol name, Symbol[] fieldNames, Sort[] fieldSorts) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(fieldNames); - CheckContextMatch(fieldSorts); + checkContextMatch(name); + checkContextMatch(fieldNames); + checkContextMatch(fieldSorts); return new TupleSort(this, name, (int) fieldNames.length, fieldNames, fieldSorts); } @@ -193,65 +194,64 @@ public class Context extends IDisposable /** * Create a new enumeration sort. **/ - public EnumSort MkEnumSort(Symbol name, Symbol[] enumNames) + public EnumSort mkEnumSort(Symbol name, Symbol... enumNames) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(enumNames); + checkContextMatch(name); + checkContextMatch(enumNames); return new EnumSort(this, name, enumNames); } /** * Create a new enumeration sort. **/ - public EnumSort MkEnumSort(String name, String[] enumNames) + public EnumSort mkEnumSort(String name, String... enumNames) throws Z3Exception { - - return new EnumSort(this, MkSymbol(name), MkSymbols(enumNames)); + return new EnumSort(this, mkSymbol(name), MkSymbols(enumNames)); } /** * Create a new list sort. **/ - public ListSort MkListSort(Symbol name, Sort elemSort) throws Z3Exception + public ListSort mkListSort(Symbol name, Sort elemSort) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(elemSort); + checkContextMatch(name); + checkContextMatch(elemSort); return new ListSort(this, name, elemSort); } /** * Create a new list sort. **/ - public ListSort MkListSort(String name, Sort elemSort) throws Z3Exception + public ListSort mkListSort(String name, Sort elemSort) throws Z3Exception { - CheckContextMatch(elemSort); - return new ListSort(this, MkSymbol(name), elemSort); + checkContextMatch(elemSort); + return new ListSort(this, mkSymbol(name), elemSort); } /** * Create a new finite domain sort. **/ - public FiniteDomainSort MkFiniteDomainSort(Symbol name, long size) + public FiniteDomainSort mkFiniteDomainSort(Symbol name, long size) throws Z3Exception { - CheckContextMatch(name); + checkContextMatch(name); return new FiniteDomainSort(this, name, size); } /** * Create a new finite domain sort. **/ - public FiniteDomainSort MkFiniteDomainSort(String name, long size) + public FiniteDomainSort mkFiniteDomainSort(String name, long size) throws Z3Exception { - return new FiniteDomainSort(this, MkSymbol(name), size); + return new FiniteDomainSort(this, mkSymbol(name), size); } /** @@ -265,7 +265,7 @@ public class Context extends IDisposable * an index referring to one of the recursive datatypes that is * declared. **/ - public Constructor MkConstructor(Symbol name, Symbol recognizer, + public Constructor mkConstructor(Symbol name, Symbol recognizer, Symbol[] fieldNames, Sort[] sorts, int[] sortRefs) throws Z3Exception { @@ -281,36 +281,36 @@ public class Context extends IDisposable * * @return **/ - public Constructor MkConstructor(String name, String recognizer, + public Constructor mkConstructor(String name, String recognizer, String[] fieldNames, Sort[] sorts, int[] sortRefs) throws Z3Exception { - return new Constructor(this, MkSymbol(name), MkSymbol(recognizer), + return new Constructor(this, mkSymbol(name), mkSymbol(recognizer), MkSymbols(fieldNames), sorts, sortRefs); } /** * Create a new datatype sort. **/ - public DatatypeSort MkDatatypeSort(Symbol name, Constructor[] constructors) + public DatatypeSort mkDatatypeSort(Symbol name, Constructor[] constructors) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(constructors); + checkContextMatch(name); + checkContextMatch(constructors); return new DatatypeSort(this, name, constructors); } /** * Create a new datatype sort. **/ - public DatatypeSort MkDatatypeSort(String name, Constructor[] constructors) + public DatatypeSort mkDatatypeSort(String name, Constructor[] constructors) throws Z3Exception { - CheckContextMatch(constructors); - return new DatatypeSort(this, MkSymbol(name), constructors); + checkContextMatch(constructors); + return new DatatypeSort(this, mkSymbol(name), constructors); } /** @@ -318,11 +318,11 @@ public class Context extends IDisposable * datatype sorts list of constructors, one list per * sort. **/ - public DatatypeSort[] MkDatatypeSorts(Symbol[] names, Constructor[][] c) + public DatatypeSort[] mkDatatypeSorts(Symbol[] names, Constructor[][] c) throws Z3Exception { - CheckContextMatch(names); + checkContextMatch(names); int n = (int) names.length; ConstructorList[] cla = new ConstructorList[n]; long[] n_constr = new long[n]; @@ -330,12 +330,12 @@ public class Context extends IDisposable { Constructor[] constructor = c[i]; - CheckContextMatch(constructor); + checkContextMatch(constructor); cla[i] = new ConstructorList(this, constructor); - n_constr[i] = cla[i].NativeObject(); + n_constr[i] = cla[i].getNativeObject(); } long[] n_res = new long[n]; - Native.mkDatatypes(nCtx(), n, Symbol.ArrayToNative(names), n_res, + Native.mkDatatypes(nCtx(), n, Symbol.arrayToNative(names), n_res, n_constr); DatatypeSort[] res = new DatatypeSort[n]; for (int i = 0; i < n; i++) @@ -349,36 +349,36 @@ public class Context extends IDisposable * * @return **/ - public DatatypeSort[] MkDatatypeSorts(String[] names, Constructor[][] c) + public DatatypeSort[] mkDatatypeSorts(String[] names, Constructor[][] c) throws Z3Exception { - return MkDatatypeSorts(MkSymbols(names), c); + return mkDatatypeSorts(MkSymbols(names), c); } /** * Creates a new function declaration. **/ - public FuncDecl MkFuncDecl(Symbol name, Sort[] domain, Sort range) + public FuncDecl mkFuncDecl(Symbol name, Sort[] domain, Sort range) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(domain); - CheckContextMatch(range); + checkContextMatch(name); + checkContextMatch(domain); + checkContextMatch(range); return new FuncDecl(this, name, domain, range); } /** * Creates a new function declaration. **/ - public FuncDecl MkFuncDecl(Symbol name, Sort domain, Sort range) + public FuncDecl mkFuncDecl(Symbol name, Sort domain, Sort range) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(domain); - CheckContextMatch(range); + checkContextMatch(name); + checkContextMatch(domain); + checkContextMatch(range); Sort[] q = new Sort[] { domain }; return new FuncDecl(this, name, q, range); } @@ -386,26 +386,26 @@ public class Context extends IDisposable /** * Creates a new function declaration. **/ - public FuncDecl MkFuncDecl(String name, Sort[] domain, Sort range) + public FuncDecl mkFuncDecl(String name, Sort[] domain, Sort range) throws Z3Exception { - CheckContextMatch(domain); - CheckContextMatch(range); - return new FuncDecl(this, MkSymbol(name), domain, range); + checkContextMatch(domain); + checkContextMatch(range); + return new FuncDecl(this, mkSymbol(name), domain, range); } /** * Creates a new function declaration. **/ - public FuncDecl MkFuncDecl(String name, Sort domain, Sort range) + public FuncDecl mkFuncDecl(String name, Sort domain, Sort range) throws Z3Exception { - CheckContextMatch(domain); - CheckContextMatch(range); + checkContextMatch(domain); + checkContextMatch(range); Sort[] q = new Sort[] { domain }; - return new FuncDecl(this, MkSymbol(name), q, range); + return new FuncDecl(this, mkSymbol(name), q, range); } /** @@ -413,34 +413,34 @@ public class Context extends IDisposable * name="prefix"/>. **/ - public FuncDecl MkFreshFuncDecl(String prefix, Sort[] domain, Sort range) + public FuncDecl mkFreshFuncDecl(String prefix, Sort[] domain, Sort range) throws Z3Exception { - CheckContextMatch(domain); - CheckContextMatch(range); + checkContextMatch(domain); + checkContextMatch(range); return new FuncDecl(this, prefix, domain, range); } /** * Creates a new constant function declaration. **/ - public FuncDecl MkConstDecl(Symbol name, Sort range) throws Z3Exception + public FuncDecl mkConstDecl(Symbol name, Sort range) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(range); + checkContextMatch(name); + checkContextMatch(range); return new FuncDecl(this, name, null, range); } /** * Creates a new constant function declaration. **/ - public FuncDecl MkConstDecl(String name, Sort range) throws Z3Exception + public FuncDecl mkConstDecl(String name, Sort range) throws Z3Exception { - CheckContextMatch(range); - return new FuncDecl(this, MkSymbol(name), null, range); + checkContextMatch(range); + return new FuncDecl(this, mkSymbol(name), null, range); } /** @@ -448,11 +448,11 @@ public class Context extends IDisposable * . * **/ - public FuncDecl MkFreshConstDecl(String prefix, Sort range) + public FuncDecl mkFreshConstDecl(String prefix, Sort range) throws Z3Exception { - CheckContextMatch(range); + checkContextMatch(range); return new FuncDecl(this, prefix, null, range); } @@ -460,21 +460,21 @@ public class Context extends IDisposable * Creates a new bound variable. The de-Bruijn index of * the variable The sort of the variable **/ - public Expr MkBound(int index, Sort ty) throws Z3Exception + public Expr mkBound(int index, Sort ty) throws Z3Exception { - return Expr.Create(this, - Native.mkBound(nCtx(), index, ty.NativeObject())); + return Expr.create(this, + Native.mkBound(nCtx(), index, ty.getNativeObject())); } /** * Create a quantifier pattern. **/ - public Pattern MkPattern(Expr[] terms) throws Z3Exception + public Pattern mkPattern(Expr... terms) throws Z3Exception { if (terms.length == 0) throw new Z3Exception("Cannot create a pattern from zero terms"); - long[] termsNative = AST.ArrayToNative(terms); + long[] termsNative = AST.arrayToNative(terms); return new Pattern(this, Native.mkPattern(nCtx(), (int) terms.length, termsNative)); } @@ -483,148 +483,136 @@ public class Context extends IDisposable * Creates a new Constant of sort and named * . **/ - public Expr MkConst(Symbol name, Sort range) throws Z3Exception + public Expr mkConst(Symbol name, Sort range) throws Z3Exception { - CheckContextMatch(name); - CheckContextMatch(range); + checkContextMatch(name); + checkContextMatch(range); - return Expr.Create( + return Expr.create( this, - Native.mkConst(nCtx(), name.NativeObject(), - range.NativeObject())); + Native.mkConst(nCtx(), name.getNativeObject(), + range.getNativeObject())); } /** * Creates a new Constant of sort and named * . **/ - public Expr MkConst(String name, Sort range) throws Z3Exception + public Expr mkConst(String name, Sort range) throws Z3Exception { - return MkConst(MkSymbol(name), range); + return mkConst(mkSymbol(name), range); } /** * Creates a fresh Constant of sort and a name * prefixed with . **/ - public Expr MkFreshConst(String prefix, Sort range) throws Z3Exception + public Expr mkFreshConst(String prefix, Sort range) throws Z3Exception { - CheckContextMatch(range); - return Expr.Create(this, - Native.mkFreshConst(nCtx(), prefix, range.NativeObject())); + checkContextMatch(range); + return Expr.create(this, + Native.mkFreshConst(nCtx(), prefix, range.getNativeObject())); } /** * Creates a fresh constant from the FuncDecl . A decl of a 0-arity function **/ - public Expr MkConst(FuncDecl f) throws Z3Exception + public Expr mkConst(FuncDecl f) throws Z3Exception { - return MkApp(f, (Expr[]) null); + return mkApp(f, (Expr[]) null); } /** * Create a Boolean constant. **/ - public BoolExpr MkBoolConst(Symbol name) throws Z3Exception + public BoolExpr mkBoolConst(Symbol name) throws Z3Exception { - return (BoolExpr) MkConst(name, BoolSort()); + return (BoolExpr) mkConst(name, getBoolSort()); } /** * Create a Boolean constant. **/ - public BoolExpr MkBoolConst(String name) throws Z3Exception + public BoolExpr mkBoolConst(String name) throws Z3Exception { - return (BoolExpr) MkConst(MkSymbol(name), BoolSort()); + return (BoolExpr) mkConst(mkSymbol(name), getBoolSort()); } /** * Creates an integer constant. **/ - public IntExpr MkIntConst(Symbol name) throws Z3Exception + public IntExpr mkIntConst(Symbol name) throws Z3Exception { - return (IntExpr) MkConst(name, IntSort()); + return (IntExpr) mkConst(name, getIntSort()); } /** * Creates an integer constant. **/ - public IntExpr MkIntConst(String name) throws Z3Exception + public IntExpr mkIntConst(String name) throws Z3Exception { - return (IntExpr) MkConst(name, IntSort()); + return (IntExpr) mkConst(name, getIntSort()); } /** * Creates a real constant. **/ - public RealExpr MkRealConst(Symbol name) throws Z3Exception + public RealExpr mkRealConst(Symbol name) throws Z3Exception { - return (RealExpr) MkConst(name, RealSort()); + return (RealExpr) mkConst(name, getRealSort()); } /** * Creates a real constant. **/ - public RealExpr MkRealConst(String name) throws Z3Exception + public RealExpr mkRealConst(String name) throws Z3Exception { - return (RealExpr) MkConst(name, RealSort()); + return (RealExpr) mkConst(name, getRealSort()); } /** * Creates a bit-vector constant. **/ - public BitVecExpr MkBVConst(Symbol name, int size) throws Z3Exception + public BitVecExpr mkBVConst(Symbol name, int size) throws Z3Exception { - return (BitVecExpr) MkConst(name, MkBitVecSort(size)); + return (BitVecExpr) mkConst(name, mkBitVecSort(size)); } /** * Creates a bit-vector constant. **/ - public BitVecExpr MkBVConst(String name, int size) throws Z3Exception + public BitVecExpr mkBVConst(String name, int size) throws Z3Exception { - return (BitVecExpr) MkConst(name, MkBitVecSort(size)); + return (BitVecExpr) mkConst(name, mkBitVecSort(size)); } /** * Create a new function application. **/ - public Expr MkApp(FuncDecl f, Expr arg) throws Z3Exception + public Expr mkApp(FuncDecl f, Expr... args) throws Z3Exception { - CheckContextMatch(f); - CheckContextMatch(arg); - Expr[] args = { arg }; - return Expr.Create(this, f, args); - } - - /** - * Create a new function application. - **/ - public Expr MkApp(FuncDecl f, Expr[] args) throws Z3Exception - { - - CheckContextMatch(f); - CheckContextMatch(args); - return Expr.Create(this, f, args); + checkContextMatch(f); + checkContextMatch(args); + return Expr.create(this, f, args); } /** * The true Term. **/ - public BoolExpr MkTrue() throws Z3Exception + public BoolExpr mkTrue() throws Z3Exception { return new BoolExpr(this, Native.mkTrue(nCtx())); } @@ -632,7 +620,7 @@ public class Context extends IDisposable /** * The false Term. **/ - public BoolExpr MkFalse() throws Z3Exception + public BoolExpr mkFalse() throws Z3Exception { return new BoolExpr(this, Native.mkFalse(nCtx())); } @@ -640,40 +628,40 @@ public class Context extends IDisposable /** * Creates a Boolean value. **/ - public BoolExpr MkBool(boolean value) throws Z3Exception + public BoolExpr mkBool(boolean value) throws Z3Exception { - return value ? MkTrue() : MkFalse(); + return value ? mkTrue() : mkFalse(); } /** * Creates the equality = . **/ - public BoolExpr MkEq(Expr x, Expr y) throws Z3Exception + public BoolExpr mkEq(Expr x, Expr y) throws Z3Exception { - CheckContextMatch(x); - CheckContextMatch(y); - return new BoolExpr(this, Native.mkEq(nCtx(), x.NativeObject(), - y.NativeObject())); + checkContextMatch(x); + checkContextMatch(y); + return new BoolExpr(this, Native.mkEq(nCtx(), x.getNativeObject(), + y.getNativeObject())); } /** * Creates a distinct term. **/ - public BoolExpr MkDistinct(Expr[] args) throws Z3Exception + public BoolExpr mkDistinct(Expr... args) throws Z3Exception { - CheckContextMatch(args); + checkContextMatch(args); return new BoolExpr(this, Native.mkDistinct(nCtx(), (int) args.length, - AST.ArrayToNative(args))); + AST.arrayToNative(args))); } /** * Mk an expression representing not(a). **/ - public BoolExpr MkNot(BoolExpr a) throws Z3Exception + public BoolExpr mkNot(BoolExpr a) throws Z3Exception { - CheckContextMatch(a); - return new BoolExpr(this, Native.mkNot(nCtx(), a.NativeObject())); + checkContextMatch(a); + return new BoolExpr(this, Native.mkNot(nCtx(), a.getNativeObject())); } /** @@ -682,216 +670,216 @@ public class Context extends IDisposable * sort An expression An * expression with the same sort as **/ - public Expr MkITE(BoolExpr t1, Expr t2, Expr t3) throws Z3Exception + public Expr mkITE(BoolExpr t1, Expr t2, Expr t3) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - CheckContextMatch(t3); - return Expr.Create( - this, - Native.mkIte(nCtx(), t1.NativeObject(), t2.NativeObject(), - t3.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + checkContextMatch(t3); + return Expr.create(this, Native.mkIte(nCtx(), t1.getNativeObject(), + t2.getNativeObject(), t3.getNativeObject())); } /** * Create an expression representing t1 iff t2. **/ - public BoolExpr MkIff(BoolExpr t1, BoolExpr t2) throws Z3Exception + public BoolExpr mkIff(BoolExpr t1, BoolExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkIff(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkIff(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 -> t2. **/ - public BoolExpr MkImplies(BoolExpr t1, BoolExpr t2) throws Z3Exception + public BoolExpr mkImplies(BoolExpr t1, BoolExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkImplies(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkImplies(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Create an expression representing t1 xor t2. **/ - public BoolExpr MkXor(BoolExpr t1, BoolExpr t2) throws Z3Exception + public BoolExpr mkXor(BoolExpr t1, BoolExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkXor(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkXor(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t[0] and t[1] and .... **/ - public BoolExpr MkAnd(BoolExpr[] t) throws Z3Exception + public BoolExpr mkAnd(BoolExpr... t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BoolExpr(this, Native.mkAnd(nCtx(), (int) t.length, - AST.ArrayToNative(t))); + AST.arrayToNative(t))); } /** * Create an expression representing t[0] or t[1] or .... **/ - public BoolExpr MkOr(BoolExpr[] t) throws Z3Exception + public BoolExpr mkOr(BoolExpr... t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BoolExpr(this, Native.mkOr(nCtx(), (int) t.length, - AST.ArrayToNative(t))); + AST.arrayToNative(t))); } /** * Create an expression representing t[0] + t[1] + .... **/ - public ArithExpr MkAdd(ArithExpr[] t) throws Z3Exception + public ArithExpr mkAdd(ArithExpr... t) throws Z3Exception { - CheckContextMatch(t); - return (ArithExpr) Expr.Create(this, - Native.mkAdd(nCtx(), (int) t.length, AST.ArrayToNative(t))); + checkContextMatch(t); + return (ArithExpr) Expr.create(this, + Native.mkAdd(nCtx(), (int) t.length, AST.arrayToNative(t))); } /** * Create an expression representing t[0] * t[1] * .... **/ - public ArithExpr MkMul(ArithExpr[] t) throws Z3Exception + public ArithExpr mkMul(ArithExpr... t) throws Z3Exception { - CheckContextMatch(t); - return (ArithExpr) Expr.Create(this, - Native.mkMul(nCtx(), (int) t.length, AST.ArrayToNative(t))); + checkContextMatch(t); + return (ArithExpr) Expr.create(this, + Native.mkMul(nCtx(), (int) t.length, AST.arrayToNative(t))); } /** * Create an expression representing t[0] - t[1] - .... **/ - public ArithExpr MkSub(ArithExpr[] t) throws Z3Exception + public ArithExpr mkSub(ArithExpr... t) throws Z3Exception { - CheckContextMatch(t); - return (ArithExpr) Expr.Create(this, - Native.mkSub(nCtx(), (int) t.length, AST.ArrayToNative(t))); + checkContextMatch(t); + return (ArithExpr) Expr.create(this, + Native.mkSub(nCtx(), (int) t.length, AST.arrayToNative(t))); } /** * Create an expression representing -t. **/ - public ArithExpr MkUnaryMinus(ArithExpr t) throws Z3Exception + public ArithExpr mkUnaryMinus(ArithExpr t) throws Z3Exception { - CheckContextMatch(t); - return (ArithExpr) Expr.Create(this, - Native.mkUnaryMinus(nCtx(), t.NativeObject())); + checkContextMatch(t); + return (ArithExpr) Expr.create(this, + Native.mkUnaryMinus(nCtx(), t.getNativeObject())); } /** * Create an expression representing t1 / t2. **/ - public ArithExpr MkDiv(ArithExpr t1, ArithExpr t2) throws Z3Exception + public ArithExpr mkDiv(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return (ArithExpr) Expr.Create(this, - Native.mkDiv(nCtx(), t1.NativeObject(), t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return (ArithExpr) Expr.create(this, Native.mkDiv(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Create an expression representing t1 mod t2. The * arguments must have int type. **/ - public IntExpr MkMod(IntExpr t1, IntExpr t2) throws Z3Exception + public IntExpr mkMod(IntExpr t1, IntExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new IntExpr(this, Native.mkMod(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new IntExpr(this, Native.mkMod(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 rem t2. The * arguments must have int type. **/ - public IntExpr MkRem(IntExpr t1, IntExpr t2) throws Z3Exception + public IntExpr mkRem(IntExpr t1, IntExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new IntExpr(this, Native.mkRem(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new IntExpr(this, Native.mkRem(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 ^ t2. **/ - public ArithExpr MkPower(ArithExpr t1, ArithExpr t2) throws Z3Exception + public ArithExpr mkPower(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return (ArithExpr) Expr.Create(this, - Native.mkPower(nCtx(), t1.NativeObject(), t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return (ArithExpr) Expr.create( + this, + Native.mkPower(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 < t2 **/ - public BoolExpr MkLt(ArithExpr t1, ArithExpr t2) throws Z3Exception + public BoolExpr mkLt(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkLt(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkLt(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 <= t2 **/ - public BoolExpr MkLe(ArithExpr t1, ArithExpr t2) throws Z3Exception + public BoolExpr mkLe(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkLe(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkLe(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 > t2 **/ - public BoolExpr MkGt(ArithExpr t1, ArithExpr t2) throws Z3Exception + public BoolExpr mkGt(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkGt(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkGt(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Create an expression representing t1 >= t2 **/ - public BoolExpr MkGe(ArithExpr t1, ArithExpr t2) throws Z3Exception + public BoolExpr mkGe(ArithExpr t1, ArithExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkGe(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkGe(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** @@ -903,11 +891,12 @@ public class Context extends IDisposable * MakeInt2Real(k) <= t1 < MkInt2Real(k)+1. The argument * must be of integer sort. **/ - public RealExpr MkInt2Real(IntExpr t) throws Z3Exception + public RealExpr mkInt2Real(IntExpr t) throws Z3Exception { - CheckContextMatch(t); - return new RealExpr(this, Native.mkInt2real(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new RealExpr(this, + Native.mkInt2real(nCtx(), t.getNativeObject())); } /** @@ -915,182 +904,184 @@ public class Context extends IDisposable * follows the SMT-LIB standard for the function to_int. The argument must * be of real sort. **/ - public IntExpr MkReal2Int(RealExpr t) throws Z3Exception + public IntExpr mkReal2Int(RealExpr t) throws Z3Exception { - CheckContextMatch(t); - return new IntExpr(this, Native.mkReal2int(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new IntExpr(this, Native.mkReal2int(nCtx(), t.getNativeObject())); } /** * Creates an expression that checks whether a real number is an integer. **/ - public BoolExpr MkIsInteger(RealExpr t) throws Z3Exception + public BoolExpr mkIsInteger(RealExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BoolExpr(this, Native.mkIsInt(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new BoolExpr(this, Native.mkIsInt(nCtx(), t.getNativeObject())); } /** * Bitwise negation. The argument must have a bit-vector * sort. **/ - public BitVecExpr MkBVNot(BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVNot(BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, Native.mkBvnot(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkBvnot(nCtx(), t.getNativeObject())); } /** * Take conjunction of bits in a vector, return vector of length 1. * The argument must have a bit-vector sort. **/ - public BitVecExpr MkBVRedAND(BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVRedAND(BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, Native.mkBvredand(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkBvredand(nCtx(), + t.getNativeObject())); } /** * Take disjunction of bits in a vector, return vector of length 1. * The argument must have a bit-vector sort. **/ - public BitVecExpr MkBVRedOR(BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVRedOR(BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, Native.mkBvredor(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkBvredor(nCtx(), + t.getNativeObject())); } /** * Bitwise conjunction. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVAND(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVAND(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvand(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvand(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Bitwise disjunction. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvor(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvor(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Bitwise XOR. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVXOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVXOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvxor(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvxor(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Bitwise NAND. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVNAND(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVNAND(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvnand(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvnand(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Bitwise NOR. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVNOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVNOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvnor(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvnor(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Bitwise XNOR. The arguments must have a bit-vector * sort. **/ - public BitVecExpr MkBVXNOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVXNOR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvxnor(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvxnor(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Standard two's complement unary minus. The arguments must have a * bit-vector sort. **/ - public BitVecExpr MkBVNeg(BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVNeg(BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, Native.mkBvneg(nCtx(), t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkBvneg(nCtx(), t.getNativeObject())); } /** * Two's complement addition. The arguments must have the same * bit-vector sort. **/ - public BitVecExpr MkBVAdd(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVAdd(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvadd(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvadd(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Two's complement subtraction. The arguments must have the same * bit-vector sort. **/ - public BitVecExpr MkBVSub(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVSub(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvsub(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvsub(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Two's complement multiplication. The arguments must have the * same bit-vector sort. **/ - public BitVecExpr MkBVMul(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVMul(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvmul(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvmul(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1099,13 +1090,13 @@ public class Context extends IDisposable * zero, then the result is undefined. The arguments must have the same * bit-vector sort. **/ - public BitVecExpr MkBVUDiv(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVUDiv(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvudiv(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvudiv(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1120,13 +1111,13 @@ public class Context extends IDisposable * If t2 is zero, then the result is undefined. The arguments * must have the same bit-vector sort. **/ - public BitVecExpr MkBVSDiv(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVSDiv(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvsdiv(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvsdiv(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1135,13 +1126,13 @@ public class Context extends IDisposable * unsigned division. If t2 is zero, then the result is * undefined. The arguments must have the same bit-vector sort. **/ - public BitVecExpr MkBVURem(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVURem(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvurem(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvurem(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1153,13 +1144,13 @@ public class Context extends IDisposable * If t2 is zero, then the result is undefined. The arguments * must have the same bit-vector sort. **/ - public BitVecExpr MkBVSRem(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVSRem(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvsrem(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvsrem(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1167,117 +1158,117 @@ public class Context extends IDisposable * t2 is zero, then the result is undefined. The arguments must * have the same bit-vector sort. **/ - public BitVecExpr MkBVSMod(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVSMod(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvsmod(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvsmod(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Unsigned less-than The arguments must have the same bit-vector * sort. **/ - public BoolExpr MkBVULT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVULT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvult(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvult(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Two's complement signed less-than The arguments must have the * same bit-vector sort. **/ - public BoolExpr MkBVSLT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVSLT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvslt(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvslt(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Unsigned less-than or equal to. The arguments must have the * same bit-vector sort. **/ - public BoolExpr MkBVULE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVULE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvule(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvule(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Two's complement signed less-than or equal to. The arguments * must have the same bit-vector sort. **/ - public BoolExpr MkBVSLE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVSLE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvsle(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvsle(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Unsigned greater than or equal to. The arguments must have the * same bit-vector sort. **/ - public BoolExpr MkBVUGE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVUGE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvuge(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvuge(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Two's complement signed greater than or equal to. The arguments * must have the same bit-vector sort. **/ - public BoolExpr MkBVSGE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVSGE(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvsge(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvsge(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Unsigned greater-than. The arguments must have the same * bit-vector sort. **/ - public BoolExpr MkBVUGT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVUGT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvugt(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvugt(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** * Two's complement signed greater-than. The arguments must have * the same bit-vector sort. **/ - public BoolExpr MkBVSGT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BoolExpr mkBVSGT(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, Native.mkBvsgt(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvsgt(nCtx(), t1.getNativeObject(), + t2.getNativeObject())); } /** @@ -1289,13 +1280,13 @@ public class Context extends IDisposable * (t2). * **/ - public BitVecExpr MkConcat(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkConcat(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkConcat(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkConcat(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1305,13 +1296,13 @@ public class Context extends IDisposable * n = high - low + 1. The argument must * have a bit-vector sort. **/ - public BitVecExpr MkExtract(int high, int low, BitVecExpr t) + public BitVecExpr mkExtract(int high, int low, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BitVecExpr(this, Native.mkExtract(nCtx(), high, low, - t.NativeObject())); + t.getNativeObject())); } /** @@ -1320,12 +1311,12 @@ public class Context extends IDisposable * the size of the given bit-vector. The argument must * have a bit-vector sort. **/ - public BitVecExpr MkSignExt(int i, BitVecExpr t) throws Z3Exception + public BitVecExpr mkSignExt(int i, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BitVecExpr(this, Native.mkSignExt(nCtx(), i, - t.NativeObject())); + t.getNativeObject())); } /** @@ -1334,24 +1325,24 @@ public class Context extends IDisposable * where \c m is the size of the given bit-vector. The argument must have a bit-vector sort. **/ - public BitVecExpr MkZeroExt(int i, BitVecExpr t) throws Z3Exception + public BitVecExpr mkZeroExt(int i, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BitVecExpr(this, Native.mkZeroExt(nCtx(), i, - t.NativeObject())); + t.getNativeObject())); } /** * Bit-vector repetition. The argument must * have a bit-vector sort. **/ - public BitVecExpr MkRepeat(int i, BitVecExpr t) throws Z3Exception + public BitVecExpr mkRepeat(int i, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, - Native.mkRepeat(nCtx(), i, t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkRepeat(nCtx(), i, + t.getNativeObject())); } /** @@ -1364,13 +1355,13 @@ public class Context extends IDisposable * * The arguments must have a bit-vector sort. **/ - public BitVecExpr MkBVSHL(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVSHL(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvshl(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvshl(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1383,13 +1374,13 @@ public class Context extends IDisposable * * The arguments must have a bit-vector sort. **/ - public BitVecExpr MkBVLSHR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVLSHR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvlshr(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvlshr(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1403,37 +1394,37 @@ public class Context extends IDisposable * * The arguments must have a bit-vector sort. **/ - public BitVecExpr MkBVASHR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception + public BitVecExpr mkBVASHR(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BitVecExpr(this, Native.mkBvashr(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new BitVecExpr(this, Native.mkBvashr(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** * Rotate Left. Rotate bits of \c t to the left \c i times. The * argument must have a bit-vector sort. **/ - public BitVecExpr MkBVRotateLeft(int i, BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVRotateLeft(int i, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BitVecExpr(this, Native.mkRotateLeft(nCtx(), i, - t.NativeObject())); + t.getNativeObject())); } /** * Rotate Right. Rotate bits of \c t to the right \c i times. The * argument must have a bit-vector sort. **/ - public BitVecExpr MkBVRotateRight(int i, BitVecExpr t) throws Z3Exception + public BitVecExpr mkBVRotateRight(int i, BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BitVecExpr(this, Native.mkRotateRight(nCtx(), i, - t.NativeObject())); + t.getNativeObject())); } /** @@ -1441,14 +1432,14 @@ public class Context extends IDisposable * times. The arguments must have the same bit-vector * sort. **/ - public BitVecExpr MkBVRotateLeft(BitVecExpr t1, BitVecExpr t2) + public BitVecExpr mkBVRotateLeft(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BitVecExpr(this, Native.mkExtRotateLeft(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1456,14 +1447,14 @@ public class Context extends IDisposable * right times. The arguments must have the same * bit-vector sort. **/ - public BitVecExpr MkBVRotateRight(BitVecExpr t1, BitVecExpr t2) + public BitVecExpr mkBVRotateRight(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BitVecExpr(this, Native.mkExtRotateRight(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -1474,12 +1465,12 @@ public class Context extends IDisposable * * The argument must be of integer sort. **/ - public BitVecExpr MkInt2BV(int n, IntExpr t) throws Z3Exception + public BitVecExpr mkInt2BV(int n, IntExpr t) throws Z3Exception { - CheckContextMatch(t); - return new BitVecExpr(this, - Native.mkInt2bv(nCtx(), n, t.NativeObject())); + checkContextMatch(t); + return new BitVecExpr(this, Native.mkInt2bv(nCtx(), n, + t.getNativeObject())); } /** @@ -1496,11 +1487,11 @@ public class Context extends IDisposable * * The argument must be of bit-vector sort. **/ - public IntExpr MkBV2Int(BitVecExpr t, boolean signed) throws Z3Exception + public IntExpr mkBV2Int(BitVecExpr t, boolean signed) throws Z3Exception { - CheckContextMatch(t); - return new IntExpr(this, Native.mkBv2int(nCtx(), t.NativeObject(), + checkContextMatch(t); + return new IntExpr(this, Native.mkBv2int(nCtx(), t.getNativeObject(), (signed) ? true : false)); } @@ -1508,133 +1499,133 @@ public class Context extends IDisposable * Create a predicate that checks that the bit-wise addition does not * overflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVAddNoOverflow(BitVecExpr t1, BitVecExpr t2, + public BoolExpr mkBVAddNoOverflow(BitVecExpr t1, BitVecExpr t2, boolean isSigned) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, - Native.mkBvaddNoOverflow(nCtx(), t1.NativeObject(), - t2.NativeObject(), (isSigned) ? true : false)); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvaddNoOverflow(nCtx(), t1 + .getNativeObject(), t2.getNativeObject(), (isSigned) ? true + : false)); } /** * Create a predicate that checks that the bit-wise addition does not * underflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVAddNoUnderflow(BitVecExpr t1, BitVecExpr t2) + public BoolExpr mkBVAddNoUnderflow(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BoolExpr(this, Native.mkBvaddNoUnderflow(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** * Create a predicate that checks that the bit-wise subtraction does not * overflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVSubNoOverflow(BitVecExpr t1, BitVecExpr t2) + public BoolExpr mkBVSubNoOverflow(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BoolExpr(this, Native.mkBvsubNoOverflow(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** * Create a predicate that checks that the bit-wise subtraction does not * underflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVSubNoUnderflow(BitVecExpr t1, BitVecExpr t2, + public BoolExpr mkBVSubNoUnderflow(BitVecExpr t1, BitVecExpr t2, boolean isSigned) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, - Native.mkBvsubNoUnderflow(nCtx(), t1.NativeObject(), - t2.NativeObject(), (isSigned) ? true : false)); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvsubNoUnderflow(nCtx(), t1 + .getNativeObject(), t2.getNativeObject(), (isSigned) ? true + : false)); } /** * Create a predicate that checks that the bit-wise signed division does not * overflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVSDivNoOverflow(BitVecExpr t1, BitVecExpr t2) + public BoolExpr mkBVSDivNoOverflow(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BoolExpr(this, Native.mkBvsdivNoOverflow(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** * Create a predicate that checks that the bit-wise negation does not * overflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVNegNoOverflow(BitVecExpr t) throws Z3Exception + public BoolExpr mkBVNegNoOverflow(BitVecExpr t) throws Z3Exception { - CheckContextMatch(t); + checkContextMatch(t); return new BoolExpr(this, Native.mkBvnegNoOverflow(nCtx(), - t.NativeObject())); + t.getNativeObject())); } /** * Create a predicate that checks that the bit-wise multiplication does not * overflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVMulNoOverflow(BitVecExpr t1, BitVecExpr t2, + public BoolExpr mkBVMulNoOverflow(BitVecExpr t1, BitVecExpr t2, boolean isSigned) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new BoolExpr(this, - Native.mkBvmulNoOverflow(nCtx(), t1.NativeObject(), - t2.NativeObject(), (isSigned) ? true : false)); + checkContextMatch(t1); + checkContextMatch(t2); + return new BoolExpr(this, Native.mkBvmulNoOverflow(nCtx(), t1 + .getNativeObject(), t2.getNativeObject(), (isSigned) ? true + : false)); } /** * Create a predicate that checks that the bit-wise multiplication does not * underflow. The arguments must be of bit-vector sort. **/ - public BoolExpr MkBVMulNoUnderflow(BitVecExpr t1, BitVecExpr t2) + public BoolExpr mkBVMulNoUnderflow(BitVecExpr t1, BitVecExpr t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new BoolExpr(this, Native.mkBvmulNoUnderflow(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** * Create an array constant. **/ - public ArrayExpr MkArrayConst(Symbol name, Sort domain, Sort range) + public ArrayExpr mkArrayConst(Symbol name, Sort domain, Sort range) throws Z3Exception { - return (ArrayExpr) MkConst(name, MkArraySort(domain, range)); + return (ArrayExpr) mkConst(name, mkArraySort(domain, range)); } /** * Create an array constant. **/ - public ArrayExpr MkArrayConst(String name, Sort domain, Sort range) + public ArrayExpr mkArrayConst(String name, Sort domain, Sort range) throws Z3Exception { - return (ArrayExpr) MkConst(MkSymbol(name), MkArraySort(domain, range)); + return (ArrayExpr) mkConst(mkSymbol(name), mkArraySort(domain, range)); } /** @@ -1646,13 +1637,15 @@ public class Context extends IDisposable * domain. The sort of the result is range. * **/ - public Expr MkSelect(ArrayExpr a, Expr i) throws Z3Exception + public Expr mkSelect(ArrayExpr a, Expr i) throws Z3Exception { - CheckContextMatch(a); - CheckContextMatch(i); - return Expr.Create(this, - Native.mkSelect(nCtx(), a.NativeObject(), i.NativeObject())); + checkContextMatch(a); + checkContextMatch(i); + return Expr.create( + this, + Native.mkSelect(nCtx(), a.getNativeObject(), + i.getNativeObject())); } /** @@ -1668,14 +1661,14 @@ public class Context extends IDisposable * with respect to i may be a different value). **/ - public ArrayExpr MkStore(ArrayExpr a, Expr i, Expr v) throws Z3Exception + public ArrayExpr mkStore(ArrayExpr a, Expr i, Expr v) throws Z3Exception { - CheckContextMatch(a); - CheckContextMatch(i); - CheckContextMatch(v); - return new ArrayExpr(this, Native.mkStore(nCtx(), a.NativeObject(), - i.NativeObject(), v.NativeObject())); + checkContextMatch(a); + checkContextMatch(i); + checkContextMatch(v); + return new ArrayExpr(this, Native.mkStore(nCtx(), a.getNativeObject(), + i.getNativeObject(), v.getNativeObject())); } /** @@ -1684,13 +1677,13 @@ public class Context extends IDisposable * v. * **/ - public ArrayExpr MkConstArray(Sort domain, Expr v) throws Z3Exception + public ArrayExpr mkConstArray(Sort domain, Expr v) throws Z3Exception { - CheckContextMatch(domain); - CheckContextMatch(v); + checkContextMatch(domain); + checkContextMatch(v); return new ArrayExpr(this, Native.mkConstArray(nCtx(), - domain.NativeObject(), v.NativeObject())); + domain.getNativeObject(), v.getNativeObject())); } /** @@ -1702,14 +1695,14 @@ public class Context extends IDisposable * [domain_i -> range]. **/ - public ArrayExpr MkMap(FuncDecl f, ArrayExpr[] args) throws Z3Exception + public ArrayExpr mkMap(FuncDecl f, ArrayExpr... args) throws Z3Exception { - CheckContextMatch(f); - CheckContextMatch(args); - return (ArrayExpr) Expr.Create(this, Native.mkMap(nCtx(), - f.NativeObject(), AST.ArrayLength(args), - AST.ArrayToNative(args))); + checkContextMatch(f); + checkContextMatch(args); + return (ArrayExpr) Expr.create(this, Native.mkMap(nCtx(), + f.getNativeObject(), AST.arrayLength(args), + AST.arrayToNative(args))); } /** @@ -1717,151 +1710,151 @@ public class Context extends IDisposable * value, for arrays that can be represented as finite maps with a default * range value. **/ - public Expr MkTermArray(ArrayExpr array) throws Z3Exception + public Expr mkTermArray(ArrayExpr array) throws Z3Exception { - CheckContextMatch(array); - return Expr.Create(this, - Native.mkArrayDefault(nCtx(), array.NativeObject())); + checkContextMatch(array); + return Expr.create(this, + Native.mkArrayDefault(nCtx(), array.getNativeObject())); } /** * Create a set type. **/ - public SetSort MkSetSort(Sort ty) throws Z3Exception + public SetSort mkSetSort(Sort ty) throws Z3Exception { - CheckContextMatch(ty); + checkContextMatch(ty); return new SetSort(this, ty); } /** * Create an empty set. **/ - public Expr MkEmptySet(Sort domain) throws Z3Exception + public Expr mkEmptySet(Sort domain) throws Z3Exception { - CheckContextMatch(domain); - return Expr.Create(this, - Native.mkEmptySet(nCtx(), domain.NativeObject())); + checkContextMatch(domain); + return Expr.create(this, + Native.mkEmptySet(nCtx(), domain.getNativeObject())); } /** * Create the full set. **/ - public Expr MkFullSet(Sort domain) throws Z3Exception + public Expr mkFullSet(Sort domain) throws Z3Exception { - CheckContextMatch(domain); - return Expr.Create(this, - Native.mkFullSet(nCtx(), domain.NativeObject())); + checkContextMatch(domain); + return Expr.create(this, + Native.mkFullSet(nCtx(), domain.getNativeObject())); } /** * Add an element to the set. **/ - public Expr MkSetAdd(Expr set, Expr element) throws Z3Exception + public Expr mkSetAdd(Expr set, Expr element) throws Z3Exception { - CheckContextMatch(set); - CheckContextMatch(element); - return Expr.Create( + checkContextMatch(set); + checkContextMatch(element); + return Expr.create( this, - Native.mkSetAdd(nCtx(), set.NativeObject(), - element.NativeObject())); + Native.mkSetAdd(nCtx(), set.getNativeObject(), + element.getNativeObject())); } /** * Remove an element from a set. **/ - public Expr MkSetDel(Expr set, Expr element) throws Z3Exception + public Expr mkSetDel(Expr set, Expr element) throws Z3Exception { - CheckContextMatch(set); - CheckContextMatch(element); - return Expr.Create( + checkContextMatch(set); + checkContextMatch(element); + return Expr.create( this, - Native.mkSetDel(nCtx(), set.NativeObject(), - element.NativeObject())); + Native.mkSetDel(nCtx(), set.getNativeObject(), + element.getNativeObject())); } /** * Take the union of a list of sets. **/ - public Expr MkSetUnion(Expr[] args) throws Z3Exception + public Expr mkSetUnion(Expr... args) throws Z3Exception { - CheckContextMatch(args); - return Expr.Create( + checkContextMatch(args); + return Expr.create( this, Native.mkSetUnion(nCtx(), (int) args.length, - AST.ArrayToNative(args))); + AST.arrayToNative(args))); } /** * Take the intersection of a list of sets. **/ - public Expr MkSetIntersection(Expr[] args) throws Z3Exception + public Expr mkSetIntersection(Expr... args) throws Z3Exception { - CheckContextMatch(args); - return Expr.Create( + checkContextMatch(args); + return Expr.create( this, Native.mkSetIntersect(nCtx(), (int) args.length, - AST.ArrayToNative(args))); + AST.arrayToNative(args))); } /** * Take the difference between two sets. **/ - public Expr MkSetDifference(Expr arg1, Expr arg2) throws Z3Exception + public Expr mkSetDifference(Expr arg1, Expr arg2) throws Z3Exception { - CheckContextMatch(arg1); - CheckContextMatch(arg2); - return Expr.Create( + checkContextMatch(arg1); + checkContextMatch(arg2); + return Expr.create( this, - Native.mkSetDifference(nCtx(), arg1.NativeObject(), - arg2.NativeObject())); + Native.mkSetDifference(nCtx(), arg1.getNativeObject(), + arg2.getNativeObject())); } /** * Take the complement of a set. **/ - public Expr MkSetComplement(Expr arg) throws Z3Exception + public Expr mkSetComplement(Expr arg) throws Z3Exception { - CheckContextMatch(arg); - return Expr.Create(this, - Native.mkSetComplement(nCtx(), arg.NativeObject())); + checkContextMatch(arg); + return Expr.create(this, + Native.mkSetComplement(nCtx(), arg.getNativeObject())); } /** * Check for set membership. **/ - public Expr MkSetMembership(Expr elem, Expr set) throws Z3Exception + public Expr mkSetMembership(Expr elem, Expr set) throws Z3Exception { - CheckContextMatch(elem); - CheckContextMatch(set); - return Expr.Create( + checkContextMatch(elem); + checkContextMatch(set); + return Expr.create( this, - Native.mkSetMember(nCtx(), elem.NativeObject(), - set.NativeObject())); + Native.mkSetMember(nCtx(), elem.getNativeObject(), + set.getNativeObject())); } /** * Check for subsetness of sets. **/ - public Expr MkSetSubset(Expr arg1, Expr arg2) throws Z3Exception + public Expr mkSetSubset(Expr arg1, Expr arg2) throws Z3Exception { - CheckContextMatch(arg1); - CheckContextMatch(arg2); - return Expr.Create( + checkContextMatch(arg1); + checkContextMatch(arg2); + return Expr.create( this, - Native.mkSetSubset(nCtx(), arg1.NativeObject(), - arg2.NativeObject())); + Native.mkSetSubset(nCtx(), arg1.getNativeObject(), + arg2.getNativeObject())); } /** @@ -1875,12 +1868,12 @@ public class Context extends IDisposable * @return A Term with value and sort **/ - public Expr MkNumeral(String v, Sort ty) throws Z3Exception + public Expr mkNumeral(String v, Sort ty) throws Z3Exception { - CheckContextMatch(ty); - return Expr - .Create(this, Native.mkNumeral(nCtx(), v, ty.NativeObject())); + checkContextMatch(ty); + return Expr.create(this, + Native.mkNumeral(nCtx(), v, ty.getNativeObject())); } /** @@ -1893,11 +1886,11 @@ public class Context extends IDisposable * @return A Term with value and type **/ - public Expr MkNumeral(int v, Sort ty) throws Z3Exception + public Expr mkNumeral(int v, Sort ty) throws Z3Exception { - CheckContextMatch(ty); - return Expr.Create(this, Native.mkInt(nCtx(), v, ty.NativeObject())); + checkContextMatch(ty); + return Expr.create(this, Native.mkInt(nCtx(), v, ty.getNativeObject())); } /** @@ -1910,11 +1903,12 @@ public class Context extends IDisposable * @return A Term with value and type **/ - public Expr MkNumeral(long v, Sort ty) throws Z3Exception + public Expr mkNumeral(long v, Sort ty) throws Z3Exception { - CheckContextMatch(ty); - return Expr.Create(this, Native.mkInt64(nCtx(), v, ty.NativeObject())); + checkContextMatch(ty); + return Expr.create(this, + Native.mkInt64(nCtx(), v, ty.getNativeObject())); } /** @@ -1924,7 +1918,7 @@ public class Context extends IDisposable * @return A Term with value / * and sort Real **/ - public RatNum MkReal(int num, int den) throws Z3Exception + public RatNum mkReal(int num, int den) throws Z3Exception { if (den == 0) throw new Z3Exception("Denominator is zero"); @@ -1938,11 +1932,11 @@ public class Context extends IDisposable * * @return A Term with value and sort Real **/ - public RatNum MkReal(String v) throws Z3Exception + public RatNum mkReal(String v) throws Z3Exception { - return new RatNum(this, Native.mkNumeral(nCtx(), v, RealSort() - .NativeObject())); + return new RatNum(this, Native.mkNumeral(nCtx(), v, getRealSort() + .getNativeObject())); } /** @@ -1950,11 +1944,11 @@ public class Context extends IDisposable * * @return A Term with value and sort Real **/ - public RatNum MkReal(int v) throws Z3Exception + public RatNum mkReal(int v) throws Z3Exception { - return new RatNum(this, Native.mkInt(nCtx(), v, RealSort() - .NativeObject())); + return new RatNum(this, Native.mkInt(nCtx(), v, getRealSort() + .getNativeObject())); } /** @@ -1962,22 +1956,22 @@ public class Context extends IDisposable * * @return A Term with value and sort Real **/ - public RatNum MkReal(long v) throws Z3Exception + public RatNum mkReal(long v) throws Z3Exception { - return new RatNum(this, Native.mkInt64(nCtx(), v, RealSort() - .NativeObject())); + return new RatNum(this, Native.mkInt64(nCtx(), v, getRealSort() + .getNativeObject())); } /** * Create an integer numeral. A string representing the Term * value in decimal notation. **/ - public IntNum MkInt(String v) throws Z3Exception + public IntNum mkInt(String v) throws Z3Exception { - return new IntNum(this, Native.mkNumeral(nCtx(), v, IntSort() - .NativeObject())); + return new IntNum(this, Native.mkNumeral(nCtx(), v, getIntSort() + .getNativeObject())); } /** @@ -1985,11 +1979,11 @@ public class Context extends IDisposable * * @return A Term with value and sort Integer **/ - public IntNum MkInt(int v) throws Z3Exception + public IntNum mkInt(int v) throws Z3Exception { - return new IntNum(this, Native.mkInt(nCtx(), v, IntSort() - .NativeObject())); + return new IntNum(this, Native.mkInt(nCtx(), v, getIntSort() + .getNativeObject())); } /** @@ -1997,11 +1991,11 @@ public class Context extends IDisposable * * @return A Term with value and sort Integer **/ - public IntNum MkInt(long v) throws Z3Exception + public IntNum mkInt(long v) throws Z3Exception { - return new IntNum(this, Native.mkInt64(nCtx(), v, IntSort() - .NativeObject())); + return new IntNum(this, Native.mkInt64(nCtx(), v, getIntSort() + .getNativeObject())); } /** @@ -2009,30 +2003,30 @@ public class Context extends IDisposable * value in decimal notation. the size of the * bit-vector **/ - public BitVecNum MkBV(String v, int size) throws Z3Exception + public BitVecNum mkBV(String v, int size) throws Z3Exception { - return (BitVecNum) MkNumeral(v, MkBitVecSort(size)); + return (BitVecNum) mkNumeral(v, mkBitVecSort(size)); } /** * Create a bit-vector numeral. value of the * numeral. the size of the bit-vector **/ - public BitVecNum MkBV(int v, int size) throws Z3Exception + public BitVecNum mkBV(int v, int size) throws Z3Exception { - return (BitVecNum) MkNumeral(v, MkBitVecSort(size)); + return (BitVecNum) mkNumeral(v, mkBitVecSort(size)); } /** * Create a bit-vector numeral. value of the * numeral. * the size of the bit-vector **/ - public BitVecNum MkBV(long v, int size) throws Z3Exception + public BitVecNum mkBV(long v, int size) throws Z3Exception { - return (BitVecNum) MkNumeral(v, MkBitVecSort(size)); + return (BitVecNum) mkNumeral(v, mkBitVecSort(size)); } /** @@ -2054,7 +2048,7 @@ public class Context extends IDisposable * name="quantifierID">optional symbol to track quantifier. optional symbol to track skolem constants. **/ - public Quantifier MkForall(Sort[] sorts, Symbol[] names, Expr body, + public Quantifier mkForall(Sort[] sorts, Symbol[] names, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { @@ -2066,7 +2060,7 @@ public class Context extends IDisposable /** * Create a universal Quantifier. **/ - public Quantifier MkForall(Expr[] boundConstants, Expr body, int weight, + public Quantifier mkForall(Expr[] boundConstants, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { @@ -2079,7 +2073,7 @@ public class Context extends IDisposable * Create an existential Quantifier. **/ - public Quantifier MkExists(Sort[] sorts, Symbol[] names, Expr body, + public Quantifier mkExists(Sort[] sorts, Symbol[] names, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { @@ -2091,7 +2085,7 @@ public class Context extends IDisposable /** * Create an existential Quantifier. **/ - public Quantifier MkExists(Expr[] boundConstants, Expr body, int weight, + public Quantifier mkExists(Expr[] boundConstants, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { @@ -2103,33 +2097,33 @@ public class Context extends IDisposable /** * Create a Quantifier. **/ - public Quantifier MkQuantifier(boolean universal, Sort[] sorts, + public Quantifier mkQuantifier(boolean universal, Sort[] sorts, Symbol[] names, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { if (universal) - return MkForall(sorts, names, body, weight, patterns, noPatterns, + return mkForall(sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID); else - return MkExists(sorts, names, body, weight, patterns, noPatterns, + return mkExists(sorts, names, body, weight, patterns, noPatterns, quantifierID, skolemID); } /** * Create a Quantifier. **/ - public Quantifier MkQuantifier(boolean universal, Expr[] boundConstants, + public Quantifier mkQuantifier(boolean universal, Expr[] boundConstants, Expr body, int weight, Pattern[] patterns, Expr[] noPatterns, Symbol quantifierID, Symbol skolemID) throws Z3Exception { if (universal) - return MkForall(boundConstants, body, weight, patterns, noPatterns, + return mkForall(boundConstants, body, weight, patterns, noPatterns, quantifierID, skolemID); else - return MkExists(boundConstants, body, weight, patterns, noPatterns, + return mkExists(boundConstants, body, weight, patterns, noPatterns, quantifierID, skolemID); } @@ -2161,14 +2155,14 @@ public class Context extends IDisposable * * @return A string representation of the benchmark. **/ - public String BenchmarkToSMTString(String name, String logic, + public String benchmarkToSMTString(String name, String logic, String status, String attributes, BoolExpr[] assumptions, BoolExpr formula) throws Z3Exception { return Native.benchmarkToSmtlibString(nCtx(), name, logic, status, attributes, (int) assumptions.length, - AST.ArrayToNative(assumptions), formula.NativeObject()); + AST.arrayToNative(assumptions), formula.getNativeObject()); } /** @@ -2180,46 +2174,46 @@ public class Context extends IDisposable * name="decls"/>. This is a useful feature since we can use arbitrary names * to reference sorts and declarations. **/ - public void ParseSMTLIBString(String str, Symbol[] sortNames, Sort[] sorts, + public void parseSMTLIBString(String str, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl[] decls) throws Z3Exception { - int csn = Symbol.ArrayLength(sortNames); - int cs = Sort.ArrayLength(sorts); - int cdn = Symbol.ArrayLength(declNames); - int cd = AST.ArrayLength(decls); + int csn = Symbol.arrayLength(sortNames); + int cs = Sort.arrayLength(sorts); + int cdn = Symbol.arrayLength(declNames); + int cd = AST.arrayLength(decls); if (csn != cs || cdn != cd) throw new Z3Exception("Argument size mismatch"); - Native.parseSmtlibString(nCtx(), str, AST.ArrayLength(sorts), - Symbol.ArrayToNative(sortNames), AST.ArrayToNative(sorts), - AST.ArrayLength(decls), Symbol.ArrayToNative(declNames), - AST.ArrayToNative(decls)); + Native.parseSmtlibString(nCtx(), str, AST.arrayLength(sorts), + Symbol.arrayToNative(sortNames), AST.arrayToNative(sorts), + AST.arrayLength(decls), Symbol.arrayToNative(declNames), + AST.arrayToNative(decls)); } /** * Parse the given file using the SMT-LIB parser. **/ - public void ParseSMTLIBFile(String fileName, Symbol[] sortNames, + public void parseSMTLIBFile(String fileName, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl[] decls) throws Z3Exception { - int csn = Symbol.ArrayLength(sortNames); - int cs = Sort.ArrayLength(sorts); - int cdn = Symbol.ArrayLength(declNames); - int cd = AST.ArrayLength(decls); + int csn = Symbol.arrayLength(sortNames); + int cs = Sort.arrayLength(sorts); + int cdn = Symbol.arrayLength(declNames); + int cd = AST.arrayLength(decls); if (csn != cs || cdn != cd) throw new Z3Exception("Argument size mismatch"); - Native.parseSmtlibFile(nCtx(), fileName, AST.ArrayLength(sorts), - Symbol.ArrayToNative(sortNames), AST.ArrayToNative(sorts), - AST.ArrayLength(decls), Symbol.ArrayToNative(declNames), - AST.ArrayToNative(decls)); + Native.parseSmtlibFile(nCtx(), fileName, AST.arrayLength(sorts), + Symbol.arrayToNative(sortNames), AST.arrayToNative(sorts), + AST.arrayLength(decls), Symbol.arrayToNative(declNames), + AST.arrayToNative(decls)); } /** * The number of SMTLIB formulas parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public int NumSMTLIBFormulas() throws Z3Exception + public int getNumSMTLIBFormulas() throws Z3Exception { return Native.getSmtlibNumFormulas(nCtx()); } @@ -2228,13 +2222,13 @@ public class Context extends IDisposable * The formulas parsed by the last call to ParseSMTLIBString or * ParseSMTLIBFile. **/ - public BoolExpr[] SMTLIBFormulas() throws Z3Exception + public BoolExpr[] getSMTLIBFormulas() throws Z3Exception { - int n = NumSMTLIBFormulas(); + int n = getNumSMTLIBFormulas(); BoolExpr[] res = new BoolExpr[n]; for (int i = 0; i < n; i++) - res[i] = (BoolExpr) Expr.Create(this, + res[i] = (BoolExpr) Expr.create(this, Native.getSmtlibFormula(nCtx(), i)); return res; } @@ -2243,7 +2237,7 @@ public class Context extends IDisposable * The number of SMTLIB assumptions parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public int NumSMTLIBAssumptions() throws Z3Exception + public int getNumSMTLIBAssumptions() throws Z3Exception { return Native.getSmtlibNumAssumptions(nCtx()); } @@ -2252,13 +2246,13 @@ public class Context extends IDisposable * The assumptions parsed by the last call to ParseSMTLIBString * or ParseSMTLIBFile. **/ - public BoolExpr[] SMTLIBAssumptions() throws Z3Exception + public BoolExpr[] getSMTLIBAssumptions() throws Z3Exception { - int n = NumSMTLIBAssumptions(); + int n = getNumSMTLIBAssumptions(); BoolExpr[] res = new BoolExpr[n]; for (int i = 0; i < n; i++) - res[i] = (BoolExpr) Expr.Create(this, + res[i] = (BoolExpr) Expr.create(this, Native.getSmtlibAssumption(nCtx(), i)); return res; } @@ -2267,7 +2261,7 @@ public class Context extends IDisposable * The number of SMTLIB declarations parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public int NumSMTLIBDecls() throws Z3Exception + public int getNumSMTLIBDecls() throws Z3Exception { return Native.getSmtlibNumDecls(nCtx()); } @@ -2276,10 +2270,10 @@ public class Context extends IDisposable * The declarations parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public FuncDecl[] SMTLIBDecls() throws Z3Exception + public FuncDecl[] getSMTLIBDecls() throws Z3Exception { - int n = NumSMTLIBDecls(); + int n = getNumSMTLIBDecls(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) res[i] = new FuncDecl(this, Native.getSmtlibDecl(nCtx(), i)); @@ -2290,7 +2284,7 @@ public class Context extends IDisposable * The number of SMTLIB sorts parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public int NumSMTLIBSorts() throws Z3Exception + public int getNumSMTLIBSorts() throws Z3Exception { return Native.getSmtlibNumSorts(nCtx()); } @@ -2299,13 +2293,13 @@ public class Context extends IDisposable * The declarations parsed by the last call to * ParseSMTLIBString or ParseSMTLIBFile. **/ - public Sort[] SMTLIBSorts() throws Z3Exception + public Sort[] getSMTLIBSorts() throws Z3Exception { - int n = NumSMTLIBSorts(); + int n = getNumSMTLIBSorts(); Sort[] res = new Sort[n]; for (int i = 0; i < n; i++) - res[i] = Sort.Create(this, Native.getSmtlibSort(nCtx(), i)); + res[i] = Sort.create(this, Native.getSmtlibSort(nCtx(), i)); return res; } @@ -2316,43 +2310,43 @@ public class Context extends IDisposable * @return A conjunction of assertions in the scope (up to push/pop) at the * end of the string. **/ - public BoolExpr ParseSMTLIB2String(String str, Symbol[] sortNames, + public BoolExpr parseSMTLIB2String(String str, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl[] decls) throws Z3Exception { - int csn = Symbol.ArrayLength(sortNames); - int cs = Sort.ArrayLength(sorts); - int cdn = Symbol.ArrayLength(declNames); - int cd = AST.ArrayLength(decls); + int csn = Symbol.arrayLength(sortNames); + int cs = Sort.arrayLength(sorts); + int cdn = Symbol.arrayLength(declNames); + int cd = AST.arrayLength(decls); if (csn != cs || cdn != cd) throw new Z3Exception("Argument size mismatch"); - return (BoolExpr) Expr.Create(this, Native.parseSmtlib2String(nCtx(), - str, AST.ArrayLength(sorts), Symbol.ArrayToNative(sortNames), - AST.ArrayToNative(sorts), AST.ArrayLength(decls), - Symbol.ArrayToNative(declNames), AST.ArrayToNative(decls))); + return (BoolExpr) Expr.create(this, Native.parseSmtlib2String(nCtx(), + str, AST.arrayLength(sorts), Symbol.arrayToNative(sortNames), + AST.arrayToNative(sorts), AST.arrayLength(decls), + Symbol.arrayToNative(declNames), AST.arrayToNative(decls))); } /** * Parse the given file using the SMT-LIB2 parser. **/ - public BoolExpr ParseSMTLIB2File(String fileName, Symbol[] sortNames, + public BoolExpr parseSMTLIB2File(String fileName, Symbol[] sortNames, Sort[] sorts, Symbol[] declNames, FuncDecl[] decls) throws Z3Exception { - int csn = Symbol.ArrayLength(sortNames); - int cs = Sort.ArrayLength(sorts); - int cdn = Symbol.ArrayLength(declNames); - int cd = AST.ArrayLength(decls); + int csn = Symbol.arrayLength(sortNames); + int cs = Sort.arrayLength(sorts); + int cdn = Symbol.arrayLength(declNames); + int cd = AST.arrayLength(decls); if (csn != cs || cdn != cd) throw new Z3Exception("Argument size mismatch"); - return (BoolExpr) Expr.Create(this, Native.parseSmtlib2File(nCtx(), - fileName, AST.ArrayLength(sorts), - Symbol.ArrayToNative(sortNames), AST.ArrayToNative(sorts), - AST.ArrayLength(decls), Symbol.ArrayToNative(declNames), - AST.ArrayToNative(decls))); + return (BoolExpr) Expr.create(this, Native.parseSmtlib2File(nCtx(), + fileName, AST.arrayLength(sorts), + Symbol.arrayToNative(sortNames), AST.arrayToNative(sorts), + AST.arrayLength(decls), Symbol.arrayToNative(declNames), + AST.arrayToNative(decls))); } /** @@ -2364,7 +2358,7 @@ public class Context extends IDisposable * name="proofs">Indicates whether proof generation should be * enabled. **/ - public Goal MkGoal(boolean models, boolean unsatCores, boolean proofs) + public Goal mkGoal(boolean models, boolean unsatCores, boolean proofs) throws Z3Exception { @@ -2374,7 +2368,7 @@ public class Context extends IDisposable /** * Creates a new ParameterSet. **/ - public Params MkParams() throws Z3Exception + public Params mkParams() throws Z3Exception { return new Params(this); @@ -2383,7 +2377,7 @@ public class Context extends IDisposable /** * The number of supported tactics. **/ - public int NumTactics() throws Z3Exception + public int getNumTactics() throws Z3Exception { return Native.getNumTactics(nCtx()); } @@ -2391,10 +2385,10 @@ public class Context extends IDisposable /** * The names of all supported tactics. **/ - public String[] TacticNames() throws Z3Exception + public String[] getTacticNames() throws Z3Exception { - int n = NumTactics(); + int n = getNumTactics(); String[] res = new String[n]; for (int i = 0; i < n; i++) res[i] = Native.getTacticName(nCtx(), i); @@ -2405,7 +2399,7 @@ public class Context extends IDisposable * Returns a string containing a description of the tactic with the given * name. **/ - public String TacticDescription(String name) throws Z3Exception + public String getTacticDescription(String name) throws Z3Exception { return Native.tacticGetDescr(nCtx(), name); @@ -2414,7 +2408,7 @@ public class Context extends IDisposable /** * Creates a new Tactic. **/ - public Tactic MkTactic(String name) throws Z3Exception + public Tactic mkTactic(String name) throws Z3Exception { return new Tactic(this, name); @@ -2424,28 +2418,29 @@ public class Context extends IDisposable * Create a tactic that applies to a Goal and then * to every subgoal produced by . **/ - public Tactic AndThen(Tactic t1, Tactic t2, Tactic[] ts) throws Z3Exception + public Tactic andThen(Tactic t1, Tactic t2, Tactic... ts) + throws Z3Exception { - - CheckContextMatch(t1); - CheckContextMatch(t2); - CheckContextMatch(ts); + checkContextMatch(t1); + checkContextMatch(t2); + checkContextMatch(ts); long last = 0; if (ts != null && ts.length > 0) { - last = ts[ts.length - 1].NativeObject(); + last = ts[ts.length - 1].getNativeObject(); for (int i = ts.length - 2; i >= 0; i--) - last = Native.tacticAndThen(nCtx(), ts[i].NativeObject(), last); + last = Native.tacticAndThen(nCtx(), ts[i].getNativeObject(), + last); } if (last != 0) { - last = Native.tacticAndThen(nCtx(), t2.NativeObject(), last); + last = Native.tacticAndThen(nCtx(), t2.getNativeObject(), last); return new Tactic(this, Native.tacticAndThen(nCtx(), - t1.NativeObject(), last)); + t1.getNativeObject(), last)); } else return new Tactic(this, Native.tacticAndThen(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -2453,10 +2448,9 @@ public class Context extends IDisposable * to every subgoal produced by . * Shorthand for AndThen. **/ - public Tactic Then(Tactic t1, Tactic t2, Tactic[] ts) throws Z3Exception + public Tactic then(Tactic t1, Tactic t2, Tactic... ts) throws Z3Exception { - - return AndThen(t1, t2, ts); + return andThen(t1, t2, ts); } /** @@ -2464,13 +2458,13 @@ public class Context extends IDisposable * it fails then returns the result of applied to the * Goal. **/ - public Tactic OrElse(Tactic t1, Tactic t2) throws Z3Exception + public Tactic orElse(Tactic t1, Tactic t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); - return new Tactic(this, Native.tacticOrElse(nCtx(), t1.NativeObject(), - t2.NativeObject())); + checkContextMatch(t1); + checkContextMatch(t2); + return new Tactic(this, Native.tacticOrElse(nCtx(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -2479,12 +2473,12 @@ public class Context extends IDisposable * terminate within milliseconds, then it fails. * **/ - public Tactic TryFor(Tactic t, int ms) throws Z3Exception + public Tactic tryFor(Tactic t, int ms) throws Z3Exception { - CheckContextMatch(t); - return new Tactic(this, Native.tacticTryFor(nCtx(), t.NativeObject(), - ms)); + checkContextMatch(t); + return new Tactic(this, Native.tacticTryFor(nCtx(), + t.getNativeObject(), ms)); } /** @@ -2493,13 +2487,13 @@ public class Context extends IDisposable * name="p"/> evaluates to false, then the new tactic behaves like the * skip tactic. **/ - public Tactic When(Probe p, Tactic t) throws Z3Exception + public Tactic when(Probe p, Tactic t) throws Z3Exception { - CheckContextMatch(t); - CheckContextMatch(p); - return new Tactic(this, Native.tacticWhen(nCtx(), p.NativeObject(), - t.NativeObject())); + checkContextMatch(t); + checkContextMatch(p); + return new Tactic(this, Native.tacticWhen(nCtx(), p.getNativeObject(), + t.getNativeObject())); } /** @@ -2507,14 +2501,14 @@ public class Context extends IDisposable * probe evaluates to true and * otherwise. **/ - public Tactic Cond(Probe p, Tactic t1, Tactic t2) throws Z3Exception + public Tactic cond(Probe p, Tactic t1, Tactic t2) throws Z3Exception { - CheckContextMatch(p); - CheckContextMatch(t1); - CheckContextMatch(t2); - return new Tactic(this, Native.tacticCond(nCtx(), p.NativeObject(), - t1.NativeObject(), t2.NativeObject())); + checkContextMatch(p); + checkContextMatch(t1); + checkContextMatch(t2); + return new Tactic(this, Native.tacticCond(nCtx(), p.getNativeObject(), + t1.getNativeObject(), t2.getNativeObject())); } /** @@ -2522,18 +2516,18 @@ public class Context extends IDisposable * is not modified anymore or the maximum number of iterations is reached. **/ - public Tactic Repeat(Tactic t, int max) throws Z3Exception + public Tactic repeat(Tactic t, int max) throws Z3Exception { - CheckContextMatch(t); - return new Tactic(this, Native.tacticRepeat(nCtx(), t.NativeObject(), - max)); + checkContextMatch(t); + return new Tactic(this, Native.tacticRepeat(nCtx(), + t.getNativeObject(), max)); } /** * Create a tactic that just returns the given goal. **/ - public Tactic Skip() throws Z3Exception + public Tactic skip() throws Z3Exception { return new Tactic(this, Native.tacticSkip(nCtx())); @@ -2542,7 +2536,7 @@ public class Context extends IDisposable /** * Create a tactic always fails. **/ - public Tactic Fail() throws Z3Exception + public Tactic fail() throws Z3Exception { return new Tactic(this, Native.tacticFail(nCtx())); @@ -2552,20 +2546,20 @@ public class Context extends IDisposable * Create a tactic that fails if the probe evaluates to * false. **/ - public Tactic FailIf(Probe p) throws Z3Exception + public Tactic failIf(Probe p) throws Z3Exception { - CheckContextMatch(p); - return new Tactic(this, Native.tacticFailIf(nCtx(), p.NativeObject())); + checkContextMatch(p); + return new Tactic(this, + Native.tacticFailIf(nCtx(), p.getNativeObject())); } /** * Create a tactic that fails if the goal is not triviall satisfiable (i.e., * empty) or trivially unsatisfiable (i.e., contains `false'). **/ - public Tactic FailIfNotDecided() throws Z3Exception + public Tactic failIfNotDecided() throws Z3Exception { - return new Tactic(this, Native.tacticFailIfNotDecided(nCtx())); } @@ -2573,13 +2567,12 @@ public class Context extends IDisposable * Create a tactic that applies using the given set of * parameters . **/ - public Tactic UsingParams(Tactic t, Params p) throws Z3Exception + public Tactic usingParams(Tactic t, Params p) throws Z3Exception { - - CheckContextMatch(t); - CheckContextMatch(p); + checkContextMatch(t); + checkContextMatch(p); return new Tactic(this, Native.tacticUsingParams(nCtx(), - t.NativeObject(), p.NativeObject())); + t.getNativeObject(), p.getNativeObject())); } /** @@ -2587,21 +2580,19 @@ public class Context extends IDisposable * parameters . Alias for * UsingParams **/ - public Tactic With(Tactic t, Params p) throws Z3Exception + public Tactic with(Tactic t, Params p) throws Z3Exception { - - return UsingParams(t, p); + return usingParams(t, p); } /** * Create a tactic that applies the given tactics in parallel. **/ - public Tactic ParOr(Tactic[] t) throws Z3Exception + public Tactic parOr(Tactic... t) throws Z3Exception { - - CheckContextMatch(t); + checkContextMatch(t); return new Tactic(this, Native.tacticParOr(nCtx(), - Tactic.ArrayLength(t), Tactic.ArrayToNative(t))); + Tactic.arrayLength(t), Tactic.arrayToNative(t))); } /** @@ -2609,20 +2600,20 @@ public class Context extends IDisposable * then to every subgoal produced by . The subgoals are processed in parallel. **/ - public Tactic ParAndThen(Tactic t1, Tactic t2) throws Z3Exception + public Tactic parAndThen(Tactic t1, Tactic t2) throws Z3Exception { - CheckContextMatch(t1); - CheckContextMatch(t2); + checkContextMatch(t1); + checkContextMatch(t2); return new Tactic(this, Native.tacticParAndThen(nCtx(), - t1.NativeObject(), t2.NativeObject())); + t1.getNativeObject(), t2.getNativeObject())); } /** * Interrupt the execution of a Z3 procedure. This procedure can be * used to interrupt: solvers, simplifiers and tactics. **/ - public void Interrupt() throws Z3Exception + public void interrupt() throws Z3Exception { Native.interrupt(nCtx()); } @@ -2630,7 +2621,7 @@ public class Context extends IDisposable /** * The number of supported Probes. **/ - public int NumProbes() throws Z3Exception + public int getNumProbes() throws Z3Exception { return Native.getNumProbes(nCtx()); } @@ -2638,10 +2629,10 @@ public class Context extends IDisposable /** * The names of all supported Probes. **/ - public String[] ProbeNames() throws Z3Exception + public String[] getProbeNames() throws Z3Exception { - int n = NumProbes(); + int n = getNumProbes(); String[] res = new String[n]; for (int i = 0; i < n; i++) res[i] = Native.getProbeName(nCtx(), i); @@ -2652,27 +2643,24 @@ public class Context extends IDisposable * Returns a string containing a description of the probe with the given * name. **/ - public String ProbeDescription(String name) throws Z3Exception + public String getProbeDescription(String name) throws Z3Exception { - return Native.probeGetDescr(nCtx(), name); } /** * Creates a new Probe. **/ - public Probe MkProbe(String name) throws Z3Exception + public Probe mkProbe(String name) throws Z3Exception { - return new Probe(this, name); } /** * Create a probe that always evaluates to . **/ - public Probe Const(double val) throws Z3Exception + public Probe constProbe(double val) throws Z3Exception { - return new Probe(this, Native.probeConst(nCtx(), val)); } @@ -2681,13 +2669,13 @@ public class Context extends IDisposable * is less than the value returned by **/ - public Probe Lt(Probe p1, Probe p2) throws Z3Exception + public Probe lt(Probe p1, Probe p2) throws Z3Exception { - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeLt(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeLt(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** @@ -2695,13 +2683,13 @@ public class Context extends IDisposable * is greater than the value returned by **/ - public Probe Gt(Probe p1, Probe p2) throws Z3Exception + public Probe gt(Probe p1, Probe p2) throws Z3Exception { - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeGt(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeGt(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** @@ -2709,13 +2697,13 @@ public class Context extends IDisposable * is less than or equal the value returned by * **/ - public Probe Le(Probe p1, Probe p2) throws Z3Exception + public Probe le(Probe p1, Probe p2) throws Z3Exception { - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeLe(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeLe(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** @@ -2723,13 +2711,12 @@ public class Context extends IDisposable * is greater than or equal the value returned by * **/ - public Probe Ge(Probe p1, Probe p2) throws Z3Exception + public Probe ge(Probe p1, Probe p2) throws Z3Exception { - - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeGe(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeGe(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** @@ -2737,50 +2724,47 @@ public class Context extends IDisposable * is equal to the value returned by **/ - public Probe Eq(Probe p1, Probe p2) throws Z3Exception + public Probe eq(Probe p1, Probe p2) throws Z3Exception { - - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeEq(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeEq(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** * Create a probe that evaluates to "true" when the value and evaluate to "true". **/ - public Probe And(Probe p1, Probe p2) throws Z3Exception + public Probe and(Probe p1, Probe p2) throws Z3Exception { - - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeAnd(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeAnd(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** * Create a probe that evaluates to "true" when the value or evaluate to "true". **/ - public Probe Or(Probe p1, Probe p2) throws Z3Exception + public Probe or(Probe p1, Probe p2) throws Z3Exception { - - CheckContextMatch(p1); - CheckContextMatch(p2); - return new Probe(this, Native.probeOr(nCtx(), p1.NativeObject(), - p2.NativeObject())); + checkContextMatch(p1); + checkContextMatch(p2); + return new Probe(this, Native.probeOr(nCtx(), p1.getNativeObject(), + p2.getNativeObject())); } /** * Create a probe that evaluates to "true" when the value does not evaluate to "true". **/ - public Probe Not(Probe p) throws Z3Exception + public Probe not(Probe p) throws Z3Exception { - CheckContextMatch(p); - return new Probe(this, Native.probeNot(nCtx(), p.NativeObject())); + checkContextMatch(p); + return new Probe(this, Native.probeNot(nCtx(), p.getNativeObject())); } /** @@ -2789,9 +2773,9 @@ public class Context extends IDisposable * check-sat commands that take more than a given number of milliseconds to * be solved. **/ - public Solver MkSolver() throws Z3Exception + public Solver mkSolver() throws Z3Exception { - return MkSolver((Symbol) null); + return mkSolver((Symbol) null); } /** @@ -2800,29 +2784,29 @@ public class Context extends IDisposable * check-sat commands that take more than a given number of milliseconds to * be solved. **/ - public Solver MkSolver(Symbol logic) throws Z3Exception + public Solver mkSolver(Symbol logic) throws Z3Exception { if (logic == null) return new Solver(this, Native.mkSolver(nCtx())); else return new Solver(this, Native.mkSolverForLogic(nCtx(), - logic.NativeObject())); + logic.getNativeObject())); } /** * Creates a new (incremental) solver. **/ - public Solver MkSolver(String logic) throws Z3Exception + public Solver mkSolver(String logic) throws Z3Exception { - return MkSolver(MkSymbol(logic)); + return mkSolver(mkSymbol(logic)); } /** * Creates a new (incremental) solver. **/ - public Solver MkSimpleSolver() throws Z3Exception + public Solver mkSimpleSolver() throws Z3Exception { return new Solver(this, Native.mkSimpleSolver(nCtx())); @@ -2833,17 +2817,17 @@ public class Context extends IDisposable * The solver supports the commands Push and Pop, * but it will always solve each check from scratch. **/ - public Solver MkSolver(Tactic t) throws Z3Exception + public Solver mkSolver(Tactic t) throws Z3Exception { return new Solver(this, Native.mkSolverFromTactic(nCtx(), - t.NativeObject())); + t.getNativeObject())); } /** * Create a Fixedpoint context. **/ - public Fixedpoint MkFixedpoint() throws Z3Exception + public Fixedpoint mkFixedpoint() throws Z3Exception { return new Fixedpoint(this); @@ -2858,10 +2842,10 @@ public class Context extends IDisposable * cref="UnwrapAST"/> The native pointer to * wrap. **/ - public AST WrapAST(long nativeObject) throws Z3Exception + public AST wrapAST(long nativeObject) throws Z3Exception { - return AST.Create(this, nativeObject); + return AST.create(this, nativeObject); } /** @@ -2873,9 +2857,9 @@ public class Context extends IDisposable * e.g., ). The AST to unwrap. **/ - public long UnwrapAST(AST a) + public long unwrapAST(AST a) { - return a.NativeObject(); + return a.getNativeObject(); } /** @@ -2891,7 +2875,7 @@ public class Context extends IDisposable /** * Retrieves parameter descriptions for simplifier. **/ - public ParamDescrs SimplifyParameterDescriptions() throws Z3Exception + public ParamDescrs getSimplifyParameterDescriptions() throws Z3Exception { return new ParamDescrs(this, Native.simplifyGetParamDescrs(nCtx())); } @@ -2914,7 +2898,7 @@ public class Context extends IDisposable * once the context is created. An exception is thrown when trying to modify * an immutable parameter. **/ - public void UpdateParamValue(String id, String value) throws Z3Exception + public void updateParamValue(String id, String value) throws Z3Exception { Native.updateParamValue(nCtx(), id, value); } @@ -2923,7 +2907,7 @@ public class Context extends IDisposable * Get a configuration parameter. Returns null if the parameter * value does not exist. **/ - public String GetParamValue(String id) throws Z3Exception + public String getParamValue(String id) throws Z3Exception { Native.StringPtr res = new Native.StringPtr(); boolean r = Native.getParamValue(nCtx(), id, res); @@ -2940,23 +2924,23 @@ public class Context extends IDisposable return m_ctx; } - void InitContext() throws Z3Exception + void initContext() throws Z3Exception { setPrintMode(Z3_ast_print_mode.Z3_PRINT_SMTLIB2_COMPLIANT); - Native.setInternalErrorHandler(nCtx()); + Native.setInternalErrorHandler(nCtx()); } - void CheckContextMatch(Z3Object other) throws Z3Exception + void checkContextMatch(Z3Object other) throws Z3Exception { - if (this != other.Context()) + if (this != other.getContext()) throw new Z3Exception("Context mismatch"); } - void CheckContextMatch(Z3Object[] arr) throws Z3Exception + void checkContextMatch(Z3Object[] arr) throws Z3Exception { if (arr != null) for (Z3Object a : arr) - CheckContextMatch(a); + checkContextMatch(a); } private ASTDecRefQueue m_AST_DRQ = new ASTDecRefQueue(); @@ -2975,77 +2959,77 @@ public class Context extends IDisposable private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue(); private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue(); - ASTDecRefQueue AST_DRQ() + ASTDecRefQueue ast_DRQ() { return m_AST_DRQ; } - ASTMapDecRefQueue ASTMap_DRQ() + ASTMapDecRefQueue astmap_DRQ() { return m_ASTMap_DRQ; } - ASTVectorDecRefQueue ASTVector_DRQ() + ASTVectorDecRefQueue astvector_DRQ() { return m_ASTVector_DRQ; } - ApplyResultDecRefQueue ApplyResult_DRQ() + ApplyResultDecRefQueue applyResult_DRQ() { return m_ApplyResult_DRQ; } - FuncInterpEntryDecRefQueue FuncEntry_DRQ() + FuncInterpEntryDecRefQueue funcEntry_DRQ() { return m_FuncEntry_DRQ; } - FuncInterpDecRefQueue FuncInterp_DRQ() + FuncInterpDecRefQueue funcInterp_DRQ() { return m_FuncInterp_DRQ; } - GoalDecRefQueue Goal_DRQ() + GoalDecRefQueue goal_DRQ() { return m_Goal_DRQ; } - ModelDecRefQueue Model_DRQ() + ModelDecRefQueue model_DRQ() { return m_Model_DRQ; } - ParamsDecRefQueue Params_DRQ() + ParamsDecRefQueue params_DRQ() { return m_Params_DRQ; } - ParamDescrsDecRefQueue ParamDescrs_DRQ() + ParamDescrsDecRefQueue paramDescrs_DRQ() { return m_ParamDescrs_DRQ; } - ProbeDecRefQueue Probe_DRQ() + ProbeDecRefQueue probe_DRQ() { return m_Probe_DRQ; } - SolverDecRefQueue Solver_DRQ() + SolverDecRefQueue solver_DRQ() { return m_Solver_DRQ; } - StatisticsDecRefQueue Statistics_DRQ() + StatisticsDecRefQueue statistics_DRQ() { return m_Statistics_DRQ; } - TacticDecRefQueue Tactic_DRQ() + TacticDecRefQueue tactic_DRQ() { return m_Tactic_DRQ; } - FixedpointDecRefQueue Fixedpoint_DRQ() + FixedpointDecRefQueue fixedpoint_DRQ() { return m_Fixedpoint_DRQ; } @@ -3057,7 +3041,7 @@ public class Context extends IDisposable **/ protected void finalize() { - Dispose(); + dispose(); if (m_refCount == 0) { @@ -3078,22 +3062,22 @@ public class Context extends IDisposable /** * Disposes of the context. **/ - public void Dispose() + public void dispose() { - m_AST_DRQ.Clear(this); - m_ASTMap_DRQ.Clear(this); - m_ASTVector_DRQ.Clear(this); - m_ApplyResult_DRQ.Clear(this); - m_FuncEntry_DRQ.Clear(this); - m_FuncInterp_DRQ.Clear(this); - m_Goal_DRQ.Clear(this); - m_Model_DRQ.Clear(this); - m_Params_DRQ.Clear(this); - m_Probe_DRQ.Clear(this); - m_Solver_DRQ.Clear(this); - m_Statistics_DRQ.Clear(this); - m_Tactic_DRQ.Clear(this); - m_Fixedpoint_DRQ.Clear(this); + m_AST_DRQ.clear(this); + m_ASTMap_DRQ.clear(this); + m_ASTVector_DRQ.clear(this); + m_ApplyResult_DRQ.clear(this); + m_FuncEntry_DRQ.clear(this); + m_FuncInterp_DRQ.clear(this); + m_Goal_DRQ.clear(this); + m_Model_DRQ.clear(this); + m_Params_DRQ.clear(this); + m_Probe_DRQ.clear(this); + m_Solver_DRQ.clear(this); + m_Statistics_DRQ.clear(this); + m_Tactic_DRQ.clear(this); + m_Fixedpoint_DRQ.clear(this); m_boolSort = null; m_intSort = null; diff --git a/src/api/java/DatatypeSort.java b/src/api/java/DatatypeSort.java index 7e6d002aa..f7b2f7d32 100644 --- a/src/api/java/DatatypeSort.java +++ b/src/api/java/DatatypeSort.java @@ -14,10 +14,10 @@ public class DatatypeSort extends Sort /** * The number of constructors of the datatype sort. **/ - public int NumConstructors() throws Z3Exception + public int getNumConstructors() throws Z3Exception { - return Native.getDatatypeSortNumConstructors(Context().nCtx(), - NativeObject()); + return Native.getDatatypeSortNumConstructors(getContext().nCtx(), + getNativeObject()); } /** @@ -25,13 +25,13 @@ public class DatatypeSort extends Sort * * @throws Z3Exception **/ - public FuncDecl[] Constructors() throws Z3Exception + public FuncDecl[] getConstructors() throws Z3Exception { - int n = NumConstructors(); + int n = getNumConstructors(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) - res[i] = new FuncDecl(Context(), Native.getDatatypeSortConstructor( - Context().nCtx(), NativeObject(), i)); + res[i] = new FuncDecl(getContext(), Native.getDatatypeSortConstructor( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -40,13 +40,13 @@ public class DatatypeSort extends Sort * * @throws Z3Exception **/ - public FuncDecl[] Recognizers() throws Z3Exception + public FuncDecl[] getRecognizers() throws Z3Exception { - int n = NumConstructors(); + int n = getNumConstructors(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) - res[i] = new FuncDecl(Context(), Native.getDatatypeSortRecognizer( - Context().nCtx(), NativeObject(), i)); + res[i] = new FuncDecl(getContext(), Native.getDatatypeSortRecognizer( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -55,22 +55,22 @@ public class DatatypeSort extends Sort * * @throws Z3Exception **/ - public FuncDecl[][] Accessors() throws Z3Exception + public FuncDecl[][] getAccessors() throws Z3Exception { - int n = NumConstructors(); + int n = getNumConstructors(); 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 fd = new FuncDecl(getContext(), + Native.getDatatypeSortConstructor(getContext().nCtx(), + getNativeObject(), i)); + int ds = fd.getDomainSize(); FuncDecl[] tmp = new FuncDecl[ds]; for (int j = 0; j < ds; j++) - tmp[j] = new FuncDecl(Context(), - Native.getDatatypeSortConstructorAccessor(Context() - .nCtx(), NativeObject(), i, j)); + tmp[j] = new FuncDecl(getContext(), + Native.getDatatypeSortConstructorAccessor(getContext() + .nCtx(), getNativeObject(), i, j)); res[i] = tmp; } return res; @@ -84,8 +84,8 @@ public class DatatypeSort extends Sort DatatypeSort(Context ctx, Symbol name, Constructor[] constructors) throws Z3Exception { - super(ctx, Native.mkDatatype(ctx.nCtx(), name.NativeObject(), - (int) constructors.length, ArrayToNative(constructors))); + super(ctx, Native.mkDatatype(ctx.nCtx(), name.getNativeObject(), + (int) constructors.length, arrayToNative(constructors))); } }; diff --git a/src/api/java/EnumSort.java b/src/api/java/EnumSort.java index 10f0f9764..f3cbda954 100644 --- a/src/api/java/EnumSort.java +++ b/src/api/java/EnumSort.java @@ -14,7 +14,7 @@ public class EnumSort extends Sort /** * The function declarations of the constants in the enumeration. **/ - public FuncDecl[] ConstDecls() + public FuncDecl[] getConstDecls() { return _constdecls; } @@ -22,7 +22,7 @@ public class EnumSort extends Sort /** * The constants in the enumeration. **/ - public Expr[] Consts() + public Expr[] getConsts() { return _consts; } @@ -30,7 +30,7 @@ public class EnumSort extends Sort /** * The test predicates for the constants in the enumeration. **/ - public FuncDecl[] TesterDecls() + public FuncDecl[] getTesterDecls() { return _testerdecls; } @@ -46,7 +46,7 @@ public class EnumSort extends Sort long[] n_constdecls = new long[n]; long[] n_testers = new long[n]; setNativeObject(Native.mkEnumerationSort(ctx.nCtx(), - name.NativeObject(), (int) n, Symbol.ArrayToNative(enumNames), + name.getNativeObject(), (int) n, Symbol.arrayToNative(enumNames), n_constdecls, n_testers)); _constdecls = new FuncDecl[n]; for (int i = 0; i < n; i++) @@ -56,6 +56,6 @@ public class EnumSort extends Sort _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], (Expr[])null); + _consts[i] = ctx.mkApp(_constdecls[i], (Expr[])null); } }; diff --git a/src/api/java/Expr.java b/src/api/java/Expr.java index 09456307f..7793a16e5 100644 --- a/src/api/java/Expr.java +++ b/src/api/java/Expr.java @@ -6,7 +6,10 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_ast_kind; +import com.microsoft.z3.enumerations.Z3_decl_kind; +import com.microsoft.z3.enumerations.Z3_lbool; +import com.microsoft.z3.enumerations.Z3_sort_kind; /* using System; */ @@ -18,9 +21,9 @@ public class Expr extends AST /** * Returns a simplified version of the expression **/ - public Expr Simplify() throws Z3Exception + public Expr simplify() throws Z3Exception { - return Simplify(null); + return simplify(null); } /** @@ -29,59 +32,57 @@ public class Expr extends AST * parameters to configure the simplifier * **/ - public Expr Simplify(Params p) throws Z3Exception + public Expr simplify(Params p) throws Z3Exception { if (p == null) - return Expr.Create(Context(), - Native.simplify(Context().nCtx(), NativeObject())); + return Expr.create(getContext(), + Native.simplify(getContext().nCtx(), getNativeObject())); else - return Expr.Create( - Context(), - Native.simplifyEx(Context().nCtx(), NativeObject(), - p.NativeObject())); + return Expr.create( + getContext(), + Native.simplifyEx(getContext().nCtx(), getNativeObject(), + p.getNativeObject())); } /** * The function declaration of the function that is applied in this * expression. **/ - public FuncDecl FuncDecl() throws Z3Exception + public FuncDecl getFuncDecl() throws Z3Exception { - - return new FuncDecl(Context(), Native.getAppDecl(Context().nCtx(), - NativeObject())); + return new FuncDecl(getContext(), Native.getAppDecl(getContext().nCtx(), + getNativeObject())); } /** * Indicates whether the expression is the true or false expression or * something else (Z3_L_UNDEF). **/ - public Z3_lbool BoolValue() throws Z3Exception + public Z3_lbool getBoolValue() throws Z3Exception { - return Z3_lbool.fromInt(Native.getBoolValue(Context().nCtx(), - NativeObject())); + return Z3_lbool.fromInt(Native.getBoolValue(getContext().nCtx(), + getNativeObject())); } /** * The number of arguments of the expression. **/ - public int NumArgs() throws Z3Exception + public int getNumArgs() throws Z3Exception { - return Native.getAppNumArgs(Context().nCtx(), NativeObject()); + return Native.getAppNumArgs(getContext().nCtx(), getNativeObject()); } /** * The arguments of the expression. **/ - public Expr[] Args() throws Z3Exception + public Expr[] getArgs() throws Z3Exception { - - int n = NumArgs(); + int n = getNumArgs(); Expr[] res = new Expr[n]; for (int i = 0; i < n; i++) - res[i] = Expr.Create(Context(), - Native.getAppArg(Context().nCtx(), NativeObject(), i)); + res[i] = Expr.create(getContext(), + Native.getAppArg(getContext().nCtx(), getNativeObject(), i)); return res; } @@ -90,14 +91,13 @@ public class Expr extends AST * name="args"/> The number of new arguments should coincide with the * current number of arguments. **/ - public void Update(Expr[] args) throws Z3Exception + public void update(Expr[] args) throws Z3Exception { - - Context().CheckContextMatch(args); - if (args.length != NumArgs()) + getContext().checkContextMatch(args); + if (args.length != getNumArgs()) throw new Z3Exception("Number of arguments does not match"); - setNativeObject(Native.updateTerm(Context().nCtx(), NativeObject(), - (int) args.length, Expr.ArrayToNative(args))); + setNativeObject(Native.updateTerm(getContext().nCtx(), getNativeObject(), + (int) args.length, Expr.arrayToNative(args))); } /** @@ -109,26 +109,25 @@ public class Expr extends AST * num_exprs, we must have that sort of from[i] * must be equal to sort of to[i]. **/ - public Expr Substitute(Expr[] from, Expr[] to) throws Z3Exception + public Expr substitute(Expr[] from, Expr[] to) throws Z3Exception { - - Context().CheckContextMatch(from); - Context().CheckContextMatch(to); + getContext().checkContextMatch(from); + getContext().checkContextMatch(to); if (from.length != to.length) throw new Z3Exception("Argument sizes do not match"); - return Expr.Create(Context(), Native.substitute(Context().nCtx(), - NativeObject(), (int) from.length, Expr.ArrayToNative(from), - Expr.ArrayToNative(to))); + return Expr.create(getContext(), Native.substitute(getContext().nCtx(), + getNativeObject(), (int) from.length, Expr.arrayToNative(from), + Expr.arrayToNative(to))); } /** * Substitute every occurrence of from in the expression with * to. **/ - public Expr Substitute(Expr from, Expr to) throws Z3Exception + public Expr substitute(Expr from, Expr to) throws Z3Exception { - return Substitute(new Expr[] { from }, new Expr[] { to }); + return substitute(new Expr[] { from }, new Expr[] { to }); } /** @@ -137,12 +136,12 @@ public class Expr extends AST * num_exprs, the variable with de-Bruijn index i * is replaced with term to[i]. **/ - public Expr SubstituteVars(Expr[] to) throws Z3Exception + public Expr substituteVars(Expr[] to) throws Z3Exception { - Context().CheckContextMatch(to); - return Expr.Create(Context(), Native.substituteVars(Context().nCtx(), - NativeObject(), (int) to.length, Expr.ArrayToNative(to))); + getContext().checkContextMatch(to); + return Expr.create(getContext(), Native.substituteVars(getContext().nCtx(), + getNativeObject(), (int) to.length, Expr.arrayToNative(to))); } /** @@ -152,15 +151,15 @@ public class Expr extends AST * @return A copy of the term which is associated with **/ - public Expr Translate(Context ctx) throws Z3Exception + public Expr translate(Context ctx) throws Z3Exception { - if (Context() == ctx) + if (getContext() == ctx) return this; else - return Expr.Create( + return Expr.create( ctx, - Native.translate(Context().nCtx(), NativeObject(), + Native.translate(getContext().nCtx(), getNativeObject(), ctx.nCtx())); } @@ -175,9 +174,9 @@ public class Expr extends AST /** * Indicates whether the term is a numeral **/ - public boolean IsNumeral() throws Z3Exception + public boolean isNumeral() throws Z3Exception { - return Native.isNumeralAst(Context().nCtx(), NativeObject()); + return Native.isNumeralAst(getContext().nCtx(), getNativeObject()); } /** @@ -185,310 +184,310 @@ public class Expr extends AST * * @return True if the term is well-sorted, false otherwise. **/ - public boolean IsWellSorted() throws Z3Exception + public boolean isWellSorted() throws Z3Exception { - return Native.isWellSorted(Context().nCtx(), NativeObject()); + return Native.isWellSorted(getContext().nCtx(), getNativeObject()); } /** * The Sort of the term. **/ - public Sort Sort() throws Z3Exception + public Sort getSort() throws Z3Exception { - return Sort.Create(Context(), - Native.getSort(Context().nCtx(), NativeObject())); + return Sort.create(getContext(), + Native.getSort(getContext().nCtx(), getNativeObject())); } /** * Indicates whether the term represents a constant. **/ - public boolean IsConst() throws Z3Exception + public boolean isConst() throws Z3Exception { - return IsApp() && NumArgs() == 0 && FuncDecl().DomainSize() == 0; + return isApp() && getNumArgs() == 0 && getFuncDecl().getDomainSize() == 0; } /** * Indicates whether the term is an integer numeral. **/ - public boolean IsIntNum() throws Z3Exception + public boolean isIntNum() throws Z3Exception { - return IsNumeral() && IsInt(); + return isNumeral() && isInt(); } /** * Indicates whether the term is a real numeral. **/ - public boolean IsRatNum() throws Z3Exception + public boolean isRatNum() throws Z3Exception { - return IsNumeral() && IsReal(); + return isNumeral() && isReal(); } /** * Indicates whether the term is an algebraic number **/ - public boolean IsAlgebraicNumber() throws Z3Exception + public boolean isAlgebraicNumber() throws Z3Exception { - return Native.isAlgebraicNumber(Context().nCtx(), NativeObject()); + return Native.isAlgebraicNumber(getContext().nCtx(), getNativeObject()); } /** * Indicates whether the term has Boolean sort. **/ - public boolean IsBool() throws Z3Exception + public boolean isBool() throws Z3Exception { - return (IsExpr() && Native.isEqSort(Context().nCtx(), - Native.mkBoolSort(Context().nCtx()), - Native.getSort(Context().nCtx(), NativeObject()))); + return (isExpr() && Native.isEqSort(getContext().nCtx(), + Native.mkBoolSort(getContext().nCtx()), + Native.getSort(getContext().nCtx(), getNativeObject()))); } /** * Indicates whether the term is the constant true. **/ - public boolean IsTrue() throws Z3Exception + public boolean isTrue() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_TRUE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_TRUE; } /** * Indicates whether the term is the constant false. **/ - public boolean IsFalse() throws Z3Exception + public boolean isFalse() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_FALSE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FALSE; } /** * Indicates whether the term is an equality predicate. **/ - public boolean IsEq() throws Z3Exception + public boolean isEq() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_EQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_EQ; } /** * Indicates whether the term is an n-ary distinct predicate (every argument * is mutually distinct). **/ - public boolean IsDistinct() throws Z3Exception + public boolean isDistinct() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_DISTINCT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_DISTINCT; } /** * Indicates whether the term is a ternary if-then-else term **/ - public boolean IsITE() throws Z3Exception + public boolean isITE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ITE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ITE; } /** * Indicates whether the term is an n-ary conjunction **/ - public boolean IsAnd() throws Z3Exception + public boolean isAnd() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_AND; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_AND; } /** * Indicates whether the term is an n-ary disjunction **/ - public boolean IsOr() throws Z3Exception + public boolean isOr() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_OR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_OR; } /** * Indicates whether the term is an if-and-only-if (Boolean equivalence, * binary) **/ - public boolean IsIff() throws Z3Exception + public boolean isIff() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_IFF; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_IFF; } /** * Indicates whether the term is an exclusive or **/ - public boolean IsXor() throws Z3Exception + public boolean isXor() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_XOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_XOR; } /** * Indicates whether the term is a negation **/ - public boolean IsNot() throws Z3Exception + public boolean isNot() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_NOT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_NOT; } /** * Indicates whether the term is an implication **/ - public boolean IsImplies() throws Z3Exception + public boolean isImplies() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_IMPLIES; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_IMPLIES; } /** * Indicates whether the term is of integer sort. **/ - public boolean IsInt() throws Z3Exception + public boolean isInt() throws Z3Exception { - return (Native.isNumeralAst(Context().nCtx(), NativeObject()) && Native - .getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject())) == Z3_sort_kind.Z3_INT_SORT + return (Native.isNumeralAst(getContext().nCtx(), getNativeObject()) && Native + .getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject())) == Z3_sort_kind.Z3_INT_SORT .toInt()); } /** * Indicates whether the term is of sort real. **/ - public boolean IsReal() throws Z3Exception + public boolean isReal() throws Z3Exception { - return Native.getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject())) == Z3_sort_kind.Z3_REAL_SORT + return Native.getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject())) == Z3_sort_kind.Z3_REAL_SORT .toInt(); } /** * Indicates whether the term is an arithmetic numeral. **/ - public boolean IsArithmeticNumeral() throws Z3Exception + public boolean isArithmeticNumeral() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ANUM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ANUM; } /** * Indicates whether the term is a less-than-or-equal **/ - public boolean IsLE() throws Z3Exception + public boolean isLE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_LE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_LE; } /** * Indicates whether the term is a greater-than-or-equal **/ - public boolean IsGE() throws Z3Exception + public boolean isGE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_GE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_GE; } /** * Indicates whether the term is a less-than **/ - public boolean IsLT() throws Z3Exception + public boolean isLT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_LT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_LT; } /** * Indicates whether the term is a greater-than **/ - public boolean IsGT() throws Z3Exception + public boolean isGT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_GT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_GT; } /** * Indicates whether the term is addition (binary) **/ - public boolean IsAdd() throws Z3Exception + public boolean isAdd() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ADD; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ADD; } /** * Indicates whether the term is subtraction (binary) **/ - public boolean IsSub() throws Z3Exception + public boolean isSub() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SUB; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SUB; } /** * Indicates whether the term is a unary minus **/ - public boolean IsUMinus() throws Z3Exception + public boolean isUMinus() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_UMINUS; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_UMINUS; } /** * Indicates whether the term is multiplication (binary) **/ - public boolean IsMul() throws Z3Exception + public boolean isMul() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_MUL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_MUL; } /** * Indicates whether the term is division (binary) **/ - public boolean IsDiv() throws Z3Exception + public boolean isDiv() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_DIV; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_DIV; } /** * Indicates whether the term is integer division (binary) **/ - public boolean IsIDiv() throws Z3Exception + public boolean isIDiv() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_IDIV; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_IDIV; } /** * Indicates whether the term is remainder (binary) **/ - public boolean IsRemainder() throws Z3Exception + public boolean isRemainder() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_REM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_REM; } /** * Indicates whether the term is modulus (binary) **/ - public boolean IsModulus() throws Z3Exception + public boolean isModulus() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_MOD; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_MOD; } /** * Indicates whether the term is a coercion of integer to real (unary) **/ - public boolean IsIntToReal() throws Z3Exception + public boolean isIntToReal() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_TO_REAL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_TO_REAL; } /** * Indicates whether the term is a coercion of real to integer (unary) **/ - public boolean IsRealToInt() throws Z3Exception + public boolean isRealToInt() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_TO_INT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_TO_INT; } /** * Indicates whether the term is a check that tests whether a real is * integral (unary) **/ - public boolean IsRealIsInt() throws Z3Exception + public boolean isRealIsInt() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_IS_INT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_IS_INT; } /** * Indicates whether the term is of an array sort. **/ - public boolean IsArray() throws Z3Exception + public boolean isArray() throws Z3Exception { - return (Native.isApp(Context().nCtx(), NativeObject()) && Z3_sort_kind - .fromInt(Native.getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject()))) == Z3_sort_kind.Z3_ARRAY_SORT); + return (Native.isApp(getContext().nCtx(), getNativeObject()) && Z3_sort_kind + .fromInt(Native.getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject()))) == Z3_sort_kind.Z3_ARRAY_SORT); } /** @@ -496,17 +495,17 @@ public class Expr extends AST * select(store(a,i,v),j) = if i = j then v else select(a,j). Array store * takes at least 3 arguments. **/ - public boolean IsStore() throws Z3Exception + public boolean isStore() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_STORE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_STORE; } /** * Indicates whether the term is an array select. **/ - public boolean IsSelect() throws Z3Exception + public boolean isSelect() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SELECT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SELECT; } /** @@ -514,27 +513,27 @@ public class Expr extends AST * select(const(v),i) = v holds for every v and i. The function is * unary. **/ - public boolean IsConstantArray() throws Z3Exception + public boolean isConstantArray() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_CONST_ARRAY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_CONST_ARRAY; } /** * Indicates whether the term is a default array. For example * default(const(v)) = v. The function is unary. **/ - public boolean IsDefaultArray() throws Z3Exception + public boolean isDefaultArray() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ARRAY_DEFAULT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ARRAY_DEFAULT; } /** * Indicates whether the term is an array map. It satisfies * map[f](a1,..,a_n)[i] = f(a1[i],...,a_n[i]) for every i. **/ - public boolean IsArrayMap() throws Z3Exception + public boolean isArrayMap() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ARRAY_MAP; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ARRAY_MAP; } /** @@ -542,155 +541,155 @@ public class Expr extends AST * is n array value that behaves as the function graph of the function * passed as parameter. **/ - public boolean IsAsArray() throws Z3Exception + public boolean isAsArray() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_AS_ARRAY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_AS_ARRAY; } /** * Indicates whether the term is set union **/ - public boolean IsSetUnion() throws Z3Exception + public boolean isSetUnion() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SET_UNION; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SET_UNION; } /** * Indicates whether the term is set intersection **/ - public boolean IsSetIntersect() throws Z3Exception + public boolean isSetIntersect() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SET_INTERSECT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SET_INTERSECT; } /** * Indicates whether the term is set difference **/ - public boolean IsSetDifference() throws Z3Exception + public boolean isSetDifference() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SET_DIFFERENCE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SET_DIFFERENCE; } /** * Indicates whether the term is set complement **/ - public boolean IsSetComplement() throws Z3Exception + public boolean isSetComplement() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SET_COMPLEMENT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SET_COMPLEMENT; } /** * Indicates whether the term is set subset **/ - public boolean IsSetSubset() throws Z3Exception + public boolean isSetSubset() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SET_SUBSET; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SET_SUBSET; } /** * Indicates whether the terms is of bit-vector sort. **/ - public boolean IsBV() throws Z3Exception + public boolean isBV() throws Z3Exception { - return Native.getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject())) == Z3_sort_kind.Z3_BV_SORT + return Native.getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject())) == Z3_sort_kind.Z3_BV_SORT .toInt(); } /** * Indicates whether the term is a bit-vector numeral **/ - public boolean IsBVNumeral() throws Z3Exception + public boolean isBVNumeral() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BNUM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BNUM; } /** * Indicates whether the term is a one-bit bit-vector with value one **/ - public boolean IsBVBitOne() throws Z3Exception + public boolean isBVBitOne() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BIT1; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BIT1; } /** * Indicates whether the term is a one-bit bit-vector with value zero **/ - public boolean IsBVBitZero() throws Z3Exception + public boolean isBVBitZero() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BIT0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BIT0; } /** * Indicates whether the term is a bit-vector unary minus **/ - public boolean IsBVUMinus() throws Z3Exception + public boolean isBVUMinus() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BNEG; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BNEG; } /** * Indicates whether the term is a bit-vector addition (binary) **/ - public boolean IsBVAdd() throws Z3Exception + public boolean isBVAdd() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BADD; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BADD; } /** * Indicates whether the term is a bit-vector subtraction (binary) **/ - public boolean IsBVSub() throws Z3Exception + public boolean isBVSub() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSUB; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSUB; } /** * Indicates whether the term is a bit-vector multiplication (binary) **/ - public boolean IsBVMul() throws Z3Exception + public boolean isBVMul() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BMUL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BMUL; } /** * Indicates whether the term is a bit-vector signed division (binary) **/ - public boolean IsBVSDiv() throws Z3Exception + public boolean isBVSDiv() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSDIV; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSDIV; } /** * Indicates whether the term is a bit-vector unsigned division (binary) **/ - public boolean IsBVUDiv() throws Z3Exception + public boolean isBVUDiv() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BUDIV; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BUDIV; } /** * Indicates whether the term is a bit-vector signed remainder (binary) **/ - public boolean IsBVSRem() throws Z3Exception + public boolean isBVSRem() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSREM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSREM; } /** * Indicates whether the term is a bit-vector unsigned remainder (binary) **/ - public boolean IsBVURem() throws Z3Exception + public boolean isBVURem() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BUREM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BUREM; } /** * Indicates whether the term is a bit-vector signed modulus **/ - public boolean IsBVSMod() throws Z3Exception + public boolean isBVSMod() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSMOD; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSMOD; } /** @@ -698,7 +697,7 @@ public class Expr extends AST **/ boolean IsBVSDiv0() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSDIV0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSDIV0; } /** @@ -706,7 +705,7 @@ public class Expr extends AST **/ boolean IsBVUDiv0() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BUDIV0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BUDIV0; } /** @@ -714,7 +713,7 @@ public class Expr extends AST **/ boolean IsBVSRem0() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSREM0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSREM0; } /** @@ -722,7 +721,7 @@ public class Expr extends AST **/ boolean IsBVURem0() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BUREM0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BUREM0; } /** @@ -730,232 +729,232 @@ public class Expr extends AST **/ boolean IsBVSMod0() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSMOD0; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSMOD0; } /** * Indicates whether the term is an unsigned bit-vector less-than-or-equal **/ - public boolean IsBVULE() throws Z3Exception + public boolean isBVULE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ULEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ULEQ; } /** * Indicates whether the term is a signed bit-vector less-than-or-equal **/ - public boolean IsBVSLE() throws Z3Exception + public boolean isBVSLE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SLEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SLEQ; } /** * Indicates whether the term is an unsigned bit-vector * greater-than-or-equal **/ - public boolean IsBVUGE() throws Z3Exception + public boolean isBVUGE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_UGEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_UGEQ; } /** * Indicates whether the term is a signed bit-vector greater-than-or-equal **/ - public boolean IsBVSGE() throws Z3Exception + public boolean isBVSGE() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SGEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SGEQ; } /** * Indicates whether the term is an unsigned bit-vector less-than **/ - public boolean IsBVULT() throws Z3Exception + public boolean isBVULT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ULT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ULT; } /** * Indicates whether the term is a signed bit-vector less-than **/ - public boolean IsBVSLT() throws Z3Exception + public boolean isBVSLT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SLT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SLT; } /** * Indicates whether the term is an unsigned bit-vector greater-than **/ - public boolean IsBVUGT() throws Z3Exception + public boolean isBVUGT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_UGT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_UGT; } /** * Indicates whether the term is a signed bit-vector greater-than **/ - public boolean IsBVSGT() throws Z3Exception + public boolean isBVSGT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SGT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SGT; } /** * Indicates whether the term is a bit-wise AND **/ - public boolean IsBVAND() throws Z3Exception + public boolean isBVAND() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BAND; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BAND; } /** * Indicates whether the term is a bit-wise OR **/ - public boolean IsBVOR() throws Z3Exception + public boolean isBVOR() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BOR; } /** * Indicates whether the term is a bit-wise NOT **/ - public boolean IsBVNOT() throws Z3Exception + public boolean isBVNOT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BNOT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BNOT; } /** * Indicates whether the term is a bit-wise XOR **/ - public boolean IsBVXOR() throws Z3Exception + public boolean isBVXOR() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BXOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BXOR; } /** * Indicates whether the term is a bit-wise NAND **/ - public boolean IsBVNAND() throws Z3Exception + public boolean isBVNAND() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BNAND; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BNAND; } /** * Indicates whether the term is a bit-wise NOR **/ - public boolean IsBVNOR() throws Z3Exception + public boolean isBVNOR() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BNOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BNOR; } /** * Indicates whether the term is a bit-wise XNOR **/ - public boolean IsBVXNOR() throws Z3Exception + public boolean isBVXNOR() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BXNOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BXNOR; } /** * Indicates whether the term is a bit-vector concatenation (binary) **/ - public boolean IsBVConcat() throws Z3Exception + public boolean isBVConcat() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_CONCAT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_CONCAT; } /** * Indicates whether the term is a bit-vector sign extension **/ - public boolean IsBVSignExtension() throws Z3Exception + public boolean isBVSignExtension() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_SIGN_EXT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_SIGN_EXT; } /** * Indicates whether the term is a bit-vector zero extension **/ - public boolean IsBVZeroExtension() throws Z3Exception + public boolean isBVZeroExtension() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ZERO_EXT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ZERO_EXT; } /** * Indicates whether the term is a bit-vector extraction **/ - public boolean IsBVExtract() throws Z3Exception + public boolean isBVExtract() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_EXTRACT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_EXTRACT; } /** * Indicates whether the term is a bit-vector repetition **/ - public boolean IsBVRepeat() throws Z3Exception + public boolean isBVRepeat() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_REPEAT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_REPEAT; } /** * Indicates whether the term is a bit-vector reduce OR **/ - public boolean IsBVReduceOR() throws Z3Exception + public boolean isBVReduceOR() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BREDOR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BREDOR; } /** * Indicates whether the term is a bit-vector reduce AND **/ - public boolean IsBVReduceAND() throws Z3Exception + public boolean isBVReduceAND() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BREDAND; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BREDAND; } /** * Indicates whether the term is a bit-vector comparison **/ - public boolean IsBVComp() throws Z3Exception + public boolean isBVComp() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BCOMP; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BCOMP; } /** * Indicates whether the term is a bit-vector shift left **/ - public boolean IsBVShiftLeft() throws Z3Exception + public boolean isBVShiftLeft() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BSHL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BSHL; } /** * Indicates whether the term is a bit-vector logical shift right **/ - public boolean IsBVShiftRightLogical() throws Z3Exception + public boolean isBVShiftRightLogical() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BLSHR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BLSHR; } /** * Indicates whether the term is a bit-vector arithmetic shift left **/ - public boolean IsBVShiftRightArithmetic() throws Z3Exception + public boolean isBVShiftRightArithmetic() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BASHR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BASHR; } /** * Indicates whether the term is a bit-vector rotate left **/ - public boolean IsBVRotateLeft() throws Z3Exception + public boolean isBVRotateLeft() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ROTATE_LEFT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ROTATE_LEFT; } /** * Indicates whether the term is a bit-vector rotate right **/ - public boolean IsBVRotateRight() throws Z3Exception + public boolean isBVRotateRight() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_ROTATE_RIGHT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_ROTATE_RIGHT; } /** @@ -963,9 +962,9 @@ public class Expr extends AST * Similar to Z3_OP_ROTATE_LEFT, but it is a binary operator * instead of a parametric one. **/ - public boolean IsBVRotateLeftExtended() throws Z3Exception + public boolean isBVRotateLeftExtended() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_EXT_ROTATE_LEFT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_EXT_ROTATE_LEFT; } /** @@ -973,9 +972,9 @@ public class Expr extends AST * Similar to Z3_OP_ROTATE_RIGHT, but it is a binary operator * instead of a parametric one. **/ - public boolean IsBVRotateRightExtended() throws Z3Exception + public boolean isBVRotateRightExtended() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_EXT_ROTATE_RIGHT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_EXT_ROTATE_RIGHT; } /** @@ -984,9 +983,9 @@ public class Expr extends AST * the most rudimentary simplification rules are applied to this * function. **/ - public boolean IsIntToBV() throws Z3Exception + public boolean isIntToBV() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_INT2BV; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_INT2BV; } /** @@ -995,9 +994,9 @@ public class Expr extends AST * the most rudimentary simplification rules are applied to this * function. **/ - public boolean IsBVToInt() throws Z3Exception + public boolean isBVToInt() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_BV2INT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_BV2INT; } /** @@ -1005,9 +1004,9 @@ public class Expr extends AST * carry bit in a full-adder. The meaning is given by the equivalence (carry * l1 l2 l3) <=> (or (and l1 l2) (and l1 l3) (and l2 l3))) **/ - public boolean IsBVCarry() throws Z3Exception + public boolean isBVCarry() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_CARRY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_CARRY; } /** @@ -1015,9 +1014,9 @@ public class Expr extends AST * meaning is given by the equivalence (xor3 l1 l2 l3) <=> (xor (xor * l1 l2) l3) **/ - public boolean IsBVXOR3() throws Z3Exception + public boolean isBVXOR3() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_XOR3; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_XOR3; } /** @@ -1025,9 +1024,9 @@ public class Expr extends AST * condition generator). The label has two parameters, a string and * a Boolean polarity. It takes one argument, a formula. **/ - public boolean IsLabel() throws Z3Exception + public boolean isLabel() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_LABEL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_LABEL; } /** @@ -1035,9 +1034,9 @@ public class Expr extends AST * Verification condition generator). A label literal has a set of * string parameters. It takes no arguments. **/ - public boolean IsLabelLit() throws Z3Exception + public boolean isLabelLit() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_LABEL_LIT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_LABEL_LIT; } /** @@ -1045,34 +1044,34 @@ public class Expr extends AST * This binary predicate is used in proof terms. It captures * equisatisfiability and equivalence modulo renamings. **/ - public boolean IsOEQ() throws Z3Exception + public boolean isOEQ() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_OEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_OEQ; } /** * Indicates whether the term is a Proof for the expression 'true'. **/ - public boolean IsProofTrue() throws Z3Exception + public boolean isProofTrue() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_TRUE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_TRUE; } /** * Indicates whether the term is a proof for a fact asserted by the user. **/ - public boolean IsProofAsserted() throws Z3Exception + public boolean isProofAsserted() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_ASSERTED; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_ASSERTED; } /** * Indicates whether the term is a proof for a fact (tagged as goal) * asserted by the user. **/ - public boolean IsProofGoal() throws Z3Exception + public boolean isProofGoal() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_GOAL; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_GOAL; } /** @@ -1081,9 +1080,9 @@ public class Expr extends AST * T2: (implies p q) [mp T1 T2]: q The second antecedents may also be a * proof for (iff p q). **/ - public boolean IsProofModusPonens() throws Z3Exception + public boolean isProofModusPonens() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS; } /** @@ -1093,9 +1092,9 @@ public class Expr extends AST * equality and equivalence. That is, R is either '~', '=' or * 'iff'. **/ - public boolean IsProofReflexivity() throws Z3Exception + public boolean isProofReflexivity() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_REFLEXIVITY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_REFLEXIVITY; } /** @@ -1104,9 +1103,9 @@ public class Expr extends AST * a proof for (R s t). T1: (R t s) [symmetry T1]: (R s t) T1 is the * antecedent of this proof object. **/ - public boolean IsProofSymmetry() throws Z3Exception + public boolean isProofSymmetry() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_SYMMETRY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_SYMMETRY; } /** @@ -1115,9 +1114,9 @@ public class Expr extends AST * u), produces a proof for (R t u). T1: (R t s) T2: (R s u) [trans T1 T2]: * (R t u) **/ - public boolean IsProofTransitivity() throws Z3Exception + public boolean isProofTransitivity() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY; } /** @@ -1133,9 +1132,9 @@ public class Expr extends AST * s to t, if we view every antecedent (R a b) as an edge between a and b. * **/ - public boolean IsProofTransitivityStar() throws Z3Exception + public boolean isProofTransitivityStar() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY_STAR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_TRANSITIVITY_STAR; } /** @@ -1145,9 +1144,9 @@ public class Expr extends AST * suppressed. That is, reflexivity proofs are supressed to save space. * **/ - public boolean IsProofMonotonicity() throws Z3Exception + public boolean isProofMonotonicity() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_MONOTONICITY; } /** @@ -1155,9 +1154,9 @@ public class Expr extends AST * for (~ p q), produces a proof for (~ (forall (x) p) (forall (x) q)). T1: * (~ p q) [quant-intro T1]: (~ (forall (x) p) (forall (x) q)) **/ - public boolean IsProofQuantIntro() throws Z3Exception + public boolean isProofQuantIntro() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_QUANT_INTRO; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_QUANT_INTRO; } /** @@ -1171,9 +1170,9 @@ public class Expr extends AST * This proof object has no antecedents. Remark. This rule is used by the * CNF conversion pass and instantiated by f = or, and g = and. **/ - public boolean IsProofDistributivity() throws Z3Exception + public boolean isProofDistributivity() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_DISTRIBUTIVITY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_DISTRIBUTIVITY; } /** @@ -1181,9 +1180,9 @@ public class Expr extends AST * Given a proof for (and l_1 ... l_n), produces a proof for l_i T1: (and * l_1 ... l_n) [and-elim T1]: l_i **/ - public boolean IsProofAndElimination() throws Z3Exception + public boolean isProofAndElimination() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_AND_ELIM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_AND_ELIM; } /** @@ -1191,9 +1190,9 @@ public class Expr extends AST * Given a proof for (not (or l_1 ... l_n)), produces a proof for (not l_i). * T1: (not (or l_1 ... l_n)) [not-or-elim T1]: (not l_i) **/ - public boolean IsProofOrElimination() throws Z3Exception + public boolean isProofOrElimination() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_NOT_OR_ELIM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NOT_OR_ELIM; } /** @@ -1208,9 +1207,9 @@ public class Expr extends AST * Examples: (= (+ x 0) x) (= (+ x 1 2) (+ 3 x)) (iff (or x false) x) * **/ - public boolean IsProofRewrite() throws Z3Exception + public boolean isProofRewrite() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_REWRITE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_REWRITE; } /** @@ -1224,9 +1223,9 @@ public class Expr extends AST * Booleans (BIT2BOOL=true) - When pulling ite expression up * (PULL_CHEAP_ITE_TREES=true) **/ - public boolean IsProofRewriteStar() throws Z3Exception + public boolean isProofRewriteStar() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_REWRITE_STAR; } /** @@ -1234,9 +1233,9 @@ public class Expr extends AST * A proof for (iff (f (forall (x) q(x)) r) (forall (x) (f (q x) * r))). This proof object has no antecedents. **/ - public boolean IsProofPullQuant() throws Z3Exception + public boolean isProofPullQuant() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT; } /** @@ -1245,9 +1244,9 @@ public class Expr extends AST * proof object is only used if the parameter PROOF_MODE is 1. This proof * object has no antecedents **/ - public boolean IsProofPullQuantStar() throws Z3Exception + public boolean isProofPullQuantStar() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT_STAR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_PULL_QUANT_STAR; } /** @@ -1257,9 +1256,9 @@ public class Expr extends AST * (forall (x_1 ... x_m) p_n[x_1 ... x_m]))) This proof object has no * antecedents **/ - public boolean IsProofPushQuant() throws Z3Exception + public boolean isProofPushQuant() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_PUSH_QUANT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_PUSH_QUANT; } /** @@ -1270,9 +1269,9 @@ public class Expr extends AST * It is used to justify the elimination of unused variables. This proof * object has no antecedents. **/ - public boolean IsProofElimUnusedVars() throws Z3Exception + public boolean isProofElimUnusedVars() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_ELIM_UNUSED_VARS; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_ELIM_UNUSED_VARS; } /** @@ -1284,27 +1283,27 @@ public class Expr extends AST * * Several variables can be eliminated simultaneously. **/ - public boolean IsProofDER() throws Z3Exception + public boolean isProofDER() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_DER; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_DER; } /** * Indicates whether the term is a proof for quantifier instantiation * A proof of (or (not (forall (x) (P x))) (P a)) **/ - public boolean IsProofQuantInst() throws Z3Exception + public boolean isProofQuantInst() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_QUANT_INST; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_QUANT_INST; } /** * Indicates whether the term is a hypthesis marker. Mark a * hypothesis in a natural deduction style proof. **/ - public boolean IsProofHypothesis() throws Z3Exception + public boolean isProofHypothesis() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_HYPOTHESIS; } /** @@ -1315,9 +1314,9 @@ public class Expr extends AST * converts the proof in a proof for (or (not l_1) ... (not l_n)), when T1 * contains the hypotheses: l_1, ..., l_n. **/ - public boolean IsProofLemma() throws Z3Exception + public boolean isProofLemma() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_LEMMA; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_LEMMA; } /** @@ -1325,27 +1324,27 @@ public class Expr extends AST * (or l_1 ... l_n l_1' ... l_m') T2: (not l_1) ... T(n+1): (not l_n) * [unit-resolution T1 ... T(n+1)]: (or l_1' ... l_m') **/ - public boolean IsProofUnitResolution() throws Z3Exception + public boolean isProofUnitResolution() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_UNIT_RESOLUTION; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_UNIT_RESOLUTION; } /** * Indicates whether the term is a proof by iff-true T1: p * [iff-true T1]: (iff p true) **/ - public boolean IsProofIFFTrue() throws Z3Exception + public boolean isProofIFFTrue() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_TRUE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_TRUE; } /** * Indicates whether the term is a proof by iff-false T1: (not p) * [iff-false T1]: (iff p false) **/ - public boolean IsProofIFFFalse() throws Z3Exception + public boolean isProofIFFFalse() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_FALSE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_FALSE; } /** @@ -1357,9 +1356,9 @@ public class Expr extends AST * This proof object has no antecedents. Remark: if f is bool, then = is * iff. **/ - public boolean IsProofCommutativity() throws Z3Exception + public boolean isProofCommutativity() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_COMMUTATIVITY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_COMMUTATIVITY; } /** @@ -1380,9 +1379,9 @@ public class Expr extends AST * connectives in the axioms a small bounded number of steps (=3). * **/ - public boolean IsProofDefAxiom() throws Z3Exception + public boolean isProofDefAxiom() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_DEF_AXIOM; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_DEF_AXIOM; } /** @@ -1401,9 +1400,9 @@ public class Expr extends AST * * Otherwise: [def-intro]: (= n e) **/ - public boolean IsProofDefIntro() throws Z3Exception + public boolean isProofDefIntro() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_DEF_INTRO; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_DEF_INTRO; } /** @@ -1411,18 +1410,18 @@ public class Expr extends AST * [apply-def T1]: F ~ n F is 'equivalent' to n, given that T1 is * a proof that n is a name for F. **/ - public boolean IsProofApplyDef() throws Z3Exception + public boolean isProofApplyDef() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_APPLY_DEF; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_APPLY_DEF; } /** * Indicates whether the term is a proof iff-oeq T1: (iff p q) * [iff~ T1]: (~ p q) **/ - public boolean IsProofIFFOEQ() throws Z3Exception + public boolean isProofIFFOEQ() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_OEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_IFF_OEQ; } /** @@ -1445,9 +1444,9 @@ public class Expr extends AST * NNF_NEG furthermore handles the case where negation is pushed over * Boolean connectives 'and' and 'or'. **/ - public boolean IsProofNNFPos() throws Z3Exception + public boolean isProofNNFPos() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_POS; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_POS; } /** @@ -1461,9 +1460,9 @@ public class Expr extends AST * s_2 ~ r_2' [nnf-neg T1 T2 T3 T4]: (~ (not (iff s_1 s_2)) (and (or r_1 * r_2) (or r_1' r_2'))) **/ - public boolean IsProofNNFNeg() throws Z3Exception + public boolean isProofNNFNeg() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_NEG; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_NEG; } /** @@ -1476,9 +1475,9 @@ public class Expr extends AST * This proof object may have n antecedents. Each antecedent is a * PR_DEF_INTRO. **/ - public boolean IsProofNNFStar() throws Z3Exception + public boolean isProofNNFStar() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_STAR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_NNF_STAR; } /** @@ -1488,9 +1487,9 @@ public class Expr extends AST * PROOF_MODE is 1. This proof object may have n antecedents. Each * antecedent is a PR_DEF_INTRO. **/ - public boolean IsProofCNFStar() throws Z3Exception + public boolean isProofCNFStar() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_CNF_STAR; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_CNF_STAR; } /** @@ -1502,9 +1501,9 @@ public class Expr extends AST * * This proof object has no antecedents. **/ - public boolean IsProofSkolemize() throws Z3Exception + public boolean isProofSkolemize() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_SKOLEMIZE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_SKOLEMIZE; } /** @@ -1512,9 +1511,9 @@ public class Expr extends AST * equi-satisfiability. Modus ponens style rule for * equi-satisfiability. T1: p T2: (~ p q) [mp~ T1 T2]: q **/ - public boolean IsProofModusPonensOEQ() throws Z3Exception + public boolean isProofModusPonensOEQ() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS_OEQ; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_MODUS_PONENS_OEQ; } /** @@ -1531,19 +1530,19 @@ public class Expr extends AST * t1 t2) (<= t2 t1))) - gcd-test - Indicates an integer linear * arithmetic lemma that uses a gcd test. **/ - public boolean IsProofTheoryLemma() throws Z3Exception + public boolean isProofTheoryLemma() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_PR_TH_LEMMA; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_PR_TH_LEMMA; } /** * Indicates whether the term is of an array sort. **/ - public boolean IsRelation() throws Z3Exception + public boolean isRelation() throws Z3Exception { - return (Native.isApp(Context().nCtx(), NativeObject()) && Native - .getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject())) == Z3_sort_kind.Z3_RELATION_SORT + return (Native.isApp(getContext().nCtx(), getNativeObject()) && Native + .getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject())) == Z3_sort_kind.Z3_RELATION_SORT .toInt()); } @@ -1553,51 +1552,51 @@ public class Expr extends AST * first argument is the relation and the remaining n elements * correspond to the n columns of the relation. **/ - public boolean IsRelationStore() throws Z3Exception + public boolean isRelationStore() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_STORE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_STORE; } /** * Indicates whether the term is an empty relation **/ - public boolean IsEmptyRelation() throws Z3Exception + public boolean isEmptyRelation() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_EMPTY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_EMPTY; } /** * Indicates whether the term is a test for the emptiness of a relation **/ - public boolean IsIsEmptyRelation() throws Z3Exception + public boolean isIsEmptyRelation() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_IS_EMPTY; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_IS_EMPTY; } /** * Indicates whether the term is a relational join **/ - public boolean IsRelationalJoin() throws Z3Exception + public boolean isRelationalJoin() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_JOIN; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_JOIN; } /** * Indicates whether the term is the union or convex hull of two relations. * The function takes two arguments. **/ - public boolean IsRelationUnion() throws Z3Exception + public boolean isRelationUnion() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_UNION; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_UNION; } /** * Indicates whether the term is the widening of two relations The * function takes two arguments. **/ - public boolean IsRelationWiden() throws Z3Exception + public boolean isRelationWiden() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_WIDEN; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_WIDEN; } /** @@ -1605,9 +1604,9 @@ public class Expr extends AST * numbers in the parameters). The function takes one * argument. **/ - public boolean IsRelationProject() throws Z3Exception + public boolean isRelationProject() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_PROJECT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_PROJECT; } /** @@ -1617,9 +1616,9 @@ public class Expr extends AST * indices corresponding to the columns of the relation. So the first column * in the relation has index 0. **/ - public boolean IsRelationFilter() throws Z3Exception + public boolean isRelationFilter() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_FILTER; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_FILTER; } /** @@ -1634,9 +1633,9 @@ public class Expr extends AST * such that target are elements in x in pos, such that there is no y in neg * that agrees with x on the columns c1, d1, .., cN, dN. **/ - public boolean IsRelationNegationFilter() throws Z3Exception + public boolean isRelationNegationFilter() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_NEGATION_FILTER; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_NEGATION_FILTER; } /** @@ -1644,17 +1643,17 @@ public class Expr extends AST * The function takes one argument. The parameters contain the * renaming as a cycle. **/ - public boolean IsRelationRename() throws Z3Exception + public boolean isRelationRename() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_RENAME; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_RENAME; } /** * Indicates whether the term is the complement of a relation **/ - public boolean IsRelationComplement() throws Z3Exception + public boolean isRelationComplement() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_COMPLEMENT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_COMPLEMENT; } /** @@ -1663,9 +1662,9 @@ public class Expr extends AST * arguments, where the first argument is a relation, and the remaining * n arguments correspond to a record. **/ - public boolean IsRelationSelect() throws Z3Exception + public boolean isRelationSelect() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_SELECT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_SELECT; } /** @@ -1675,28 +1674,28 @@ public class Expr extends AST * kind to perform destructive updates to * the first argument. **/ - public boolean IsRelationClone() throws Z3Exception + public boolean isRelationClone() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_RA_CLONE; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_RA_CLONE; } /** * Indicates whether the term is of an array sort. **/ - public boolean IsFiniteDomain() throws Z3Exception + public boolean isFiniteDomain() throws Z3Exception { - return (Native.isApp(Context().nCtx(), NativeObject()) && Native - .getSortKind(Context().nCtx(), - Native.getSort(Context().nCtx(), NativeObject())) == Z3_sort_kind.Z3_FINITE_DOMAIN_SORT + return (Native.isApp(getContext().nCtx(), getNativeObject()) && Native + .getSortKind(getContext().nCtx(), + Native.getSort(getContext().nCtx(), getNativeObject())) == Z3_sort_kind.Z3_FINITE_DOMAIN_SORT .toInt()); } /** * Indicates whether the term is a less than predicate over a finite domain. **/ - public boolean IsFiniteDomainLT() throws Z3Exception + public boolean isFiniteDomainLT() throws Z3Exception { - return FuncDecl().DeclKind() == Z3_decl_kind.Z3_OP_FD_LT; + return getFuncDecl().getDeclKind() == Z3_decl_kind.Z3_OP_FD_LT; } /** @@ -1714,12 +1713,12 @@ public class Expr extends AST * different depending on the scope in which it appears. The deeper x * appears, the higher is its index. **/ - public int Index() throws Z3Exception + public int getIndex() throws Z3Exception { - if (!IsVar()) + if (!isVar()) throw new Z3Exception("Term is not a bound variable."); - return Native.getIndexValue(Context().nCtx(), NativeObject()); + return Native.getIndexValue(getContext().nCtx(), getNativeObject()); } /** @@ -1742,30 +1741,25 @@ public class Expr extends AST } } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.isApp(Context().nCtx(), obj) - ^ true - && Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_VAR_AST - .toInt() - && Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST - .toInt()) - throw new Z3Exception("Underlying object is not a term"); - super.CheckNativeObject(obj); + if (!Native.isApp(getContext().nCtx(), obj) && + Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_VAR_AST.toInt() && + Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST.toInt()) + throw new Z3Exception("Underlying object is not a term"); + super.checkNativeObject(obj); } - static Expr Create(Context ctx, FuncDecl f, Expr[] arguments) + static Expr create(Context ctx, FuncDecl f, Expr ... arguments) throws Z3Exception { - - long obj = Native.mkApp(ctx.nCtx(), f.NativeObject(), - AST.ArrayLength(arguments), AST.ArrayToNative(arguments)); - return Create(ctx, obj); + long obj = Native.mkApp(ctx.nCtx(), f.getNativeObject(), + AST.arrayLength(arguments), AST.arrayToNative(arguments)); + return create(ctx, obj); } - static Expr Create(Context ctx, long obj) throws Z3Exception + static Expr create(Context ctx, long obj) throws Z3Exception { - Z3_ast_kind k = Z3_ast_kind.fromInt(Native.getAstKind(ctx.nCtx(), obj)); if (k == Z3_ast_kind.Z3_QUANTIFIER_AST) return new Quantifier(ctx, obj); diff --git a/src/api/java/FiniteDomainSort.java b/src/api/java/FiniteDomainSort.java index 8c39320ad..a8ba0d8c3 100644 --- a/src/api/java/FiniteDomainSort.java +++ b/src/api/java/FiniteDomainSort.java @@ -14,10 +14,10 @@ public class FiniteDomainSort extends Sort /** * The size of the finite domain sort. **/ - public long Size() throws Z3Exception + public long getSize() throws Z3Exception { Native.LongPtr res = new Native.LongPtr(); - Native.getFiniteDomainSortSize(Context().nCtx(), NativeObject(), res); + Native.getFiniteDomainSortSize(getContext().nCtx(), getNativeObject(), res); return res.value; } @@ -28,7 +28,7 @@ public class FiniteDomainSort extends Sort FiniteDomainSort(Context ctx, Symbol name, long size) throws Z3Exception { - super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.NativeObject(), + super(ctx, Native.mkFiniteDomainSort(ctx.nCtx(), name.getNativeObject(), size)); } } diff --git a/src/api/java/Fixedpoint.java b/src/api/java/Fixedpoint.java index 375cb7b97..6a8cafae2 100644 --- a/src/api/java/Fixedpoint.java +++ b/src/api/java/Fixedpoint.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_lbool; /** * Object for managing fixedpoints @@ -17,9 +17,9 @@ public class Fixedpoint extends Z3Object /** * A string that describes all available fixedpoint solver parameters. **/ - public String Help() throws Z3Exception + public String getHelp() throws Z3Exception { - return Native.fixedpointGetHelp(Context().nCtx(), NativeObject()); + return Native.fixedpointGetHelp(getContext().nCtx(), getNativeObject()); } /** @@ -30,9 +30,9 @@ public class Fixedpoint extends Z3Object public void setParameters(Params value) throws Z3Exception { - Context().CheckContextMatch(value); - Native.fixedpointSetParams(Context().nCtx(), NativeObject(), - value.NativeObject()); + getContext().checkContextMatch(value); + Native.fixedpointSetParams(getContext().nCtx(), getNativeObject(), + value.getNativeObject()); } /** @@ -40,10 +40,10 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public ParamDescrs ParameterDescriptions() throws Z3Exception + public ParamDescrs getParameterDescriptions() throws Z3Exception { - return new ParamDescrs(Context(), Native.fixedpointGetParamDescrs( - Context().nCtx(), NativeObject())); + return new ParamDescrs(getContext(), Native.fixedpointGetParamDescrs( + getContext().nCtx(), getNativeObject())); } /** @@ -51,13 +51,13 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public void Assert(BoolExpr[] constraints) throws Z3Exception + public void assert_(BoolExpr ... constraints) throws Z3Exception { - Context().CheckContextMatch(constraints); + getContext().checkContextMatch(constraints); for (BoolExpr a : constraints) { - Native.fixedpointAssert(Context().nCtx(), NativeObject(), - a.NativeObject()); + Native.fixedpointAssert(getContext().nCtx(), getNativeObject(), + a.getNativeObject()); } } @@ -66,12 +66,12 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public void RegisterRelation(FuncDecl f) throws Z3Exception + public void registerRelation(FuncDecl f) throws Z3Exception { - Context().CheckContextMatch(f); - Native.fixedpointRegisterRelation(Context().nCtx(), NativeObject(), - f.NativeObject()); + getContext().checkContextMatch(f); + Native.fixedpointRegisterRelation(getContext().nCtx(), getNativeObject(), + f.getNativeObject()); } /** @@ -79,12 +79,12 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public void AddRule(BoolExpr rule, Symbol name) throws Z3Exception + public void addRule(BoolExpr rule, Symbol name) throws Z3Exception { - Context().CheckContextMatch(rule); - Native.fixedpointAddRule(Context().nCtx(), NativeObject(), - rule.NativeObject(), AST.GetNativeObject(name)); + getContext().checkContextMatch(rule); + Native.fixedpointAddRule(getContext().nCtx(), getNativeObject(), + rule.getNativeObject(), AST.getNativeObject(name)); } /** @@ -92,12 +92,11 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public void AddFact(FuncDecl pred, int[] args) 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); + getContext().checkContextMatch(pred); + Native.fixedpointAddFact(getContext().nCtx(), getNativeObject(), + pred.getNativeObject(), (int) args.length, args); } /** @@ -109,12 +108,12 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public Status Query(BoolExpr query) 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())); + getContext().checkContextMatch(query); + Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(getContext().nCtx(), + getNativeObject(), query.getNativeObject())); switch (r) { case Z3_L_TRUE: @@ -134,13 +133,13 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public Status Query(FuncDecl[] 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))); + getContext().checkContextMatch(relations); + Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(getContext() + .nCtx(), getNativeObject(), AST.arrayLength(relations), AST + .arrayToNative(relations))); switch (r) { case Z3_L_TRUE: @@ -155,9 +154,9 @@ public class Fixedpoint extends Z3Object /** * Creates a backtracking point. **/ - public void Push() throws Z3Exception + public void push() throws Z3Exception { - Native.fixedpointPush(Context().nCtx(), NativeObject()); + Native.fixedpointPush(getContext().nCtx(), getNativeObject()); } /** @@ -165,9 +164,9 @@ public class Fixedpoint extends Z3Object * thrown if Pop is called without a corresponding Push * **/ - public void Pop() throws Z3Exception + public void pop() throws Z3Exception { - Native.fixedpointPop(Context().nCtx(), NativeObject()); + Native.fixedpointPop(getContext().nCtx(), getNativeObject()); } /** @@ -175,12 +174,12 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public void UpdateRule(BoolExpr rule, Symbol name) throws Z3Exception + public void updateRule(BoolExpr rule, Symbol name) throws Z3Exception { - Context().CheckContextMatch(rule); - Native.fixedpointUpdateRule(Context().nCtx(), NativeObject(), - rule.NativeObject(), AST.GetNativeObject(name)); + getContext().checkContextMatch(rule); + Native.fixedpointUpdateRule(getContext().nCtx(), getNativeObject(), + rule.getNativeObject(), AST.getNativeObject(name)); } /** @@ -189,29 +188,29 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public Expr GetAnswer() throws Z3Exception + public Expr getAnswer() throws Z3Exception { - long ans = Native.fixedpointGetAnswer(Context().nCtx(), NativeObject()); - return (ans == 0) ? null : Expr.Create(Context(), ans); + long ans = Native.fixedpointGetAnswer(getContext().nCtx(), getNativeObject()); + return (ans == 0) ? null : Expr.create(getContext(), ans); } /** * Retrieve explanation why fixedpoint engine returned status Unknown. **/ - public String GetReasonUnknown() throws Z3Exception + public String getReasonUnknown() throws Z3Exception { - return Native.fixedpointGetReasonUnknown(Context().nCtx(), - NativeObject()); + return Native.fixedpointGetReasonUnknown(getContext().nCtx(), + getNativeObject()); } /** * Retrieve the number of levels explored for a given predicate. **/ - public int GetNumLevels(FuncDecl predicate) throws Z3Exception + public int getNumLevels(FuncDecl predicate) throws Z3Exception { - return Native.fixedpointGetNumLevels(Context().nCtx(), NativeObject(), - predicate.NativeObject()); + return Native.fixedpointGetNumLevels(getContext().nCtx(), getNativeObject(), + predicate.getNativeObject()); } /** @@ -219,22 +218,22 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public Expr GetCoverDelta(int level, FuncDecl 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); + long res = Native.fixedpointGetCoverDelta(getContext().nCtx(), + getNativeObject(), level, predicate.getNativeObject()); + return (res == 0) ? null : Expr.create(getContext(), res); } /** * Add property about the predicate. The property is added * at level. **/ - public void AddCover(int level, FuncDecl predicate, Expr property) + public void addCover(int level, FuncDecl predicate, Expr property) throws Z3Exception { - Native.fixedpointAddCover(Context().nCtx(), NativeObject(), level, - predicate.NativeObject(), property.NativeObject()); + Native.fixedpointAddCover(getContext().nCtx(), getNativeObject(), level, + predicate.getNativeObject(), property.getNativeObject()); } /** @@ -244,7 +243,7 @@ public class Fixedpoint extends Z3Object { try { - return Native.fixedpointToString(Context().nCtx(), NativeObject(), + return Native.fixedpointToString(getContext().nCtx(), getNativeObject(), 0, null); } catch (Z3Exception e) { @@ -256,12 +255,12 @@ public class Fixedpoint extends Z3Object * Instrument the Datalog engine on which table representation to use for * recursive predicate. **/ - public void SetPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception + public void setPredicateRepresentation(FuncDecl f, Symbol[] kinds) throws Z3Exception { - Native.fixedpointSetPredicateRepresentation(Context().nCtx(), - NativeObject(), f.NativeObject(), AST.ArrayLength(kinds), - Symbol.ArrayToNative(kinds)); + Native.fixedpointSetPredicateRepresentation(getContext().nCtx(), + getNativeObject(), f.getNativeObject(), AST.arrayLength(kinds), + Symbol.arrayToNative(kinds)); } @@ -271,8 +270,8 @@ public class Fixedpoint extends Z3Object public String toString(BoolExpr[] queries) throws Z3Exception { - return Native.fixedpointToString(Context().nCtx(), NativeObject(), - AST.ArrayLength(queries), AST.ArrayToNative(queries)); + return Native.fixedpointToString(getContext().nCtx(), getNativeObject(), + AST.arrayLength(queries), AST.arrayToNative(queries)); } /** @@ -280,15 +279,15 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public BoolExpr[] Rules() throws Z3Exception + public BoolExpr[] getRules() throws Z3Exception { - ASTVector v = new ASTVector(Context(), Native.fixedpointGetRules( - Context().nCtx(), NativeObject())); - int n = v.Size(); + ASTVector v = new ASTVector(getContext(), Native.fixedpointGetRules( + getContext().nCtx(), getNativeObject())); + 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()); + res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject()); return res; } @@ -297,15 +296,15 @@ public class Fixedpoint extends Z3Object * * @throws Z3Exception **/ - public BoolExpr[] Assertions() throws Z3Exception + public BoolExpr[] getAssertions() throws Z3Exception { - ASTVector v = new ASTVector(Context(), Native.fixedpointGetAssertions( - Context().nCtx(), NativeObject())); - int n = v.Size(); + ASTVector v = new ASTVector(getContext(), Native.fixedpointGetAssertions( + getContext().nCtx(), getNativeObject())); + 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()); + res[i] = new BoolExpr(getContext(), v.get(i).getNativeObject()); return res; } @@ -319,15 +318,15 @@ public class Fixedpoint extends Z3Object super(ctx, Native.mkFixedpoint(ctx.nCtx())); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Fixedpoint_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().fixedpoint_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Fixedpoint_DRQ().Add(o); - super.DecRef(o); + getContext().fixedpoint_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/FixedpointDecRefQueue.java b/src/api/java/FixedpointDecRefQueue.java index 677691db8..e52389b85 100644 --- a/src/api/java/FixedpointDecRefQueue.java +++ b/src/api/java/FixedpointDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class FixedpointDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class FixedpointDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/FuncDecl.java b/src/api/java/FuncDecl.java index a2bf28c5d..ada44bbd7 100644 --- a/src/api/java/FuncDecl.java +++ b/src/api/java/FuncDecl.java @@ -6,7 +6,9 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_ast_kind; +import com.microsoft.z3.enumerations.Z3_decl_kind; +import com.microsoft.z3.enumerations.Z3_parameter_kind; /** * Function declarations. @@ -32,7 +34,7 @@ public class FuncDecl extends AST /** * Object comparison. **/ - public boolean Equals(Object o) + public boolean equals(Object o) { FuncDecl casted = (FuncDecl) o; if (casted == null) @@ -43,9 +45,9 @@ public class FuncDecl extends AST /** * A hash code. **/ - public int GetHashCode() throws Z3Exception + public int hashCode() { - return super.GetHashCode(); + return super.hashCode(); } /** @@ -55,7 +57,7 @@ public class FuncDecl extends AST { try { - return Native.funcDeclToString(Context().nCtx(), NativeObject()); + return Native.funcDeclToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -65,125 +67,125 @@ public class FuncDecl extends AST /** * Returns a unique identifier for the function declaration. **/ - public int Id() throws Z3Exception + public int getId() throws Z3Exception { - return Native.getFuncDeclId(Context().nCtx(), NativeObject()); + return Native.getFuncDeclId(getContext().nCtx(), getNativeObject()); } /** * The arity of the function declaration **/ - public int Arity() throws Z3Exception + public int getArity() throws Z3Exception { - return Native.getArity(Context().nCtx(), NativeObject()); + return Native.getArity(getContext().nCtx(), getNativeObject()); } /** * The size of the domain of the function declaration **/ - public int DomainSize() throws Z3Exception + public int getDomainSize() throws Z3Exception { - return Native.getDomainSize(Context().nCtx(), NativeObject()); + return Native.getDomainSize(getContext().nCtx(), getNativeObject()); } /** * The domain of the function declaration **/ - public Sort[] Domain() throws Z3Exception + public Sort[] getDomain() throws Z3Exception { - int n = DomainSize(); + int n = getDomainSize(); Sort[] res = new Sort[n]; for (int i = 0; i < n; i++) - res[i] = Sort.Create(Context(), - Native.getDomain(Context().nCtx(), NativeObject(), i)); + res[i] = Sort.create(getContext(), + Native.getDomain(getContext().nCtx(), getNativeObject(), i)); return res; } /** * The range of the function declaration **/ - public Sort Range() throws Z3Exception + public Sort getRange() throws Z3Exception { - return Sort.Create(Context(), - Native.getRange(Context().nCtx(), NativeObject())); + return Sort.create(getContext(), + Native.getRange(getContext().nCtx(), getNativeObject())); } /** * The kind of the function declaration. **/ - public Z3_decl_kind DeclKind() throws Z3Exception + public Z3_decl_kind getDeclKind() throws Z3Exception { - return Z3_decl_kind.fromInt(Native.getDeclKind(Context().nCtx(), - NativeObject())); + return Z3_decl_kind.fromInt(Native.getDeclKind(getContext().nCtx(), + getNativeObject())); } /** * The name of the function declaration **/ - public Symbol Name() throws Z3Exception + public Symbol getName() throws Z3Exception { - return Symbol.Create(Context(), - Native.getDeclName(Context().nCtx(), NativeObject())); + return Symbol.create(getContext(), + Native.getDeclName(getContext().nCtx(), getNativeObject())); } /** * The number of parameters of the function declaration **/ - public int NumParameters() throws Z3Exception + public int getNumParameters() throws Z3Exception { - return Native.getDeclNumParameters(Context().nCtx(), NativeObject()); + return Native.getDeclNumParameters(getContext().nCtx(), getNativeObject()); } /** * The parameters of the function declaration **/ - public Parameter[] Parameters() throws Z3Exception + public Parameter[] getParameters() throws Z3Exception { - int num = NumParameters(); + int num = getNumParameters(); 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)); + .getDeclParameterKind(getContext().nCtx(), getNativeObject(), i)); switch (k) { case Z3_PARAMETER_INT: - res[i] = new Parameter(k, Native.getDeclIntParameter(Context() - .nCtx(), NativeObject(), i)); + res[i] = new Parameter(k, Native.getDeclIntParameter(getContext() + .nCtx(), getNativeObject(), i)); break; case Z3_PARAMETER_DOUBLE: res[i] = new Parameter(k, Native.getDeclDoubleParameter( - Context().nCtx(), NativeObject(), i)); + getContext().nCtx(), getNativeObject(), i)); break; case Z3_PARAMETER_SYMBOL: - res[i] = new Parameter(k, Symbol.Create(Context(), Native - .getDeclSymbolParameter(Context().nCtx(), - NativeObject(), i))); + res[i] = new Parameter(k, Symbol.create(getContext(), Native + .getDeclSymbolParameter(getContext().nCtx(), + getNativeObject(), i))); break; case Z3_PARAMETER_SORT: - res[i] = new Parameter(k, Sort.Create(Context(), Native - .getDeclSortParameter(Context().nCtx(), NativeObject(), + res[i] = new Parameter(k, Sort.create(getContext(), Native + .getDeclSortParameter(getContext().nCtx(), getNativeObject(), i))); break; case Z3_PARAMETER_AST: - res[i] = new Parameter(k, new AST(Context(), - Native.getDeclAstParameter(Context().nCtx(), - NativeObject(), i))); + res[i] = new Parameter(k, new AST(getContext(), + Native.getDeclAstParameter(getContext().nCtx(), + getNativeObject(), i))); break; case Z3_PARAMETER_FUNC_DECL: - res[i] = new Parameter(k, new FuncDecl(Context(), - Native.getDeclFuncDeclParameter(Context().nCtx(), - NativeObject(), i))); + res[i] = new Parameter(k, new FuncDecl(getContext(), + Native.getDeclFuncDeclParameter(getContext().nCtx(), + getNativeObject(), i))); break; case Z3_PARAMETER_RATIONAL: res[i] = new Parameter(k, Native.getDeclRationalParameter( - Context().nCtx(), NativeObject(), i)); + getContext().nCtx(), getNativeObject(), i)); break; default: throw new Z3Exception( @@ -210,9 +212,9 @@ public class FuncDecl extends AST /** * The int value of the parameter. **/ - public int Int() throws Z3Exception + public int getInt() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_INT) throw new Z3Exception("parameter is not an int"); return i; } @@ -220,9 +222,9 @@ public class FuncDecl extends AST /** * The double value of the parameter. **/ - public double Double() throws Z3Exception + public double getDouble() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_DOUBLE) throw new Z3Exception("parameter is not a double "); return d; } @@ -230,9 +232,9 @@ public class FuncDecl extends AST /** * The Symbol value of the parameter. **/ - public Symbol Symbol() throws Z3Exception + public Symbol getSymbol() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SYMBOL) throw new Z3Exception("parameter is not a Symbol"); return sym; } @@ -240,9 +242,9 @@ public class FuncDecl extends AST /** * The Sort value of the parameter. **/ - public Sort Sort() throws Z3Exception + public Sort getSort() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_SORT) throw new Z3Exception("parameter is not a Sort"); return srt; } @@ -250,9 +252,9 @@ public class FuncDecl extends AST /** * The AST value of the parameter. **/ - public AST AST() throws Z3Exception + public AST getAST() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_AST) throw new Z3Exception("parameter is not an AST"); return ast; } @@ -260,9 +262,9 @@ public class FuncDecl extends AST /** * The FunctionDeclaration value of the parameter. **/ - public FuncDecl FuncDecl() throws Z3Exception + public FuncDecl getFuncDecl() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_FUNC_DECL) throw new Z3Exception("parameter is not a function declaration"); return fd; } @@ -270,9 +272,9 @@ public class FuncDecl extends AST /** * The rational string value of the parameter. **/ - public String Rational() throws Z3Exception + public String getRational() throws Z3Exception { - if (ParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL) + if (getParameterKind() != Z3_parameter_kind.Z3_PARAMETER_RATIONAL) throw new Z3Exception("parameter is not a rational String"); return r; } @@ -280,7 +282,7 @@ public class FuncDecl extends AST /** * The kind of the parameter. **/ - public Z3_parameter_kind ParameterKind() throws Z3Exception + public Z3_parameter_kind getParameterKind() throws Z3Exception { return kind; } @@ -337,9 +339,9 @@ public class FuncDecl extends AST 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())); + super(ctx, Native.mkFuncDecl(ctx.nCtx(), name.getNativeObject(), + AST.arrayLength(domain), AST.arrayToNative(domain), + range.getNativeObject())); } @@ -347,18 +349,18 @@ public class FuncDecl extends AST throws Z3Exception { super(ctx, Native.mkFreshFuncDecl(ctx.nCtx(), prefix, - AST.ArrayLength(domain), AST.ArrayToNative(domain), - range.NativeObject())); + AST.arrayLength(domain), AST.arrayToNative(domain), + range.getNativeObject())); } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST + if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_FUNC_DECL_AST .toInt()) throw new Z3Exception( "Underlying object is not a function declaration"); - super.CheckNativeObject(obj); + super.checkNativeObject(obj); } /** @@ -367,31 +369,9 @@ public class FuncDecl extends AST * * @return **/ - /* operator this[] not translated */ - - /** - * Create expression that applies function to arguments. - * - * @return - **/ - public Expr Apply(Expr[] args) throws Z3Exception + public Expr apply(Expr ... args) throws Z3Exception { - Context().CheckContextMatch(args); - return Expr.Create(Context(), this, args); + getContext().checkContextMatch(args); + return Expr.create(getContext(), this, args); } - - /** - * Create expression that applies function to one argument. - * - * @return - **/ - public Expr Apply(Expr arg) throws Z3Exception - { - Context().CheckContextMatch(arg); - Expr[] a = { arg }; - return Expr.Create(Context(), this, a); - } - } diff --git a/src/api/java/FuncInterp.java b/src/api/java/FuncInterp.java index 261f433e7..b7fa118e9 100644 --- a/src/api/java/FuncInterp.java +++ b/src/api/java/FuncInterp.java @@ -24,18 +24,18 @@ public class FuncInterp extends Z3Object * * @throws Z3Exception **/ - public Expr Value() throws Z3Exception + public Expr getValue() throws Z3Exception { - return Expr.Create(Context(), - Native.funcEntryGetValue(Context().nCtx(), NativeObject())); + return Expr.create(getContext(), + Native.funcEntryGetValue(getContext().nCtx(), getNativeObject())); } /** * The number of arguments of the entry. **/ - public int NumArgs() throws Z3Exception + public int getNumArgs() throws Z3Exception { - return Native.funcEntryGetNumArgs(Context().nCtx(), NativeObject()); + return Native.funcEntryGetNumArgs(getContext().nCtx(), getNativeObject()); } /** @@ -43,13 +43,13 @@ public class FuncInterp extends Z3Object * * @throws Z3Exception **/ - public Expr[] Args() throws Z3Exception + public Expr[] getArgs() throws Z3Exception { - int n = NumArgs(); + int n = getNumArgs(); Expr[] res = new Expr[n]; for (int i = 0; i < n; i++) - res[i] = Expr.Create(Context(), Native.funcEntryGetArg( - Context().nCtx(), NativeObject(), i)); + res[i] = Expr.create(getContext(), Native.funcEntryGetArg( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -60,12 +60,12 @@ public class FuncInterp extends Z3Object { try { - int n = NumArgs(); + int n = getNumArgs(); String res = "["; - Expr[] args = Args(); + Expr[] args = getArgs(); for (int i = 0; i < n; i++) res += args[i] + ", "; - return res + Value() + "]"; + return res + getValue() + "]"; } catch (Z3Exception e) { return new String("Z3Exception: " + e.getMessage()); @@ -77,25 +77,25 @@ public class FuncInterp extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().FuncEntry_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().funcEntry_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().FuncEntry_DRQ().Add(o); - super.DecRef(o); + getContext().funcEntry_DRQ().add(o); + super.decRef(o); } }; /** * The number of entries in the function interpretation. **/ - public int NumEntries() throws Z3Exception + public int getNumEntries() throws Z3Exception { - return Native.funcInterpGetNumEntries(Context().nCtx(), NativeObject()); + return Native.funcInterpGetNumEntries(getContext().nCtx(), getNativeObject()); } /** @@ -103,13 +103,13 @@ public class FuncInterp extends Z3Object * * @throws Z3Exception **/ - public Entry[] Entries() throws Z3Exception + public Entry[] getEntries() throws Z3Exception { - int n = NumEntries(); + int n = getNumEntries(); Entry[] res = new Entry[n]; for (int i = 0; i < n; i++) - res[i] = new Entry(Context(), Native.funcInterpGetEntry(Context() - .nCtx(), NativeObject(), i)); + res[i] = new Entry(getContext(), Native.funcInterpGetEntry(getContext() + .nCtx(), getNativeObject(), i)); return res; } @@ -118,18 +118,18 @@ public class FuncInterp extends Z3Object * * @throws Z3Exception **/ - public Expr Else() throws Z3Exception + public Expr getElse() throws Z3Exception { - return Expr.Create(Context(), - Native.funcInterpGetElse(Context().nCtx(), NativeObject())); + return Expr.create(getContext(), + Native.funcInterpGetElse(getContext().nCtx(), getNativeObject())); } /** * The arity of the function interpretation **/ - public int Arity() throws Z3Exception + public int getArity() throws Z3Exception { - return Native.funcInterpGetArity(Context().nCtx(), NativeObject()); + return Native.funcInterpGetArity(getContext().nCtx(), getNativeObject()); } /** @@ -141,12 +141,12 @@ public class FuncInterp extends Z3Object { String res = ""; res += "["; - for (Entry e : Entries()) + for (Entry e : getEntries()) { - int n = e.NumArgs(); + int n = e.getNumArgs(); if (n > 1) res += "["; - Expr[] args = e.Args(); + Expr[] args = e.getArgs(); for (int i = 0; i < n; i++) { if (i != 0) @@ -155,9 +155,9 @@ public class FuncInterp extends Z3Object } if (n > 1) res += "]"; - res += " -> " + e.Value() + ", "; + res += " -> " + e.getValue() + ", "; } - res += "else -> " + Else(); + res += "else -> " + getElse(); res += "]"; return res; } catch (Z3Exception e) @@ -171,15 +171,15 @@ public class FuncInterp extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().FuncInterp_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().funcInterp_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().FuncInterp_DRQ().Add(o); - super.DecRef(o); + getContext().funcInterp_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/FuncInterpDecRefQueue.java b/src/api/java/FuncInterpDecRefQueue.java index d1b662cb2..e2814a9b8 100644 --- a/src/api/java/FuncInterpDecRefQueue.java +++ b/src/api/java/FuncInterpDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class FuncInterpDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class FuncInterpDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/FuncInterpEntryDecRefQueue.java b/src/api/java/FuncInterpEntryDecRefQueue.java index df2702020..61488ec74 100644 --- a/src/api/java/FuncInterpEntryDecRefQueue.java +++ b/src/api/java/FuncInterpEntryDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class FuncInterpEntryDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class FuncInterpEntryDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/Global.java b/src/api/java/Global.java index c08691ded..33a828fb8 100644 --- a/src/api/java/Global.java +++ b/src/api/java/Global.java @@ -30,7 +30,7 @@ public final class Global * will set the parameter "decimal" in the module "pp" to true. * **/ - public static void SetParameter(String id, String value) + public static void setParameter(String id, String value) { Native.globalParamSet(id, value); } @@ -44,7 +44,7 @@ public final class Global * The result string stored in param_value is stored in a shared location. * **/ - public static String GetParameter(String id) + public static String getParameter(String id) { Native.StringPtr res = new Native.StringPtr(); if (!Native.globalParamGet(id, res)) @@ -60,7 +60,7 @@ public final class Global * * @seealso SetParameter **/ - public static void ResetParameters() + public static void resetParameters() { Native.globalParamResetAll(); } diff --git a/src/api/java/Goal.java b/src/api/java/Goal.java index 61ac96d30..520a7af15 100644 --- a/src/api/java/Goal.java +++ b/src/api/java/Goal.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_goal_prec; /** * A goal (aka problem). A goal is essentially a set of formulas, that can be @@ -21,43 +21,43 @@ public class Goal extends Z3Object * applied when the objective is to find a proof for a given goal. * **/ - public Z3_goal_prec Precision() throws Z3Exception + public Z3_goal_prec getPrecision() throws Z3Exception { - return Z3_goal_prec.fromInt(Native.goalPrecision(Context().nCtx(), - NativeObject())); + return Z3_goal_prec.fromInt(Native.goalPrecision(getContext().nCtx(), + getNativeObject())); } /** * Indicates whether the goal is precise. **/ - public boolean IsPrecise() throws Z3Exception + public boolean isPrecise() throws Z3Exception { - return Precision() == Z3_goal_prec.Z3_GOAL_PRECISE; + return getPrecision() == Z3_goal_prec.Z3_GOAL_PRECISE; } /** * Indicates whether the goal is an under-approximation. **/ - public boolean IsUnderApproximation() throws Z3Exception + public boolean isUnderApproximation() throws Z3Exception { - return Precision() == Z3_goal_prec.Z3_GOAL_UNDER; + return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER; } /** * Indicates whether the goal is an over-approximation. **/ - public boolean IsOverApproximation() throws Z3Exception + public boolean isOverApproximation() throws Z3Exception { - return Precision() == Z3_goal_prec.Z3_GOAL_OVER; + return getPrecision() == Z3_goal_prec.Z3_GOAL_OVER; } /** * Indicates whether the goal is garbage (i.e., the product of over- and * under-approximations). **/ - public boolean IsGarbage() throws Z3Exception + public boolean isGarbage() throws Z3Exception { - return Precision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER; + return getPrecision() == Z3_goal_prec.Z3_GOAL_UNDER_OVER; } /** @@ -65,59 +65,47 @@ public class Goal extends Z3Object * * @throws Z3Exception **/ - public void Assert(BoolExpr[] constraints) throws Z3Exception + public void assert_(BoolExpr ... constraints) throws Z3Exception { - Context().CheckContextMatch(constraints); + getContext().checkContextMatch(constraints); for (BoolExpr c : constraints) { - Native.goalAssert(Context().nCtx(), NativeObject(), - c.NativeObject()); + Native.goalAssert(getContext().nCtx(), getNativeObject(), + c.getNativeObject()); } } - /** - * Adds a to the given goal. - * - * @throws Z3Exception - **/ - public void Assert(BoolExpr constraint) throws Z3Exception - { - Context().CheckContextMatch(constraint); - Native.goalAssert(Context().nCtx(), NativeObject(), - constraint.NativeObject()); - } - /** * Indicates whether the goal contains `false'. **/ - public boolean Inconsistent() throws Z3Exception + public boolean inconsistent() throws Z3Exception { - return Native.goalInconsistent(Context().nCtx(), NativeObject()); + return Native.goalInconsistent(getContext().nCtx(), getNativeObject()); } /** * The depth of the goal. This tracks how many transformations * were applied to it. **/ - public int Depth() throws Z3Exception + public int getDepth() throws Z3Exception { - return Native.goalDepth(Context().nCtx(), NativeObject()); + return Native.goalDepth(getContext().nCtx(), getNativeObject()); } /** * Erases all formulas from the given goal. **/ - public void Reset() throws Z3Exception + public void reset() throws Z3Exception { - Native.goalReset(Context().nCtx(), NativeObject()); + Native.goalReset(getContext().nCtx(), getNativeObject()); } /** * The number of formulas in the goal. **/ - public int Size() throws Z3Exception + public int size() throws Z3Exception { - return Native.goalSize(Context().nCtx(), NativeObject()); + return Native.goalSize(getContext().nCtx(), getNativeObject()); } /** @@ -125,40 +113,41 @@ public class Goal extends Z3Object * * @throws Z3Exception **/ - public BoolExpr[] Formulas() throws Z3Exception + public BoolExpr[] getFormulas() throws Z3Exception { - int n = Size(); + 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)); + res[i] = new BoolExpr(getContext(), Native.goalFormula(getContext() + .nCtx(), getNativeObject(), i)); return res; } /** * The number of formulas, subformulas and terms in the goal. **/ - public int NumExprs() throws Z3Exception + public int getNumExprs() throws Z3Exception { - return Native.goalNumExprs(Context().nCtx(), NativeObject()); + return Native.goalNumExprs(getContext().nCtx(), getNativeObject()); } /** * Indicates whether the goal is empty, and it is precise or the product of * an under approximation. **/ - public boolean IsDecidedSat() throws Z3Exception + public boolean isDecidedSat() throws Z3Exception { - return Native.goalIsDecidedSat(Context().nCtx(), NativeObject()); + return Native.goalIsDecidedSat(getContext().nCtx(), getNativeObject()); } /** * Indicates whether the goal contains `false', and it is precise or the * product of an over approximation. **/ - public boolean IsDecidedUnsat() throws Z3Exception + public boolean isDecidedUnsat() throws Z3Exception { - return Native.goalIsDecidedUnsat(Context().nCtx(), NativeObject()); + return Native + .goalIsDecidedUnsat(getContext().nCtx(), getNativeObject()); } /** @@ -167,25 +156,40 @@ public class Goal extends Z3Object * * @throws Z3Exception **/ - public Goal Translate(Context ctx) throws Z3Exception + public Goal translate(Context ctx) throws Z3Exception { - return new Goal(ctx, Native.goalTranslate(Context().nCtx(), - NativeObject(), ctx.nCtx())); + return new Goal(ctx, Native.goalTranslate(getContext().nCtx(), + getNativeObject(), ctx.nCtx())); } /** * Simplifies the goal. Essentially invokes the `simplify' tactic * on the goal. **/ - public Goal Simplify(Params p) throws Z3Exception + public Goal simplify() throws Z3Exception { - Tactic t = Context().MkTactic("simplify"); - ApplyResult res = t.Apply(this, p); + Tactic t = getContext().mkTactic("simplify"); + ApplyResult res = t.apply(this); - if (res.NumSubgoals() == 0) + if (res.getNumSubgoals() == 0) throw new Z3Exception("No subgoals"); else - return res.Subgoals()[0]; + return res.getSubgoals()[0]; + } + + /** + * Simplifies the goal. Essentially invokes the `simplify' tactic + * on the goal. + **/ + public Goal simplify(Params p) throws Z3Exception + { + Tactic t = getContext().mkTactic("simplify"); + ApplyResult res = t.apply(this, p); + + if (res.getNumSubgoals() == 0) + throw new Z3Exception("No subgoals"); + else + return res.getSubgoals()[0]; } /** @@ -197,7 +201,7 @@ public class Goal extends Z3Object { try { - return Native.goalToString(Context().nCtx(), NativeObject()); + return Native.goalToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -216,16 +220,16 @@ public class Goal extends Z3Object (unsatCores) ? true : false, (proofs) ? true : false)); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Goal_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().goal_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Goal_DRQ().Add(o); - super.DecRef(o); + getContext().goal_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/GoalDecRefQueue.java b/src/api/java/GoalDecRefQueue.java index 7dd52285f..0c7b8f5d9 100644 --- a/src/api/java/GoalDecRefQueue.java +++ b/src/api/java/GoalDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class GoalDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class GoalDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/IDecRefQueue.java b/src/api/java/IDecRefQueue.java index e4eec7f4f..ddb679910 100644 --- a/src/api/java/IDecRefQueue.java +++ b/src/api/java/IDecRefQueue.java @@ -6,26 +6,26 @@ package com.microsoft.z3; -import java.util.*; +import java.util.LinkedList; abstract class IDecRefQueue { protected Object m_lock = new Object(); protected LinkedList m_queue = new LinkedList(); - final int m_move_limit = 1024; + protected final int m_move_limit = 1024; - public abstract void IncRef(Context ctx, long obj); + protected abstract void incRef(Context ctx, long obj); - public abstract void DecRef(Context ctx, long obj); + protected abstract void decRef(Context ctx, long obj); - public void IncAndClear(Context ctx, long o) + protected void incAndClear(Context ctx, long o) { - IncRef(ctx, o); + incRef(ctx, o); if (m_queue.size() >= m_move_limit) - Clear(ctx); + clear(ctx); } - public void Add(long o) + protected void add(long o) { if (o == 0) return; @@ -36,12 +36,12 @@ abstract class IDecRefQueue } } - public void Clear(Context ctx) + protected void clear(Context ctx) { synchronized (m_lock) { for (Long o : m_queue) - DecRef(ctx, o); + decRef(ctx, o); m_queue.clear(); } } diff --git a/src/api/java/IDisposable.java b/src/api/java/IDisposable.java index 02bbb0ad5..9092213e3 100644 --- a/src/api/java/IDisposable.java +++ b/src/api/java/IDisposable.java @@ -21,7 +21,7 @@ package com.microsoft.z3; public class IDisposable { - public void Dispose() throws Z3Exception + public void dispose() throws Z3Exception { } } diff --git a/src/api/java/IntNum.java b/src/api/java/IntNum.java index 1397616c6..ebf237a2e 100644 --- a/src/api/java/IntNum.java +++ b/src/api/java/IntNum.java @@ -22,10 +22,10 @@ public class IntNum extends IntExpr /** * Retrieve the int value. **/ - public int Int() throws Z3Exception + public int getInt() throws Z3Exception { Native.IntPtr res = new Native.IntPtr(); - if (Native.getNumeralInt(Context().nCtx(), NativeObject(), res) ^ true) + if (Native.getNumeralInt(getContext().nCtx(), getNativeObject(), res) ^ true) throw new Z3Exception("Numeral is not an int"); return res.value; } @@ -33,10 +33,10 @@ public class IntNum extends IntExpr /** * Retrieve the 64-bit int value. **/ - public long Int64() throws Z3Exception + public long getInt64() throws Z3Exception { Native.LongPtr res = new Native.LongPtr(); - if (Native.getNumeralInt64(Context().nCtx(), NativeObject(), res) ^ true) + if (Native.getNumeralInt64(getContext().nCtx(), getNativeObject(), res) ^ true) throw new Z3Exception("Numeral is not an int64"); return res.value; } @@ -44,7 +44,7 @@ public class IntNum extends IntExpr /** * Retrieve the BigInteger value. **/ - public BigInteger BigInteger() throws Z3Exception + public BigInteger getBigInteger() throws Z3Exception { return new BigInteger(this.toString()); } @@ -56,7 +56,7 @@ public class IntNum extends IntExpr { try { - return Native.getNumeralString(Context().nCtx(), NativeObject()); + return Native.getNumeralString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); diff --git a/src/api/java/IntSymbol.java b/src/api/java/IntSymbol.java index 3dbdfaf73..113b507c3 100644 --- a/src/api/java/IntSymbol.java +++ b/src/api/java/IntSymbol.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_symbol_kind; /** * Numbered symbols @@ -17,11 +17,11 @@ public class IntSymbol extends Symbol * The int value of the symbol. Throws an exception if the symbol * is not of int kind. **/ - public int Int() throws Z3Exception + public int getInt() throws Z3Exception { - if (!IsIntSymbol()) + if (!isIntSymbol()) throw new Z3Exception("Int requested from non-Int symbol"); - return Native.getSymbolInt(Context().nCtx(), NativeObject()); + return Native.getSymbolInt(getContext().nCtx(), getNativeObject()); } IntSymbol(Context ctx, long obj) throws Z3Exception @@ -34,11 +34,11 @@ public class IntSymbol extends Symbol super(ctx, Native.mkIntSymbol(ctx.nCtx(), i)); } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL + if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_INT_SYMBOL .toInt()) throw new Z3Exception("Symbol is not of integer kind"); - super.CheckNativeObject(obj); + super.checkNativeObject(obj); } } diff --git a/src/api/java/ListSort.java b/src/api/java/ListSort.java index 98292b6ae..df1c51a95 100644 --- a/src/api/java/ListSort.java +++ b/src/api/java/ListSort.java @@ -14,36 +14,32 @@ public class ListSort extends Sort /** * The declaration of the nil function of this list sort. **/ - public FuncDecl NilDecl() + public FuncDecl getNilDecl() { - return nilDecl; } /** * The empty list. **/ - public Expr Nil() + public Expr getNil() { - return nilConst; } /** * The declaration of the isNil function of this list sort. **/ - public FuncDecl IsNilDecl() + public FuncDecl getIsNilDecl() { - return isNilDecl; } /** * The declaration of the cons function of this list sort. **/ - public FuncDecl ConsDecl() + public FuncDecl getConsDecl() { - return consDecl; } @@ -51,27 +47,24 @@ public class ListSort extends Sort * The declaration of the isCons function of this list sort. * **/ - public FuncDecl IsConsDecl() + public FuncDecl getIsConsDecl() { - return isConsDecl; } /** * The declaration of the head function of this list sort. **/ - public FuncDecl HeadDecl() + public FuncDecl getHeadDecl() { - return headDecl; } /** * The declaration of the tail function of this list sort. **/ - public FuncDecl TailDecl() + public FuncDecl getTailDecl() { - return tailDecl; } @@ -87,8 +80,8 @@ public class ListSort extends Sort 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, + setNativeObject(Native.mkListSort(ctx.nCtx(), name.getNativeObject(), + elemSort.getNativeObject(), inil, iisnil, icons, iiscons, ihead, itail)); nilDecl = new FuncDecl(ctx, inil.value); isNilDecl = new FuncDecl(ctx, iisnil.value); @@ -96,6 +89,6 @@ public class ListSort extends Sort isConsDecl = new FuncDecl(ctx, iiscons.value); headDecl = new FuncDecl(ctx, ihead.value); tailDecl = new FuncDecl(ctx, itail.value); - nilConst = ctx.MkConst(nilDecl); + nilConst = ctx.mkConst(nilDecl); } }; diff --git a/src/api/java/Log.java b/src/api/java/Log.java index cd62f82ac..99581cedb 100644 --- a/src/api/java/Log.java +++ b/src/api/java/Log.java @@ -21,7 +21,7 @@ public final class Log * * @return True if opening the log file succeeds, false otherwise. **/ - public static boolean Open(String filename) + public static boolean open(String filename) { m_is_open = true; return Native.openLog(filename) == 1; @@ -30,7 +30,7 @@ public final class Log /** * Closes the interaction log. **/ - public static void Close() + public static void close() { m_is_open = false; Native.closeLog(); @@ -41,7 +41,7 @@ public final class Log * log. * @throws Z3Exception **/ - public static void Append(String s) throws Z3Exception + public static void append(String s) throws Z3Exception { if (!m_is_open) throw new Z3Exception("Log cannot be closed."); diff --git a/src/api/java/Model.java b/src/api/java/Model.java index e38c260c4..32247eb4a 100644 --- a/src/api/java/Model.java +++ b/src/api/java/Model.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_sort_kind; /** * A Model contains interpretations (assignments) of constants and functions. @@ -21,10 +21,10 @@ public class Model extends Z3Object * null otherwise. * @throws Z3Exception **/ - public Expr ConstInterp(Expr a) throws Z3Exception + public Expr getConstInterp(Expr a) throws Z3Exception { - Context().CheckContextMatch(a); - return ConstInterp(a.FuncDecl()); + getContext().checkContextMatch(a); + return getConstInterp(a.getFuncDecl()); } /** @@ -35,22 +35,22 @@ public class Model extends Z3Object * null otherwise. * @throws Z3Exception **/ - public Expr ConstInterp(FuncDecl f) throws Z3Exception + public Expr getConstInterp(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 + getContext().checkContextMatch(f); + if (f.getArity() != 0 + || Native.getSortKind(getContext().nCtx(), + Native.getRange(getContext().nCtx(), f.getNativeObject())) == 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()); + long n = Native.modelGetConstInterp(getContext().nCtx(), getNativeObject(), + f.getNativeObject()); if (n == 0) return null; else - return Expr.Create(Context(), n); + return Expr.create(getContext(), n); } /** @@ -62,17 +62,17 @@ public class Model extends Z3Object * the model, null otherwise. * @throws Z3Exception **/ - public FuncInterp FuncInterp(FuncDecl f) throws Z3Exception + public FuncInterp getFuncInterp(FuncDecl f) throws Z3Exception { - Context().CheckContextMatch(f); + getContext().checkContextMatch(f); - Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(Context() - .nCtx(), Native.getRange(Context().nCtx(), f.NativeObject()))); + Z3_sort_kind sk = Z3_sort_kind.fromInt(Native.getSortKind(getContext() + .nCtx(), Native.getRange(getContext().nCtx(), f.getNativeObject()))); - if (f.Arity() == 0) + if (f.getArity() == 0) { - long n = Native.modelGetConstInterp(Context().nCtx(), - NativeObject(), f.NativeObject()); + long n = Native.modelGetConstInterp(getContext().nCtx(), + getNativeObject(), f.getNativeObject()); if (sk == Z3_sort_kind.Z3_ARRAY_SORT) { @@ -80,11 +80,11 @@ public class Model extends Z3Object return null; else { - if (Native.isAsArray(Context().nCtx(), n) ^ true) + if (Native.isAsArray(getContext().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)); + long fd = Native.getAsArrayFuncDecl(getContext().nCtx(), n); + return getFuncInterp(new FuncDecl(getContext(), fd)); } } else { @@ -93,21 +93,21 @@ public class Model extends Z3Object } } else { - long n = Native.modelGetFuncInterp(Context().nCtx(), - NativeObject(), f.NativeObject()); + long n = Native.modelGetFuncInterp(getContext().nCtx(), + getNativeObject(), f.getNativeObject()); if (n == 0) return null; else - return new FuncInterp(Context(), n); + return new FuncInterp(getContext(), n); } } /** * The number of constants that have an interpretation in the model. **/ - public int NumConsts() throws Z3Exception + public int getNumConsts() throws Z3Exception { - return Native.modelGetNumConsts(Context().nCtx(), NativeObject()); + return Native.modelGetNumConsts(getContext().nCtx(), getNativeObject()); } /** @@ -115,22 +115,22 @@ public class Model extends Z3Object * * @throws Z3Exception **/ - public FuncDecl[] ConstDecls() throws Z3Exception + public FuncDecl[] getConstDecls() throws Z3Exception { - int n = NumConsts(); + int n = getNumConsts(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) - res[i] = new FuncDecl(Context(), Native.modelGetConstDecl(Context() - .nCtx(), NativeObject(), i)); + res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext() + .nCtx(), getNativeObject(), i)); return res; } /** * The number of function interpretations in the model. **/ - public int NumFuncs() throws Z3Exception + public int getNumFuncs() throws Z3Exception { - return Native.modelGetNumFuncs(Context().nCtx(), NativeObject()); + return Native.modelGetNumFuncs(getContext().nCtx(), getNativeObject()); } /** @@ -138,13 +138,13 @@ public class Model extends Z3Object * * @throws Z3Exception **/ - public FuncDecl[] FuncDecls() throws Z3Exception + public FuncDecl[] getFuncDecls() throws Z3Exception { - int n = NumFuncs(); + int n = getNumFuncs(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) - res[i] = new FuncDecl(Context(), Native.modelGetFuncDecl(Context() - .nCtx(), NativeObject(), i)); + res[i] = new FuncDecl(getContext(), Native.modelGetFuncDecl(getContext() + .nCtx(), getNativeObject(), i)); return res; } @@ -153,18 +153,18 @@ public class Model extends Z3Object * * @throws Z3Exception **/ - public FuncDecl[] Decls() throws Z3Exception + public FuncDecl[] getDecls() throws Z3Exception { - int nFuncs = NumFuncs(); - int nConsts = NumConsts(); + int nFuncs = getNumFuncs(); + int nConsts = getNumConsts(); 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)); + res[i] = new FuncDecl(getContext(), Native.modelGetConstDecl(getContext() + .nCtx(), getNativeObject(), i)); for (int i = 0; i < nFuncs; i++) - res[nConsts + i] = new FuncDecl(Context(), Native.modelGetFuncDecl( - Context().nCtx(), NativeObject(), i)); + res[nConsts + i] = new FuncDecl(getContext(), Native.modelGetFuncDecl( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -197,14 +197,14 @@ public class Model extends Z3Object * @return The evaluation of in the model. * @throws Z3Exception **/ - public Expr Eval(Expr t, boolean completion) 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) + if (Native.modelEval(getContext().nCtx(), getNativeObject(), + t.getNativeObject(), (completion) ? true : false, v) ^ true) throw new ModelEvaluationFailedException(); else - return Expr.Create(Context(), v.value); + return Expr.create(getContext(), v.value); } /** @@ -212,18 +212,18 @@ public class Model extends Z3Object * * @throws Z3Exception **/ - public Expr Evaluate(Expr t, boolean completion) throws Z3Exception + public Expr evaluate(Expr t, boolean completion) throws Z3Exception { - return Eval(t, completion); + return eval(t, completion); } /** * The number of uninterpreted sorts that the model has an interpretation * for. **/ - public int NumSorts() throws Z3Exception + public int getNumSorts() throws Z3Exception { - return Native.modelGetNumSorts(Context().nCtx(), NativeObject()); + return Native.modelGetNumSorts(getContext().nCtx(), getNativeObject()); } /** @@ -235,14 +235,14 @@ public class Model extends Z3Object * * @throws Z3Exception **/ - public Sort[] Sorts() throws Z3Exception + public Sort[] getSorts() throws Z3Exception { - int n = NumSorts(); + int n = getNumSorts(); Sort[] res = new Sort[n]; for (int i = 0; i < n; i++) - res[i] = Sort.Create(Context(), - Native.modelGetSort(Context().nCtx(), NativeObject(), i)); + res[i] = Sort.create(getContext(), + Native.modelGetSort(getContext().nCtx(), getNativeObject(), i)); return res; } @@ -255,15 +255,15 @@ public class Model extends Z3Object * of * @throws Z3Exception **/ - public Expr[] SortUniverse(Sort s) throws Z3Exception + public Expr[] getSortUniverse(Sort s) throws Z3Exception { - ASTVector nUniv = new ASTVector(Context(), Native.modelGetSortUniverse( - Context().nCtx(), NativeObject(), s.NativeObject())); - int n = nUniv.Size(); + ASTVector nUniv = new ASTVector(getContext(), Native.modelGetSortUniverse( + getContext().nCtx(), getNativeObject(), s.getNativeObject())); + 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()); + res[i] = Expr.create(getContext(), nUniv.get(i).getNativeObject()); return res; } @@ -276,7 +276,7 @@ public class Model extends Z3Object { try { - return Native.modelToString(Context().nCtx(), NativeObject()); + return Native.modelToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -288,15 +288,15 @@ public class Model extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Model_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().model_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Model_DRQ().Add(o); - super.DecRef(o); + getContext().model_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ModelDecRefQueue.java b/src/api/java/ModelDecRefQueue.java index 71fb939cf..a0542714e 100644 --- a/src/api/java/ModelDecRefQueue.java +++ b/src/api/java/ModelDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ModelDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ModelDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/ParamDescrs.java b/src/api/java/ParamDescrs.java index 09b70f5c7..3b3e76e51 100644 --- a/src/api/java/ParamDescrs.java +++ b/src/api/java/ParamDescrs.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_param_kind; /** * A ParamDescrs describes a set of parameters. @@ -16,21 +16,21 @@ public class ParamDescrs extends Z3Object /** * validate a set of parameters. **/ - public void Validate(Params p) throws Z3Exception + public void validate(Params p) throws Z3Exception { - Native.paramsValidate(Context().nCtx(), p.NativeObject(), - NativeObject()); + Native.paramsValidate(getContext().nCtx(), p.getNativeObject(), + getNativeObject()); } /** * Retrieve kind of parameter. **/ - public Z3_param_kind GetKind(Symbol name) throws Z3Exception + public Z3_param_kind getKind(Symbol name) throws Z3Exception { return Z3_param_kind.fromInt(Native.paramDescrsGetKind( - Context().nCtx(), NativeObject(), name.NativeObject())); + getContext().nCtx(), getNativeObject(), name.getNativeObject())); } /** @@ -38,14 +38,14 @@ public class ParamDescrs extends Z3Object * * @throws Z3Exception **/ - public Symbol[] Names() throws Z3Exception + public Symbol[] getNames() throws Z3Exception { - int sz = Native.paramDescrsSize(Context().nCtx(), NativeObject()); + int sz = Native.paramDescrsSize(getContext().nCtx(), getNativeObject()); Symbol[] names = new Symbol[sz]; for (int i = 0; i < sz; ++i) { - names[i] = Symbol.Create(Context(), Native.paramDescrsGetName( - Context().nCtx(), NativeObject(), i)); + names[i] = Symbol.create(getContext(), Native.paramDescrsGetName( + getContext().nCtx(), getNativeObject(), i)); } return names; } @@ -53,9 +53,9 @@ public class ParamDescrs extends Z3Object /** * The size of the ParamDescrs. **/ - public int Size() throws Z3Exception + public int size() throws Z3Exception { - return Native.paramDescrsSize(Context().nCtx(), NativeObject()); + return Native.paramDescrsSize(getContext().nCtx(), getNativeObject()); } /** @@ -65,7 +65,7 @@ public class ParamDescrs extends Z3Object { try { - return Native.paramDescrsToString(Context().nCtx(), NativeObject()); + return Native.paramDescrsToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -77,15 +77,15 @@ public class ParamDescrs extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().ParamDescrs_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().paramDescrs_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().ParamDescrs_DRQ().Add(o); - super.DecRef(o); + getContext().paramDescrs_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ParamDescrsDecRefQueue.java b/src/api/java/ParamDescrsDecRefQueue.java index 75e2a2c7e..70806041d 100644 --- a/src/api/java/ParamDescrsDecRefQueue.java +++ b/src/api/java/ParamDescrsDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ParamDescrsDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ParamDescrsDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/Params.java b/src/api/java/Params.java index c954c50e5..68af4386b 100644 --- a/src/api/java/Params.java +++ b/src/api/java/Params.java @@ -14,65 +14,65 @@ public class Params extends Z3Object /** * Adds a parameter setting. **/ - public void Add(Symbol name, boolean value) throws Z3Exception + public void add(Symbol name, boolean value) throws Z3Exception { - Native.paramsSetBool(Context().nCtx(), NativeObject(), - name.NativeObject(), (value) ? true : false); + Native.paramsSetBool(getContext().nCtx(), getNativeObject(), + name.getNativeObject(), (value) ? true : false); } /** * Adds a parameter setting. **/ - public void Add(Symbol name, double value) throws Z3Exception + public void add(Symbol name, double value) throws Z3Exception { - Native.paramsSetDouble(Context().nCtx(), NativeObject(), - name.NativeObject(), value); + Native.paramsSetDouble(getContext().nCtx(), getNativeObject(), + name.getNativeObject(), value); } /** * Adds a parameter setting. **/ - public void Add(Symbol name, Symbol value) throws Z3Exception + public void add(Symbol name, Symbol value) throws Z3Exception { - Native.paramsSetSymbol(Context().nCtx(), NativeObject(), - name.NativeObject(), value.NativeObject()); + Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(), + name.getNativeObject(), value.getNativeObject()); } /** * Adds a parameter setting. **/ - public void Add(String name, boolean value) throws Z3Exception + public void add(String name, boolean value) throws Z3Exception { - Native.paramsSetBool(Context().nCtx(), NativeObject(), - Context().MkSymbol(name).NativeObject(), value); + Native.paramsSetBool(getContext().nCtx(), getNativeObject(), + getContext().mkSymbol(name).getNativeObject(), value); } /** * Adds a parameter setting. **/ - public void Add(String name, int value) throws Z3Exception + public void add(String name, int value) throws Z3Exception { - Native.paramsSetUint(Context().nCtx(), NativeObject(), Context() - .MkSymbol(name).NativeObject(), value); + Native.paramsSetUint(getContext().nCtx(), getNativeObject(), getContext() + .mkSymbol(name).getNativeObject(), value); } /** * Adds a parameter setting. **/ - public void Add(String name, double value) throws Z3Exception + public void add(String name, double value) throws Z3Exception { - Native.paramsSetDouble(Context().nCtx(), NativeObject(), Context() - .MkSymbol(name).NativeObject(), value); + Native.paramsSetDouble(getContext().nCtx(), getNativeObject(), getContext() + .mkSymbol(name).getNativeObject(), value); } /** * Adds a parameter setting. **/ - public void Add(String name, Symbol value) throws Z3Exception + public void add(String name, Symbol value) throws Z3Exception { - Native.paramsSetSymbol(Context().nCtx(), NativeObject(), Context() - .MkSymbol(name).NativeObject(), value.NativeObject()); + Native.paramsSetSymbol(getContext().nCtx(), getNativeObject(), getContext() + .mkSymbol(name).getNativeObject(), value.getNativeObject()); } /** @@ -82,7 +82,7 @@ public class Params extends Z3Object { try { - return Native.paramsToString(Context().nCtx(), NativeObject()); + return Native.paramsToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -94,15 +94,15 @@ public class Params extends Z3Object super(ctx, Native.mkParams(ctx.nCtx())); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Params_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().params_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Params_DRQ().Add(o); - super.DecRef(o); + getContext().params_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ParamsDecRefQueue.java b/src/api/java/ParamsDecRefQueue.java index 7c3ccbee8..361fdf133 100644 --- a/src/api/java/ParamsDecRefQueue.java +++ b/src/api/java/ParamsDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ParamsDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ParamsDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/Pattern.java b/src/api/java/Pattern.java index ed36ad0e7..cd9340c9d 100644 --- a/src/api/java/Pattern.java +++ b/src/api/java/Pattern.java @@ -15,9 +15,9 @@ public class Pattern extends AST /** * The number of terms in the pattern. **/ - public int NumTerms() throws Z3Exception + public int getNumTerms() throws Z3Exception { - return Native.getPatternNumTerms(Context().nCtx(), NativeObject()); + return Native.getPatternNumTerms(getContext().nCtx(), getNativeObject()); } /** @@ -25,14 +25,14 @@ public class Pattern extends AST * * @throws Z3Exception **/ - public Expr[] Terms() throws Z3Exception + public Expr[] getTerms() throws Z3Exception { - int n = NumTerms(); + int n = getNumTerms(); Expr[] res = new Expr[n]; for (int i = 0; i < n; i++) - res[i] = Expr.Create(Context(), - Native.getPattern(Context().nCtx(), NativeObject(), i)); + res[i] = Expr.create(getContext(), + Native.getPattern(getContext().nCtx(), getNativeObject(), i)); return res; } @@ -43,7 +43,7 @@ public class Pattern extends AST { try { - return Native.patternToString(Context().nCtx(), NativeObject()); + return Native.patternToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); diff --git a/src/api/java/Probe.java b/src/api/java/Probe.java index 80ac55b70..b68b0266f 100644 --- a/src/api/java/Probe.java +++ b/src/api/java/Probe.java @@ -23,20 +23,11 @@ public class Probe extends Z3Object * 0.0 for false, and a value different from 0.0 for true. * @throws Z3Exception **/ - public double Apply(Goal g) 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); + getContext().checkContextMatch(g); + return Native.probeApply(getContext().nCtx(), getNativeObject(), + g.getNativeObject()); } Probe(Context ctx, long obj) throws Z3Exception @@ -49,15 +40,15 @@ public class Probe extends Z3Object super(ctx, Native.mkProbe(ctx.nCtx(), name)); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Probe_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().probe_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Probe_DRQ().Add(o); - super.DecRef(o); + getContext().probe_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/ProbeDecRefQueue.java b/src/api/java/ProbeDecRefQueue.java index b368702df..0ae0b0e8e 100644 --- a/src/api/java/ProbeDecRefQueue.java +++ b/src/api/java/ProbeDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class ProbeDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class ProbeDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/Quantifier.java b/src/api/java/Quantifier.java index 6ee7e4412..78a0fc03f 100644 --- a/src/api/java/Quantifier.java +++ b/src/api/java/Quantifier.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_ast_kind; /** * Quantifier expressions. @@ -16,34 +16,34 @@ public class Quantifier extends BoolExpr /** * Indicates whether the quantifier is universal. **/ - public boolean IsUniversal() throws Z3Exception + public boolean isUniversal() throws Z3Exception { - return Native.isQuantifierForall(Context().nCtx(), NativeObject()); + return Native.isQuantifierForall(getContext().nCtx(), getNativeObject()); } /** * Indicates whether the quantifier is existential. **/ - public boolean IsExistential() throws Z3Exception + public boolean isExistential() throws Z3Exception { - return !IsUniversal(); + return !isUniversal(); } /** * The weight of the quantifier. **/ - public int Weight() throws Z3Exception + public int getWeight() throws Z3Exception { - return Native.getQuantifierWeight(Context().nCtx(), NativeObject()); + return Native.getQuantifierWeight(getContext().nCtx(), getNativeObject()); } /** * The number of patterns. **/ - public int NumPatterns() throws Z3Exception + public int getNumPatterns() throws Z3Exception { return Native - .getQuantifierNumPatterns(Context().nCtx(), NativeObject()); + .getQuantifierNumPatterns(getContext().nCtx(), getNativeObject()); } /** @@ -51,23 +51,23 @@ public class Quantifier extends BoolExpr * * @throws Z3Exception **/ - public Pattern[] Patterns() throws Z3Exception + public Pattern[] getPatterns() throws Z3Exception { - int n = NumPatterns(); + int n = getNumPatterns(); Pattern[] res = new Pattern[n]; for (int i = 0; i < n; i++) - res[i] = new Pattern(Context(), Native.getQuantifierPatternAst( - Context().nCtx(), NativeObject(), i)); + res[i] = new Pattern(getContext(), Native.getQuantifierPatternAst( + getContext().nCtx(), getNativeObject(), i)); return res; } /** * The number of no-patterns. **/ - public int NumNoPatterns() throws Z3Exception + public int getNumNoPatterns() throws Z3Exception { - return Native.getQuantifierNumNoPatterns(Context().nCtx(), - NativeObject()); + return Native.getQuantifierNumNoPatterns(getContext().nCtx(), + getNativeObject()); } /** @@ -75,22 +75,22 @@ public class Quantifier extends BoolExpr * * @throws Z3Exception **/ - public Pattern[] NoPatterns() throws Z3Exception + public Pattern[] getNoPatterns() throws Z3Exception { - int n = NumNoPatterns(); + int n = getNumNoPatterns(); Pattern[] res = new Pattern[n]; for (int i = 0; i < n; i++) - res[i] = new Pattern(Context(), Native.getQuantifierNoPatternAst( - Context().nCtx(), NativeObject(), i)); + res[i] = new Pattern(getContext(), Native.getQuantifierNoPatternAst( + getContext().nCtx(), getNativeObject(), i)); return res; } /** * The number of bound variables. **/ - public int NumBound() throws Z3Exception + public int getNumBound() throws Z3Exception { - return Native.getQuantifierNumBound(Context().nCtx(), NativeObject()); + return Native.getQuantifierNumBound(getContext().nCtx(), getNativeObject()); } /** @@ -98,13 +98,13 @@ public class Quantifier extends BoolExpr * * @throws Z3Exception **/ - public Symbol[] BoundVariableNames() throws Z3Exception + public Symbol[] getBoundVariableNames() throws Z3Exception { - int n = NumBound(); + int n = getNumBound(); Symbol[] res = new Symbol[n]; for (int i = 0; i < n; i++) - res[i] = Symbol.Create(Context(), Native.getQuantifierBoundName( - Context().nCtx(), NativeObject(), i)); + res[i] = Symbol.create(getContext(), Native.getQuantifierBoundName( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -113,13 +113,13 @@ public class Quantifier extends BoolExpr * * @throws Z3Exception **/ - public Sort[] BoundVariableSorts() throws Z3Exception + public Sort[] getBoundVariableSorts() throws Z3Exception { - int n = NumBound(); + int n = getNumBound(); Sort[] res = new Sort[n]; for (int i = 0; i < n; i++) - res[i] = Sort.Create(Context(), Native.getQuantifierBoundSort( - Context().nCtx(), NativeObject(), i)); + res[i] = Sort.create(getContext(), Native.getQuantifierBoundSort( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -128,10 +128,10 @@ public class Quantifier extends BoolExpr * * @throws Z3Exception **/ - public BoolExpr Body() throws Z3Exception + public BoolExpr getBody() throws Z3Exception { - return new BoolExpr(Context(), Native.getQuantifierBody(Context() - .nCtx(), NativeObject())); + return new BoolExpr(getContext(), Native.getQuantifierBody(getContext() + .nCtx(), getNativeObject())); } Quantifier(Context ctx, boolean isForall, Sort[] sorts, Symbol[] names, @@ -140,11 +140,11 @@ public class Quantifier extends BoolExpr { super(ctx); - Context().CheckContextMatch(patterns); - Context().CheckContextMatch(noPatterns); - Context().CheckContextMatch(sorts); - Context().CheckContextMatch(names); - Context().CheckContextMatch(body); + getContext().checkContextMatch(patterns); + getContext().checkContextMatch(noPatterns); + getContext().checkContextMatch(sorts); + getContext().checkContextMatch(names); + getContext().checkContextMatch(body); if (sorts.length != names.length) throw new Z3Exception( @@ -153,20 +153,20 @@ public class Quantifier extends BoolExpr 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())); + : false, weight, AST.arrayLength(patterns), AST + .arrayToNative(patterns), AST.arrayLength(sorts), AST + .arrayToNative(sorts), Symbol.arrayToNative(names), body + .getNativeObject())); } 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())); + (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.getNativeObject())); } } @@ -176,26 +176,26 @@ public class Quantifier extends BoolExpr { super(ctx); - Context().CheckContextMatch(noPatterns); - Context().CheckContextMatch(patterns); + getContext().checkContextMatch(noPatterns); + getContext().checkContextMatch(patterns); // Context().CheckContextMatch(bound); - Context().CheckContextMatch(body); + getContext().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())); + (isForall) ? true : false, weight, AST.arrayLength(bound), + AST.arrayToNative(bound), AST.arrayLength(patterns), + AST.arrayToNative(patterns), body.getNativeObject())); } 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())); + 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.getNativeObject())); } } @@ -204,11 +204,11 @@ public class Quantifier extends BoolExpr super(ctx, obj); } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST + if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_QUANTIFIER_AST .toInt()) throw new Z3Exception("Underlying object is not a quantifier"); - super.CheckNativeObject(obj); + super.checkNativeObject(obj); } } diff --git a/src/api/java/RatNum.java b/src/api/java/RatNum.java index bdc57fbdb..e1cb5b346 100644 --- a/src/api/java/RatNum.java +++ b/src/api/java/RatNum.java @@ -16,36 +16,36 @@ public class RatNum extends RealExpr /** * The numerator of a rational numeral. **/ - public IntNum Numerator() throws Z3Exception + public IntNum getNumerator() throws Z3Exception { - return new IntNum(Context(), Native.getNumerator(Context().nCtx(), - NativeObject())); + return new IntNum(getContext(), Native.getNumerator(getContext().nCtx(), + getNativeObject())); } /** * The denominator of a rational numeral. **/ - public IntNum Denominator() throws Z3Exception + public IntNum getDenominator() throws Z3Exception { - return new IntNum(Context(), Native.getDenominator(Context().nCtx(), - NativeObject())); + return new IntNum(getContext(), Native.getDenominator(getContext().nCtx(), + getNativeObject())); } /** * Converts the numerator of the rational to a BigInteger **/ - public BigInteger BigIntNumerator() throws Z3Exception + public BigInteger getBigIntNumerator() throws Z3Exception { - IntNum n = Numerator(); + IntNum n = getNumerator(); return new BigInteger(n.toString()); } /** * Converts the denominator of the rational to a BigInteger **/ - public BigInteger BigIntDenominator() throws Z3Exception + public BigInteger getBigIntDenominator() throws Z3Exception { - IntNum n = Denominator(); + IntNum n = getDenominator(); return new BigInteger(n.toString()); } @@ -53,9 +53,9 @@ public class RatNum extends RealExpr * Returns a string representation in decimal notation. The result * has at most decimal places. **/ - public String ToDecimalString(int precision) throws Z3Exception + public String toDecimalString(int precision) throws Z3Exception { - return Native.getNumeralDecimalString(Context().nCtx(), NativeObject(), + return Native.getNumeralDecimalString(getContext().nCtx(), getNativeObject(), precision); } @@ -66,7 +66,7 @@ public class RatNum extends RealExpr { try { - return Native.getNumeralString(Context().nCtx(), NativeObject()); + return Native.getNumeralString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); diff --git a/src/api/java/RelationSort.java b/src/api/java/RelationSort.java index 820228e82..bdc4d7804 100644 --- a/src/api/java/RelationSort.java +++ b/src/api/java/RelationSort.java @@ -14,26 +14,26 @@ public class RelationSort extends Sort /** * The arity of the relation sort. **/ - public int Arity() throws Z3Exception + public int getArity() throws Z3Exception { - return Native.getRelationArity(Context().nCtx(), NativeObject()); + return Native.getRelationArity(getContext().nCtx(), getNativeObject()); } /** * The sorts of the columns of the relation sort. * @throws Z3Exception **/ - public Sort[] ColumnSorts() throws Z3Exception + public Sort[] getColumnSorts() throws Z3Exception { if (m_columnSorts != null) return m_columnSorts; - int n = Arity(); + int n = getArity(); Sort[] res = new Sort[n]; for (int i = 0; i < n; i++) - res[i] = Sort.Create(Context(), Native.getRelationColumn(Context() - .nCtx(), NativeObject(), i)); + res[i] = Sort.create(getContext(), Native.getRelationColumn(getContext() + .nCtx(), getNativeObject(), i)); return res; } diff --git a/src/api/java/SetSort.java b/src/api/java/SetSort.java index ffeebfd3d..a94a34b26 100644 --- a/src/api/java/SetSort.java +++ b/src/api/java/SetSort.java @@ -18,6 +18,6 @@ public class SetSort extends Sort SetSort(Context ctx, Sort ty) throws Z3Exception { - super(ctx, Native.mkSetSort(ctx.nCtx(), ty.NativeObject())); + super(ctx, Native.mkSetSort(ctx.nCtx(), ty.getNativeObject())); } } diff --git a/src/api/java/Solver.java b/src/api/java/Solver.java index 278427d49..c60d3f88c 100644 --- a/src/api/java/Solver.java +++ b/src/api/java/Solver.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_lbool; /** * Solvers. @@ -16,9 +16,9 @@ public class Solver extends Z3Object /** * A string that describes all available solver parameters. **/ - public String Help() throws Z3Exception + public String getHelp() throws Z3Exception { - return Native.solverGetHelp(Context().nCtx(), NativeObject()); + return Native.solverGetHelp(getContext().nCtx(), getNativeObject()); } /** @@ -28,9 +28,9 @@ public class Solver extends Z3Object **/ public void setParameters(Params value) throws Z3Exception { - Context().CheckContextMatch(value); - Native.solverSetParams(Context().nCtx(), NativeObject(), - value.NativeObject()); + getContext().checkContextMatch(value); + Native.solverSetParams(getContext().nCtx(), getNativeObject(), + value.getNativeObject()); } /** @@ -38,35 +38,36 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public ParamDescrs ParameterDescriptions() throws Z3Exception + public ParamDescrs getParameterDescriptions() throws Z3Exception { - return new ParamDescrs(Context(), Native.solverGetParamDescrs(Context() - .nCtx(), NativeObject())); + return new ParamDescrs(getContext(), Native.solverGetParamDescrs( + getContext().nCtx(), getNativeObject())); } /** * The current number of backtracking points (scopes). * **/ - public int NumScopes() throws Z3Exception + public int getNumScopes() throws Z3Exception { - return Native.solverGetNumScopes(Context().nCtx(), NativeObject()); + return Native + .solverGetNumScopes(getContext().nCtx(), getNativeObject()); } /** * Creates a backtracking point. **/ - public void Push() throws Z3Exception + public void push() throws Z3Exception { - Native.solverPush(Context().nCtx(), NativeObject()); + Native.solverPush(getContext().nCtx(), getNativeObject()); } /** * Backtracks one backtracking point. . **/ - public void Pop() throws Z3Exception + public void pop() throws Z3Exception { - Pop(1); + pop(1); } /** @@ -74,18 +75,18 @@ public class Solver extends Z3Object * an exception is thrown if is not smaller than * NumScopes **/ - public void Pop(int n) throws Z3Exception + public void pop(int n) throws Z3Exception { - Native.solverPop(Context().nCtx(), NativeObject(), n); + Native.solverPop(getContext().nCtx(), getNativeObject(), n); } /** * Resets the Solver. This removes all assertions from the * solver. **/ - public void Reset() throws Z3Exception + public void reset() throws Z3Exception { - Native.solverReset(Context().nCtx(), NativeObject()); + Native.solverReset(getContext().nCtx(), getNativeObject()); } /** @@ -93,26 +94,62 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public void Assert(BoolExpr[] constraints) throws Z3Exception + public void assert_(BoolExpr... constraints) throws Z3Exception { - Context().CheckContextMatch(constraints); + getContext().checkContextMatch(constraints); for (BoolExpr a : constraints) { - Native.solverAssert(Context().nCtx(), NativeObject(), - a.NativeObject()); + Native.solverAssert(getContext().nCtx(), getNativeObject(), + a.getNativeObject()); } } - /** - * Assert one constraint into the solver. - * - * @throws Z3Exception - **/ - public void Assert(BoolExpr constraint) throws Z3Exception + // / + // / Assert multiple constraints into the solver, and track them (in the + // unsat) core + // / using the Boolean constants in ps. + // / + // / + // / This API is an alternative to with assumptions for + // extracting unsat cores. + // / Both APIs can be used in the same solver. The unsat core will contain a + // combination + // / of the Boolean variables provided using + // and the Boolean literals + // / provided using with assumptions. + // / + public void assertAndTrack(BoolExpr[] constraints, BoolExpr[] ps) throws Z3Exception { - Context().CheckContextMatch(constraint); - Native.solverAssert(Context().nCtx(), NativeObject(), - constraint.NativeObject()); + getContext().checkContextMatch(constraints); + getContext().checkContextMatch(ps); + if (constraints.length != ps.length) + throw new Z3Exception("Argument size mismatch"); + + for (int i = 0; i < constraints.length; i++) + Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(), + constraints[i].getNativeObject(), ps[i].getNativeObject()); + } + + // / + // / Assert a constraint into the solver, and track it (in the unsat) core + // / using the Boolean constant p. + // / + // / + // / This API is an alternative to with assumptions for + // extracting unsat cores. + // / Both APIs can be used in the same solver. The unsat core will contain a + // combination + // / of the Boolean variables provided using + // and the Boolean literals + // / provided using with assumptions. + // / + public void assertAndTrack(BoolExpr constraint, BoolExpr p) throws Z3Exception + { + getContext().checkContextMatch(constraint); + getContext().checkContextMatch(p); + + Native.solverAssertAndTrack(getContext().nCtx(), getNativeObject(), + constraint.getNativeObject(), p.getNativeObject()); } /** @@ -120,11 +157,11 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public int NumAssertions() throws Z3Exception + public int getNumAssertions() throws Z3Exception { - ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions( - Context().nCtx(), NativeObject())); - return ass.Size(); + ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions( + getContext().nCtx(), getNativeObject())); + return ass.size(); } /** @@ -132,14 +169,14 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public BoolExpr[] Assertions() throws Z3Exception + public BoolExpr[] getAssertions() throws Z3Exception { - ASTVector ass = new ASTVector(Context(), Native.solverGetAssertions( - Context().nCtx(), NativeObject())); - int n = ass.Size(); + ASTVector ass = new ASTVector(getContext(), Native.solverGetAssertions( + getContext().nCtx(), getNativeObject())); + 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()); + res[i] = new BoolExpr(getContext(), ass.get(i).getNativeObject()); return res; } @@ -148,16 +185,16 @@ public class Solver extends Z3Object * **/ - public Status Check(Expr[] assumptions) throws Z3Exception + public Status check(Expr... assumptions) throws Z3Exception { Z3_lbool r; if (assumptions == null) - r = Z3_lbool.fromInt(Native.solverCheck(Context().nCtx(), - NativeObject())); + r = Z3_lbool.fromInt(Native.solverCheck(getContext().nCtx(), + getNativeObject())); else - r = Z3_lbool.fromInt(Native.solverCheckAssumptions( - Context().nCtx(), NativeObject(), (int) assumptions.length, - AST.ArrayToNative(assumptions))); + r = Z3_lbool.fromInt(Native.solverCheckAssumptions(getContext() + .nCtx(), getNativeObject(), (int) assumptions.length, AST + .arrayToNative(assumptions))); switch (r) { case Z3_L_TRUE: @@ -174,9 +211,9 @@ public class Solver extends Z3Object * **/ - public Status Check() throws Z3Exception + public Status check() throws Z3Exception { - return Check(null); + return check((Expr[]) null); } /** @@ -187,13 +224,13 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public Model Model() throws Z3Exception + public Model getModel() throws Z3Exception { - long x = Native.solverGetModel(Context().nCtx(), NativeObject()); + long x = Native.solverGetModel(getContext().nCtx(), getNativeObject()); if (x == 0) return null; else - return new Model(Context(), x); + return new Model(getContext(), x); } /** @@ -204,13 +241,13 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public Expr Proof() throws Z3Exception + public Expr getProof() throws Z3Exception { - long x = Native.solverGetProof(Context().nCtx(), NativeObject()); + long x = Native.solverGetProof(getContext().nCtx(), getNativeObject()); if (x == 0) return null; else - return Expr.Create(Context(), x); + return Expr.create(getContext(), x); } /** @@ -221,15 +258,15 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public Expr[] UnsatCore() throws Z3Exception + public Expr[] getUnsatCore() throws Z3Exception { - ASTVector core = new ASTVector(Context(), Native.solverGetUnsatCore( - Context().nCtx(), NativeObject())); - int n = core.Size(); + ASTVector core = new ASTVector(getContext(), Native.solverGetUnsatCore( + getContext().nCtx(), getNativeObject())); + 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()); + res[i] = Expr.create(getContext(), core.get(i).getNativeObject()); return res; } @@ -237,9 +274,10 @@ public class Solver extends Z3Object * A brief justification of why the last call to Check returned * UNKNOWN. **/ - public String ReasonUnknown() throws Z3Exception + public String getReasonUnknown() throws Z3Exception { - return Native.solverGetReasonUnknown(Context().nCtx(), NativeObject()); + return Native.solverGetReasonUnknown(getContext().nCtx(), + getNativeObject()); } /** @@ -247,10 +285,10 @@ public class Solver extends Z3Object * * @throws Z3Exception **/ - public Statistics Statistics() throws Z3Exception + public Statistics getStatistics() throws Z3Exception { - return new Statistics(Context(), Native.solverGetStatistics(Context() - .nCtx(), NativeObject())); + return new Statistics(getContext(), Native.solverGetStatistics( + getContext().nCtx(), getNativeObject())); } /** @@ -260,7 +298,8 @@ public class Solver extends Z3Object { try { - return Native.solverToString(Context().nCtx(), NativeObject()); + return Native + .solverToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -272,15 +311,15 @@ public class Solver extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Solver_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().solver_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Solver_DRQ().Add(o); - super.DecRef(o); + getContext().solver_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/SolverDecRefQueue.java b/src/api/java/SolverDecRefQueue.java index 2696f6ecc..1c715716a 100644 --- a/src/api/java/SolverDecRefQueue.java +++ b/src/api/java/SolverDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class SolverDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class SolverDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/Sort.java b/src/api/java/Sort.java index fcf6b117a..58f7638ba 100644 --- a/src/api/java/Sort.java +++ b/src/api/java/Sort.java @@ -6,7 +6,8 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_ast_kind; +import com.microsoft.z3.enumerations.Z3_sort_kind; /** * The Sort class implements type information for ASTs. @@ -47,7 +48,7 @@ public class Sort extends AST return false; } - return this.NativeObject() == casted.NativeObject(); + return this.getNativeObject() == casted.getNativeObject(); } /** @@ -55,35 +56,35 @@ public class Sort extends AST * * @return A hash code **/ - public int GetHashCode() throws Z3Exception + public int hashCode() { - return super.GetHashCode(); + return super.hashCode(); } /** * Returns a unique identifier for the sort. **/ - public int Id() throws Z3Exception + public int getId() throws Z3Exception { - return Native.getSortId(Context().nCtx(), NativeObject()); + return Native.getSortId(getContext().nCtx(), getNativeObject()); } /** * The kind of the sort. **/ - public Z3_sort_kind SortKind() throws Z3Exception + public Z3_sort_kind getSortKind() throws Z3Exception { - return Z3_sort_kind.fromInt(Native.getSortKind(Context().nCtx(), - NativeObject())); + return Z3_sort_kind.fromInt(Native.getSortKind(getContext().nCtx(), + getNativeObject())); } /** * The name of the sort **/ - public Symbol Name() throws Z3Exception + public Symbol getName() throws Z3Exception { - return Symbol.Create(Context(), - Native.getSortName(Context().nCtx(), NativeObject())); + return Symbol.create(getContext(), + Native.getSortName(getContext().nCtx(), getNativeObject())); } /** @@ -93,7 +94,7 @@ public class Sort extends AST { try { - return Native.sortToString(Context().nCtx(), NativeObject()); + return Native.sortToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -117,15 +118,15 @@ public class Sort extends AST } } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.getAstKind(Context().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST + if (Native.getAstKind(getContext().nCtx(), obj) != Z3_ast_kind.Z3_SORT_AST .toInt()) throw new Z3Exception("Underlying object is not a sort"); - super.CheckNativeObject(obj); + super.checkNativeObject(obj); } - static Sort Create(Context ctx, long obj) throws Z3Exception + static Sort create(Context ctx, long obj) throws Z3Exception { switch (Z3_sort_kind.fromInt(Native.getSortKind(ctx.nCtx(), obj))) { diff --git a/src/api/java/Statistics.java b/src/api/java/Statistics.java index 3f6e31f96..c36020bd6 100644 --- a/src/api/java/Statistics.java +++ b/src/api/java/Statistics.java @@ -25,7 +25,7 @@ public class Statistics extends Z3Object /** * The uint-value of the entry. **/ - public int UIntValue() + public int getUIntValue() { return m_int; } @@ -33,7 +33,7 @@ public class Statistics extends Z3Object /** * The double-value of the entry. **/ - public double DoubleValue() + public double getDoubleValue() { return m_double; } @@ -41,7 +41,7 @@ public class Statistics extends Z3Object /** * True if the entry is uint-valued. **/ - public boolean IsUInt() + public boolean isUInt() { return m_is_int; } @@ -49,7 +49,7 @@ public class Statistics extends Z3Object /** * True if the entry is double-valued. **/ - public boolean IsDouble() + public boolean isDouble() { return m_is_double; } @@ -59,11 +59,11 @@ public class Statistics extends Z3Object * * @throws Z3Exception **/ - public String Value() throws Z3Exception + public String getValueString() throws Z3Exception { - if (IsUInt()) + if (isUInt()) return Integer.toString(m_int); - else if (IsDouble()) + else if (isDouble()) return Double.toString(m_double); else throw new Z3Exception("Unknown statistical entry type"); @@ -76,7 +76,7 @@ public class Statistics extends Z3Object { try { - return Key + ": " + Value(); + return Key + ": " + getValueString(); } catch (Z3Exception e) { return new String("Z3Exception: " + e.getMessage()); @@ -110,7 +110,7 @@ public class Statistics extends Z3Object { try { - return Native.statsToString(Context().nCtx(), NativeObject()); + return Native.statsToString(getContext().nCtx(), getNativeObject()); } catch (Z3Exception e) { return "Z3Exception: " + e.getMessage(); @@ -120,9 +120,9 @@ public class Statistics extends Z3Object /** * The number of statistical data. **/ - public int Size() throws Z3Exception + public int size() throws Z3Exception { - return Native.statsSize(Context().nCtx(), NativeObject()); + return Native.statsSize(getContext().nCtx(), getNativeObject()); } /** @@ -130,21 +130,21 @@ public class Statistics extends Z3Object * * @throws Z3Exception **/ - public Entry[] Entries() throws Z3Exception + public Entry[] getEntries() throws Z3Exception { - int n = Size(); + 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)); + String k = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i); + if (Native.statsIsUint(getContext().nCtx(), getNativeObject(), i)) + e = new Entry(k, Native.statsGetUintValue(getContext().nCtx(), + getNativeObject(), i)); + else if (Native.statsIsDouble(getContext().nCtx(), getNativeObject(), i)) + e = new Entry(k, Native.statsGetDoubleValue(getContext().nCtx(), + getNativeObject(), i)); else throw new Z3Exception("Unknown data entry value"); res[i] = e; @@ -155,12 +155,12 @@ public class Statistics extends Z3Object /** * The statistical counters. **/ - public String[] Keys() throws Z3Exception + public String[] getKeys() throws Z3Exception { - int n = Size(); + int n = size(); String[] res = new String[n]; for (int i = 0; i < n; i++) - res[i] = Native.statsGetKey(Context().nCtx(), NativeObject(), i); + res[i] = Native.statsGetKey(getContext().nCtx(), getNativeObject(), i); return res; } @@ -172,8 +172,8 @@ public class Statistics extends Z3Object **/ public Entry get(String key) throws Z3Exception { - int n = Size(); - Entry[] es = Entries(); + int n = size(); + Entry[] es = getEntries(); for (int i = 0; i < n; i++) if (es[i].Key == key) return es[i]; @@ -185,15 +185,15 @@ public class Statistics extends Z3Object super(ctx, obj); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Statistics_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().statistics_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Statistics_DRQ().Add(o); - super.DecRef(o); + getContext().statistics_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/StatisticsDecRefQueue.java b/src/api/java/StatisticsDecRefQueue.java index 907cf8760..d16bf3710 100644 --- a/src/api/java/StatisticsDecRefQueue.java +++ b/src/api/java/StatisticsDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class StatisticsDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class StatisticsDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/StringSymbol.java b/src/api/java/StringSymbol.java index 81ada78a4..951051aa0 100644 --- a/src/api/java/StringSymbol.java +++ b/src/api/java/StringSymbol.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_symbol_kind; /** * Named symbols @@ -17,9 +17,9 @@ public class StringSymbol extends Symbol * The string value of the symbol. Throws an exception if the * symbol is not of string kind. **/ - public String String() throws Z3Exception + public String getString() throws Z3Exception { - return Native.getSymbolString(Context().nCtx(), NativeObject()); + return Native.getSymbolString(getContext().nCtx(), getNativeObject()); } StringSymbol(Context ctx, long obj) throws Z3Exception @@ -32,12 +32,12 @@ public class StringSymbol extends Symbol super(ctx, Native.mkStringSymbol(ctx.nCtx(), s)); } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { - if (Native.getSymbolKind(Context().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL + if (Native.getSymbolKind(getContext().nCtx(), obj) != Z3_symbol_kind.Z3_STRING_SYMBOL .toInt()) throw new Z3Exception("Symbol is not of String kind"); - super.CheckNativeObject(obj); + super.checkNativeObject(obj); } } diff --git a/src/api/java/Symbol.java b/src/api/java/Symbol.java index cd987adf2..177409ec8 100644 --- a/src/api/java/Symbol.java +++ b/src/api/java/Symbol.java @@ -6,7 +6,7 @@ package com.microsoft.z3; -import com.microsoft.z3.enumerations.*; +import com.microsoft.z3.enumerations.Z3_symbol_kind; /** * Symbols are used to name several term and type constructors. @@ -16,26 +16,26 @@ public class Symbol extends Z3Object /** * The kind of the symbol (int or string) **/ - protected Z3_symbol_kind Kind() throws Z3Exception + protected Z3_symbol_kind getKind() throws Z3Exception { - return Z3_symbol_kind.fromInt(Native.getSymbolKind(Context().nCtx(), - NativeObject())); + return Z3_symbol_kind.fromInt(Native.getSymbolKind(getContext().nCtx(), + getNativeObject())); } /** * Indicates whether the symbol is of Int kind **/ - public boolean IsIntSymbol() throws Z3Exception + public boolean isIntSymbol() throws Z3Exception { - return Kind() == Z3_symbol_kind.Z3_INT_SYMBOL; + return getKind() == Z3_symbol_kind.Z3_INT_SYMBOL; } /** * Indicates whether the symbol is of string kind. **/ - public boolean IsStringSymbol() throws Z3Exception + public boolean isStringSymbol() throws Z3Exception { - return Kind() == Z3_symbol_kind.Z3_STRING_SYMBOL; + return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL; } /** @@ -45,10 +45,10 @@ public class Symbol extends Z3Object { try { - if (IsIntSymbol()) - return Integer.toString(((IntSymbol) this).Int()); - else if (IsStringSymbol()) - return ((StringSymbol) this).String(); + if (isIntSymbol()) + return Integer.toString(((IntSymbol) this).getInt()); + else if (isStringSymbol()) + return ((StringSymbol) this).getString(); else return new String( "Z3Exception: Unknown symbol kind encountered."); @@ -66,7 +66,7 @@ public class Symbol extends Z3Object super(ctx, obj); } - static Symbol Create(Context ctx, long obj) throws Z3Exception + static Symbol create(Context ctx, long obj) throws Z3Exception { switch (Z3_symbol_kind.fromInt(Native.getSymbolKind(ctx.nCtx(), obj))) { diff --git a/src/api/java/Tactic.java b/src/api/java/Tactic.java index 124db0ef2..e62096715 100644 --- a/src/api/java/Tactic.java +++ b/src/api/java/Tactic.java @@ -18,69 +18,57 @@ public class Tactic extends Z3Object /** * A string containing a description of parameters accepted by the tactic. **/ - public String Help() throws Z3Exception + public String getHelp() throws Z3Exception { - return Native.tacticGetHelp(Context().nCtx(), NativeObject()); + return Native.tacticGetHelp(getContext().nCtx(), getNativeObject()); } /** * Retrieves parameter descriptions for Tactics. * @throws Z3Exception **/ - public ParamDescrs ParameterDescriptions() throws Z3Exception + public ParamDescrs getParameterDescriptions() throws Z3Exception { - return new ParamDescrs(Context(), Native.tacticGetParamDescrs(Context() - .nCtx(), NativeObject())); + return new ParamDescrs(getContext(), Native.tacticGetParamDescrs(getContext() + .nCtx(), getNativeObject())); } /** * Execute the tactic over the goal. * @throws Z3Exception **/ - public ApplyResult Apply(Goal g) throws Z3Exception + public ApplyResult apply(Goal g) throws Z3Exception { - return Apply(g, null); + return apply(g, null); } /** * Execute the tactic over the goal. * @throws Z3Exception **/ - public ApplyResult Apply(Goal g, Params p) throws Z3Exception + public ApplyResult apply(Goal g, Params p) throws Z3Exception { - - Context().CheckContextMatch(g); + getContext().checkContextMatch(g); if (p == null) - return new ApplyResult(Context(), Native.tacticApply(Context() - .nCtx(), NativeObject(), g.NativeObject())); + return new ApplyResult(getContext(), Native.tacticApply(getContext() + .nCtx(), getNativeObject(), g.getNativeObject())); else { - Context().CheckContextMatch(p); - return new ApplyResult(Context(), - Native.tacticApplyEx(Context().nCtx(), NativeObject(), - g.NativeObject(), p.NativeObject())); + getContext().checkContextMatch(p); + return new ApplyResult(getContext(), + Native.tacticApplyEx(getContext().nCtx(), getNativeObject(), + g.getNativeObject(), p.getNativeObject())); } } - /** - * 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. * @throws Z3Exception **/ - public Solver Solver() throws Z3Exception + public Solver getSolver() throws Z3Exception { - - return Context().MkSolver(this); + return getContext().mkSolver(this); } Tactic(Context ctx, long obj) throws Z3Exception @@ -93,15 +81,15 @@ public class Tactic extends Z3Object super(ctx, Native.mkTactic(ctx.nCtx(), name)); } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { - Context().Tactic_DRQ().IncAndClear(Context(), o); - super.IncRef(o); + getContext().tactic_DRQ().incAndClear(getContext(), o); + super.incRef(o); } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { - Context().Tactic_DRQ().Add(o); - super.DecRef(o); + getContext().tactic_DRQ().add(o); + super.decRef(o); } } diff --git a/src/api/java/TacticDecRefQueue.java b/src/api/java/TacticDecRefQueue.java index c2ea2c079..50fba156e 100644 --- a/src/api/java/TacticDecRefQueue.java +++ b/src/api/java/TacticDecRefQueue.java @@ -7,7 +7,7 @@ package com.microsoft.z3; class TacticDecRefQueue extends IDecRefQueue { - public void IncRef(Context ctx, long obj) + protected void incRef(Context ctx, long obj) { try { @@ -18,7 +18,7 @@ class TacticDecRefQueue extends IDecRefQueue } } - public void DecRef(Context ctx, long obj) + protected void decRef(Context ctx, long obj) { try { diff --git a/src/api/java/TupleSort.java b/src/api/java/TupleSort.java index 3eb28b88e..554581d0f 100644 --- a/src/api/java/TupleSort.java +++ b/src/api/java/TupleSort.java @@ -15,33 +15,33 @@ public class TupleSort extends Sort * The constructor function of the tuple. * @throws Z3Exception **/ - public FuncDecl MkDecl() throws Z3Exception + public FuncDecl mkDecl() throws Z3Exception { - return new FuncDecl(Context(), Native.getTupleSortMkDecl(Context() - .nCtx(), NativeObject())); + return new FuncDecl(getContext(), Native.getTupleSortMkDecl(getContext() + .nCtx(), getNativeObject())); } /** * The number of fields in the tuple. **/ - public int NumFields() throws Z3Exception + public int getNumFields() throws Z3Exception { - return Native.getTupleSortNumFields(Context().nCtx(), NativeObject()); + return Native.getTupleSortNumFields(getContext().nCtx(), getNativeObject()); } /** * The field declarations. * @throws Z3Exception **/ - public FuncDecl[] FieldDecls() throws Z3Exception + public FuncDecl[] getFieldDecls() throws Z3Exception { - int n = NumFields(); + int n = getNumFields(); FuncDecl[] res = new FuncDecl[n]; for (int i = 0; i < n; i++) - res[i] = new FuncDecl(Context(), Native.getTupleSortFieldDecl( - Context().nCtx(), NativeObject(), i)); + res[i] = new FuncDecl(getContext(), Native.getTupleSortFieldDecl( + getContext().nCtx(), getNativeObject(), i)); return res; } @@ -51,8 +51,8 @@ public class TupleSort extends Sort 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])); + setNativeObject(Native.mkTupleSort(ctx.nCtx(), name.getNativeObject(), + numFields, Symbol.arrayToNative(fieldNames), + AST.arrayToNative(fieldSorts), t, new long[numFields])); } }; diff --git a/src/api/java/UninterpretedSort.java b/src/api/java/UninterpretedSort.java index bc062cb50..51df17543 100644 --- a/src/api/java/UninterpretedSort.java +++ b/src/api/java/UninterpretedSort.java @@ -18,6 +18,6 @@ public class UninterpretedSort extends Sort UninterpretedSort(Context ctx, Symbol s) throws Z3Exception { - super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.NativeObject())); + super(ctx, Native.mkUninterpretedSort(ctx.nCtx(), s.getNativeObject())); } } diff --git a/src/api/java/Version.java b/src/api/java/Version.java index af5da39de..b96fb50f9 100644 --- a/src/api/java/Version.java +++ b/src/api/java/Version.java @@ -14,7 +14,7 @@ public class Version /** * The major version **/ - public static int Major() + public static int getMajor() { Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.getVersion(major, minor, build, revision); @@ -24,7 +24,7 @@ public class Version /** * The minor version **/ - public static int Minor() + public static int getMinor() { Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.getVersion(major, minor, build, revision); @@ -34,7 +34,7 @@ public class Version /** * The build version **/ - public static int Build() + public static int getBuild() { Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.getVersion(major, minor, build, revision); @@ -44,7 +44,7 @@ public class Version /** * The revision **/ - public static int Revision() + public static int getRevision() { Native.IntPtr major = new Native.IntPtr(), minor = new Native.IntPtr(), build = new Native.IntPtr(), revision = new Native.IntPtr(); Native.getVersion(major, minor, build, revision); diff --git a/src/api/java/Z3Exception.java b/src/api/java/Z3Exception.java index ae7046c90..24dc586d4 100644 --- a/src/api/java/Z3Exception.java +++ b/src/api/java/Z3Exception.java @@ -6,7 +6,6 @@ package com.microsoft.z3; -import java.lang.Exception; /** * The exception base class for error reporting from Z3 diff --git a/src/api/java/Z3Object.java b/src/api/java/Z3Object.java index 8aeb03ddf..6c2c11e25 100644 --- a/src/api/java/Z3Object.java +++ b/src/api/java/Z3Object.java @@ -17,17 +17,17 @@ public class Z3Object extends IDisposable **/ protected void finalize() throws Z3Exception { - Dispose(); + dispose(); } /** * Disposes of the underlying native Z3 object. **/ - public void Dispose() throws Z3Exception + public void dispose() throws Z3Exception { if (m_n_obj != 0) { - DecRef(m_n_obj); + decRef(m_n_obj); m_n_obj = 0; } @@ -51,23 +51,23 @@ public class Z3Object extends IDisposable { ctx.m_refCount++; m_ctx = ctx; - IncRef(obj); + incRef(obj); m_n_obj = obj; } - void IncRef(long o) throws Z3Exception + void incRef(long o) throws Z3Exception { } - void DecRef(long o) throws Z3Exception + void decRef(long o) throws Z3Exception { } - void CheckNativeObject(long obj) throws Z3Exception + void checkNativeObject(long obj) throws Z3Exception { } - long NativeObject() + long getNativeObject() { return m_n_obj; } @@ -76,39 +76,39 @@ public class Z3Object extends IDisposable { if (value != 0) { - CheckNativeObject(value); - IncRef(value); + checkNativeObject(value); + incRef(value); } if (m_n_obj != 0) { - DecRef(m_n_obj); + decRef(m_n_obj); } m_n_obj = value; } - static long GetNativeObject(Z3Object s) + static long getNativeObject(Z3Object s) { if (s == null) return 0; - return s.NativeObject(); + return s.getNativeObject(); } - Context Context() + Context getContext() { return m_ctx; } - static long[] ArrayToNative(Z3Object[] a) + static long[] arrayToNative(Z3Object[] a) { if (a == null) return null; long[] an = new long[a.length]; for (int i = 0; i < a.length; i++) - an[i] = (a[i] == null) ? 0 : a[i].NativeObject(); + an[i] = (a[i] == null) ? 0 : a[i].getNativeObject(); return an; } - static int ArrayLength(Z3Object[] a) + static int arrayLength(Z3Object[] a) { return (a == null) ? 0 : a.length; }