(Context ctx)
| 866 | |
| 867 | // / @param ctx |
| 868 | void logicExample(Context ctx) throws TestFailedException |
| 869 | { |
| 870 | System.out.println("LogicTest"); |
| 871 | Log.append("LogicTest"); |
| 872 | |
| 873 | Global.ToggleWarningMessages(true); |
| 874 | |
| 875 | BitVecSort bvs = ctx.mkBitVecSort(32); |
| 876 | Expr<BitVecSort> x = ctx.mkConst("x", bvs); |
| 877 | Expr<BitVecSort> y = ctx.mkConst("y", bvs); |
| 878 | BoolExpr eq = ctx.mkEq(x, y); |
| 879 | |
| 880 | // Use a solver for QF_BV |
| 881 | Solver s = ctx.mkSolver("QF_BV"); |
| 882 | s.add(eq); |
| 883 | Status res = s.check(); |
| 884 | System.out.printf("solver result: %s%n", res); |
| 885 | |
| 886 | // Or perhaps a tactic for QF_BV |
| 887 | Goal g = ctx.mkGoal(true, false, false); |
| 888 | g.add(eq); |
| 889 | |
| 890 | Tactic t = ctx.mkTactic("qfbv"); |
| 891 | ApplyResult ar = t.apply(g); |
| 892 | System.out.printf("tactic result: %s%n", ar); |
| 893 | |
| 894 | if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) |
| 895 | throw new TestFailedException(); |
| 896 | } |
| 897 | |
| 898 | // / Demonstrates how to use the ParOr tactic. |
| 899 |
no test coverage detected