Microsoft.Z3.Context.MkPower C# (CSharp) Méthode

MkPower() public méthode

Create an expression representing t1 ^ t2.
public MkPower ( ArithExpr t1, ArithExpr t2 ) : ArithExpr
t1 ArithExpr
t2 ArithExpr
Résultat ArithExpr
        public ArithExpr MkPower(ArithExpr t1, ArithExpr t2)
        {
            Contract.Requires(t1 != null);
            Contract.Requires(t2 != null);
            Contract.Ensures(Contract.Result<ArithExpr>() != null);

            CheckContextMatch(t1);
            CheckContextMatch(t2);
            return (ArithExpr)Expr.Create(this, Native.Z3_mk_power(nCtx, t1.NativeObject, t2.NativeObject));
        }

Usage Example

Exemple #1
0
    public void Run()
    {
        Dictionary<string, string> cfg = new Dictionary<string, string>() {
            { "AUTO_CONFIG", "true" },
            { "MODEL", "true" } };

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

            Solver s = ctx.MkSolver();
            s.Assert(ctx.MkAnd(ctx.MkEq(ctx.MkAdd(x, ctx.MkReal("10000000000000000000000")), y),
                               ctx.MkGt(y, ctx.MkReal("20000000000000000"))));
            s.Check();

            Console.WriteLine(s.Model);

            Expr q = ctx.MkAdd(ctx.MkPower(ctx.MkReal(2), ctx.MkReal(1, 2)),
                                        ctx.MkPower(ctx.MkReal(3), ctx.MkReal(1, 2)));

            Console.WriteLine(q);

            AlgebraicNum an = (AlgebraicNum)q.Simplify();

            Console.WriteLine(an);

            Console.WriteLine("[" + an.ToLower(10) + "," + an.ToUpper(10) + "]");
            Console.WriteLine(an.ToDecimal(10));
        }
    }
All Usage Examples Of Microsoft.Z3.Context::MkPower
Context