next up previous contents index
Next: Definite Programs Up: Using Tabling in XSB: Previous: Using Tabling in XSB:   Contents   Index


XSB as a Prolog System

Before describing how to program using tabling it is perhaps worthwhile to review some of the goals of XSB. Among them are:

  1. To execute tabled predicates at the speed of compiled Prolog.
  2. To ensure that the speed of compiled Prolog is not slowed significantly by adding the option of tabling.
  3. To ensure that the functionality of Prolog is not compromised by support for tabling.
  4. To provide Prolog functionality in tabled predicates and operators whenever it is semantically sensible to do so.
  5. To provide standard predicates to manipulate tables taken as objects in themselves.

Goals 1 and 2 are addressed by XSB's engine, which in Version 2.5 is based on a memory-copying version of a virtual machine called the SLG-WAM. The overhead for SLD resolution using this machine is small, and usually less than 5%. Thus when XSB is used simply as a Prolog system (i.e., no tabling is used), it is reasonably competitive with other Prolog implementations based on a WAM emulator written in C or assembly. For example, when compiled as a threaded interpreter (see Chapter 3) XSB Version 2.5 is about two times slower than Quintus 3.1.1 or emulated SICStus Prolog 3.1.

Goals 3, 4 and 5 have been nearly met, but there are a few instances in which interaction of tabling with a Prolog construct has not been accomplished, or is perhaps impossible. Accordingly we discuss these instances throughout this chapter. XSB is still under development however, so that future versions may support more transparent mixing of Prolog and tabled code (e.g. allowing tabled predicates in the scope of \+/1) or adding Prolog functionality to tabled predicates or operators (e.g. allowing non-ground negation in tnot/1).


next up previous contents index
Next: Definite Programs Up: Using Tabling in XSB: Previous: Using Tabling in XSB:   Contents   Index
Luis Fernando P. de Castro 2003-06-27