Search in sources :

Example 56 with IndexExpressionsSet

use of com.sri.ai.expresso.api.IndexExpressionsSet in project aic-expresso by aic-sri-international.

the class TupleQuantifierSimplifier method rewriteThereExists.

private static Expression rewriteThereExists(Expression quantifiedExpression, Map<Expression, Expression> indexToTypeMap, Map<Expression, Expression> indexToTupleOfVars, Context context) {
    if (indexToTypeMap.size() > 1) {
        throw new IllegalStateException("We have an Existential Quantifier with > 1 index : " + quantifiedExpression);
    }
    Pair<IndexExpressionsSet, Expression> updatePair = update(ThereExists.getBody(quantifiedExpression), indexToTypeMap, indexToTupleOfVars, context);
    Expression result = ThereExists.make(updatePair.first, updatePair.second);
    return result;
}
Also used : DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) Expression(com.sri.ai.expresso.api.Expression) LambdaExpression(com.sri.ai.expresso.api.LambdaExpression) QuantifiedExpression(com.sri.ai.expresso.api.QuantifiedExpression) ExtensionalIndexExpressionsSet(com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet) IndexExpressionsSet(com.sri.ai.expresso.api.IndexExpressionsSet)

Example 57 with IndexExpressionsSet

use of com.sri.ai.expresso.api.IndexExpressionsSet in project aic-expresso by aic-sri-international.

the class TupleQuantifierSimplifier method rewriteCountingFormula.

private static Expression rewriteCountingFormula(CountingFormula countingFormula, Map<Expression, Expression> indexToTypeMap, Map<Expression, Expression> indexToTupleOfVars, Context context) {
    Pair<IndexExpressionsSet, Expression> updatePair = update(countingFormula.getBody(), indexToTypeMap, indexToTupleOfVars, context);
    Expression result = new DefaultCountingFormula(updatePair.first, updatePair.second);
    return result;
}
Also used : DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) Expression(com.sri.ai.expresso.api.Expression) LambdaExpression(com.sri.ai.expresso.api.LambdaExpression) QuantifiedExpression(com.sri.ai.expresso.api.QuantifiedExpression) ExtensionalIndexExpressionsSet(com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet) IndexExpressionsSet(com.sri.ai.expresso.api.IndexExpressionsSet) DefaultCountingFormula(com.sri.ai.expresso.core.DefaultCountingFormula)

Example 58 with IndexExpressionsSet

use of com.sri.ai.expresso.api.IndexExpressionsSet in project aic-expresso by aic-sri-international.

the class TupleQuantifierSimplifier method rewriteForAll.

private static Expression rewriteForAll(Expression quantifiedExpression, Map<Expression, Expression> indexToTypeMap, Map<Expression, Expression> indexToTupleOfVars, Context context) {
    if (indexToTypeMap.size() > 1) {
        throw new IllegalStateException("We have a Universal Quantifier with > 1 index : " + quantifiedExpression);
    }
    Pair<IndexExpressionsSet, Expression> updatePair = update(ForAll.getBody(quantifiedExpression), indexToTypeMap, indexToTupleOfVars, context);
    Expression result = ForAll.make(updatePair.first, updatePair.second);
    return result;
}
Also used : DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) Expression(com.sri.ai.expresso.api.Expression) LambdaExpression(com.sri.ai.expresso.api.LambdaExpression) QuantifiedExpression(com.sri.ai.expresso.api.QuantifiedExpression) ExtensionalIndexExpressionsSet(com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet) IndexExpressionsSet(com.sri.ai.expresso.api.IndexExpressionsSet)

Example 59 with IndexExpressionsSet

use of com.sri.ai.expresso.api.IndexExpressionsSet in project aic-expresso by aic-sri-international.

the class TupleQuantifierSimplifier method rewriteCountingFormula.

private static Expression rewriteCountingFormula(CountingFormula countingFormula, Map<Expression, Expression> indexToTypeMap, Map<Expression, Expression> indexToTupleOfVars, Context context) {
    Pair<IndexExpressionsSet, Expression> updatePair = update(countingFormula.getBody(), indexToTypeMap, indexToTupleOfVars, context);
    Expression result = new DefaultCountingFormula(updatePair.first, updatePair.second);
    return result;
}
Also used : DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) Expression(com.sri.ai.expresso.api.Expression) LambdaExpression(com.sri.ai.expresso.api.LambdaExpression) QuantifiedExpression(com.sri.ai.expresso.api.QuantifiedExpression) ExtensionalIndexExpressionsSet(com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet) IndexExpressionsSet(com.sri.ai.expresso.api.IndexExpressionsSet) DefaultCountingFormula(com.sri.ai.expresso.core.DefaultCountingFormula)

Example 60 with IndexExpressionsSet

use of com.sri.ai.expresso.api.IndexExpressionsSet in project aic-expresso by aic-sri-international.

the class TupleQuantifierSimplifier method rewriteLambdaExpression.

private static Expression rewriteLambdaExpression(LambdaExpression lambdaExpression, Map<Expression, Expression> indexToTypeMap, Map<Expression, Expression> indexToTupleOfVars, Context context) {
    Pair<IndexExpressionsSet, Expression> updatePair = update(lambdaExpression.getBody(), indexToTypeMap, indexToTupleOfVars, context);
    Expression result = new DefaultLambdaExpression(updatePair.first, updatePair.second);
    return result;
}
Also used : DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) Expression(com.sri.ai.expresso.api.Expression) LambdaExpression(com.sri.ai.expresso.api.LambdaExpression) QuantifiedExpression(com.sri.ai.expresso.api.QuantifiedExpression) DefaultLambdaExpression(com.sri.ai.expresso.core.DefaultLambdaExpression) ExtensionalIndexExpressionsSet(com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet) IndexExpressionsSet(com.sri.ai.expresso.api.IndexExpressionsSet)

Aggregations

IndexExpressionsSet (com.sri.ai.expresso.api.IndexExpressionsSet)74 Expression (com.sri.ai.expresso.api.Expression)73 ExtensionalIndexExpressionsSet (com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet)48 IntensionalSet (com.sri.ai.expresso.api.IntensionalSet)24 LambdaExpression (com.sri.ai.expresso.api.LambdaExpression)23 ArrayList (java.util.ArrayList)20 DefaultLambdaExpression (com.sri.ai.expresso.core.DefaultLambdaExpression)17 Type (com.sri.ai.expresso.api.Type)15 QuantifiedExpression (com.sri.ai.expresso.api.QuantifiedExpression)12 Context (com.sri.ai.grinder.api.Context)12 IndexExpressions (com.sri.ai.grinder.library.indexexpression.IndexExpressions)9 Context (com.sri.ai.grinder.sgdpllt.api.Context)9 FunctionType (com.sri.ai.expresso.type.FunctionType)8 Util.mapIntoArrayList (com.sri.ai.util.Util.mapIntoArrayList)8 Rational (com.sri.ai.util.math.Rational)7 List (java.util.List)7 SyntaxTree (com.sri.ai.expresso.api.SyntaxTree)6 QuantifiedExpressionWithABody (com.sri.ai.expresso.api.QuantifiedExpressionWithABody)5 DefaultCountingFormula (com.sri.ai.expresso.core.DefaultCountingFormula)5 DefaultIntensionalMultiSet (com.sri.ai.expresso.core.DefaultIntensionalMultiSet)5