(Context ctx)
| 1074 | |
| 1075 | // / @param ctx |
| 1076 | void logicExample(Context ctx) throws TestFailedException |
| 1077 | { |
| 1078 | System.out.println("LogicTest"); |
| 1079 | Log.append("LogicTest"); |
| 1080 | |
| 1081 | com.microsoft.z3.Global.ToggleWarningMessages(true); |
| 1082 | |
| 1083 | BitVecSort bvs = ctx.mkBitVecSort(32); |
| 1084 | Expr x = ctx.mkConst("x", bvs); |
| 1085 | Expr y = ctx.mkConst("y", bvs); |
| 1086 | BoolExpr eq = ctx.mkEq(x, y); |
| 1087 | |
| 1088 | // Use a solver for QF_BV |
| 1089 | Solver s = ctx.mkSolver("QF_BV"); |
| 1090 | s.add(eq); |
| 1091 | Status res = s.check(); |
| 1092 | System.out.println("solver result: " + res); |
| 1093 | |
| 1094 | // Or perhaps a tactic for QF_BV |
| 1095 | Goal g = ctx.mkGoal(true, false, false); |
| 1096 | g.add(eq); |
| 1097 | |
| 1098 | Tactic t = ctx.mkTactic("qfbv"); |
| 1099 | ApplyResult ar = t.apply(g); |
| 1100 | System.out.println("tactic result: " + ar); |
| 1101 | |
| 1102 | if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) |
| 1103 | throw new TestFailedException(); |
| 1104 | } |
| 1105 | |
| 1106 | // / Demonstrates how to use the ParOr tactic. |
| 1107 |
no test coverage detected