MCPcopy Create free account
hub / github.com/Z3Prover/z3 / logicExample

Method logicExample

examples/java/JavaExample.java:1076–1104  ·  view source on GitHub ↗
(Context ctx)

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls 15

appendMethod · 0.95
addMethod · 0.95
checkMethod · 0.95
addMethod · 0.95
applyMethod · 0.95
getNumSubgoalsMethod · 0.95
getSubgoalsMethod · 0.95
mkBitVecSortMethod · 0.80
mkConstMethod · 0.80
mkEqMethod · 0.80
mkSolverMethod · 0.80
mkGoalMethod · 0.80

Tested by

no test coverage detected