Skip to content

Why tabling seems to need the base case clauses to end with a cut? #2700

Answered by jasagredo
jasagredo asked this question in Q&A
Discussion options

You must be logged in to vote

I think I found the why for this phenomenon. The paper on which tabling is based mentions the following:

The leader, defined in Figure 4, takes responsibility for computing all the answers of its scheduling component...

With figure 4 being:

run_leader(Wrapper,Worker,Table) :-
  create_scheduling_component,
  activate(Wrapper,Worker,Table),
  completion,
  unset_scheduling_component.

And then:

Note that a failure driven loop is used to backtrack over all the alternatives of Worker.

as seen in figure 6:

activate(Wrapper,Worker,Table) :-
  table_set_status(Table,active),
  (
    delim(Wrapper,Worker,Table),
    fail
    ;
    true
  ).

So indeed it will run the predicate and for this to …

Replies: 5 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@jasagredo
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@jasagredo
Comment options

@jjtolton
Comment options

@jasagredo
Comment options

Comment options

You must be logged in to vote
3 replies
@jasagredo
Comment options

@jasagredo
Comment options

@jjtolton
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jasagredo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants