Single Time-Stamped Tries for Retroactive Call Subsumption
📝 Abstract
Tabling is an evaluation strategy for Prolog programs that works by storing answers in a table space and then by using them in similar subgoals. Some tabling engines use call by subsumption, where it is determined that a subgoal will consume answers from a more general subgoal in order to reduce the search space and increase efficiency. We designed an extension, named Retroactive Call Subsumption (RCS), that implements call by subsumption independently of the call order, thus allowing a more general subgoal to force previous called subgoals to become answer consumers. For this extension, we propose a new table space design, the Single Time Stamped Trie (STST), that is organized to make answer sharing across subsumed/subsuming subgoals simple and efficient. In this paper, we present the new STST table space design and we discuss the main modifications made to the original Time Stamped Tries approach to non-retroactive call by subsumption. In experimental results, with programs that stress some deficiencies of the new STST design, some overheads may be observed, however the results achieved with more realistic programs greatly offset these overheads.
💡 Analysis
Tabling is an evaluation strategy for Prolog programs that works by storing answers in a table space and then by using them in similar subgoals. Some tabling engines use call by subsumption, where it is determined that a subgoal will consume answers from a more general subgoal in order to reduce the search space and increase efficiency. We designed an extension, named Retroactive Call Subsumption (RCS), that implements call by subsumption independently of the call order, thus allowing a more general subgoal to force previous called subgoals to become answer consumers. For this extension, we propose a new table space design, the Single Time Stamped Trie (STST), that is organized to make answer sharing across subsumed/subsuming subgoals simple and efficient. In this paper, we present the new STST table space design and we discuss the main modifications made to the original Time Stamped Tries approach to non-retroactive call by subsumption. In experimental results, with programs that stress some deficiencies of the new STST design, some overheads may be observed, however the results achieved with more realistic programs greatly offset these overheads.
📄 Content
Single Time-Stamped Tries for Retroactive Call Subsumption Fl´avio Cruz and Ricardo Rocha CRACS & INESC-Porto LA, Faculty of Sciences, University of Porto Rua do Campo Alegre, 1021/1055, 4169-007 Porto, Portugal {flavioc,ricroc}@dcc.fc.up.pt Abstract. Tabling is an evaluation strategy for Prolog programs that works by storing answers in a table space and then by using them in similar subgoals. Some tabling engines use call by subsumption, where it is determined that a subgoal will consume answers from a more gen- eral subgoal in order to reduce the search space and increase efficiency. We designed an extension, named Retroactive Call Subsumption (RCS), that implements call by subsumption independently of the call order, thus allowing a more general subgoal to force previous called subgoals to become answer consumers. For this extension, we propose a new table space design, the Single Time Stamped Trie (STST), that is organized to make answer sharing across subsumed/subsuming subgoals simple and efficient. In this paper, we present the new STST table space design and we discuss the main modifications made to the original Time Stamped Tries approach to non-retroactive call by subsumption. In experimental results, with programs that stress some deficiencies of the new STST design, some overheads may be observed, however the results achieved with more realistic programs greatly offset these overheads. Keywords: Tabled Evaluation, Call Subsumption, Implementation. 1 Introduction Tabling is an evaluation technique for Prolog systems that has several advantages over traditional SLD resolution: reduction of the search space, elimination of loops, and better termination properties [1]. In a nutshell, tabling works by storing found answers in a memory area called the table space and then by reusing those answers in similar calls that appear during the resolution process. First calls to tabled subgoals are considered generators because they are evaluated as usual and their answers are stored in the table space. Similar calls are named consumers because, instead of executing program code, they are evaluated by consuming the answers stored in the table space for the corresponding similar generator subgoal. There are two main approaches to determine if two subgoals A and B are similar: – Variant-based tabling: A and B are variants if they can be made identical up to variable renaming. For example, p(X, 1, Y ) is a variant of p(W, 1, Z) because both can be transformed into p(V AR0, 1, V AR1); arXiv:1112.3779v1 [cs.PL] 16 Dec 2011 – Subsumption-based tabling: A is considered similar to B if A is subsumed by B (or B subsumes A), i.e., if A is more specific than B (or an instance of). For example, subgoal p(X, 1, f(a, b)) is subsumed by subgoal p(Y, 1, Z) because there is a substitution {Y = X, Z = f(a, b)} that makes p(X, 1, f(a, b)) an instance of p(Y, 1, Z). Tabling by call subsumption is based on the principle that if A is subsumed by B and SA and SB are the respective answer sets, therefore SA ⊆SB. Please notice that when using some extra-logical features of Prolog, such as the var/1 predicate, this assumption may not hold. Because subsumption-based tabling can detect a larger number of similar subgoals, variant and subsumed subgoals, it allows greater reuse of answers and thus better space usage, since the answer sets for the subsumed subgoals do not need to be stored. Moreover, subsumption-based tabling has also the potential to be more efficient than variant-based tabling because the search space tends to be reduced as less code is executed [2]. Despite all these advantages, the more strict semantics of subsumption-based tabling and the challenge of implementing it efficiently makes variant-based tabling more popular among the available tabling systems. XSB Prolog [3] was the first Prolog system providing support for subsumption- based tabling by introducing a new data structure, the Dynamic Threaded Se- quential Automata (DTSA) [4], that permits incremental retrieval of answers for subsumed subgoals. However, the DTSA design had one major drawback, namely, the need for two data structures for the same information. A more space efficient design, called Time-Stamped Trie (TST) [2, 5], solved this by using only one data structure. Despite the advantages of subsumption-based tabling, the degree of answer reuse might depend heavily on the call order of the subgoals. To take effective advantage of subsumption-based tabling in XSB, the more general subgoals should be called before the specific ones. When this does not happen, answer reuse does not occur and Prolog code is executed for both subgoals. Recently, we implemented a novel design, called Retroactive Call Subsump- tion (RCS) [6], that extends the original TST approach by also allowing sharing of answers when a subsumed subgoal is called before a subsuming subgoal. Our extension enables answer reuse independently of the subgoal call order and there- fore increases the usefulness o
This content is AI-processed based on ArXiv data.