Inheritance: Z3Object
Esempio n. 1
0
        /// <summary>
        /// Returns a simplified version of the expression.
        /// </summary>
        /// <param name="p">A set of parameters to configure the simplifier</param>
        /// <seealso cref="Context.SimplifyHelp"/>
        public Expr Simplify(Params p = null)
        {
            Contract.Ensures(Contract.Result<Expr>() != null);

            if (p == null)
                return Expr.Create(Context, Native.Z3_simplify(Context.nCtx, NativeObject));
            else
                return Expr.Create(Context, Native.Z3_simplify_ex(Context.nCtx, NativeObject, p.NativeObject));
        }
Esempio n. 2
0
        /// <summary> 
        /// Computes an interpolant.
        /// </summary>    
        /// <remarks>For more information on interpolation please refer
        /// too the function Z3_get_interpolant in the C/C++ API, which is 
        /// well documented.</remarks>
        public BoolExpr[] GetInterpolant(Expr pf, Expr pat, Params p)
        {
            Contract.Requires(pf != null);
            Contract.Requires(pat != null);
            Contract.Requires(p != null);
            Contract.Ensures(Contract.Result<Expr>() != null);

            CheckContextMatch(pf);
            CheckContextMatch(pat);
            CheckContextMatch(p);

            ASTVector seq = new ASTVector(this, Native.Z3_get_interpolant(nCtx, pf.NativeObject, pat.NativeObject, p.NativeObject));
            return seq.ToBoolExprArray();
        }
Esempio n. 3
0
        /// <summary>
        /// Execute the tactic over the goal. 
        /// </summary>
        public ApplyResult Apply(Goal g, Params p = null)
        {
            Contract.Requires(g != null);
            Contract.Ensures(Contract.Result<ApplyResult>() != null);

            Context.CheckContextMatch(g);
            if (p == null)
                return new ApplyResult(Context, Native.Z3_tactic_apply(Context.nCtx, NativeObject, g.NativeObject));
            else
            {
                Context.CheckContextMatch(p);
                return new ApplyResult(Context, Native.Z3_tactic_apply_ex(Context.nCtx, NativeObject, g.NativeObject, p.NativeObject));
            }
        }
Esempio n. 4
0
        /// <summary> 
        /// Computes an interpolant.
        /// </summary>    
        /// <remarks>For more information on interpolation please refer
        /// too the function Z3_compute_interpolant in the C/C++ API, which is 
        /// well documented.</remarks>
        public Z3_lbool ComputeInterpolant(Expr pat, Params p, out BoolExpr[] interp, out Model model)
        {
            Contract.Requires(pat != null);
            Contract.Requires(p != null);
            Contract.Ensures(Contract.ValueAtReturn(out interp) != null);
            Contract.Ensures(Contract.ValueAtReturn(out model) != null);

            CheckContextMatch(pat);
            CheckContextMatch(p);

            IntPtr i = IntPtr.Zero, m = IntPtr.Zero;
            int r = Native.Z3_compute_interpolant(nCtx, pat.NativeObject, p.NativeObject, ref i, ref m);
            interp = new ASTVector(this, i).ToBoolExprArray();
            model = new Model(this, m);
            return (Z3_lbool)r;
        }
        /// <summary> 
        /// Computes an interpolant.
        /// </summary>    
        /// <remarks>For more information on interpolation please refer
        /// too the function Z3_get_interpolant in the C/C++ API, which is 
        /// well documented.</remarks>
        Expr[] GetInterpolant(Expr pf, Expr pat, Params p)
        {
            Contract.Requires(pf != null);
            Contract.Requires(pat != null);
            Contract.Requires(p != null);
            Contract.Ensures(Contract.Result<Expr>() != null);

            CheckContextMatch(pf);
            CheckContextMatch(pat);
            CheckContextMatch(p);

            ASTVector seq = new ASTVector(this, Native.Z3_get_interpolant(nCtx, pf.NativeObject, pat.NativeObject, p.NativeObject));
            uint n = seq.Size;
            Expr[] res = new Expr[n];
            for (uint i = 0; i < n; i++)
                res[i] = Expr.Create(this, seq[i].NativeObject);
            return res;
        }
Esempio n. 6
0
        /// <summary>
        /// Create a tactic that applies <paramref name="t"/> using the given set of parameters <paramref name="p"/>.
        /// </summary>
        /// <remarks>Alias for <c>UsingParams</c></remarks>
        public Tactic With(Tactic t, Params p)
        {
            Contract.Requires(t != null);
            Contract.Requires(p != null);
            Contract.Ensures(Contract.Result<Tactic>() != null);

            return UsingParams(t, p);
        }
Esempio n. 7
0
        /// <summary>
        /// Create a tactic that applies <paramref name="t"/> using the given set of parameters <paramref name="p"/>.
        /// </summary>
        public Tactic UsingParams(Tactic t, Params p)
        {
            Contract.Requires(t != null);
            Contract.Requires(p != null);
            Contract.Ensures(Contract.Result<Tactic>() != null);

            CheckContextMatch(t);
            CheckContextMatch(p);
            return new Tactic(this, Native.Z3_tactic_using_params(nCtx, t.NativeObject, p.NativeObject));
        }
 /// <summary>
 /// validate a set of parameters.
 /// </summary>
 public void Validate(Params p)
 {
     Contract.Requires(p != null);
     Native.Z3_params_validate(Context.nCtx, p.NativeObject, NativeObject);
 }
Esempio n. 9
0
 /// <summary>
 /// Simplifies the goal.
 /// </summary>
 /// <remarks>Essentially invokes the `simplify' tactic on the goal.</remarks>
 public Goal Simplify(Params p = null)
 {
     Tactic t = Context.MkTactic("simplify");
     ApplyResult res = t.Apply(this, p);
     
     if (res.NumSubgoals == 0)
         return Context.MkGoal();
     else        
         return res.Subgoals[0];
 }
Esempio n. 10
0
        /// <summary>
        /// Simplifies the goal.
        /// </summary>
        /// <remarks>Essentially invokes the `simplify' tactic on the goal.</remarks>
        public Goal Simplify(Params p = null)
        {
            Tactic t = Context.MkTactic("simplify");
            ApplyResult res = t.Apply(this, p);

            if (res.NumSubgoals == 0)
                throw new Z3Exception("No subgoals");
            else
                return res.Subgoals[0];
        }