public IAbstractDomainWithTransferFunctions <Expression> TestFalse(Expression guard) { IntervalEnvironment < Rational, Expression> resultLeft = (IntervalEnvironment < Rational, Expression>)left.TestFalse(guard); WeakUpperBounds <Expression, Rational> resultRight = (WeakUpperBounds <Expression, Rational>)right.TestFalse(guard); return((IAbstractDomainWithTransferFunctions <Expression>)Factory(resultLeft, resultRight)); }
Reduce(IntervalEnvironment < Rational, Expression> left, WeakUpperBounds <Expression, Rational> right) { ALog.BeginReduce("IntervalsWithSymbolicUpperBounds"); foreach (Expression x in left.Keys) { foreach (Expression y in left.Keys) { if (x.Equals(y)) { continue; } FlatAbstractDomain <bool> b = left.CheckIfLessThan(x, y); if (b.IsTop || b.IsBottom) { continue; } if (b.BoxedElement == true) { ALog.Message("Adding " + ExpressionPrinter <Expression> .ToString(x, this.decoder) + " < " + ExpressionPrinter <Expression> .ToString(y, this.decoder) + " as " + left.BoundsFor(x) + " < " + left.BoundsFor(y)); right.TestTrueLessThan(x, y); // Add the constraint x < y } } } ALog.EndReduce(); return(this.Factory(left, right)); }
private LinearEqualitiesForUnsafeCode PropagateConstants(IntervalEnvironment <BoxedExpression> intervals, LinearEqualitiesForUnsafeCode equalities) { foreach (var x in intervals.Variables) { Interval value = intervals[x]; if (!value.IsTop && !value.IsBottom && value.IsSingleton) { BoxedExpression valueAsExp = this.Encoder.ConstantFor((Int32)value.LowerBound); BoxedExpression toAssume = this.Encoder.CompoundExpressionFor(ExpressionType.Bool, ExpressionOperator.Equal, x, valueAsExp); equalities = (LinearEqualitiesForUnsafeCode)equalities.TestTrue(toAssume); } } return(equalities); }
public override INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> GetTopValue() { switch (this.specificoptions[0].type) { case Analyzers.DomainKind.SubPolyhedra: { var intervals = new IntervalEnvironment <BoxedVariable <Variable>, BoxedExpression>(this.ExpressionManager); var karr = new LinearEqualitiesForSubpolyhedraEnvironment <BoxedVariable <Variable>, BoxedExpression>(this.ExpressionManager); var subpolyhedra = new SubPolyhedra <BoxedVariable <Variable>, BoxedExpression>(karr, intervals, this.ExpressionManager); return(subpolyhedra); } default: throw new AbstractInterpretationException("Abstract domain not supported"); } }
private Preconditions JoinOnIntervals(Preconditions prev, Preconditions next, bool widen) { Contract.Requires(prev != null); Contract.Requires(next != null); var expManager = this.GetExpressionManager(); var intvLeft = new IntervalEnvironment <BoxedVariable <Variable>, BoxedExpression>(expManager); var intvRight = new IntervalEnvironment <BoxedVariable <Variable>, BoxedExpression>(expManager); intvLeft = Assume(intvLeft, prev); intvRight = Assume(intvRight, next); var result = widen ? intvRight.Widening(intvLeft) : intvRight.Join(intvLeft); if (widen && result.LessEqual(intvLeft)) { return(null); } return(result.To(new BoxedExpressionFactory <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Variable>(this.Mdriver.MetaDataDecoder)).SplitConjunctions()); }
/// <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); }
private IntervalEnvironment <BoxedVariable <Variable>, BoxedExpression> Assume(IntervalEnvironment <BoxedVariable <Variable>, BoxedExpression> intv, Preconditions pre) { Contract.Requires(intv != null); Contract.Requires(pre != null); foreach (var p in pre) { intv = intv.TestTrue(p); } return(intv); }
public IntervalsForUnsafeCode(IntervalEnvironment <BoxedExpression> original, IExpressionContext <APC, Local, Parameter, Method, Field, Type, ExternalExpression, Variable> context) : base(original) { this.context = context; this.decoder = (BoxedExpressionDecoder <Type, ExternalExpression>)original.Decoder; }
protected override ReducedCartesianAbstractDomain <IntervalEnvironment <Rational, Expression>, WeakUpperBounds <Expression, Rational> > Factory(IntervalEnvironment <Rational, Expression> left, WeakUpperBounds <Expression, Rational> right) { throw new Exception("The method or operation is not implemented."); }
public ProductIntervalsWeakUpperBounds(IntervalEnvironment <Rational, Expression> left, WeakUpperBounds <Expression, Rational> right) : base(left, right) { }
protected override ReducedCartesianAbstractDomain <IntervalEnvironment <Rational, Expression>, WeakUpperBounds <Expression, Rational> > Factory(IntervalEnvironment <Rational, Expression> left, WeakUpperBounds <Expression, Rational> right) { return(new IntervalsWithSymbolicBoundsOfRational32 <Expression>(left, right, this.Decoder)); }
public IntervalsWithSymbolicBoundsOfRational32(IntervalEnvironment <Rational, Expression> left, WeakUpperBounds <Expression, Rational> right, IExpressionDecoder <Expression> decoder) : base(left, right, decoder) { }
Factory(IntervalEnvironment < Rational, Expression> left, WeakUpperBounds <Expression, Rational> right);
/// <summary> /// Please note that the decoder MUST be already be set for the <code>left</code> and <code>right</code> abstract domains /// </summary> protected Pentagons(IntervalEnvironment < Rational, Expression> /*!*/ left, WeakUpperBounds <Expression, Rational> /*!*/ right, IExpressionDecoder <Expression> decoder) : base(left, right) { this.decoder = decoder; }
protected override ReducedCartesianAbstractDomain <IntervalEnvironment <BoxedExpression>, Stripe <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> > > Factory(IntervalEnvironment <BoxedExpression> left, Stripe <BoxedExpression, IDecodeMetaData <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly> > right) { StripeWithIntervalsForUnsafeCode result = new StripeWithIntervalsForUnsafeCode((IntervalsForUnsafeCode)left, (StripeForUnsafeCode)right, decoder, context, this.mdDecoder); foreach (BoxedExpression exp in this.nullPointers) { result.nullPointers.Add(exp); } return(result); }