AndThen() публичный Метод

Create a tactic that applies t1 to a Goal and then t2 to every subgoal produced by t1.
public AndThen ( Microsoft.Z3.Tactic t1, Microsoft.Z3.Tactic t2 ) : Microsoft.Z3.Tactic
t1 Microsoft.Z3.Tactic
t2 Microsoft.Z3.Tactic
Результат Microsoft.Z3.Tactic
Пример #1
0
    public void Run()
    {
        Dictionary<string, string> cfg = new Dictionary<string, string>() {
            { "AUTO_CONFIG", "true" } };

        using (Context ctx = new Context(cfg))
        {
            RealExpr x = ctx.MkRealConst("x");
            RealExpr y = ctx.MkRealConst("y");

            RatNum zero = ctx.MkReal(0);
            RatNum two = ctx.MkReal(2);

            Goal g = ctx.MkGoal();
            g.Assert(ctx.MkGt(x, zero));
            g.Assert(ctx.MkGt(y, zero));
            g.Assert(ctx.MkEq(x, ctx.MkAdd(y, two)));
            Console.WriteLine(g);

            Tactic t1 = ctx.MkTactic("simplify");
            Tactic t2 = ctx.MkTactic("solve-eqs");
            Tactic t = ctx.AndThen(t1, t2);

            Console.WriteLine(t[g]);
        }
    }
Пример #2
0
        static void ModelConverterTest(Context ctx)
        {
            Console.WriteLine("ModelConverterTest");

            ArithExpr xr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("x"), ctx.MkRealSort());
            ArithExpr yr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("y"), ctx.MkRealSort());
            Goal g4 = ctx.MkGoal(true);
            g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
            g4.Assert(ctx.MkEq(yr, ctx.MkAdd(xr, ctx.MkReal(1, 1))));
            g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1)));

            ApplyResult ar = ApplyTactic(ctx, ctx.MkTactic("simplify"), g4);
            if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
                throw new TestFailedException();

            ar = ApplyTactic(ctx, ctx.AndThen(ctx.MkTactic("simplify"), ctx.MkTactic("solve-eqs")), g4);
            if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
                throw new TestFailedException();

            Solver s = ctx.MkSolver();
            foreach (BoolExpr e in ar.Subgoals[0].Formulas)
                s.Assert(e);
            Status q = s.Check();
            Console.WriteLine("Solver says: " + q);
            Console.WriteLine("Model: \n" + s.Model);
            Console.WriteLine("Converted Model: \n" + ar.ConvertModel(0, s.Model));
            if (q != Status.SATISFIABLE)
                throw new TestFailedException();
        }