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