[Paper Review] XSB: Extending Prolog with Tabled Logic Programming
This paper presents XSB, a Prolog system that extends traditional logic programming with tabled logic programming (TLP) to ensure termination and optimal complexity for recursive and negated queries. By integrating tabling with dynamic code, constraints, and multi-threading, XSB enables efficient, declarative programming for complex applications in semantic web, program analysis, and knowledge representation.
The paradigm of Tabled Logic Programming (TLP) is now supported by a number of Prolog systems, including XSB, YAP Prolog, B-Prolog, Mercury, ALS, and Ciao. The reasons for this are partly theoretical: tabling ensures termination and optimal known complexity for queries to a large class of programs. However the overriding reasons are practical. TLP allows sophisticated programs to be written concisely and efficiently, especially when mechanisms such as tabled negation and call and answer subsumption are supported. As a result TLP has now been used in a variety of applications from program analysis to querying over the semantic web. This paper provides a survey of TLP and its applications as implemented in XSB Prolog, along with discussion of how XSB supports tabling with dynamically changing code, and in a multi-threaded environment.
Motivation & Objective
- To extend Prolog with tabled logic programming (TLP) to overcome termination and efficiency issues in recursive and negated queries.
- To enable practical, efficient, and declarative programming by integrating tabling with dynamic code, constraints, and multi-threading in a standard Prolog environment.
- To support advanced knowledge representation paradigms such as non-monotonic reasoning, preferences, and integration with Answer Set Programming (ASP).
- To provide a robust, standards-compliant Prolog system that supports real-world applications in program analysis, semantic web, and medical informatics.
Proposed method
- Uses SLG resolution with tabled subgoals to cache and reuse answers, preventing infinite loops in recursive queries.
- Implements tabled negation using Well-Founded Semantics (WFS) to handle negation in a consistent and terminating manner.
- Applies call and answer subsumption to optimize tabled evaluations by reusing more general answers and avoiding redundant computation.
- Supports incremental tabling and dynamic code modification, enabling runtime updates to predicates and tables.
- Integrates with constraint logic programming via attributed variables and supports CLP(R), CLP(FD), and Constraint Handling Rules (CHR).
- Enables multi-threaded execution with thread-safe table management and shared table access across threads.
Experimental results
Research questions
- RQ1How can tabling be effectively integrated into Prolog to ensure termination and optimal complexity for recursive and negated queries?
- RQ2What mechanisms are required to support dynamic code modification and incremental tabling in a tabled Prolog system?
- RQ3How can tabled logic programming be extended to support non-monotonic reasoning, preferences, and integration with Answer Set Programming?
- RQ4What are the performance and scalability characteristics of tabled Prolog in multi-threaded and constraint-based programming environments?
- RQ5How can tabled Prolog be used to implement complex knowledge representation systems such as Flora-2 and Semantic Web applications?
Key findings
- Tabled logic programming in XSB ensures termination for programs with the bounded term-size property, enabling reliable execution of recursive queries.
- Tabled negation under Well-Founded Semantics allows correct and efficient evaluation of negated subgoals, even in the presence of cycles.
- Call and answer subsumption significantly reduce table space and computation time by reusing more general answers and avoiding redundant derivations.
- XSB supports dynamic code modification and incremental tabling, enabling runtime updates to predicates without recompilation.
- The integration of constraints via attributed variables allows seamless use of CLP(R), CLP(FD), and CHR within the tabled Prolog environment.
- XSB’s multi-threaded support enables scalable, concurrent execution of tabled queries, enhancing performance on modern parallel architectures.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.