Esempio n. 1
0
 /// <summary>
 /// Convert an 'Eq' expression.
 /// </summary>
 /// <param name="expression">The expression.</param>
 /// <param name="parameter">The parameter.</param>
 /// <returns>The compilable expression.</returns>
 public Expression VisitZenEqExpr <T>(ZenEqExpr <T> expression, ExpressionConverterEnvironment parameter)
 {
     return(LookupOrCompute(expression, () =>
     {
         return Expression.Equal(
             expression.Expr1.Accept(this, parameter),
             expression.Expr2.Accept(this, parameter));
     }));
 }
Esempio n. 2
0
 public ImmutableHashSet <object> VisitZenEqExpr <T>(ZenEqExpr <T> expression, Unit parameter)
 {
     return(LookupOrCompute(expression, () =>
     {
         var x = expression.Expr1.Accept(this, parameter);
         var y = expression.Expr2.Accept(this, parameter);
         this.Combine(x, y);
         return x.Union(y);
     }));
 }
        /// <summary>
        /// Visit an EqExpr.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <param name="parameter">The parameter.</param>
        /// <returns>The resulting symbolic value.</returns>
        public SymbolicValue <TModel, TVar, TBool, TInt> VisitZenEqExpr <T1>(ZenEqExpr <T1> expression, SymbolicEvaluationEnvironment <TModel, TVar, TBool, TInt> parameter)
        {
            return(LookupOrCompute(expression, () =>
            {
                var v1 = expression.Expr1.Accept(this, parameter);
                var v2 = expression.Expr2.Accept(this, parameter);

                if (v1 is SymbolicBool <TModel, TVar, TBool, TInt> b1 && v2 is SymbolicBool <TModel, TVar, TBool, TInt> b2)
                {
                    return new SymbolicBool <TModel, TVar, TBool, TInt>(this.Solver, this.Solver.Iff(b1.Value, b2.Value));
                }

                var i1 = (SymbolicInteger <TModel, TVar, TBool, TInt>)v1;
                var i2 = (SymbolicInteger <TModel, TVar, TBool, TInt>)v2;
                return new SymbolicBool <TModel, TVar, TBool, TInt>(this.Solver, this.Solver.Eq(i1.Value, i2.Value));
            }));