class_docstr: Rules that describe how to deduce facts in logic space
  
  When defined, these rules allow implications to quickly be determined
  for a set of facts. For this precomputed deduction tables are used.
  see `deduce_all_facts`   (forward-chaining)
  
  Also it is possible to gather prerequisites for a fact, which is tried
  to be proven.    (backward-chaining)
  
  
  Definition Syntax
  -----------------
  
  a -> b       -- a=T -> b=T  (and automatically b=F -> a=F)
  a -> !b      -- a=T -> b=F
  a == b       -- a -> b & b -> a
  a -> b & c   -- a=T -> b=T & c=T
  # TODO b | c
  
  
  Internals
  ---------
  
  .full_implications[k, v]: all the implications of fact k=v
  .beta_triggers[k, v]: beta rules that might be triggered when k=v
  .prereq  -- {} k <- [] of k's prerequisites
  
  .defined_facts -- set of defined fact names
code: def _beta_rules_lines(self):
      reverse_implications = defaultdict(list)
      for n, (pre, implied) in enumerate(self.beta_rules):
          reverse_implications[implied].append((pre, n))
  
      yield "# Note: the order of the beta rules is used in the beta_triggers"
      yield "beta_rules = ["
      yield ""
      m = 0
      indices = {}
      for implied in sorted(reverse_implications):
          fact, value = implied
          yield f"    # Rules implying {fact} = {value}"
          for pre, n in reverse_implications[implied]:
              indices[n] = m
              m += 1
              setstr = ", ".join(map(str, sorted(pre)))
              yield f"    ({{{setstr}}},"
              yield f"        {implied!r}),"
          yield ""
      yield "] # beta_rules"
  
      yield "beta_triggers = {"
      for query in sorted(self.beta_triggers):
          fact, value = query
          triggers = [indices[n] for n in self.beta_triggers[query]]
          yield f"    {query!r}: {triggers!r},"
      yield "} # beta_triggers"
  
imports: from collections import defaultdict
  from typing import Iterator
  from .logic import Logic, And, Or, Not
label_desc: Use image node_id 7 for calling the FactRules obj's underlying member method code with example usage: obj._beta_rules_lines() without return types