This paper introduces an efficient backtracking method for LISP, implemented in the MLISP2 language. The authors argue that by integrating backtracking seamlessly into the language's execution model, they achieve significant performance improvements and ease of use, making nondeterministic programming more practical.
TL;DR
This paper presents an efficient "state-saving" backtracking implementation within the MLISP2 language. By carefully managing state information and integrating it into the LISP interpreter, MLISP2 achieves near-zero overhead for most operations, making nondeterministic programming practical and efficient.
What Problem Does This Paper Address?
Nondeterministic programming, where a program explores multiple possibilities to find a solution, is crucial for many Artificial Intelligence problems. Backtracking is a key control structure that enables this exploration by allowing a program to "undo" a wrong choice and try an alternative. However, early implementations of backtracking systems (like PLANNER) often incurred significant performance penalties, making them impractical for real-world applications. These systems either required programmers to explicitly manage state saving or had inefficient mechanisms for restoring state, leading to either increased programmer burden or substantial overhead. The paper aims to address this by developing an efficient and user-friendly backtracking system.
Methods
The core of MLISP2's approach is a "state-saving" method for backtracking. Unlike "sequential" or "inverse statement" methods that try to undo individual operations, the state-saving method captures the entire state of the computation at a "decision point" (a point where a choice is made). When a failure occurs, the system restores the computation to this saved state, allowing it to explore another alternative.
Key aspects of MLISP2's implementation include:
- Automatic State Saving: The system automatically saves necessary state information, relieving the programmer from this burden.
- Efficient State Representation: MLISP2 leverages LISP's standard variable storage (value cells and property lists). This means fetching variable values is as fast as in deterministic LISP, and stores are only slightly slower in some cases. This is a major efficiency gain over systems like QA4 that significantly degrade variable access times.
- Incremental State Saving: Instead of saving the entire state at every decision point, MLISP2 saves only the incremental changes to the P stack (for local variables and temporary results) and SP stack (for recursive calls) since the last decision point. This is managed using a "low water mark" (LWM) pointer.
- Context Numbers: A unique context number is assigned to each dynamic decision point. This allows for referencing specific backtracking contexts and for "setting variables in context," enabling information to be passed back up the goal tree.
- Property List Variable Handling: For property list variables, MLISP2 saves the old value and context only when a variable is first set within a new context. This avoids redundant saving of information.
The paper also introduces new language features like the LET expression (for pattern matching) and the SELECT expression (for general backtracking in programs), which provide structured ways to incorporate nondeterminism.
Datasets
Not discussed in the paper. The paper focuses on the implementation of a language feature rather than on training or evaluating on specific datasets.
Key Insights and Ideas
- The "State-Saving" Advantage: The paper strongly advocates for the state-saving approach over inverse-statement methods, highlighting its efficiency in restoring the computation to a previous point, especially when many intermediate operations have occurred.
- Seamless Integration is Key: The most significant insight is that by integrating backtracking directly into the LISP interpreter and leveraging existing data structures (value cells, property lists), MLISP2 achieves remarkable efficiency. This avoids the performance degradation seen in earlier systems that treated backtracking as an add-on.
- Automatic vs. Explicit State Management: The authors argue that automatic state saving simplifies programming and reduces bugs compared to systems requiring explicit programmer intervention.
- Nondeterministic GO TOs are Problematic: The paper critiques nondeterministic GO TO-like features (e.g., in ECL) as being less desirable than structured nondeterministic constructs like the
SELECTexpression, drawing parallels to the move away from GO TOs in deterministic programming.
Key Results
The paper claims that MLISP2's backtracking system requires less than ten percent of the execution time of typical jobs. Crucially, most common operations (fetching/storing variables, function entry/exit) take no longer with backtracking than without it. The overhead for maintaining backtracking capability when it's not used is described as "insignificant." The authors state that MLISP2 has been used successfully for two years by the AI community at Stanford, demonstrating its versatility, ease of use, and efficiency.
Limitations and Future Work
- Simplifications in the Table: The authors note that the summary table of backtracking systems is presented with "some simplifications and omissions."
- Comparison to PLANNER/ECL: While MLISP2 offers advantages, it's noted that systems like PLANNER and ECL offer slightly more powerful features, such as the ability to fail to a label. However, the authors argue that these features are analogous to GO TOs and are therefore less desirable.
- Future Work: The paper doesn't explicitly detail future work but implies that the success of MLISP2's approach paves the way for more widespread and practical use of backtracking in programming languages. The focus on efficiency and simplicity suggests that further refinements in these areas would be beneficial.
Summary updated