예제 #1
0
        /// <summary>
        /// Check for contraddictions.
        /// The understanding here is that:
        ///   - 'this' is interpreted as existential and 'exists' as universal
        ///   - 'that' is interpreted as universal and 'exists' as existential
        /// </summary>
        public bool AreInContraddiction(NonRelationalValueAbstraction <Variable, Expression> other)
        {
            Contract.Requires(other != null);

            if (this.Interval.Meet(other.Interval).IsBottom)
            {
                return(true);
            }

            if (!this.DisEqualities.Join(other.Equalities).IsTop)
            {
                return(true);
            }

            if (!this.Equalities.Join(other.DisEqualities).IsTop)
            {
                return(true);
            }

            if (!this.Equalities.Join(other.StrictUpperBounds).IsTop)
            {
                return(true);
            }

            if (!this.StrictUpperBounds.Join(other.Equalities).IsTop)
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public bool LessEqual(NonRelationalValueAbstraction <Variable, Expression> other)
        {
            Contract.Requires(other != null);

            if (!disInterval.LessEqual(other.Interval))
            {
                return(false);
            }
            Contract.Assert(other.symbolicConditions != null);
            if (!symbolicConditions.LessEqual(other.symbolicConditions))
            {
                return(false);
            }

            // F: Assuming the object invariant for other
            Contract.Assert(other.weaklyRelationalDomains != null);
            Contract.Assume(Contract.ForAll(other.weaklyRelationalDomains, dom => dom != null));
            Contract.Assume(weaklyRelationalDomains.Length == other.weaklyRelationalDomains.Length, "assuming object invariant");
            for (var i = 0; i < weaklyRelationalDomains.Length; i++)
            {
                if (!weaklyRelationalDomains[i].LessEqual(other.weaklyRelationalDomains[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #3
0
        public NonRelationalValueAbstraction <Variable, Expression> Widening(NonRelationalValueAbstraction <Variable, Expression> prev)
        {
            Contract.Requires(prev != null);
            Contract.Ensures(Contract.Result <NonRelationalValueAbstraction <Variable, Expression> >() != null);

            NonRelationalValueAbstraction <Variable, Expression> result;

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

            var intv = disInterval.Widening(prev.Interval);
            var symbolicConditions = this.symbolicConditions.Join(prev.symbolicConditions);

            Contract.Assume(weaklyRelationalDomains.Length == prev.weaklyRelationalDomains.Length);

            var newWeaklyDomains = ParallelOperation(weaklyRelationalDomains, prev.weaklyRelationalDomains, (x, y) => x.Widening(y));

            return(new NonRelationalValueAbstraction <Variable, Expression>(intv, SymbolicConditions, newWeaklyDomains));
        }
예제 #4
0
        public NonRelationalValueAbstraction <Variable, Expression> Join(NonRelationalValueAbstraction <Variable, Expression> other)
        {
            Contract.Requires(other != null);
            Contract.Ensures(Contract.Result <NonRelationalValueAbstraction <Variable, Expression> >() != null);

            NonRelationalValueAbstraction <Variable, Expression> result;

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

            var intv = this.disInterval.Join(other.Interval);
            var symbolicConditions = this.symbolicConditions.Join(other.symbolicConditions);

            Contract.Assume(this.weaklyRelationalDomains.Length == other.weaklyRelationalDomains.Length);

            var newWeaklyDomains = ParallelOperation(this.weaklyRelationalDomains, other.weaklyRelationalDomains, (x, y) => x.Join(y));

            return(new NonRelationalValueAbstraction <Variable, Expression>(intv, symbolicConditions, newWeaklyDomains));
        }