public void AssumeInDisInterval(Variable x, DisInterval value) { for (int i = 0; i < this.disjuncts.Length; i++) { this.disjuncts[i].AssumeInDisInterval(x, value); } }
protected override void AssumeInDisInterval_Internal(Variable x, DisInterval value) { if (value.IsTop) { return; } DisInterval prev, next; if (this.TryGetValue(x, out prev)) { next = prev.Meet(value); } else { next = value; } if (next.IsBottom) { this.State = AbstractState.Bottom; } else { this[x] = next; } }
public NonRelationalValueAbstraction( DisInterval interval, SymbolicExpressionTracker <Variable, Expression> symbolicConditions, SetOfConstraints <Variable> equalities, SetOfConstraints <Variable> disequalities, SetOfConstraints <Variable> weakUpperBounds, SetOfConstraints <Variable> strictUpperBounds, SetOfConstraints <Variable> existential) { Contract.Requires(interval != null); Contract.Requires(symbolicConditions != null); Contract.Requires(disequalities != null); Contract.Requires(equalities != null); Contract.Requires(weakUpperBounds != null); Contract.Requires(strictUpperBounds != null); Contract.Requires(existential != null); disInterval = interval; this.symbolicConditions = symbolicConditions; weaklyRelationalDomains = new SetOfConstraints <Variable>[WeaklyRelationalDomainsCount] { equalities, disequalities, weakUpperBounds, strictUpperBounds, existential }; }
protected override void AssumeInDisInterval_Internal(Variable x, DisInterval disIntv) { Rational r; if (disIntv.TryGetSingletonValue(out r)) { Interval_IEEE754 value; long intValue; if (r.TryInt64(out intValue)) { value = Interval_IEEE754.For(intValue); } else { value = Interval_IEEE754.For((double)r); } Interval_IEEE754 prev; if (this.TryGetValue(x, out prev)) { value = value.Meet(prev); } this[x] = value; } }
// Meaning: // weaklyRelationalDomains[0] == Equalities // weaklyRelationalDomains[1] == DisEqualities // weaklyRelationalDomains[2] == WeakUpperBounds // weaklyRelationalDomains[3] == StrictUpperBounds // weaklyRelationalDomains[4] == Existential #endregion #region Constructor public NonRelationalValueAbstraction(DisInterval interval) : this(interval, SymbolicExpressionTracker <Variable, Expression> .Unknown, SetOfConstraints <Variable> .Unknown, SetOfConstraints <Variable> .Unknown, SetOfConstraints <Variable> .Unknown, SetOfConstraints <Variable> .Unknown, SetOfConstraints <Variable> .Unknown) { Contract.Requires(interval != null); }
protected override void AssumeLeftLessThanK(Variable left, DisInterval k) { DisInterval refined; if (IntervalInference.TryRefine_LeftLessThanK(true, left, k, this, out refined)) { this[left] = refined; } }
protected override void AssumeKLessThanRight(DisInterval k, Variable right) { DisInterval refined; if (IntervalInference.TryRefine_KLessThanRight(true, k, right, Rational.For(1), this, out refined)) { this[right] = refined; } }
public static DisInterval EnumValues <Type>(Type t, Func <Type, List <int> > enumranges) { var ranges = enumranges(t); if (ranges != null) { return(DisInterval.For(ranges.ConvertAll <Interval>(x => Interval.For(x)))); } return(Ranges.Int32Range); }
private NonRelationalValueAbstraction( DisInterval interval, SymbolicExpressionTracker <Variable, Expression> symbolicConditions, SetOfConstraints <Variable>[] domains) { Contract.Requires(interval != null); Contract.Requires(symbolicConditions != null); Contract.Requires(domains != null); Contract.Requires(domains.Length == WeaklyRelationalDomainsCount); Contract.Requires(Contract.ForAll(domains, el => el != null)); disInterval = interval; this.symbolicConditions = symbolicConditions; weaklyRelationalDomains = domains; }
public override FlatAbstractDomain <bool> IsNotZero(DisInterval intv) { Contract.Assume(intv != null); // F: just lazy if (intv.IsSingleton && intv.LowerBound.IsZero) { return(CheckOutcome.False); } if (intv.Meet(this.IntervalZero).IsBottom) { return(CheckOutcome.True); } return(CheckOutcome.Top); }
private DisIntervalEnvironment <Variable, Expression> TestTrueEqualToDisinterval(Variable v, DisInterval dis) { Contract.Requires(dis != null); Contract.Ensures(Contract.Result <DisIntervalEnvironment <Variable, Expression> >() != null); DisInterval prevVal; if (this.TryGetValue(v, out prevVal)) { dis = prevVal.Meet(dis); } this[v] = dis; return(this); }
public override DisIntervalEnvironment <Variable, Expression> TestNotEqual(Expression e1, Expression e2) { var v2 = this.Eval(e2); if (v2.IsSingleton) { var notV2 = DisInterval.NotInThisInterval(v2); var e1Var = this.ExpressionManager.Decoder.UnderlyingVariable(this.ExpressionManager.Decoder.Stripped(e1)); this.RefineWith(e1Var, notV2); } bool isBottomLT, isBottomGT; var constraintsLT = IntervalInference.InferConstraints_LT(true, e1, e2, this.ExpressionManager.Decoder, this, out isBottomLT); var constraintsGT = IntervalInference.InferConstraints_LT(true, e2, e1, this.ExpressionManager.Decoder, this, out isBottomGT); if (isBottomLT) { // Bottom join Bottom = Bottom if (isBottomGT) { return(this.Bottom); } this.TestTrueListOfFacts(constraintsGT); } else if (isBottomGT) { this.TestTrueListOfFacts(constraintsLT); } else { var join = JoinConstraints(constraintsLT, constraintsGT); this.TestTrueListOfFacts(join); } return(this); }
public override DisInterval Interval_Not(DisInterval left) { if (!left.IsNormal) { return(left); } // !(!0) is 0 if (left.IsNotZero) { return(DisInterval.For(0)); } // !(0) is !=0 if (left.IsZero) { return(DisInterval.NotZero); } // !([0, +oo]) is [-oo, -1] if (left.IsPositiveOrZero) { return(DisInterval.Negative); } return(left); }
public override DisInterval For(uint u) { return(DisInterval.For(u)); }
public override DisInterval For(Rational r) { return(DisInterval.For(r)); }
public override DisInterval For(long v) { return(DisInterval.For(v)); }
public override DisInterval For(sbyte s) { return(DisInterval.For(s)); }
public override DisInterval For(double d) { return(DisInterval.For(d)); }
public override DisInterval For(short v) { return(DisInterval.For(v)); }
protected override DisInterval ApplyConversion(ExpressionOperator conversionType, DisInterval val) { return(val.Map(intv => Interval.ApplyConversion(conversionType, intv))); }
public override DisInterval For(byte v) { return(DisInterval.For(v)); }
public override DisInterval Interval_ShiftRight(DisInterval left, DisInterval right) { return(DisInterval.ShiftRight(left, right)); }
public override DisInterval Interval_BitwiseOr(DisInterval left, DisInterval right) { return(left | right); }
public override DisInterval Interval_UnaryMinus(DisInterval left) { return(-left); }
void IIntervalAbstraction <Variable, Expression> .AssumeInDisInterval(Variable x, DisInterval value) { this.AssumeInDisInterval(x, value); }
public override DisInterval For(Rational inf, Rational sup) { return(DisInterval.For(inf, sup)); }
protected override DisInterval ConvertInterval(Interval intv) { return(DisInterval.For(intv)); }
public override DisInterval Interval_Rem(DisInterval left, DisInterval right) { return(left % right); }
public void AssumeInDisInterval(Variable x, DisInterval value) { // does nothing }
public override DisInterval Interval_BitwiseAnd(DisInterval left, DisInterval right) { return(left & right); }