Papers
Topics
Authors
Recent
Search
2000 character limit reached

A Prime-Generated Formalization of Nagata's Factoriality Theorem in Lean 4

Published 6 Apr 2026 in math.AC and cs.LO | (2604.05238v1)

Abstract: We present a Lean 4 Mathlib formalization of Nagata's factoriality theorem: if R is a noetherian domain and S <= R is a prime-generated submonoid such that S{-1}R is a UFD, then R itself is a UFD. The prime-generated hypothesis -- every element of S is a finite product of primes belonging to S -- replaces a superficially cleaner but degenerate prime-or-unit condition that the formalization effort exposed. The development packages the theorem both for the concrete type Localization S and through abstract IsLocalization formulations. As applications, we formalize two Nagata-based proofs that R[X] is a UFD whenever R is a noetherian UFD: one via Laurent-polynomial localization at powers of X, and one via localization at the constant primes and identification with Frac(R)[X]. Reusing the same package, we also obtain the iterated polynomial corollary R[X][Y]. No public formalization of this result is known to us in Lean, Coq, or Isabelle.

Summary

  • The paper formalizes Nagata’s factoriality theorem in Lean 4 by introducing prime-generated conditions to transfer unique factorization from localizations to base rings.
  • It presents a layered proof architecture with conditional transfer lemmas and a robust API that integrates with Mathlib for modular, reusable proofs.
  • The development includes two formalized routes for proving R[X] as a UFD, demonstrating practical applications to polynomial and Laurent polynomial rings.

Formalization of Nagata's Factoriality Theorem in Lean 4

Overview and Objectives

This paper presents a comprehensive formalization of Nagata's factoriality theorem within the Lean 4 theorem prover, leveraging the Mathlib library for foundational algebraic infrastructure. The theorem is a cornerstone in commutative algebra, providing conditions under which unique factorization in a localization can be transferred back to the base ring. The formal development not only covers the theorem for submonoids generated by primes (prime-generated submonoids) but also offers a robust, reusable package for deploying the result in several typical applications, notably for polynomial and Laurent polynomial rings. Explicit attention is given to the design and correctness of hypotheses, the formal architecture required for efficient proof engineering, and the pragmatic integration with Lean's and Mathlib's algebraic hierarchies.

Precise Formal Statement and Hypothesis Refinement

The paper formalizes Nagata's theorem under the following statement: If RR is a noetherian integral domain and SRS\subseteq R is a prime-generated submonoid such that the localization S1RS^{-1}R is a unique factorization domain (UFD), then RR is a UFD. The formalization exposes a significant deficiency in prior textbook-level hypotheses—namely, the inadequacy of the “prime-or-unit” condition for handling submonoids with more than one non-associate prime generator. This prompts the introduction and rigorous use of the prime-generated condition, which is formalized in Lean using multisets for representing unordered products of primes.

Moreover, the development introduces the Avoids predicate to precisely capture when an irreducible element in RR is mapped to a non-unit in S1RS^{-1}R, a requirement for correctly transferring factorization properties. This rigorous hypothesis design is essential for both mathematical correctness and the modularity needed for formal proof reuse.

Proof Architecture and Modular Engineering

The formal proof is systematically decomposed into four architectural layers:

  1. Prime-Generated Submonoid API: Defines and analyzes properties of prime-generated submonoids, including closure, factorization, and zero-exclusion, providing foundational lemmas that support the rest of the development.
  2. Conditional Transfer Lemmas: Develops a suite of crucial transfer lemmas—divisibility, irreducibility, and primality—between RR and its localization S1RS^{-1}R. These are formulated under precisely stated combinations of prime-generation and avoidance, emphasizing their conditional nature and facilitating their reuse across distinct localizations.
  3. Key Lemma—Case Distinction on Irreducibles: Asserts that under the hypotheses of the theorem, every irreducible in RR is prime, utilizing the transfer lemmas via a case analysis conditioned on whether the irreducible divides some sSs \in S.
  4. Final UFD Construction: Assembles the previous components with Mathlib's UFD infrastructure to obtain the UniqueFactorizationMonoid instance for SRS\subseteq R0, emphasizing compatibility with existing algebraic hierarchies and proof engineering practices.

