Implementation of a Linear Tabling Mechanism

  • Authors:
  • Neng-Fa Zhou;Yi-Dong Shen;Li-Yan Yuan;Jia-Huai You

  • Affiliations:
  • -;-;-;-

  • Venue:
  • PADL '00 Proceedings of the Second International Workshop on Practical Aspects of Declarative Languages
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

Delaying-based tabling mechanisms, such as the one adopted in XSB, are non-linear in the sense that the computation state of delayed calls has to be preserved. In this paper, we present the implementation of a linear tabling mechanism. The key idea is to let a call execute from the backtracking point of a former variant call if such a call exists. The linear tabling mechanism has the following advantages over non-linear ones: (1) it is relatively easy to implement; (2) it imposes no overhead on standard Prolog programs; and (3) the cut operator works as for standard Prolog programs and thus it is possible to use the cut operator to express negation-as-failure and conditionals in tabled programs. The weakness of the linear mechanism is the necessity of re-computation for computing fix-points. However, we have found that re-computation can be avoided for a large portion of calls of directly-recursive tabled predicates. We have implemented the linear tabling mechanism in B-Prolog. Experimental comparison shows that B-Prolog is close in speed to XSB and outperforms XSB when re-computation can be avoided. Concerning space efficiency, B-Prolog is an order of magnitude better than XSB for some programs.