Push() public method

Add the AST a to the back of the vector. The size is increased by 1.
public Push ( AST a ) : void
a AST An AST
return void
Example #1
0
        /// <summary>
        /// Return a set of cubes.
        /// </summary>
        public IEnumerable <BoolExpr[]> Cube()
        {
            using ASTVector cv = new ASTVector(Context);
            if (CubeVariables != null)
            {
                foreach (var b in CubeVariables)
                {
                    cv.Push(b);
                }
            }

            while (true)
            {
                var lvl = BacktrackLevel;
                BacktrackLevel    = uint.MaxValue;
                using ASTVector r = new ASTVector(Context, Native.Z3_solver_cube(Context.nCtx, NativeObject, cv.NativeObject, lvl));
                var v = r.ToBoolExprArray();
                CubeVariables = cv.ToBoolExprArray();
                if (v.Length == 1 && v[0].IsFalse)
                {
                    break;
                }
                yield return(v);

                if (v.Length == 0)
                {
                    break;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Retrieve fixed assignments to the set of variables in the form of consequences.
        /// Each consequence is an implication of the form
        ///
        ///       relevant-assumptions Implies variable = value
        ///
        /// where the relevant assumptions is a subset of the assumptions that are passed in
        /// and the equality on the right side of the implication indicates how a variable
        /// is fixed.
        /// </summary>
        /// <remarks>
        /// <seealso cref="Model"/>
        /// <seealso cref="UnsatCore"/>
        /// <seealso cref="Proof"/>
        /// </remarks>
        public Status Consequences(IEnumerable <BoolExpr> assumptions, IEnumerable <Expr> variables, out BoolExpr[] consequences)
        {
            using ASTVector result = new ASTVector(Context);
            using ASTVector asms   = new ASTVector(Context);
            using ASTVector vars   = new ASTVector(Context);
            foreach (var asm in assumptions)
            {
                asms.Push(asm);
            }
            foreach (var v in variables)
            {
                vars.Push(v);
            }
            Z3_lbool r = (Z3_lbool)Native.Z3_solver_get_consequences(Context.nCtx, NativeObject, asms.NativeObject, vars.NativeObject, result.NativeObject);

            consequences = result.ToBoolExprArray();
            return(lboolToStatus(r));
        }
Example #3
0
 /// <summary>
 /// Retrieve fixed assignments to the set of variables in the form of consequences.
 /// Each consequence is an implication of the form 
 ///
 ///       relevant-assumptions Implies variable = value
 /// 
 /// where the relevant assumptions is a subset of the assumptions that are passed in
 /// and the equality on the right side of the implication indicates how a variable
 /// is fixed.
 /// </summary>
 /// <remarks>
 /// <seealso cref="Model"/>
 /// <seealso cref="UnsatCore"/>
 /// <seealso cref="Proof"/>    
 /// </remarks>    
 public Status Consequences(IEnumerable<BoolExpr> assumptions, IEnumerable<Expr> variables, out BoolExpr[] consequences)
 {
     ASTVector result = new ASTVector(Context);
     ASTVector asms = new ASTVector(Context);
     ASTVector vars = new ASTVector(Context);
     foreach (var asm in assumptions) asms.Push(asm);
     foreach (var v in variables) vars.Push(v);
     Z3_lbool r = (Z3_lbool)Native.Z3_solver_get_consequences(Context.nCtx, NativeObject, asms.NativeObject, vars.NativeObject, result.NativeObject);
     consequences = result.ToBoolExprArray();
     return lboolToStatus(r);
 }