Fermat's Last Theorem (FLT) Project
repository·main·Indexed 21 days ago
https://github.com/imperialcollegelondon/fltA large-scale effort to formalize a modern proof of Fermat's Last Theorem using the Lean interactive theorem prover. The project utilizes the Verso Blueprint framework to manage complex mathematical dependencies and generate interactive, graph-based documentation that links mathematical statements to Lean declarations.
What's inside flt
- The FLT project is a large-scale effort to formalize a modern proof of Fermat's Last Theorem using the Lean interactive theorem prover (ITP). The goal is to translate complex 20th-century mathematical theories—such as automorphic forms, L-functions, Galois representations, and modularity lifting theorems—into a computer-verifiable format. The project aims to reduce FLT to claims known by the end of the 1980s and uses the blueprint software framework to manage the complex dependency graph of the proof.
Recognize the three core Verso syntax forms
mainWhen authoring in Verso, start by mastering these three fundamental patterns:
#doc (Manual) "Title" =>: Starts a document module.{include 0 Some.Module}: Includes a chapter module into the top-level Blueprint file.:::definition "label_1": Starts a Blueprint block.
Use labels for node identity and dependencies
mainBlueprint nodes (statements, groups, authors, etc.) are identified by unique labels chosen by the author. These labels are stable identifiers used for:
- Dependency references: Using
{uses "label"}[]to create a dependency edge in the graph. - Link-only references: Using
{bpref "label"}[]to link to a node without registering a formal dependency. - Code attachment: Labeling inline
leanorrustblocks to attach them to a Blueprint node. - Metadata: Used in summary pages, graphs, and exported metadata.
Tip: Choose labels early and treat them as stable project identifiers. If a role like
{uses "label"}[]has an empty payload, Blueprint can automatically generate visible text (e.g.,Theorem N).- Dependency references: Using
Use labels to identify and link Blueprint nodes
mainLabels are the core of the Blueprint system. Authors choose stable labels (e.g.,
addition_spec,multiplication_assoc) to identify nodes. These labels enable:- Dependency Tracking: Use
{uses "label"}[]to indicate that a node mathematically depends on the target. Blueprint resolves these forward references during the build. - Prose References: Use
{bpref "label"}[]to create a link in the text that renders as a Blueprint link but does not add an edge to the dependency graph or summary. - Code Attachment: Attach inline Lean code or raw TeX source using labeled
leanortexcode blocks. - Metadata Tagging: Tag compiled declarations using
@[blueprint "label"]. - Graph/Summary Identification: Identify nodes in the generated summary and graph views.
If the payload of a
usesorbprefcommand is empty (e.g.,{uses "label"}[]), Blueprint automatically generates visible text likeTheorem N.- Dependency Tracking: Use
Understand the Dimension Theorem formalization
mainThis module proves the dimension theorem for Noetherian local rings. It establishes that the Krull dimension of a ring $R$ is equal to both the growth degree of its Hilbert-Samuel function and the minimum number of generators of an ideal whose radical is the maximal ideal.
The core theorem is expressed as the cycle:
dim R ≤ growthDeg R ≤ minGenPrimary R ≤ dim R.Key definitions used:
growthDeg R: The least exponent bounding the Hilbert-Samuel function $n \mapsto \text{length}(R / \mathfrak{m}^n)$. Note that this is treated as a formal growth order rather than a constructed polynomial.minGenPrimary R: The least number of generators of an ideal whose radical is the maximal ideal.ringKrullDim R: The Krull dimension of the ring.
ringKrullDim R = (growthDeg R : WithBot ℕ∞) ringKrullDim R = (minGenPrimary R : WithBot ℕ∞)The Blueprint software framework
mainThe blueprint software, developed by Patrick Massot, is a framework used to enable collaboration on large-scale formalization projects. It provides tools for:
- Dependency Management: Creating a blueprint graph that visualizes the progress and logical dependencies of a proof.
- Mathematical Roadmapping: Providing a structured way to write mathematical proofs (often in LaTeX) that serve as a roadmap for formalization in an ITP like Lean.
- Collaboration: Facilitating the transition of mathematical ideas from paper to code by allowing experts to state results clearly for others to formalize.
Understand the structure of a Blueprint project
mainA Blueprint project consists of three primary components:
- Chapter Modules: One or more Lean files containing the mathematical content.
- Blueprint Top-level File: An assembly file (often named
Contents.leanin older examples) that organizes the document and includes chapters. - Generator Entry Point: A file (e.g.,
ProjectTemplateMain.lean) that renders the site.
Key files in a standard template include
lakefile.leanfor package configuration and the generator entry point.Understand the Blueprint mental model
mainA Blueprint project is composed of three primary components:
- Chapter modules: Lean files containing the mathematical content and Blueprint blocks.
- Top-level Blueprint file: An assembly file (often named
Contents.lean, though the name is arbitrary) that imports chapters and configures global pages. - Generator entry point: A file that handles the rendering of the site.
This structure allows you to separate mathematical content from the document assembly and the final rendering logic.
Verify the Dimension Theorem implementation
mainTo verify that the formalization is complete and does not rely on unproven assumptions (using
sorry), use thelakebuild command. You can then inspect the axioms used by the theorem to ensure it only relies on standard Lean axioms.Run the following commands:
# Compile the package lake build FLT.Slop.DimensionTheorem # Check the axioms used by the theorem #print axioms DimensionTheorem.dimension_theoremA successful verification should report only the three standard axioms:
[propext, Classical.choice, Quot.sound].lake build FLT.Slop.DimensionTheoremCreate Blueprint blocks in chapters
mainBlueprint chapters use specific block forms to define mathematical objects. These blocks can be nested or linked via
parentattributes.Core Block Forms:
:::definition "label":::lemma_ "label":::theorem "label":::corollary "label":::proof "label"(Attaches to the preceding statement with the same label):::group "label"(Used for grouping related statements):::author "id" (name := "Name")(Assigns authorship)
Example usage:
:::definition "addition_spec" (parent := "addition_core") We write $`a + b` for the result of adding $`b` to $`a`. ::: :::theorem "addition_right_identity" (parent := "addition_core") (owner := "project_author") For every natural number $`n`, adding zero on the right leaves it unchanged: $`n + 0 = n`. ::: :::proof "addition_right_identity" Induct on $`n`. :::How to contribute to the FLT project
mainThe project is open-source and relies on crowd-sourcing mathematical expertise. To participate:
- Explore the codebase: The formalization work is hosted on GitHub at https://github.com/ImperialCollegeLondon/FLT.
- Review the roadmap: Use the blueprint (an in-progress LaTeX write-up) and the blueprint graph (a dependency graph showing current progress) to understand the mathematical route being taken.
- Collaborate via Zulip: The primary research forum for real-time collaboration between mathematicians and computer scientists is the FLT stream on Lean Zulip. This is the recommended place to make yourself known if you wish to contribute code or mathematical proofs.
Connect Blueprint blocks to Lean code
mainThere are three ways to link Blueprint statements to Lean formalization:
- Inline Lean code: Attach a labeled
leanblock directly after a Blueprint block using the same label. This is best for local formalization. - Compiled Lean declarations: Use the
@[blueprint "label"]attribute on an existing Lean theorem or definition. Blueprint will register it as a node and attempt to use its docstring as the informal statement. - Existing Lean declarations: Use the
(lean := "declaration_name")option in a Blueprint block to point to a Lean-owned declaration without re-stating it.
Reference Table:
Method Syntax Use Case Inline ```lean "label"Local code in the same project Attribute @[blueprint "label"]Registering existing Lean code as a Blueprint node Pointer (lean := "Name")Linking an informal block to an existing Lean name Note:
(lean := "Name")supports comma-separated lists like(lean := "Nat.add, Nat.succ").// Method 2: Attribute @[blueprint "addition_assoc_compiled"] theorem addition_assoc_compiled (a b c : Nat) : (a + b) + c = a + (b + c) := by simpa [Nat.add_assoc]// Method 3: Pointer :::theorem "addition_assoc" (lean := "Nat.add_assoc") For all natural numbers $`a`, $`b`, and $`c`, addition is associative. :::- Inline Lean code: Attach a labeled