コード例 #1
0
            /// <summary>
            ///   left * right != 0 ??
            /// </summary>
            public override FlatAbstractDomain <bool> VisitMultiplication(Expression left, Expression right,
                                                                          Expression original, FlatAbstractDomain <bool> data)
            {
                FlatAbstractDomain <bool> leftIsZero  = IsNotZero(left);
                FlatAbstractDomain <bool> rightIsZero = IsNotZero(right);

                if (leftIsZero.IsNormal() && rightIsZero.IsNormal())
                {
                    // One of the two is zero ...
                    if (leftIsZero.IsFalse() || rightIsZero.IsFalse())
                    {
                        return(CheckOutcome.False);
                    }
                    // Both are non zero
                    if (leftIsZero.IsTrue() && rightIsZero.IsTrue())
                    {
                        return(CheckOutcome.True);
                    }
                }

                if (leftIsZero.IsBottom || rightIsZero.IsBottom)
                {
                    return(CheckOutcome.Bottom);
                }


                return(CheckOutcome.Top);
            }
コード例 #2
0
        private static ProofOutcome ProcessOutcome <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions>
        (
            FlatAbstractDomain <bool> result,
            BoxedExpression exp,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, LogOptions> mdriver,
            out BoxedExpression simplified
        )
            where Expression : IEquatable <Expression>
            where Variable : IEquatable <Variable>
            where LogOptions : IFrameworkLogOptions
            where Type : IEquatable <Type>
        {
            if (result.IsTrue())
            {
                simplified = BoxedExpression.Const(1, mdriver.MetaDataDecoder.System_Boolean, mdriver.MetaDataDecoder);
                return(ProofOutcome.True);
            }
            if (result.IsFalse())
            {
                simplified = BoxedExpression.Const(0, mdriver.MetaDataDecoder.System_Boolean, mdriver.MetaDataDecoder);
                return(ProofOutcome.False);
            }

            simplified = exp;
            return(ProofOutcome.Top);
        }