示例#1
0
        public static FlatDomain <bool> Negate(this FlatDomain <bool> o)
        {
            if (o.IsNormal())
            {
                return(!o.IsTrue());
            }

            return(o);
        }
        public FlatDomain <bool> Isinst(E orig, TypeNode type, V dest, E obj, bool polarity)
        {
            if (!polarity)
            {
                return(this.analysis.IsNull(this.pc, dest));
            }
            FlatDomain <bool> outcome = this.analysis.IsNonNull(this.pc, dest);

            return(outcome.IsTrue() ? outcome : this.Recurse(true, obj));
        }
示例#3
0
        public FlatDomain <bool> IsTrueImply(APC pc, Sequence <BoxedExpression> positiveAssumptions, Sequence <BoxedExpression> negativeAssumptions, BoxedExpression goal)
        {
            FlatDomain <bool> outcome = IsTrue(pc, goal);

            if (outcome.IsTrue() || outcome.IsBottom)
            {
                return(outcome);
            }

            return(ProofOutcome.Top);
        }
示例#4
0
            public static void ValidateAssertions(IFactQuery <BoxedExpression, TVariable> facts, IMethodDriver <TExpression, TVariable> driver, List <string> proofResults)
            {
                APC entryAfterRequires = driver.ContextProvider.MethodContext.CFG.EntryAfterRequires;

                if (facts.IsUnreachable(entryAfterRequires))
                {
                    proofResults.Add("Method precondition is unsatisfiable");
                    return;
                }

                object assertStats;

                foreach (AssertionObligation obl in GetAssertions(driver, out assertStats))
                {
                    FlatDomain <bool> outcome = facts.IsTrue(obl.Apc, BoxedExpression.For(driver.ContextProvider.ExpressionContext.Refine(obl.Apc, obl.Condition), driver.ExpressionDecoder));

                    string pc = obl.Apc.ToString();

                    if (outcome.IsNormal())
                    {
                        proofResults.Add(string.Format("Assertion at point {0} is {1}", pc, outcome.IsTrue() ? "true" : "false"));
                    }
                    else if (outcome.IsTop)
                    {
                        proofResults.Add("Assertion at point " + pc + " is unproven");
                    }
                    else
                    {
                        proofResults.Add("Assertion at point " + pc + " is unreachable");
                    }
                }
            }