Example #1
0
        public IAbstractDomain Join(IAbstractDomain a)
        {
            IAbstractDomain result;

            if (AbstractDomainsHelper.TryTrivialJoin(this, a, out result))
            {
                return(result);
            }

            BoundedDisjunction <Variable, Expression> asDisjunctionDomain = a as  BoundedDisjunction <Variable, Expression>;

            Debug.Assert(asDisjunctionDomain != null);

            INumericalAbstractDomain <Variable, Expression>[] joinDisjuncts = new INumericalAbstractDomain <Variable, Expression> [this.disjuncts.Length + asDisjunctionDomain.disjuncts.Length];

            // Copy both the domains
            for (int i = 0; i < this.disjuncts.Length; i++)
            {
                joinDisjuncts[i] = this.disjuncts[i];
            }

            for (int i = 0; i < asDisjunctionDomain.disjuncts.Length; i++)
            {
                joinDisjuncts[this.disjuncts.Length + i] = asDisjunctionDomain.disjuncts[i];
            }

            return(new  BoundedDisjunction <Variable, Expression>(joinDisjuncts));
        }
Example #2
0
        public IAbstractDomain Widening(IAbstractDomain prev)
        {
            IAbstractDomain result;

            if (AbstractDomainsHelper.TryTrivialJoin(this, prev, out result))
            {
                return(result);
            }

            BoundedDisjunction <Variable, Expression> asDisjunctionDomain = prev as  BoundedDisjunction <Variable, Expression>;

            Debug.Assert(asDisjunctionDomain != null);

            INumericalAbstractDomain <Variable, Expression> left  = SmashTogether(this.disjuncts);
            INumericalAbstractDomain <Variable, Expression> right = SmashTogether(asDisjunctionDomain.disjuncts);

            return(new  BoundedDisjunction <Variable, Expression>((INumericalAbstractDomain <Variable, Expression>)left.Widening(right)));
        }
        public IAbstractDomain Meet(IAbstractDomain a)
        {
            IAbstractDomain result;

            if (AbstractDomainsHelper.TryTrivialMeet(this, a, out result))
            {
                return(result);
            }

            BoundedDisjunction <Variable, Expression> asDisjunctionDomain = a as BoundedDisjunction <Variable, Expression>;

            Debug.Assert(asDisjunctionDomain != null);

            INumericalAbstractDomain <Variable, Expression> left  = SmashTogether(disjuncts);
            INumericalAbstractDomain <Variable, Expression> right = SmashTogether(asDisjunctionDomain.disjuncts);

            return(new BoundedDisjunction <Variable, Expression>((INumericalAbstractDomain <Variable, Expression>)left.Meet(right)));
        }
Example #4
0
        static private INumericalAbstractDomain <Variable, Expression> SmashTogether(IAbstractDomain boundedDisjunction, bool p)
        {
            INumericalAbstractDomain <Variable, Expression> asNumericalDomain = (INumericalAbstractDomain <Variable, Expression>)boundedDisjunction;

            Debug.Assert(boundedDisjunction != null);

            if (p)
            { // It is a
                BoundedDisjunction <Variable, Expression> asDisjunction = asNumericalDomain as  BoundedDisjunction <Variable, Expression>;

                Debug.Assert(asDisjunction != null);

                return(SmashTogether(asDisjunction.disjuncts));
            }
            else
            {
                return(asNumericalDomain);
            }
        }