DefunT: A Tool for Automating Termination Proofs by Using the Community Books (Extended Abstract)

Matt Kaufmann
DOI: https://doi.org/10.4204/EPTCS.280.12
2018-10-10
Abstract:We present a tool that automates termination proofs for recursive definitions by mining existing termination theorems.
Logic in Computer Science
What problem does this paper attempt to address?
The problem that this paper attempts to solve is the termination proof of automated recursive functions. Specifically, the author introduces a tool named `defunT`, which aims to automate the termination proof of recursive definitions in ACL2 by leveraging the existing termination theorem library (community books). ### Problem Background In formal verification and theorem proving, ensuring the termination of a program is a crucial issue. For recursive functions, proving their termination usually requires constructing a suitable measure and proving that this measure strictly decreases with each recursive call. Completing this process manually can be very tedious and error - prone. ### Solution The `defunT` tool simplifies the termination proof in the following ways: 1. **Utilizing Existing Theorems**: `defunT` depends on a pre - proven database of termination theorems, which are stored as disjunctions. The database is generated by the script `write - td - cands.sh` and saved in the files `td - cands.lisp` and `td - cands.acl2`. 2. **Automated Search and Application**: When a user defines a new recursive function, the `defunT` macro automatically searches for relevant termination theorems in the database and attempts to apply them to the new function. If a matching theorem is found, `defunT` automatically generates the necessary events, including local include - book events containing the required books and helper theorems. 3. **Optimization and Acceleration**: To increase the speed of the proof, `defunT` uses some optimization techniques, such as: - **Clause Simplification**: Simplifying the clause list of the termination theorem to a standardized form for better sub - clause subset testing. - **Hint Strategy**: Using specific hints to guide the proof process, reducing unnecessary clause splitting and theory expansion. ### Example An example given in the paper shows how `defunT` processes a function `f3` with multiple recursive calls. By searching for relevant theorems in the database, `defunT` automatically generates proofs for three termination goals and successfully integrates these proofs into the final function definition. ```lisp (defunt f3 (x y) (if (consp x) (if (atom y) (list (f3 (cddr x) y) (f3 (cadr x) y)) (f3 (cdr x) y)) (list x y))) ``` ### Conclusion The main goal of `defunT` is to simplify the process of proving the termination of recursive functions in ACL2, making it more automated and convenient. Although there are other similar tools (such as Terminatricks), `defunT` provides a unique solution by fully leveraging the existing theorem library in the community books. Future work includes further optimizing the tool's performance, expanding the theorem library, and inviting more researchers to participate in the improvement. ### References [1] Byron Cook, Andreas Podelski & Andrey Rybalchenko (2011): Proving Program Termination. Commun. ACM 54(5), pp. 88–98. [2] Matt Kaufmann, Panagiotis Manolios, J Strother Moore & Daron Vroon (2006): Integrating CCG analysis into ACL2. In: Workshop Proceedings: WST 2006, Eighth International Workshop on Termination, pp. 64–68. [3]