GroundLiteral first = loopIt.next();
FuzzyExpression antecExp = new FuzzyVariableExpression(first.toString());
while (loopIt.hasNext()) {
antecExp = new FuzzyBinaryExpression(antecExp,
new FuzzyVariableExpression(loopIt.next().toString()),
new SM());
}
// Now create the consequent by stringing together the completion
// formulas of the rules in RMINUS with SM:
Iterator<GroundRule> ruleIt = RMINUS.iterator();
FuzzyExpression consExp;
if (ruleIt.hasNext()) {
GroundRule firstRule = ruleIt.next();
consExp = firstRule.createCompletion();
while (ruleIt.hasNext()) {
consExp = new FuzzyBinaryExpression(consExp,
ruleIt.next().createCompletion(), new SM());
}
} else {
// If RMINUS is empty, we have to have 0.0, i.e. none of the
// rules in RPLUS offer real support and thus all literals in
// the loop should be zero.
consExp = new FuzzyConstantExpression(0.0);
}
return new FuzzyLiteral(1.0, 1.0, new FuzzyBinaryExpression(antecExp, consExp, new IW()));
} else {
// If there is no loop, this method shouldn't have been called, so
// we return an easy literal.