YAP 7.1.0
Tabling

YAPTab is the tabling engine that extends YAP's execution model to support tabled evaluation for definite programs More...

Detailed Description

YAPTab is the tabling engine that extends YAP's execution model to support tabled evaluation for definite programs

YAPTab was implemented by Ricardo Rocha and its implementation is largely based on the ground-breaking design of the XSB Prolog system, which implements the SLG-WAM Tables are implemented using tries and YAPTab supports the dynamic intermixing of batched scheduling and local scheduling at the subgoal level Currently, the following restrictions are of note:

To experiment with YAPTab use --enable-tabling in the configure script or add -DTABLING to YAP_EXTRAS in the system's Makefile We next describe the set of built-ins predicates designed to interact with YAPTab and control tabled execution:


Class Documentation

◆ abolish_table/1

class abolish_table/1

YapTab extends the Yap Prolog engine to support sequential tabling.

YapOr extends the Yap Prolog engine to support or-parallelism YapOr extends the Yap Prolog engine to support or-parallelism

abolish_table(+ P)

Removes all the entries from the table space for predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn]) The predicate remains as a tabled predicate

◆ is_tabled/1

class is_tabled/1

is_tabled(+ P)

Succeeds if the predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn]), of the form name/arity, is a tabled predicate

◆ show_table/1

class show_table/1

show_table(+ P)

Prints table contents (subgoals and answers) for predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn])

◆ table/1

class table/1

table( + P )

Declares predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn]) as a tabled predicate P must be written in the form name/arity Examples:

:- table @ son/3 .
:- table @ father/2 .
:- table @ mother/2 .

or

:- table @ son/3 , @ father/2 , @ mother/2 .

or

:- table [son/3, @ref father/2 , @ref mother/2 ].

◆ table_statistics/1

class table_statistics/1

table_statistics(+ P)

Prints table statistics (subgoals and answers) for predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn])

◆ tabling_mode/2

class tabling_mode/2

tabling_mode(+ P,? Mode)

Sets or reads the default tabling mode for a tabled predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn]) The list of Mode options includes:

  • batched

    Defines that, by default, batched scheduling is the scheduling strategy to be used to evaluated calls to predicate P

  • local

    Defines that, by default, local scheduling is the scheduling strategy to be used to evaluated calls to predicate P

  • exec_answers

    Defines that, by default, when a call to predicate P is already evaluated (completed), answers are obtained by executing compiled WAM-like code directly from the trie data structure This reduces the loading time when backtracking, but the order in which answers are obtained is undefined

  • load_answers

    Defines that, by default, when a call to predicate P is already evaluated (completed), answers are obtained (as a consumer) by loading them from the trie data structure This guarantees that answers are obtained in the same order as they were found Somewhat less efficient but creates less choice-points

The default tabling mode for a new tabled predicate is batched and exec_answers To set the tabling mode for all predicates at once you can use the yap_flag/2 predicate as described next