MkProbe() public method

Creates a new Probe.
public MkProbe ( string name ) : Probe
name string
return Probe
Esempio n. 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");
            RealExpr z = ctx.MkRealConst("z");
            RatNum zero = ctx.MkReal(0);
            RatNum two = ctx.MkReal(2);

            Goal g = ctx.MkGoal();

            g.Assert(ctx.MkGe(ctx.MkSub(ctx.MkPower(x, two), ctx.MkPower(y, two)), zero));

            Probe p = ctx.MkProbe("num-consts");
            Probe p2 = ctx.Gt(p, ctx.Const(2));
            Tactic t = ctx.Cond(p2, ctx.MkTactic("simplify"), ctx.MkTactic("factor"));

            Console.WriteLine(t[g]);

            g = ctx.MkGoal();
            g.Assert(ctx.MkGe(ctx.MkAdd(x, x, y, z), zero));
            g.Assert(ctx.MkGe(ctx.MkSub(ctx.MkPower(x, two), ctx.MkPower(y, two)), zero));

            Console.WriteLine(t[g]);
        }
    }
Esempio n. 2
0
    public void Run()
    {
        using (Context ctx = new Context())
        {
            RealExpr x = ctx.MkRealConst("x");
            RealExpr y = ctx.MkRealConst("y");

            Goal g = ctx.MkGoal();
            g.Assert(ctx.MkGt(x, ctx.MkReal(10)), ctx.MkEq(y, ctx.MkAdd(x, ctx.MkReal(1))));
            g.Assert(ctx.MkGt(y, ctx.MkReal(1)));

            Console.WriteLine(ctx.MkProbe("num-consts").Apply(g));
            Console.WriteLine(ctx.MkProbe("size").Apply(g));
            Console.WriteLine(ctx.MkProbe("num-exprs").Apply(g));
        }
    }
Esempio n. 3
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");
            RealExpr z = ctx.MkRealConst("z");

            Goal g = ctx.MkGoal();
            g.Assert(ctx.MkGt(ctx.MkAdd(x, y, z), ctx.MkReal(0)));

            Probe p = ctx.MkProbe("num-consts");
            Console.WriteLine("num-consts: " + p.Apply(g));

            Tactic t = ctx.FailIf(ctx.Gt(p, ctx.Const(2)));

            try
            {
                t.Apply(g);
            }
            catch (Z3Exception ex)
            {
                Console.WriteLine("Tactic failed: " + ex.Message);
            }

            Console.WriteLine("trying again...");

            g = ctx.MkGoal();
            g.Assert(ctx.MkGt(ctx.MkAdd(x, y), ctx.MkReal(0)));

            Console.WriteLine(t[g]);

        }
    }
Esempio n. 4
0
 public Probe Probe(string name)
 => Context.MkProbe(name);