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

Method logicExample

examples/java/JavaGenericExample.java:868–896  ·  view source on GitHub ↗
(Context ctx)

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls 15

appendMethod · 0.95
ToggleWarningMessagesMethod · 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

Tested by

no test coverage detected