Abstract
This paper details the development and implementation of TKP 1 (Tsukuba-Keio Prover No. 1), an automated theorem prover designed for the formal verification of recursive computer programs. By employing a Gentzen-type sequent calculus and representing programs as functionals, the system automates the generation of induction hypotheses and the simplification of logical expressions. We demonstrate the system's efficacy through the automated proof of equivalence between recursive and iterative implementations of the factorial function.
Introduction
In the mid-1970s, ensuring program correctness was a manual and error-prone process. While theoretical frameworks for program semantics had been established by researchers such as McCarthy and Scott, automating the proofs of these properties remained a significant challenge. TKP 1 was developed to bridge the gap between high-level program logic and the low-level logical steps required for formal verification, specifically targeting the complexities of functionals and fixed-point operators used in recursion.
Methodology
Functional Representation and Logic
The core of TKP 1 lies in its unified mathematical treatment of programs and logic. Programs are represented as compositions of functionals. Crucially, logical formulas are also treated as a special class of functional, allowing the system to use a single engine to simplify both the program structure and the logical properties being tested. The system includes specific rules for "p-type expressions" (McCarthy’s if-then-else), decomposing them into logical branches that the sequent calculus can process.
The Gentzen-Type System
The prover utilizes a "cut-less" Gentzen-type formal system (sequent calculus). By avoiding the "cut" rule, which often leads to an infinite search space in automated reasoning, TKP 1 can systematically decompose complex theorems into smaller, manageable sub-theorems. This approach ensures a more predictable and exhaustive search for proofs.
Automatic Induction
To handle recursive definitions, TKP 1 automatically generates induction hypotheses (e.g., $f^n \to G$) and attempts to prove the $n+1$ case. This allows the system to handle "infinitely long expressions" represented via fixed-point operators without manual intervention.
Implementation and Visualization
TKP 1 was implemented in KLISP (a subset of LISP 1.5) and operated on a TOSBAC 3400/30 computer. Despite the complexity of the task, the entire prover and its data were optimized to fit within just 4K cells of memory.
A key feature of the system is its dedicated "visualizer" phase. This component converts internal S-expression proof representations into a human-readable "staircase" format, which clearly illustrates the logical derivation tree and the steps taken by the machine to reach a conclusion.
Experimental Results
The system was evaluated using classic benchmarks in program verification, most notably the equivalence of recursive and iterative factorial functions. TKP 1 successfully proved that a standard recursive factorial implementation is equivalent to an iterative version using an accumulator. The system also successfully verified various recursive program properties described in contemporary literature (e.g., Manna et al., 1972).
Discussion and Limitations
While TKP 1 demonstrated the feasibility of automated Gentzen-type provers on limited hardware, the authors identified several areas for improvement:
- Algebraic Knowledge: The prover occasionally stalled on simple algebraic identities (e.g., $x \times 1 = x$), suggesting that future iterations should incorporate a library of standard algebraic theorems.
- Dynamic Assumptions: The system struggled with procedural assumptions that change during program execution.
- Interactivity: The authors concluded that while TKP 1 was designed for full automation, an interactive system—where a human could guide the prover through difficult logical leaps—would be more effective for complex, real-world software verification.
Conclusion
TKP 1 represents a foundational step in automated reasoning, proving that a Gentzen-type system could be implemented efficiently enough to handle complex recursive identities. Its unified treatment of logic and computation, combined with automatic induction, provided a blueprint for subsequent developments in formal methods.
Summary updated