This layered architecture ensures that the formalized results are broadly applicable—beyond the specific proof of Nagata's theorem, the infrastructure is structured to allow for future generalizations and new applications.

Application: Two Formalized Routes to SRS\subseteq R1 as a UFD

The formalization provides two structurally distinct proof routes for establishing that SRS\subseteq R2 is a UFD whenever SRS\subseteq R3 is a noetherian UFD:

  • Laurent-Polynomial Localization Route: Localizes at powers of SRS\subseteq R4 (the indeterminate), leveraging the isomorphism of this localization with the Laurent polynomial ring SRS\subseteq R5. This approach necessitates auxiliary primality transfer lemmas to ensure that prime polynomials that do not divide SRS\subseteq R6 remain prime in the localized ring. The result is then descended back to SRS\subseteq R7 via the formal Nagata argument.
  • Fraction Field Localization Route: Localizes at the submonoid generated by constant primes, showing that the resulting localization aligns with SRS\subseteq R8 and transferring the UFD structure. This alternative localization route offers conceptual clarity and exercises the modular Nagata infrastructure in a genuinely distinct setting.

Both approaches directly engage the prime-generation machinery and associated transfer lemmas, providing robust formal confirmations and reusable patterns for further applications, including to iterated polynomial rings SRS\subseteq R9.

Formal API and Integration with Mathlib

The development constructs an explicit Lean 4 API:

  • Abstract and Concrete Theorem Packages: Theorems are presented both for concrete localizations and for abstract IsLocalization instances, enabling downstream users to invoke the result in both canonical and customized algebraic contexts.
  • Packaged Corollaries: Variants for submonoids generated by arbitrary (finite or infinite) sets of primes are provided, automatically handling closure and zero-exclusion via reusable API components.
  • Dual Proof Chains: Both the mathematically general (prime-generated) and the classical (prime-or-unit) proof lines are formalized and retained, enhancing pedagogical value and permitting compatibility checking.

The infrastructure minimizes explicit hypothesis management by leveraging Lean's Fact and typeclass system, addressing formal ergonomic considerations such as universe polymorphism, typeclass diamonds, and localization interface abstraction.

Lessons for Formal Mathematics and Future Prospects

Key proof-engineering lessons highlighted in the paper include:

  • Hypothesis Design as a Driver of Mathematical Correctness: The shift from “prime-or-unit” to “prime-generated” hypotheses was forced by formal application requirements, demonstrating the power of mechanized proof to surface subtle mathematical misstatements.
  • Conditional Transfer Lemmas: The formulation of transfer lemmas under precisely specified hypotheses enables clean modularity and facilitates proof reuse in advanced commutative algebra.
  • Multiset Induction: The combinatorial infrastructure required for multiset-based factorization induction demands substantial formal effort, providing a case study in translating routine mathematical arguments into explicit formal proofs.
  • API Design and Library Integration: The approach demonstrates techniques for packaging reusable formalizations that interact smoothly with existing algebraic libraries, structuring results to be directly usable for upstream integration into Mathlib.

The formalization creates a sustainable path for future work, including generalizations to ideal-theoretic forms of Nagata's theorem, formalization of factoriality in broader classes of rings (e.g., Krull domains), further case studies in power-series and algebraic integer rings, and systematic comparisons between different proof strategies (Gauss lemma versus localization).

Conclusion

The Lean 4 formalization of Nagata's factoriality theorem presented in this paper constitutes a substantial advance in the formalization of constructive commutative algebra. The development unites technically precise hypothesis design, modular proof architecture, and reusable API construction, enabling both direct applications (such as to the UFD property of polynomial and Laurent polynomial rings) and methodological insights for future algebraic formalizations. The artifact's separation of conditional infrastructure and application layers positions it for integration with Mathlib, promoting the formal theorem's utility across a spectrum of algebraic settings. The precision enforced by mechanization exposes and resolves long-standing informal ambiguities, underscoring the essential value of interactive theorem proving in mathematical research and digital mathematics infrastructure.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We're still in the process of identifying open problems mentioned in this paper. Please check back in a few minutes.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 7 likes about this paper.