G3Kappa / Ergo

Other
4 stars 0 forks source link

Tabling and Memoization #6

Closed G3Kappa closed 1 year ago

G3Kappa commented 2 years ago

Waiting on #5.

G3Kappa commented 1 year ago

I'm unclear on why SWI requires attributed variables for tabling. It probably has to do with constraint solvers.

For the time being, tabling has been implemented as follows:

  1. Tabled predicates are marked by the :- table directive;
  2. Tabled predicates are rewritten into several aux predicates plus a wrapper predicate that calls tabled/1 with the (unified) head of the aux predicates as argument;
  3. tabled/1 implements SLDT resolution and overrides the regular SLD resolution for the affected predicates. It's working for the Fibonacci sequence, at least.