sbool ai_deriveOutput_debug; static Set ai_deriveOutput(L rules, LS facts) { final new NLLogicChecker_v3 c; c.facts = facts; c.rules = rules; final new NLLogicChecker_v2.Matching m; final new LinkedHashSet out; for (final IfThen rule : nlLogic_filterByRHSConstructs(rules, 'output)) { if (ai_deriveOutput_debug) print("ai_deriveOutput: Checking " + rule); c.iterate(rule.in, m, r { if (ai_deriveOutput_debug) print("Got matches: " + sfu(m.matches)); for (Exp e : nlLogic_unrollAnd(rule.out)) { if (e cast Func) if (eq(e.name, "output")) continue with out.add(nlLogic_text(c.apply(e.arg, m))); if (c.checkHelper(e, m)) continue; print("Ignoring unknown RHS element: " + e); } }); } ret out; }