示例#1
0
            public override PolyhedraEnvironment <Expression> VisitNotEqual(Expression left, Expression right, PolyhedraEnvironment <Expression> data)
            {
                // left != right
                AI.IExpr notEq = linearfactory.Neq(Converter.Box(left, this.Decoder), Converter.Box(right, this.Decoder));

                return(data.Factory(UnderlyingPolyhedra.Constrain(data.embedded, notEq), data.intv));
            }
示例#2
0
        public FlatAbstractDomain <bool> CheckIfLessEqualThan(Expression e1, Expression e2)
        {
            // exp1 <= exp2 ?
            AI.IExpr toAssume = linearfactory.AtMost(Converter.Box(e1, decoder), Converter.Box(e2, decoder));

            return(ToFlatAbstractDomain(UnderlyingPolyhedra.CheckPredicate(embedded, toAssume)).Meet(intv.CheckIfLessEqualThan(e1, e2)));
        }
示例#3
0
        public INumericalAbstractDomain <Variable, Expression> TestTrueLessEqualThan(Expression exp1, Expression exp2)
        {
            // exp1 <= exp2
            AI.IExpr toAssume = linearfactory.AtMost(Converter.Box(exp1, decoder), Converter.Box(exp2, decoder));

            return(Factory(UnderlyingPolyhedra.Constrain(embedded, toAssume), intv.TestTrueLessEqualThan(exp1, exp2)));
        }
示例#4
0
        public FlatAbstractDomain <bool> CheckIfGreaterEqualThanZero(Expression exp)
        {
            // exp >= 0 ?
            AI.IExpr toCheck = linearfactory.AtMost(linearfactory.Const(0), Converter.Box <Expression>(exp, decoder));

            return(ToFlatAbstractDomain(UnderlyingPolyhedra.CheckPredicate(embedded, toCheck)).Meet(intv.CheckIfGreaterEqualThanZero(exp)));
        }
示例#5
0
        public AI.IFunApp Add(AI.IExpr p, AI.IExpr q)
        {
            Expression e1 = Converter.Unbox <Expression>(p);
            Expression e2 = Converter.Unbox <Expression>(q);

            return(Converter.Box(encoder.CompoundExpressionFor(ExpressionType.Int32, ExpressionOperator.Addition, e1, e2), decoder));
        }
示例#6
0
        public INumericalAbstractDomain <Variable, Expression> TestTrueGeqZero(Expression exp)
        {
            // 0 <= exp
            AI.IExpr toAssume = linearfactory.AtMost(linearfactory.Const(0), Converter.Box <Expression>(exp, decoder));

            return(Factory(UnderlyingPolyhedra.Constrain(embedded, toAssume), intv.TestTrueGeqZero(exp)));
        }
示例#7
0
        public AI.IFunApp Neq(AI.IExpr p, AI.IExpr q)
        {
            Expression e1 = Converter.Unbox <Expression>(p);
            Expression e2 = Converter.Unbox <Expression>(q);

            return(Converter.Box(encoder.CompoundExpressionFor(ExpressionType.Bool, ExpressionOperator.NotEqual, e1, e2), decoder));
        }
示例#8
0
        public INumericalAbstractDomain <Variable, Expression> TestTrueLessThan(Expression exp1, Expression exp2)
        {
            // exp1 <= exp2 -1
            AI.IExpr toAssume = linearfactory.AtMost(Converter.Box(exp1, this.decoder), linearfactory.Add(Converter.Box(exp2, this.decoder), linearfactory.Const(-1)));

            return(Factory(UnderlyingPolyhedra.Constrain(this.embedded, toAssume), this.intv.TestTrueLessThan(exp1, exp2)));
        }
示例#9
0
        public AI.IFunApp AtMost(AI.IExpr p, AI.IExpr q)
        {
            Expression e1 = Converter.Unbox <Expression>(p);
            Expression e2 = Converter.Unbox <Expression>(q);

            return(Converter.Box(this.encoder.CompoundExpressionFor(ExpressionType.Bool, ExpressionOperator.LessEqualThan, e1, e2), this.decoder));
        }
示例#10
0
        public FlatAbstractDomain <bool> CheckIfLessThan(Expression e1, Expression e2)
        {
            // exp1 <= exp2 -1 ?

            AI.IExpr toAssume = linearfactory.AtMost(Converter.Box(e1, this.decoder), linearfactory.Add(Converter.Box(e2, this.decoder), linearfactory.Const(-1)));

            return(ToFlatAbstractDomain(UnderlyingPolyhedra.CheckPredicate(this.embedded, toAssume)).Meet(this.intv.CheckIfLessThan(e1, e2)));
        }
示例#11
0
 private void AssignIntervalJustInPolyhedra(Expression x, Interval value)
 {
     if (!value.IsBottom)
     {
         if (!value.LowerBound.IsInfinity)
         {
             AI.IExpr lowerBound = linearfactory.AtMost(linearfactory.Const((Int32)value.LowerBound.PreviousInteger), Converter.BoxAsVariable(x, decoder));
             embedded = UnderlyingPolyhedra.Constrain(embedded, lowerBound);
         }
         if (!value.UpperBound.IsInfinity)
         {
             AI.IExpr upperBound = linearfactory.AtMost(Converter.BoxAsVariable(x, decoder), linearfactory.Const((Int32)value.UpperBound.NextInteger));
             embedded = UnderlyingPolyhedra.Constrain(embedded, upperBound);
         }
     }
 }
示例#12
0
 static public E Unbox <E>(AI.IExpr boxed)
 {
     return(((Exp <E>)boxed).InExp);
 }
示例#13
0
        public AI.IFunApp Not(AI.IExpr p)
        {
            Expression e = Converter.Unbox <Expression>(p);

            return(Converter.Box(encoder.CompoundExpressionFor(ExpressionType.Bool, ExpressionOperator.Not, e), decoder));
        }
示例#14
0
 public AI.IFunApp Implies(AI.IExpr p, AI.IExpr q)
 {
     return(new UninterestingFunctions());
 }