Documente Academic
Documente Profesional
Documente Cultură
February 1, 2010
2 Tabling
Evaluation
Variant Tabling
3 Subsumptive Tabling
Evaluation
4 Table Space
Variant Table Space
Subsumptive Table Space
5 Objectives
6 Work Plan
SLD shortcomings
?- path(1, Z) Program
path(X, Z) :- path(X, Y),
1. path(1, Z) edge(Y, Z).
path(X, Z) :- edge(X, Z).
3. path(1, Y)
1 2 3
Infinite Loop
Tabling
Tabled Evaluation
Example
1. path(1, Z)
Y = 2 Y = 3
Variant Tabling
Subsumptive Tabling
Theorem
If two subgoals G and G � exist, such that S and S � are the respective
answer sets and G � subsumes G , then S ⊆ S � .
Subsumptive Evaluation
Answers Program
path(X, Z): {(3) X=1 Z=2, (4) X=2 path(X, Z) :- edge(X, Z).
Z=3, (9) X=1 Z=3} path(X, Z) :- edge(X, Y), path(Y, Z).
path(2, Z) {(9) Z=3}
edge(1, 2). edge(2, 3).
path(3, Z): ∅
Example
1. path(X, Z)
X=1,Y=2 X=2,Y=3
3. X = 1 4. X = 2
5. fail 8. path(2, Z) 10. path(3, Z) 11. fail
Z = 2 Z = 3
9. Z = 3
root
a b VAR0
root
a b
a, 5 b, 2 a, 6 b, 2
a, 5 b, 4 a, 2 a, 5 b, 6 a, 2
d, 5 c, 3 a, 1 b, 4 VAR0, 2 d, 5 c, 3 a, 1 c, 6 b, 4 VAR0, 2
Objectives
Work Plan
http://github.com/flavioc/yap/
http://cracs.fc.up.pt/
http://www.dcc.fc.up.pt/~vsc/Yap/
http://flaviocruz.net/