* calls cache(...) on it and returns it.
* @return let t = lookup(formula) | some t => t,
* cache(formula, formula.op(formula.left.accept(this), formula.right.accept(this))
*/
public final BooleanValue visit(NaryFormula formula) {
final BooleanValue ret = lookup(formula);
if (ret!=null) return ret;
final FormulaOperator op = formula.op();
final Operator.Nary boolOp;
switch(op) {
case AND : boolOp = Operator.AND; break;
case OR : boolOp = Operator.OR; break;
default : throw new IllegalArgumentException("Unknown nary operator: " + op);
}
final BooleanAccumulator acc = BooleanAccumulator.treeGate(boolOp);
final BooleanValue shortCircuit = boolOp.shortCircuit();
for(Formula child : formula) {
if (acc.add(child.accept(this))==shortCircuit)
break;
}