Efficient data structures for tabled resolution
暂无分享,去创建一个
The use of tabling in logic programming allows bottom-up evaluation to be incorporated in a top-down framework, combining advantages of both. It is only recently that systems based on tabling are beginning to emerge and early experience with them suggests that table based resolution methods are practically viable. Therefore techniques to enhance the performance of tabling systems are becoming important. This Ph.D. dissertation is concerned with the design, implementation and experimental evaluation of data structures and algorithms for high-performance table access.
The essence of our approach is centered around using tries as the basis for representing and manipulating tables. Tries provide complete discrimination for terms, and permit a lookup and possible insertion to be performed in a single pass through a term. A novel technique called substitution factoring is also proposed to reduce the access cost for answers to be 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 as WAM code, or asserted.
While tries are efficient for variant based tabled evaluation, they are limited in their ability to recognize reusable subcomputations. By recognizing such computations and not redoing them, subsumption based tabling systems can yield superior performance. The main challenge here is the design of mechanisms that can efficiently reuse previously computed results.
We propose a novel organization of tables called Dynamic Threaded Sequential Automata for subsumption based tabling and provide mechanisms to manipulate them with minimal overheads. We furnish experimental evidence that subsumption based tabling systems that use our techniques exhibit significantly better performance over those based on variants.
Scheduling strategies that determine the order in which tabled answers are resolved against calls that consume them affect the performance of subsumption based engines in two significant ways. Firstly they can affect the degree of consumption of answers from incomplete tables, which is inherently more expensive than consuming answers from complete tables. Secondly by altering the order in which general and particular calls are made they affect the amount of program clause resolution resulting from the evaluation of a call. We develop an abstract machine for tabled resolution that facilitates formalizing the concept of a scheduling strategy. We show that an optimal scheduling strategy does not exist.
The paradigm of subsumption based tabling does not restrict our ability to handle programs with negation. We show that a subsumption engine can be used to compute the well-founded model of a general program.
Finally, we show the practical realization of our ideas by describing their implementation, and demonstrate their efficiency by performance measurements.