コード例 #1
0
    /// <summary>
    /// This is a version of the join which causes a partial propagation of the information from Intervals to Symbolic upper bounds
    /// </summary>
    /// <param name="a">The other element</param>
    public override IAbstractDomain Join(IAbstractDomain a)
    {
        if (this.IsBottom)
        {
            return(a);
        }
        if (a.IsBottom)
        {
            return(this);
        }
        if (this.IsTop)
        {
            return(this);
        }
        if (a.IsTop)
        {
            return(a);
        }

        //^ assert a is ReducedCartesianAbstractDomain<LeftDomain, RightDomain>;

        Pentagons < Rational, Expression> r = a as Pentagons < Rational, Expression>;

        if (a == null)
        {
            Debug.Assert(false, "Error cannot compare a cartesian abstract element with a " + a.GetType());
        }

        IntervalEnvironment < Rational, Expression> joinLeftPart;
        WeakUpperBounds <Expression,  Rational>     joinRightPart;

        {
            // These two lines have a weak notion of closure, which essentially avoids dropping "x < y" if it is implied by the intervals abstract domain
            // It seems that it is as precise as the expensive join

            joinRightPart = this.Right.Join(r.Right, this.Left, r.Left);
            joinLeftPart  = (IntervalEnvironment < Rational, Expression>) this.Left.Join(r.Left);
        }

        return(this.Factory(joinLeftPart, joinRightPart));
    }
コード例 #2
0
    /// <summary>
    /// The pairwise widening
    /// </summary>
    public override IAbstractDomain Widening(IAbstractDomain prev)
    {
        if (this.IsBottom)
        {
            return(prev);
        }
        if (prev.IsBottom)
        {
            return(this);
        }

        Debug.Assert(prev is Pentagons < Rational, Expression>, "Wrong type of the domain for the widening...");

        Pentagons < Rational, Expression> asIntWSUB = (Pentagons < Rational, Expression>)prev;

        IntervalEnvironment < Rational, Expression> widenLeft  = (IntervalEnvironment < Rational, Expression>) this.Left.Widening(asIntWSUB.Left);
        WeakUpperBounds <Expression,  Rational>     widenRight = (WeakUpperBounds <Expression,  Rational>) this.Right.Widening(asIntWSUB.Right);

        Pentagons < Rational, Expression> result = (Pentagons < Rational, Expression>) this.Factory(widenLeft, widenRight);

        return(result);
    }
コード例 #3
0
    override public bool LessEqual(IAbstractDomain /*!*/ a)
    {
        if (this == a)
        {
            return(true);
        }
        if (this.IsBottom)
        {
            return(true);
        }
        if (this.IsTop)
        {
            return(a.IsTop);
        }
        if (a.IsBottom)
        {
            return(false);
        }
        if (a.IsTop)
        {
            return(true);
        }

        Pentagons < Rational, Expression> r = a as Pentagons < Rational, Expression>;

        bool b1 = this.Left.LessEqual(r.Left);

        if (!b1)
        {
            return(false);
        }

        bool b2 = this.Right.LessEqual(r.Right);

        return(b2);
    }