use of com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet in project aic-expresso by aic-sri-international.
the class IndexExpressions method makeExtensionalIndexExpressionsSetFromSymbolsAndTypesStrings.
public static ExtensionalIndexExpressionsSet makeExtensionalIndexExpressionsSetFromSymbolsAndTypesStrings(String... symbolsAndTypes) {
Expression[] symbolsAndTypesExpressions = GrinderUtil.makeListOfSymbolsAndTypesExpressionsFromSymbolsAndTypesStrings(symbolsAndTypes);
List<Expression> indexExpressions = GrinderUtil.makeIndexExpressionsFromSymbolsAndTypes(symbolsAndTypesExpressions);
ExtensionalIndexExpressionsSet result = new ExtensionalIndexExpressionsSet(indexExpressions);
return result;
}
use of com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet in project aic-expresso by aic-sri-international.
the class ThereExists method make.
public static Expression make(IndexExpressionsSet indexExpressions, Expression body) {
Expression current = body;
List<Expression> indexExpressionsList = ((ExtensionalIndexExpressionsSet) indexExpressions).getList();
for (int i = indexExpressionsList.size() - 1; i >= 0; i--) {
current = make(indexExpressionsList.get(i), current);
}
return current;
}
use of com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet in project aic-expresso by aic-sri-international.
the class GrinderUtil method makeIndexExpressionsForIndicesInListAndTypesInRegistry.
/**
* Returns a list of index expressions corresponding to the given indices and their types per the registry, if any.
*/
public static ExtensionalIndexExpressionsSet makeIndexExpressionsForIndicesInListAndTypesInRegistry(Collection<Expression> indices, Registry registry) {
List<Expression> indexExpressions = new LinkedList<Expression>();
for (Expression index : indices) {
Expression type = registry.getTypeExpressionOfRegisteredSymbol(index);
Expression indexExpression = IndexExpressions.makeIndexExpression(index, type);
indexExpressions.add(indexExpression);
}
return new ExtensionalIndexExpressionsSet(indexExpressions);
}
use of com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet in project aic-expresso by aic-sri-international.
the class AbstractFunctionBasedGroup method makeProblemExpression.
public Expression makeProblemExpression(List<Expression> indices, List<Expression> indicesTypes, Expression constraint, Expression body) {
List<Expression> indexExpressions = makeIndexExpressions(indices, indicesTypes);
IndexExpressionsSet indexExpressionsSet = new ExtensionalIndexExpressionsSet(indexExpressions);
DefaultIntensionalMultiSet set = new DefaultIntensionalMultiSet(indexExpressionsSet, body, constraint);
Expression problem = apply(getQuantifierFunctionString(), set);
return problem;
}
use of com.sri.ai.expresso.core.ExtensionalIndexExpressionsSet in project aic-expresso by aic-sri-international.
the class SimplifierForQuantificationOn method applySimplifier.
@Override
public Expression applySimplifier(Expression expression, Context context) {
Expression result;
try {
QuantifiedExpressionWithABody quantifiedExpression = (QuantifiedExpressionWithABody) expression;
Expression body = quantifiedExpression.getBody();
ExtensionalIndexExpressionsSet indexExpressions = (ExtensionalIndexExpressionsSet) quantifiedExpression.getIndexExpressions();
// the set is intensional, but not the set of index expressions!
result = quantifierEliminator.extendContextAndSolve(group, indexExpressions, TRUE, body, context);
} catch (IllegalArgumentException exception) {
result = expression;
}
return result;
}
Aggregations