Lean4Lean: Towards a Verified Typechecker for Lean, in Lean (2403.14064v2)
Abstract: In this paper we present a new "external checker" for the Lean theorem prover, written in Lean itself. This is the first complete typechecker for Lean 4 other than the reference implementation in C++ used by Lean itself, and our new checker is competitive with the original, running between 20% and 50% slower and usable to verify all of Lean's mathlib library, forming an additional step in Lean's aim to self-host the full elaborator and compiler. Moreover, because the checker is written in a language which admits formal verification, it is possible to state and prove properties about the kernel itself, and we report on some initial steps taken in this direction to formalize the Lean type theory abstractly and express the relation between the kernel functions and the type theory. We plan to use this project to help justify any future changes to the kernel and type theory and ensure unsoundness does not sneak in through either the abstract theory or implementation bugs.
- Failure of Normalization in Impredicative Type Theory with Proof-Irrelevant Propositional Equality. Logical Methods in Computer Science, Volume 16, Issue 2, June 2020. URL: https://lmcs.episciences.org/6606, doi:10.23638/LMCS-16(2:14)2020.
- Coq in Coq. Available on the WWW, 1997.
- Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions. Springer Science & Business Media, 2013.
- Mario Carneiro. The Type Theory of Lean. 2019. URL: https://github.com/digama0/lean-type-theory/releases/tag/v1.0.
- Mario Carneiro. Metamath zero: Designing a theorem prover prover. In Intelligent Computer Mathematics: 13th International Conference, CICM 2020, Bertinoro, Italy, July 26–31, 2020, Proceedings, page 71–88, Berlin, Heidelberg, 2020. Springer-Verlag. doi:10.1007/978-3-030-53518-6_5.
- A self-verifying theorem prover. PhD thesis, University of Texas, 2009.
- The Lean Theorem Prover (system description). In International Conference on Automated Deduction, pages 378–388. Springer, 2015.
- Peter Dybjer. Inductive Families. Formal aspects of computing, 6(4):440–465, 1994.
- John Harrison. Towards self-verification of hol light. In Ulrich Furbach and Natarajan Shankar, editors, Proceedings of the third International Joint Conference, IJCAR 2006, volume 4130 of Lecture Notes in Computer Science, pages 177–191, Seattle, WA, 2006. Springer-Verlag.
- CakeML: A Verified Implementation of ML. SIGPLAN Not., 49(1):179–191, January 2014. URL: http://doi.acm.org/10.1145/2578855.2535841, doi:10.1145/2578855.2535841.
- Coq Coq correct! verification of type checking and erasure for Coq, in Coq. Proc. ACM Program. Lang., 4(POPL), dec 2019. doi:10.1145/3371076.
- Sebastian Andreas Ullrich. An Extensible Theorem Proving Frontend. PhD thesis, Karlsruher Institut für Technologie (KIT), 2023. doi:10.5445/IR/1000161074.