Exemplo n.º 1
0
        public void Assign(Expression x, Expression exp, INumericalAbstractDomainQuery <Variable, Expression> preState)
        {
            // Infer some x >= 0 invariants which requires the information from the two domains
            // The information should be inferred in the pre-state
            List <Expression> geqZero;

            // if (this.ExpressionManager.Encoder!= null)
            {
                geqZero = new GreaterEqualThanZeroConstraints <Variable, Expression>(this.ExpressionManager).InferConstraints(x, exp, preState);
                Contract.Assert(Contract.ForAll(geqZero, condition => condition != null));
            }

/*      else
 *    {
 *      geqZero = new List<Expression>();
 *      // F: we do not decompile ForAll in the case below
 *      Contract.Assume(Contract.ForAll(geqZero, condition => condition != null));
 *    }
 */
            Contract.Assert(Contract.ForAll(geqZero, condition => condition != null));

            this.Right.Assign(x, exp, preState);
            this.Left.Assign(x, exp, preState);

            // The information is assumed in the post-state...
            foreach (var condition in geqZero)
            {
                this.TestTrue(condition);
            }
        }
Exemplo n.º 2
0
        public override void Assign(Expression x, Expression exp)
        {
            // F: I am lazy...
            Contract.Assume(x != null);
            Contract.Assume(exp != null);

            // Infer some x >= 0 invariants which requires the information from the two domains
            // The information should be inferred in the pre-state
            var geqZero = new GreaterEqualThanZeroConstraints <Variable, Expression>(this.ExpressionManager).InferConstraints(x, exp, this);

            this.Left.Assign(x, exp, this);
            this.Right.Assign(x, exp);

            // The information is assumed in the post-state...
            foreach (var condition in geqZero)
            {
                this.TestTrue(condition);
            }
        }