TY - JOUR
T1 - Efficient access mechanisms for tabled logic programs
AU - Ramakrishnan, I. V.
AU - Rao, Prasad
AU - Sagonas, Konstantinos
AU - Swift, Terrance
AU - Warren, David S.
N1 - Funding Information:
The authors thank C.R. Ramakrishnan for his help in the preparation and proofreading of this article, and the anonymous reviewers for their many helpful comments. This research was supported in part by NSF grants CCR 9711386, 9705998, 9702681, 9510072, 9404921, CDA 9303181, INT 9600598 and 9314412, and by a fellowship from the K.U. Leuven Research Council.
PY - 1999
Y1 - 1999
N2 - The use of tabling in logic programming allows bottom-up evaluation to be incorporated in a top-down framework, combining advantages of both. At the engine level, tabling also introduces issues not present in pure top-down evaluation, due to the need for subgoals and answers to access tables during resolution. This article describes the design, implementation, and experimental evaluation of data structures and algorithms for high-performance table access. Our approach uses tries as the basis for tables. Tries, a variant of discrimination nets, provide complete discrimination for terms, and permit a lookup and possible insertion to be performed in a single pass through a term. In addition, a novel technique of substitution factoring is proposed. When substitution factoring is used, the access cost for answers is proportional to the size of the answer substitution, rather than to the size of the answer itself. Answer tries can be implemented both as interpreted structures and as compiled WAM-like code. When they are compiled, the speed of computing substitutions through answer tries is competitive with the speed of unit facts compiled or asserted as WAM code. Because answer tries can also be created an order of magnitude more quickly than asserted code, they form a promising alternative for representing certain types of dynamic code, even in Prolog systems without tabling.
AB - The use of tabling in logic programming allows bottom-up evaluation to be incorporated in a top-down framework, combining advantages of both. At the engine level, tabling also introduces issues not present in pure top-down evaluation, due to the need for subgoals and answers to access tables during resolution. This article describes the design, implementation, and experimental evaluation of data structures and algorithms for high-performance table access. Our approach uses tries as the basis for tables. Tries, a variant of discrimination nets, provide complete discrimination for terms, and permit a lookup and possible insertion to be performed in a single pass through a term. In addition, a novel technique of substitution factoring is proposed. When substitution factoring is used, the access cost for answers is proportional to the size of the answer substitution, rather than to the size of the answer itself. Answer tries can be implemented both as interpreted structures and as compiled WAM-like code. When they are compiled, the speed of computing substitutions through answer tries is competitive with the speed of unit facts compiled or asserted as WAM code. Because answer tries can also be created an order of magnitude more quickly than asserted code, they form a promising alternative for representing certain types of dynamic code, even in Prolog systems without tabling.
KW - Discrimination nets
KW - Implementation
KW - Indexing
KW - SLG-WAM
KW - Tabling
KW - Tries
UR - http://www.scopus.com/inward/record.url?scp=0032755587&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=0032755587&partnerID=8YFLogxK
U2 - 10.1016/S0743-1066(98)10013-4
DO - 10.1016/S0743-1066(98)10013-4
M3 - Article
AN - SCOPUS:0032755587
SN - 0743-1066
VL - 38
SP - 31
EP - 54
JO - Journal of Logic Programming
JF - Journal of Logic Programming
IS - 1
ER -