Lean4Lean is a project that formalizes Lean's kernel and type theory within Lean itself. It includes a carbon copy of Lean's kernel written in Lean, allowing for differential testing and verification. The goal is to ensure the correctness of Lean's kernel by proving its properties and potentially replacing the original C++ kernel with a verified one.
The porting of Mathlib from Lean 3 to Lean 4 is significant because it involved translating about a million lines of code, making it the largest porting effort in interactive theorem prover history. The tool MathPort was developed to automate this process, preserving the intent of the original code and ensuring 95% of it worked correctly, with manual cleanup required for the remaining 5%.
The main goal of MetaMath Zero is to create a minimal, fast, and highly verifiable theorem prover kernel. It aims to provide strong guarantees about the correctness of proofs, ensuring that if a theorem is proven, it follows from the axioms without any soundness holes. This is achieved by simplifying the system and making it easy to verify its implementation.
MetaMath differs from other theorem provers like Lean or Coq in its simplicity and focus on ease of verification. It uses a string-based approach rather than a tree structure, and its proofs are encoded as sequences of tokens. This makes it faster and easier to implement a verifier, but it lacks features like dependent types and tactics, which are common in more complex systems like Lean or Coq.
Lean's type theory has undecidable type checking because it includes proof relevance and sub-singleton eliminating inductive types, which complicate the type checking process. The idealized version of Lean's type theory is undecidable, and the actual implementation under-approximates it, sometimes rejecting type-correct terms that would require infinite computation to verify.
The Fermat's Last Theorem project in Lean is significant because it represents a major effort to formalize a well-known mathematical result in an interactive theorem prover. The project, led by Kevin Buzzard, aims to formalize the theorem in Lean, which could be a game-changer for the adoption of Lean among mathematicians and the broader formal verification community.
MetaMath Zero ensures the correctness of its implementation by focusing on simplicity and verifiability. The goal is to prove that the kernel, when executed on a specific architecture like x86, correctly checks that theorems follow from axioms. This involves formalizing the language, specifying its semantics, and proving that the implementation adheres to these specifications.
Key differences between Lean and Coq include Lean's proof relevance and sub-singleton eliminating inductive types, which make its type theory undecidable. Coq, on the other hand, has cumulative universes and a subtyping relation, which simplifies some aspects of type checking. Lean's type theory is also more flexible but harder to analyze, while Coq's is more structured and easier to prove properties about.
The speed of MetaMath's verifier is important because it allows for the practical verification of large-scale mathematical libraries. For example, the entire ZFC set theory in MetaMath can be checked in about 10 seconds with the original verifier and in 1 second with an optimized Rust implementation. This speed is crucial for scalability and adoption, especially when compared to slower systems like Lean or Coq.
Lean plays a significant role in the formalization of mathematics by providing a user-friendly and scalable interactive theorem prover. Its adoption by mathematicians like Terence Tao and its ability to formalize high-level theorems like Fermat's Last Theorem make it a game-changer in the formal verification community. Lean's focus on usability and its growing library, Mathlib, make it an attractive tool for both researchers and educators.
Mario Carneiro is the creator of Mathlib, Lean4Lean and Metamath0. He is currently doing his Postdoc at Chalmers University working on CakeML. In this episode we talk about foundations of theorem provers, type systems properties, semantics and interoperabilities.
If you enjoy the show please consider supporting us at our ko-fi: https://ko-fi.com/typetheoryforall