Lean
Formalisation projects in Lean.
- A non-Gorenstein point on a smoothable Hilbert scheme: formal proofA formal proof in Lean 4, with no added axiom, that the local ring of the reduced smoothable component of Hilb10(𝔸9) at the square-zero point is not Gorenstein. This is the first assertion of the main theorem of the article; the assertion on the normalization is not formalised.
- Finite algebras of length at most nineteen are smoothable: formal proofA complete formal proof in Lean 4 that, over an algebraically closed field of characteristic zero, every finite quotient of k[x,y,z] of length at most 19 is smoothable, with no added axiom. It formalises the main theorems of Fourteen points in three-space and Nineteen points in three-space.
- Normality of smooth lattice three-polytopes: formal proofA complete formal proof in Lean 4 that every smooth three-dimensional lattice polytope is normal. It formalises the article on the AI results page.
A non-Gorenstein point on a smoothable Hilbert scheme
The theorem
The statement, as written in check/AuditTarget.lean in the archive. That file imports only Mathlib, so the following is all one has to read:
/-- A local ring is Gorenstein when it has finite injective dimension over itself. -/
def IsGorensteinLocal (A : Type u) [CommRing A] : Prop :=
IsLocalRing A ∧ injectiveDimension (ModuleCat.of A A) ≠ ⊤
/-- The 450 coordinates `x(i,j,l)`, `i ≤ j`. -/
abbrev Idx : Type := {v : Fin 9 × Fin 9 × Fin 10 // v.1 ≤ v.2.1}
/-- The polynomial ring in the 450 coordinates. -/
abbrev P : Type u := MvPolynomial Idx k
/-- The evaluation matrix of the functions `1, z₁, …, z₉` at ten points of `k⁹`. -/
def evalMatrix (w : Fin 10 → Fin 9 → k) : Matrix (Fin 10) (Fin 10) k :=
Matrix.of fun a l => Fin.cases 1 (fun m => w a m) l
/-- The structure constants of the algebra of functions on the ten points `w`. -/
noncomputable def simplexPt (w : Fin 10 → Fin 9 → k) : Idx → k := fun v =>
(Matrix.mulVec (evalMatrix w)⁻¹ fun a => w a v.1.1 * w a v.1.2.1) v.1.2.2
/-- The ideal of the chart of the reduced smoothable component: the polynomials vanishing on the
structure constants of all ten-point subschemes on which `1, z₁, …, z₉` is a basis. -/
noncomputable def chartIdeal : Ideal (P k) :=
vanishingIdeal k {x | ∃ w : Fin 10 → Fin 9 → k, IsUnit (evalMatrix w).det ∧ x = simplexPt w}
/-- The point `[Z₀]`, `Z₀ = Spec k[z₁, …, z₉]/(z)²`: all coordinates vanish. -/
noncomputable def origin : Ideal (P k) := Ideal.span (Set.range X)
/-- The maximal ideal of `[Z₀]` in the chart. -/
noncomputable def chartVertex : Ideal (P k ⧸ chartIdeal k) :=
(origin k).map (Ideal.Quotient.mk (chartIdeal k))
/-- **Theorem.** The local ring of the reduced smoothable component of `Hilb₁₀(𝔸⁹)` at `[Z₀]` is not
Gorenstein. -/
def AuditTarget.NotGorenstein : Prop :=
∀ (k : Type u) [Field k] [IsAlgClosed k] [CharZero k],
∃ _ : (chartVertex k).IsMaximal, ¬ IsGorensteinLocal (Localization.AtPrime (chartVertex k))
It is proved in check/AuditCheck.lean from the project’s theorem Nongor10.targetB:
#print axioms Nongor10.stage2 -- 'Nongor10.stage2' depends on axioms: [propext, Classical.choice, Quot.sound]
In words: over an algebraically closed field of characteristic zero, the local ring of the reduced smoothable component of Hilb10(𝔸9) at the point defined by (z1,…,z9)2 is not Gorenstein.
What is and is not formalised
- Formalised: the first assertion of Theorem 1.1 of the article. Also that the chart is an integral variety of dimension 90; that the canonical module of the centred chart is not generated by one element at this point; and the general theorem that
ExtcS(S/J, S) is generated by one element when S is regular local, S/J is Gorenstein and c = dim S − dim S/J. - Not formalised: the second assertion of that theorem, on the normalization and its canonical divisor.
- Not a Lean theorem: Mathlib has no Hilbert schemes, so the step from Hilb10(𝔸9) to the ring above rests on the standard description of the open subset on which 1, z1, …, z9 is a basis, in the coordinates x(i,j,l), and on the smoothable component being the closure of the ten-point subschemes. The ideal is defined as a vanishing ideal, which gives the reduced structure.
Checks
- Clean build of the published archive with Lean 4.34.0 and Mathlib
db00fb39: no errors and nosorry; the archive’sVERIFY.shpasses. - Lean’s kernel replayed the whole development from scratch, Mathlib included (
leanchecker --fresh). - The independent type checker nanoda re-checked the two summary theorems
Nongor10.stage1andNongor10.stage2together with the declarations they depend on, Mathlib included: 57 063 declarations, permitting only the three standard axioms. As a control, it rejected a theorem proved withsorry. - The statements were written a second time using only Mathlib (
check/in the archive) and proved from the theorems of the project.
Building it
tar xzf non_gorenstein_hilbert10_lean.tar.gz cd non_gorenstein_hilbert10_lean lake exe cache get # downloads prebuilt Mathlib lake build ./VERIFY.sh # hashes, clean rebuild, sorry scan, axioms, statement check
This needs elan. With prebuilt Mathlib, a clean build takes about ten minutes on sixteen cores. SHA-256 of the archive (0.3 MB): c75efea653252e5dbaeec96736d418971ac839b6b82394feccb09d92d2fe991c
Licence: PolyForm Strict 1.0.0 (noncommercial use only; no changes or redistribution), except the directory Nongor10/Ported/, which remains under the Apache License 2.0. For other uses, please contact me.
About this formalisation
The formalisation was produced by AI agents working from the article, which it follows in outline but not always in detail: 56 files and about 16 000 lines, including about 3200 lines of generated certificate data checked by Lean’s kernel. About 4100 of these lines, the theory of depth, Cohen–Macaulay rings and Gorenstein local rings, are by Nailin Guan, taken from open pull requests to Mathlib (#31884 and the chain ending in #33380); Nongor10/Ported/PROVENANCE.md lists each source commit and every change.
Finite algebras of length at most nineteen
The theorem
The main theorem, in Hilb3/Main/B19K.lean, and the axioms it depends on:
theorem Hilb3.hilb_le_nineteen {k : Type*} [Field k] [IsAlgClosed k] [CharZero k]
(I : Ideal (MvPolynomial (Fin 3) k)) [Module.Finite k (MvPolynomial (Fin 3) k ⧸ I)]
(hI : Module.finrank k (MvPolynomial (Fin 3) k ⧸ I) ≤ 19) :
Smoothable k (MvPolynomial (Fin 3) k ⧸ I)
#print axioms Hilb3.hilb_le_nineteen
-- 'Hilb3.hilb_le_nineteen' depends on axioms: [propext, Classical.choice, Quot.sound]
In words: over an algebraically closed field of characteristic zero, every quotient of k[x,y,z] of finite length at most nineteen is smoothable. The same statement over ℂ is Hilb3.hilb_le_nineteen_complex; Hilb3.hilb_le_eighteen, hilb_le_seventeen, hilb_le_sixteen, hilb_le_fifteen, hilb_le_fourteen, hilb_le_thirteen and hilb_le_twelve are the cases of length at most 18, 17, 16, 15, 14, 13 and 12. The proof uses only the three standard axioms of Lean’s logic: no sorry, no added axiom and no native_decide.
Results from the literature. The articles use several published results as black boxes. The formalisation proves the ones it needs, with the statements given in Hilb3/Axioms.lean: Zheng’s theorem on finite quotients of surfaces with a rational double point, in all types, and the linkage theorem of Jelisiejew, Ramkumar and Sammartano (arXiv:2409.17009, Section 5.1). With S = k[x,y,z] and m = (x,y,z): if mN ⊆ (f,g,h) + mN+1 and J = (f,g,h) + mN ⊆ I, then the lengths of S/(J:I) and S/I add up to that of S/J, and S/I is smoothable if and only if S/(J:I) is. It also proves Gotzmann’s persistence theorem and Macaulay’s bound in the cases used, the length abc of a complete intersection of three forms without common zero, and the smoothability of very compressed algebras (Douvropoulos, Jelisiejew, Nødland and Teitler). The file also declares one axiom, the smoothability of finite Gorenstein subschemes (Buchsbaum–Eisenbud, Kleppe), which is used only by an alternative argument for one case kept in the source; no main theorem depends on it, as the axiom list above shows and the archive’s VERIFY.sh checks.
What “smoothable” means
A basis of a d-dimensional algebra gives its structure constants, a point of kd×d×d. The étale locus is the set of structure constants of the split algebra kd in all of its bases, and an algebra is Smoothable when its structure constants, in some basis, lie in the Zariski closure of the étale locus. These definitions, verbatim from the source:
/-- The Zariski closure of `S ⊆ σ → k`: common zeros of all polynomials vanishing on `S`. -/
def zclosure (S : Set (σ → k)) : Set (σ → k) :=
{x | ∀ p : MvPolynomial σ k, (∀ y ∈ S, eval y p = 0) → eval x p = 0}
/-- The structure constants of `A` in the basis `b`: `b i * b j = ∑ l, structConst b (i, j, l) • b l`. -/
noncomputable def structConst {A : Type*} [CommRing A] [Algebra k A] {d : ℕ}
(b : Basis (Fin d) k A) : SCIdx d → k :=
fun ijl => b.repr (b ijl.1 * b ijl.2.1) ijl.2.2
/-- The étale locus: structure constants of the split algebra `Fin d → k` in all of its bases. -/
def etaleLocus (d : ℕ) : Set (SCIdx d → k) :=
Set.range fun b : Basis (Fin d) k (Fin d → k) => structConst b
/-- A (finite) commutative `k`-algebra is smoothable if, in some basis, its structure constants lie in
the Zariski closure of the étale locus. An algebra without a finite basis is not smoothable. -/
def Smoothable (A : Type*) [CommRing A] [Algebra k A] : Prop :=
∃ (d : ℕ) (b : Basis (Fin d) k A), structConst b ∈ zclosure (etaleLocus k d)
That this agrees with smoothability in the Hilbert scheme of points of affine three-space — so that the theorem says that the Hilbert scheme of d points in 𝔸3 is irreducible for d ≤ 19 — is a published result (Cartwright, Erman, Velasco and Viray, Hilbert schemes of 8 points, Lemma 4.1). It is cited, not formalised.
Checks
- Clean build of the published archive with Lean 4.34.0 and Mathlib
db00fb39: no errors and nosorry; the archive’sVERIFY.shpasses. - Lean’s kernel re-checked every declaration of the project, each of its 2013 modules against the modules it imports (
leanchecker). - The independent type checker nanoda re-checked the main theorems for lengths 14, 16, 17, 18 and 19 (the last four also over ℂ), the theorem on very compressed algebras and Zheng’s theorem for types E7 and E8, together with the declarations they depend on, Mathlib included: 115 997 declarations, permitting only the three standard axioms.
- The statements were written a second time using only Mathlib and the definition above (
check/in the archive) and proved from the theorems of the project. - For lengths at most twelve, two independent reviews of the formal statements against the article found no error.
Building it
tar xzf points_in_three_space_lean.tar.gz cd points_in_three_space_lean lake exe cache get # downloads prebuilt Mathlib lake build ./VERIFY.sh # hashes, clean rebuild, sorry scan, axioms, statement check
This needs elan. Because of the certificates for type E8, a clean build takes many hours and needs plenty of memory. SHA-256 of the archive (12 MB): 5951f4e92769eebeba34cb4f32128838edb237c1239ac6b319b43472c711a093
Licence: PolyForm Strict 1.0.0. Free to download, build and use for noncommercial purposes; no changes, redistribution or sale.
About this formalisation
The formalisation was produced by AI agents working from the articles Fourteen points in three-space and Nineteen points in three-space, which it follows in outline but not always in detail: 2012 files and about 420 000 lines. Of these, 1075 files (about 109 000 lines, mostly generated certificate data) prove Zheng’s theorem for types E7 and E8. Types An, Dn and E6 have proofs of their own; for E7 the binary octahedral group is treated as an index-two extension of the group of type E6; for E8 Zheng’s reduction to moves between irreducible types is used for the binary icosahedral group over ℚ(i,√3,√5), and each move is certified by exact certificates that Lean’s kernel re-checks.
For the very compressed algebras the formalisation proves that k[x,y,z]/I is smoothable whenever (x,y,z)4 ⊆ I ⊆ (x,y,z)3, in every length from 10 to 20 (Hilb3.smoothable_veryCompressed_three), by an elementary form of the strategy of Douvropoulos, Jelisiejew, Nødland and Teitler: limits of scaled configurations of points, a Jacobian criterion for density, and an exact rational certificate for each case, checked by Lean’s kernel. The linkage theorem is proved directly for the notion of smoothability above, by deforming a complete intersection over a smoothing of the residual scheme; one ingredient is that a factor of a smoothable product of algebras is smoothable.
Status. Complete: the main theorems of both articles, lengths up to nineteen, with standard axioms only.
Previous versions remain available: lengths at most eighteen, points_in_three_space_lean_v5.tar.gz (SHA-256 2250bb97d2590139b211a5030c426c5e2d2f215505fa77b2b23447b87dbbaca1); lengths at most sixteen, points_in_three_space_lean_v4.tar.gz (SHA-256 0ce2e289db0b9984f406047771003619a33c38bfb7011774f299a2b80fa76d6f); lengths at most fifteen, assuming the linkage theorem, points_in_three_space_lean_v3.tar.gz (SHA-256 787053fff616b3d26d2eedbac7ed0b9a64281677e41f7daa52cb3e2f453a40be); lengths at most fourteen, points_in_three_space_lean_v2.tar.gz (SHA-256 fc6ec6de6fa871b91d27009bc3090d205df68c08d8b2c3dce6676c1958b465cd); lengths at most twelve, points_in_three_space_lean_v1.tar.gz (SHA-256 c3dc79fce73646c6dbd812067bb0a4fd7998649967e25fd0eb6f4e40abe8352d).
Normality of smooth lattice three-polytopes
The theorem
The main theorem, in Odanorm/Main.lean, and the axioms it depends on:
theorem oda_normality_dim_three (P : SmoothPolytope) : IsNormal P.carrier #print axioms Odanorm.Main.oda_normality_dim_three -- 'Odanorm.Main.oda_normality_dim_three' depends on axioms: [propext, Classical.choice, Quot.sound]
These are the three standard axioms of Lean’s logic. The proof uses no sorry, no added axiom and no native_decide, and lake build itself checks the axiom list.
What the statement says
Normality is the integer decomposition property: for every k ≥ 1, every lattice point of kP is a sum of k lattice points of P. A SmoothPolytope is a lattice polytope in ℝ³ given both by an irredundant facet description with primitive normals and by its vertices; at every vertex it coincides locally with the cone spanned by a basis of ℤ³. The source also proves that the unit cube is a SmoothPolytope, so the theorem is not vacuous.
Below is everything the statement refers to apart from Mathlib, verbatim from the source (pr is declared under variable {n : ℕ}).
/-- The ambient real space. -/
abbrev E (n : ℕ) := Fin n → ℝ
/-- The lattice `M ≅ ℤⁿ`. -/
abbrev L (n : ℕ) := Fin n → ℤ
/-- The inclusion `M ↪ M_ℝ`. -/
def toE {n : ℕ} (x : L n) : E n := fun i => (x i : ℝ)
/-- A lattice covector, viewed in `M_ℝ` via the standard identification `N ≅ ℤⁿ`. -/
def covectorToE {n : ℕ} (b : L n) : E n := fun i => (b i : ℝ)
/-- The `k`-fold dilate. For convex `S` this agrees with the `k`-fold Minkowski sum. -/
def dilate {n : ℕ} (k : ℝ) (S : Set (E n)) : Set (E n) := {x | ∃ s ∈ S, x = k • s}
/-- `P` is `k`-normal: every lattice point of `kP` is a sum of `k` lattice points of `P`. -/
def KNormal {n : ℕ} (P : Set (E n)) (k : ℕ) : Prop :=
∀ z : L n, toE z ∈ dilate (k : ℝ) P →
∃ f : Fin k → L n, (∀ i, toE (f i) ∈ P) ∧ z = ∑ i, f i
/-- `P` is normal (has the integer decomposition property). -/
def IsNormal {n : ℕ} (P : Set (E n)) : Prop := ∀ k : ℕ, 1 ≤ k → KNormal P k
/-- The pairing `⟪u, y⟫` used throughout. -/
def pr (u y : E n) : ℝ := ∑ i, u i * y i
/-- `e` is a `ℤ`-basis of `M = ℤ³`. -/
def IsLatticeBasis (e : Fin 3 → L 3) : Prop :=
∀ x : L 3, ∃! t : Fin 3 → ℤ, x = ∑ j, t j • e j
/-- `u ∈ N` is primitive: nonzero, and not a proper multiple of a lattice covector. -/
def IsPrimitive (u : L 3) : Prop :=
u ≠ 0 ∧ ∀ (k : ℤ) (v : L 3), u = k • v → k = 1 ∨ k = -1
/-- **A smooth lattice three-polytope**, `thm:main`.
Fields `hfacets`/`hverts` carry the two descriptions of the same set; Minkowski–Weyl,
which would produce one from the other, is not available, so both are data. `hprim`,
`hinj`, `hirred` say the normals are *primitive*, *pairwise distinct*, and that the
presentation is *irredundant*, which is what `\eqref{eq:facet-presentation}` gives; mere
attainment of each inequality would be weaker, and is derived from `hirred` as
`FacetDepthCore.attained`. `hfulldim` is
`dim P = 3`. `hextreme` says `verts` really is the vertex set (no point of it is in the
hull of the others). `hsmooth` is smoothness. -/
structure SmoothPolytope where
/-- the index set of the facets -/
ι : Type
fintypeι : Fintype ι
nonemptyι : Nonempty ι
/-- the primitive outward facet normals `u_ρ ∈ N` -/
u : ι → L 3
/-- the right-hand sides `a_ρ` -/
a : ι → ℝ
/-- the vertex set -/
verts : Finset (L 3)
/-- the polytope `P ⊆ M_ℝ` -/
carrier : Set (E 3)
/-- `P = {x : ⟪u_ρ, x⟫ ≤ a_ρ for every ρ}` -/
hfacets : carrier = {x : E 3 | ∀ j, pr (covectorToE (u j)) x ≤ a j}
/-- `P = conv(verts)`, so `P` is a lattice polytope -/
hverts : carrier = convexHull ℝ (toE '' (verts : Set (L 3)))
/-- the normals are primitive -/
hprim : ∀ j, IsPrimitive (u j)
/-- distinct facets have distinct normals -/
hinj : Function.Injective u
/-- **the presentation is irredundant** — `\eqref{eq:facet-presentation}`. No
inequality may be dropped: for every `j` the body cut out by the *other* inequalities
differs from `P`. (It always *contains* `P`, so `≠` is strict containment, i.e. some
point satisfies every inequality but the `j`-th.) This is what makes the `u j` the
facet normals; mere *attainment* of each inequality would be strictly weaker, and is
recovered from this field as the theorem `FacetDepthCore.attained` below. -/
hirred : ∀ j, carrier ≠ {x : E 3 | ∀ l, l ≠ j → pr (covectorToE (u l)) x ≤ a l}
/-- `dim P = 3` -/
hfulldim : affineSpan ℝ (toE '' (verts : Set (L 3))) = ⊤
/-- `verts` is exactly the vertex set -/
hextreme : ∀ v ∈ verts, toE v ∉ convexHull ℝ (toE '' ((verts : Set (L 3)) \ {v}))
/-- **smoothness**: at every vertex `P` is locally the simplicial cone spanned by a
lattice basis -/
hsmooth : ∀ v ∈ verts, ∃ (e : Fin 3 → L 3) (ε : ℝ), 0 < ε ∧ IsLatticeBasis e ∧
∀ x : E 3, dist x (toE v) < ε →
(x ∈ carrier ↔ ∃ t : Fin 3 → ℝ, (∀ j, 0 ≤ t j) ∧ x = toE v + ∑ j, t j • toE (e j))
Checks
Carried out on the archive on 26 September 2026. On 28 September only the licence was added; the code is unchanged and the new archive passes VERIFY.sh again.
- Clean build from the archive with Lean 4.34.0 and Mathlib
db00fb39: no errors and nosorry. - Lean’s kernel re-checked every declaration, including all of Mathlib (
leanchecker --fresh). - The independent type checker nanoda re-checked the theorem and everything it depends on (39 201 declarations, including the parts of Mathlib it uses), permitting only the three axioms above.
Building it
tar xzf oda_normality_lean.tar.gz cd oda_normality_lean lake exe cache get # downloads prebuilt Mathlib lake build ./VERIFY.sh # hashes, clean rebuild, sorry scan, axioms
This needs elan; the archive pins the Lean toolchain and the Mathlib commit. SHA-256 of the archive: 449dc2f91d01be395a08a11605561d483a551d49e93000ca7079753b9267c2e2
Licence: PolyForm Strict 1.0.0 (file LICENSE in both archives). Free to download, build and use for noncommercial purposes; no changes, redistribution or sale.
About this version
This is a shortened version of the original formal development: 46 files and about 10 700 lines instead of 71 files and 37 000, with the same theorem and the same definitions. Several steps are proved differently from the article; for instance, a single “octahedron lemma” replaces the route through Howe’s theorem and Pick’s formula in Section 7 and the odd-index argument in Section 8, and the matrix lemma is used in a scaled form that needs no invertibility. The README.md in the archive lists the changes. An earlier, longer version (about 21 000 lines) remains available: tar.gz. The opening section of the article describes how the proof and the formalisation were produced.