Shows how to use Solver(logic)
(Context ctx)
| 1021 | /// </summary> |
| 1022 | /// <param name="ctx"></param> |
| 1023 | static void LogicExample(Context ctx) |
| 1024 | { |
| 1025 | Console.WriteLine("LogicTest"); |
| 1026 | |
| 1027 | Microsoft.Z3.Global.ToggleWarningMessages(true); |
| 1028 | |
| 1029 | BitVecSort bvs = ctx.MkBitVecSort(32); |
| 1030 | Expr x = ctx.MkConst("x", bvs); |
| 1031 | Expr y = ctx.MkConst("y", bvs); |
| 1032 | BoolExpr eq = ctx.MkEq(x, y); |
| 1033 | |
| 1034 | // Use a solver for QF_BV |
| 1035 | Solver s = ctx.MkSolver("QF_BV"); |
| 1036 | s.Assert(eq); |
| 1037 | Status res = s.Check(); |
| 1038 | Console.WriteLine("solver result: " + res); |
| 1039 | |
| 1040 | |
| 1041 | // Or perhaps a tactic for QF_BV |
| 1042 | Goal g = ctx.MkGoal(true); |
| 1043 | g.Assert(eq); |
| 1044 | |
| 1045 | Tactic t = ctx.MkTactic("qfbv"); |
| 1046 | ApplyResult ar = t.Apply(g); |
| 1047 | Console.WriteLine("tactic result: " + ar); |
| 1048 | |
| 1049 | if (ar.NumSubgoals != 1 || !ar.Subgoals[0].IsDecidedSat) |
| 1050 | throw new TestFailedException(); |
| 1051 | } |
| 1052 | |
| 1053 | /// <summary> |
| 1054 | /// Demonstrates how to use the ParOr tactic. |
nothing calls this directly
no test coverage detected