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

MkInt2Real() public méthode

Coerce an integer to a real.
There is also a converse operation exposed. It follows the semantics prescribed by the SMT-LIB standard. You can take the floor of a real by creating an auxiliary integer Term k and and asserting MakeInt2Real(k) <= t1 < MkInt2Real(k)+1. The argument must be of integer sort.
public MkInt2Real ( IntExpr t ) : RealExpr
t IntExpr
Résultat RealExpr
        public RealExpr MkInt2Real(IntExpr t)
        {
            Contract.Requires(t != null);
            Contract.Ensures(Contract.Result<RealExpr>() != null);

            CheckContextMatch(t);
            return new RealExpr(this, Native.Z3_mk_int2real(nCtx, t.NativeObject));
        }

Usage Example

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

        using (Context ctx = new Context(cfg))
        {
            IntExpr x = ctx.MkIntConst("x");
            FuncDecl x_d = x.FuncDecl;

            Console.WriteLine("is_expr(x_d): " + x_d.IsExpr);
            Console.WriteLine("is_func_decl(x_d): " + x_d.IsFuncDecl);
            Console.WriteLine("x_d.Name: " + x_d.Name);
            Console.WriteLine("x_d.Range: " + x_d.Range);
            Console.WriteLine("x_d.Arity: " + x_d.Arity);
            Console.WriteLine("x_d() == x: " + (x_d.Apply() == x));

            FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { ctx.IntSort, ctx.RealSort }, ctx.BoolSort);

            Console.WriteLine("f.Name: " + f.Name);
            Console.WriteLine("f.Range: " + f.Range);
            Console.WriteLine("f.Arity: " + f.Arity);

            for (uint i = 0; i < f.Arity; i++)
                Console.WriteLine("domain(" + i + "): " + f.Domain[i]);

            Console.WriteLine(f[x, ctx.MkInt2Real(x)]);
            Console.WriteLine(f[x, ctx.MkInt2Real(x)].FuncDecl == f);
        }
    }
All Usage Examples Of Microsoft.Z3.Context::MkInt2Real
Context