Exemple #1
0
 protected override void PopulateWarningContextInternal(ProofOutcome outcome)
 {
     if (outcome == ProofOutcome.Top)
     {
         this.AdditionalInformationOnTheWarning.AddRange(WarningContextFetcher.InferContext(this.PC, this.arg, this.Context, this.DecoderForMetaData.IsBoolean));
     }
 }
                protected override sealed ProofOutcome ValidateInternal(IFactQuery <BoxedExpression, Variable> query, ContractInferenceManager inferenceManager, IOutputResults output)
                {
                    if (this.MethodDriver.Options.TraceChecks)
                    {
                        output.WriteLine("Validating proof obligation: {0}", this.Condition != null ? this.Condition.ToString() : "<null?>");
                    }

                    var result = ValidateInternalSpecific(query, inferenceManager, output);

                    if (result != ProofOutcome.Top)
                    {
                        return(result);
                    }

                    var condition = this.Condition;

                    if (condition != null)
                    {
                        WeakestPreconditionProver.AdditionalInfo why;
                        if (TryDischargeProofObligationWithWeakestPreconditions(condition, query, inferenceManager, output, out why))
                        {
                            return(ProofOutcome.True);
                        }
                        else
                        {
                            this.AdditionalInformationOnTheWarning.AddRange(WarningContextFetcher.InferContext(this.PC, condition, this.Context, this.DecoderForMetaData.IsBoolean));
                            this.AdditionalInformationOnTheWarning.AddRange(why.GetWarningContexts());
                        }
                    }
                    return(ProofOutcome.Top);
                }
        private Witness MakeUpAWitness(APC pc, WarningType type, BoxedExpression precondition, KeyValuePair <BoxedExpression, IEnumerable <MinimalProofObligation> > pair)
        {
            uint?id;
            var  provenance = pair.Value;

            if (provenance != null && provenance.Any())
            {
                id = provenance.First().ID;
            }
            else
            {
                id = null;
            }

            var md             = this.mdriver;
            var warningContext = WarningContextFetcher.InferContext(pc, precondition, md.Context, md.MetaDataDecoder.IsBoolean)
                                 .Where(wc => wc.Type != WarningContext.ContextType.ViaParameterUnmodified); // very likely we will have unmodified parameters, and we do not want them to count in the score

            return(new Witness(id, type, ProofOutcome.Top, pc, warningContext));
        }