Abstract
Standard logic programming environments, such as Prolog, often suffer from two primary limitations: procedural instability due to infinite loops and an inability to explain why a query failed. Prolog/Ex 1 addresses these issues by introducing a modified inference engine that provides human-readable explanations for both "yes" and "no" answers. By utilizing rule tracking for loop prevention and "conditional proofs" to identify missing links in failed logic, Prolog/Ex 1 transforms the logic interpreter into a transparent expert system capable of providing actionable intelligence even when a conclusion cannot be reached.
Introduction
In the early 1980s, the logic programming language Prolog emerged as a powerful tool for developing knowledge-based systems. Its declarative nature allowed researchers to focus on what a system knew rather than how it should compute results. However, the gap between the logical theory and the procedural execution of the interpreter created significant hurdles for practical use. Specifically, standard Prolog interpreters often failed silently or entered infinite loops when faced with certain recursive rules. Furthermore, when a query failed, the system provided a simple "no," offering no insight into which part of the knowledge base was insufficient.
Adrian Walker’s Prolog/Ex 1 was developed to solve these transparency issues. By generating "conditional proofs," the engine provides a roadmap of the reasoning process, highlighting exactly where a chain of logic broke down.
The Problem: The Procedural Trap and the "No" Black Box
The development of Prolog/Ex 1 was motivated by two specific technical challenges inherent in the logic programming of the era:
- The Procedural Trap: Even if a program is logically sound (declaratively reasonable), the order of rules can cause standard interpreters to fall into unbounded recursion. For example, left-recursive rules—where a predicate calls itself at the start of a definition—typically crash standard Prolog systems.
- The "No" Black Box: Standard Prolog operates under the "Closed World Assumption." If the engine cannot find a proof, it returns "no." In expert systems used for medical or financial advice, a binary "no" is insufficient. Users require an explanation: was a specific fact missing, or did a rule fail to trigger?
Methodology: Transparency through Conditional Logic
Prolog/Ex 1 introduces a modified interpreter with three primary innovations to the standard inference process:
1. Loop Prevention via Rule Tracking
To handle the procedural trap, the engine maintains a record of the rules applied during a specific computation path. A rule is only applied if it has not been used previously in that path, or if the current application represents a more specific case. This mechanism allows Prolog/Ex 1 to assign procedural meaning to programs that would otherwise cause infinite loops, such as those defining transitive relationships.
2. Conditional Proofs for Negative Answers
The most significant innovation of Prolog/Ex 1 is its treatment of failure. When a standard proof fails, the engine does not stop. Instead, it explores "partial proofs" where failing steps are tentatively assumed to succeed. These assumed steps are marked as conditional and flagged with a question mark (?) in the resulting explanation tree. This allows the system to present a "what-if" scenario to the user, showing what would need to be true for the query to succeed.
3. Heuristic Search for Explanations
Because a single query might have many possible proofs (or many ways to fail), the engine uses heuristics to select the most useful explanation:
- For "Yes" answers: The engine seeks the shortest possible proof to ensure the explanation is concise and easy to follow.
- For "No" answers: The engine uses a heuristic to find a conditional explanation where the first "assumption" of success occurs as deep in the reasoning chain as possible. This directs the user toward the most specific point of failure rather than a broad, high-level breakdown.
Evaluation: The Flight Knowledge Base
The engine was evaluated using recursive logic examples and a "Flight Knowledge Base." This dataset consisted of cities (e.g., JFK, BOS, SFO, LAX, LHR) and assertions about flights between them.
In a standard system, asking if a path exists between two cities might result in an infinite loop if the rules are defined transitively (e.g., fly(X, Y) <- fly(X, Z) & fly(Z, Y)). Prolog/Ex 1 successfully navigates these rules. Furthermore, if a user asks for a path that does not exist—for instance, from San Francisco (SFO) to London (LHR)—the engine might show a path that would work if a specific connecting flight existed, flagging the missing flight (e.g., flight(lax, ...)?) to show the user exactly why the query failed.
Key Insights
The core philosophy of Prolog/Ex 1 is that a "no" answer is essentially a "yes" answer with missing pieces. By identifying these missing links and presenting them as part of a proof tree, the system functions as a true inference engine rather than a simple calculator.
Additionally, the system is capable of generalizing questions. If a query involves a constant not present in the database, the engine can explain why no entity of that type could satisfy the query, rather than failing on a technicality. The resulting proof trees can be mapped into "quasi-English" (as seen in the SYLLOG system), making the logic accessible to non-programmers.
Limitations and Future Work
While Prolog/Ex 1 significantly improves transparency, it introduces computational complexity. Assuming failing goals succeed expands the search space, making loop prevention essential for performance. Additionally, the quality of a "no" explanation is highly dependent on the heuristics used to select which failure to highlight. While the "deepest assumption" heuristic is effective for simple domains, more complex knowledge bases might require sophisticated "common sense" heuristics to remain useful. Finally, the paper does not deeply explore how the overhead of tracking rule history scales with massive, real-world knowledge bases.
Conclusion
Prolog/Ex 1 represents an early and vital step toward explainable AI. By treating the proof tree as the primary output and providing a mechanism to explain failure, it transformed logic programming from a black-box execution environment into a transparent tool for decision support.
Summary updated