/// <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>;

            ProductIntervalsWeakUpperBounds <Expression> r = a as ProductIntervalsWeakUpperBounds <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;

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

            return(this.Factory(joinLeftPart, joinRightPart));
        }
Example #2
0
        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);
            }

            var r = a as PentagonsPlus <Variable, Expression>;

            Contract.Assume(r != null, "Error cannot compare a cartesian abstract element with a " + a.GetType());

            // 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

            var joinLeftPart = this.Left.Join(r.Left, this.Right.Left, r.Right.Left);

            Contract.Assert(joinLeftPart != null);
            var joinRightPart = this.Right.Join(r.Right) as Pentagons <Variable, Expression>;

            Contract.Assume(joinRightPart != null);

            return(new PentagonsPlus <Variable, Expression>(joinLeftPart, joinRightPart, this.ExpressionManager));
        }
    /// <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));
    }