An Interpreter For The Programming Languages Predicate Logic

Sten-Åke Tärnlund

Abstract

In the mid-1970s, the paradigm of "Logic as a Programming Language" sought to bridge the gap between formal reasoning and practical computation. This paper presents an early LISP-based interpreter for predicate logic designed to address the inherent non-determinism of pure logic systems. By employing Kowalski’s connection graphs and allowing for explicit programmer-defined control structures, the interpreter enables efficient execution of complex logical proofs. Experimental results on benchmarks like the "Tower Program" demonstrate significant performance improvements through optimized data representation and graph-simplification heuristics.

Introduction

The transition of predicate logic from a theoretical tool for formalizing human thought to a functional programming environment was historically hindered by the "combinatorial explosion" of search spaces. Without guidance, a computer might explore an unmanageable number of proof paths to find a single answer. This research addresses these hurdles by introducing an interpreter implemented in LISP 1.6 that provides tools to guide search, optimize underlying data structures, and simplify logical graphs to make computation feasible and fast.

Methods

The interpreter is built upon several core pillars. Central to its design is Kowalski’s Procedural Form, where programs are structured as procedures (Horn clauses) where a head is implied by a body of calls. The system represents these programs as connection graphs, where atoms are linked if they can be unified. This graphical representation allows for various execution strategies, including top-down, bottom-up, or "middle-out" approaches.

Figure 1: A connection graph illustrating the unification of 'Part' predicates and the resulting substitutions for variables x, y, and z.

To manage non-determinism, the authors introduced explicit control syntax (using double angle brackets << >>) to order procedure calls, effectively telling the interpreter which logical path to prioritize. Additionally, the "One-Link Evocation" technique simplifies the graph by eagerly resolving procedures connected by a single link, pruning the search space before the primary execution begins. The system also utilizes Robinson’s unification algorithm as its primary engine, computing substitution sets that bridge disparate parts of the program.

Benchmarks and Data Representation

The effectiveness of the interpreter was evaluated using logical benchmarks rather than modern datasets. A primary example is the "Tower Program," a block-stacking problem used to illustrate how pre-processing problems into specific data structures can yield massive performance gains without altering the underlying logic.

Figure 2: The recursive program structure defining a tower of blocks, used to demonstrate the impact of data structure optimization.

Another significant test case was "Knuth’s Zodiac Example," based on algorithms from Donald Knuth’s The Art of Computer Programming. This involved deleting a specific node from a binary tree while maintaining symmetrical order—a complex task for early theorem-proving technology.

Results and Insights

The interpreter demonstrated impressive efficiency for its era. By optimizing the data structure in the Tower benchmark, the authors achieved a 15x speedup over naive logical implementations. The Zodiac example was resolved in just 2.6 seconds at Stanford. Notably, the system successfully found a proof of depth 42 in only 75 seconds, showcasing the power of guided search in logic programming.

One of the key insights of the work is that logic programming makes execution "transparent." Because every step is a formal logical step, debugging becomes a process of identifying logical contradictions or missing assertions, which is often more intuitive than debugging imperative machine code.

Conclusion

This work highlights that in logic programming, data representation and search control are as critical as the logic itself. By treating logic as a transparent execution environment, the authors paved the way for more robust and high-performance logic-based languages. Future work suggests a move toward many-sorted logic to simplify reasoning about data types and more automated handling of non-determinism to reduce the reliance on manual programmer intervention.

Summary updated

BibTeX
@inproceedings{tarnlund1975interpreter,
  author = {Sten-Åke Tärnlund},
  title = {{An Interpreter For The Programming Languages Predicate Logic}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1975},
}
Figure