Exemplo n.º 1
0
                protected override ProofOutcome ValidateInternalSpecific(IFactQuery <BoxedExpression, Variable> query, ContractInferenceManager inferenceManager, IOutputResults output)
                {
                    // Check if expForIndex >= 0
                    return(query.IsGreaterEqualToZero(this.PC, index));

#if false
                    // Try to use weakest preconditions
                    if (result == ProofOutcome.Top)
                    {
                        if (CanAssumeLowerBoundPrecondition(output, this.index))
                        {
                            result = ProofOutcome.True;
                        }
                        else
                        {
                            // if we have lb <= i, then we can suggest 0 <= lb
                            //
                            foreach (Variable lb in query.LowerBounds(this.PC, index, false))
                            {
                                BoxedExpression lbbox = BoxedExpression.Var(lb);
                                if (CanAssumeLowerBoundPrecondition(output, lbbox))
                                {
                                    result = ProofOutcome.True;
                                }
                            }
                        }
                    }

                    return(result);
#endif
                }
Exemplo n.º 2
0
                protected override ProofOutcome ValidateInternalSpecific(IFactQuery <BoxedExpression, Variable> query, ContractInferenceManager inferenceManager, IOutputResults output)
                {
                    // First, we check if arg != MinValue

                    object value;

                    if (!this.DecoderForMetaData.TryGetMinValueForType(this.typeOfArg, out value))
                    {
                        return(ProofOutcome.Top);
                    }

                    var condition = this.Condition;

                    if (condition != null) // this.Condition may return null
                    {
                        var result = query.IsTrue(this.PC, condition);

                        if (result != ProofOutcome.Top)
                        {
                            return(result);
                        }
                    }
                    // We check a sufficient condition: if arg is >= 0, then it is not the negation of a negative "extreme"
                    var greaterThanZero = query.IsGreaterEqualToZero(this.PC, this.arg);

                    return((greaterThanZero == ProofOutcome.True || greaterThanZero == ProofOutcome.Bottom)
            ? greaterThanZero : ProofOutcome.Top);
                }
Exemplo n.º 3
0
 protected override ProofOutcome ValidateInternalSpecific(IFactQuery <BoxedExpression, Variable> query, ContractInferenceManager inferenceManager, IOutputResults output)
 {
     return(query.IsGreaterEqualToZero(this.PC, this.size));
 }