Abstract 1 Introduction 2 Divided Power Structures 3 The Exponential Module

A Formalization of Divided Powers in Lean

Antoine Chambert-Loir111Both authors contributed equally to this research. ORCID Université Paris Cité, Institut de mathématiques de Jussieu – Paris rive gauche, France María Inés de Frutos-Fernández111Both authors contributed equally to this research. ORCID Universität Bonn, Germany
Abstract

Given an ideal I in a commutative ring A, a divided power structure on I is a collection of maps {γn:IA}n, subject to axioms that imply that it behaves like the family {xxnn!}n, but which can be defined even when division by factorials is not possible in A. Divided power structures have important applications in diverse areas of mathematics, including algebraic topology, number theory and algebraic geometry.

In this article we describe a formalization in Lean 4 of the basic theory of divided power structures, including divided power morphisms and sub-divided power ideals, and we provide several fundamental constructions, in particular quotients and sums. This constitutes the first formalization of this theory in any theorem prover.

As a prerequisite of general interest, we expand the formalized theory of multivariate power series rings, endowing them with a topology and defining evaluation and substitution of power series.

Keywords and phrases:
Formal mathematics, algebraic number theory, commutative algebra, divided powers, Lean, Mathlib
Funding:
Antoine Chambert-Loir: The author acknowledges the support of the APRAPRAM Émergence project of Université Paris Cité.
María Inés de Frutos-Fernández: The author was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy – EXC-2047/1 – 390685813, and by the Grant CA1/RSUE/2021-00623 funded by the Spanish Ministry of Universities, the Recovery, Transformation and Resilience Plan, and Universidad Autónoma de Madrid. Part of this work was conducted during the HIM trimester programme Prospects of Formal Mathematics, also funded by EXC-2047/1 – 390685813.
Copyright and License:
[Uncaptioned image] © Antoine Chambert-Loir and María Inés de Frutos-Fernández; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Logic and verification
; Theory of computation Type theory
Acknowledgements:
We are grateful to Kevin Buzzard for suggesting this project and for his ongoing support during its completion. We would also like to thank Anatole Dedecker, Floris van Doorn and Bhavik Mehta for interesting discussions about the project. Finally, we thank the Mathlib community and reviewers for useful feedback on our contributions to the library.
Funding:
This work was started during the ICERM workshop “Lean for the Curious Mathematician 2022”, funded by the US National Science Foundation under Grant No. DMS-1929284.
Editors:
Yannick Forster and Chantal Keller

1 Introduction

The theory of divided powers, invented by Cartan in [3], grew out of the observation that there are algebraic contexts where one can make sense of ratios of the form hk/k!, even though division by integers such as k! is not a priori possible in an arbitrary ring. Cartan also found out the relevant functional equations satisfied by these ratios.

The context of Cartan’s work is algebraic topology. In [3], the elements h are classes of even degree in a graded commutative Eilenberg–Maclane algebra. While such algebras are not commutative, the part where the divided powers take place is essentially commutative, and the theory has not been elaborated further for noncommutative rings. On the other hand, the case of commutative rings has been the object of a detailed inquiry, starting from the works of Roby [14, 15, 16]. For this reason, here we only consider commutative rings.

In the 1960s, under the impulse of Grothendieck, algebraic geometers tried to understand the relations between the various cohomology theories that could be defined on algebraic varieties. It was soon observed that the “algebraic de Rham cohomology” led to technical difficulties, essentially because the primitive of a polynomial anTn is given by the expression 1n+1anTn+1, which involves integer denominators. One of the suggestions made by Grothendieck was to work, not with polynomials, but in a “divided power algebra”, in which all ratios Tn/n! make sense. This suggestion was followed by Berthelot [1] for his development of crystalline cohomology.

Despite their complexity, crystalline cohomology and subsequent p-adic cohomologies are fundamental to modern arithmetic geometry. In particular, they are one of the multiple tools used by Wiles and his collaborators in the proof of Fermat’s Last Theorem. The present formalization of divided powers is thus one step in the formalization of this theorem (see Section 4.2.3 for more technical details).

In this article we formalize in Lean 4 the basic theory of divided power rings, divided power morphisms and sub-divided power ideals. We also provide several constructions of divided powers, including quotients and sums. To the authors’ knowledge, this is the first formalization of the theory of divided powers in any theorem prover.

As a prerequisite, which has applications far beyond the scope of this project, we formalize the topological theory of multivariate power series rings and make it possible to evaluate and substitute power series.

Our work constitutes the first formalization of these topological aspects of multivariate power series, but related work exists in several theorem provers. The ring of multivariate power series (as an abstract ring) has been formalized in Mizar [17], while the topological ring of univariate power series has been formalized in Isabelle/HOL [4]. In Rocq, a formalization of the abstract ring of univariate power series is available in the UniMath library [13], and a separate implementation built over the MathComp library is described in [10]. Note that none of these include a formalization of evaluation or substitution of univariate or multivariate formal power series.

1.1 Lean and Mathlib

This formalization project uses the theorem prover Lean [9, 12] and builds over Lean’s mathematical library Mathlib [11], which was ported to the latest version of the language (Lean 4) in 2023. While the project started in Lean 3 and the first Mathlib contributions from it were made to Mathlib3, after the library port we translated our existing work to Lean 4 and used the latter version for the rest of the development.

Throughout the text, we use the clickable symbol to link to the source code for the formalization. The original work described in this article comprises about 8,000 lines of code, of which approximately 5,000 have been merged into Mathlib; the rest of our code can be found in the public GitHub repository mariainesdff/divided_powers_journal  . We keep a record of past and ongoing contributions to Mathlib arising from this work in the Lean prover community project “Divided Powers”  .

1.2 Paper Outline

In §2, we describe the general theory of divided power structures: after introducing the definition and some key examples, we treat divided power morphisms in §2.3, sub-divided power ideals in §2.4, and divided powers on quotient rings in §2.5. §3 is devoted to the formalization of the module of exponential power series: in §3.1 and §3.2 we describe the topological theory of multivariate power series rings, which is needed in §3.3 to define evaluation and substitution operations and in §3.4 to describe the exponential module, which is later used in §3.5 to define divided powers on sums of ideals. Finally, we conclude with some implementation remarks in §4.1 and a description of future work in §4.2.

2 Divided Power Structures

2.1 Definition

Definition 1 ([2, Definition 3.1]).

Let I be an ideal in a commutative ring A. A divided power structure on I is a family of maps γn:IA for n such that

  1. (i)

    xI, γ0(x)=1.

  2. (ii)

    xI, γ1(x)=x.

  3. (iii)

    xI,n>0,γn(x)I.

  4. (iv)

    x,yI,γn(x+y)=i+j=nγi(x)γj(y).

  5. (v)

    aA,xI,γn(ax)=anγn(x).

  6. (vi)

    xI,m,n,γm(x)γn(x)=(m+nm)γm+n(x).

  7. (vii)

    xI,m,n>0,γm(γn(x))=(mn)!m!(n!)mγmn(x).

If I is an ideal equipped with a divided power structure, we say that I has divided powers, that (I,γ) is a divided power ideal, and that (A,I,γ) is a divided power ring or a divided power algebra.

Listing 1: Definition of divided power structure.
structure DividedPowers {A : Type*} [CommSemiring A] (I : Ideal A) where
dpow : A A
dpow_null : {n x} (_ : x I), dpow n x = 0
dpow_zero : {x} (_ : x I), dpow 0 x = 1
dpow_one : {x} (_ : x I), dpow 1 x = x
dpow_mem : {n x} (_ : n 0) (_ : x I), dpow n x I
dpow_add : (n) {x y} (_ : x I) (_ : y I),
dpow n (x + y) = (antidiagonal n).sum fun k dpow k.1 x * dpow k.2 y
dpow_mul : (n) {a : A} {x} (_ : x I),
dpow n (a * x) = a ^ n * dpow n x
mul_dpow : (m n) {x} (_ : x I),
dpow m x * dpow n x = choose (m + n) m * dpow (m + n) x
dpow_comp : (m) {n x} (_ : n 0) (_ : x I),
dpow m (dpow n x) = uniformBell m n * dpow (m * n) x

When A is a -algebra, one may set γn(x)=xn/n! for all xI and these axioms are easy to check. In particular, axiom (iv) is a version of the binomial theorem without binomial coefficients.

 Remark 2.

The fraction (mn)!m!(n!)m appearing in condition (vii) is a natural number for all n,m; we formalize this definition as Nat.uniformBell222The terminology comes from that of Bell numbers in combinatorics, which represent the number of partitions of a set of given cardinality; here, we fix one particular partition type.  . This quantity has a combinatorial significance: it counts the number of ways to divide a set with mn elements into m groups of n-element subsets.

We formalize Definition 1 as a structure DividedPowers   (see Listing 1), where the field dpow represents the family of functions {γn}n. Note that, instead of defining dpow as a function IA, we define it as a function AA and impose in the field dpow_null the condition that this map is zero outside the ideal I (see §4.1.1 for a discussion of this choice).

In our formalized definition, we only require A to be a commutative semiring instead of a commutative ring; that is, we do not assume that A has a negation operator. However, as mentioned in the introduction, it does not seem that a general, and relevant, definition of divided powers has been given in the noncommutative setting, so we do not relax the commutativity hypothesis.

In the field dpow_add, the expression (antidiagonal n).sum fun k dpow k.1 x * dpow k.2 y represents the sum k1+k2=nγk1(x)γk2(y)  , while in dpow_comp, uniformBell m n represents the fraction (mn)!m!(n!)m.

2.2 Examples of Divided Power Structures

We formalized several examples of divided power structures, starting with the trivial one.

Example 3.

In any commutative ring A, the trivial ideal (0) is a divided power ideal with respect to the family γn(0)=0 for all n1  .

We next consider several ideals for which the family γn(x)=xnn! is a divided power structure. We start by making the definition OfInvertibleFactorial.dpow  , where we represent xnn! by Ring.inverse (n ! : A) * x ^ n. Note that Ring.inverse is defined for any ring A as the function sending x : A to its inverse, if it exists, or to 0, otherwise. Hence we can write down this definition without any extra hypothesis on A or I. However, for it to define a divided power structure, some extra conditions are required.

variable {A : Type*} [CommSemiring A] (I : Ideal A)
def OfInvertibleFactorial.dpow : A A :=
fun n x if x I then Ring.inverse (n ! : A) * x ^ n else 0
Example 4.

If A is a -algebra, then any ideal in A has a unique divided power structure, given by the family γn(x)=xnn!  .

Another sufficient condition for γn(x)=xnn! to be a divided power structure on an ideal I is the existence of a natural number n such that (n1)! is invertible in A and In=0. We call this divided power structure OfInvertibleFactorial.dividedPowers  .

def OfInvertibleFactorial.dividedPowers {n : ℕ}
(hn_fac : IsUnit ((n - 1).factorial : A)) (hnI : I ^ n = 0) :
DividedPowers I where
dpow := OfInvertibleFactorial.dpow I
...

In particular, we can specialize this definition to obtain three interesting examples.

Examples 5.
  1. 1.

    If A is any commutative ring and IA is any ideal such that I2=0, then γn(x)=xnn! is a divided power structure on I, because (21)!=1 is always invertible  .

  2. 2.

    If p is a prime number which is nilpotent in A (that is, pn=0 in A for some natural number n), and Ip=0, then γn(x)=xnn! is a divided power structure on I, since (p1)! is a unit in A  .

  3. 3.

    Recall that the characteristic of A is the smallest positive natural number p such that p copies of 1A add up to 0A, if such a number exists, or zero otherwise. If the characteristic of A is a prime number p and Ip=0, then γn(x)=xnn! is a divided power structure on I. This follows as a special case of the previous example, since the characteristic of a ring is a nilpotent element  .

Finally, we consider an example which is of key importance in number theory. For each prime number p, we can define a p-adic absolute value on the rational numbers; the completion of with respect to this absolute value is the field p of p-adic numbers. The subring of p consisting of elements with absolute value at most one is the ring p of p-adic integers. The ring p has a unique maximal ideal, generated by p; this ideal consists of the elements of absolute value strictly smaller than one.

Example 6.

The family γn(x)=xnn! is a divided power structure on the p-ideal (p)  . The key part of the proof is to show that, for every x(p) and every nonzero n, the fraction γn(x)=xnn! has p-adic absolute value less than one, and hence belongs to the ideal (p). Then, the verification of the axioms of a divided power structure can be checked in p, and they follow from Example 4 since p is a -algebra.

We formalize Example 6 as a special case of a more general construction: if f:SA is a ring homomorphism and J is an S-ideal such that span(f(I))=J and such that f1(γn(f(x))I for all n0,xI, then f induces a divided power structure on I  .

2.3 Divided Power Morphisms

Let (A,I,γ) and (B,J,δ) be two divided power rings.

Definition 7 ([2, §3]).

A divided power morphism f:(A,I,γ)(B,J,δ) is a ring homomorphism f:AB such that f(I)J and δn(f(x))=f(γn(x)) for all n,xI.

We provide two formalized versions of this definition: a propositional one, which we call IsDPMorphism  , as well as a bundled version DPMorphism   which contains both the map f:AB and the properties it must satisfy.

structure DividedPowers.IsDPMorphism (f : A →+* B) : Prop where
ideal_comp : I.map f J
dpow_comp : {n}, a I, hJ.dpow n (f a) = f (hI.dpow n a)
structure DividedPowers.DPMorphism extends RingHom A B where
ideal_comp : I.map toRingHom J
dpow_comp : {n}, a I, hJ.dpow n (toRingHom a) = toRingHom (hI.dpow n a)

While the unbundled definition is more convenient to develop the basic theory of divided power morphisms, we anticipate that the bundled version will be useful for future work towards formalizing the crystalline site, so we provide it as well.

We formalize several fundamental results about divided power morphisms, including the following propositions.

Proposition 8 ([15, Proposition 2]).

Let f:AB be a ring homomorphism such that f(I)J. Then the set of elements xA such that δn(f(x))=f(γn(x)) for all n is an ideal of A  .

Proposition 9 ([15, Proposition 3]).

Let S be a generating set for the ideal I. If f:AB is a ring homomorphism such that f(I)J, and for every n and xS the equality δn(f(x))=f(γn(x)) holds, then f is a divided power morphism  .

Corollary 10.

Let S be a generating set for the ideal I, and let γ be a second divided power structure on I. If γn(x)=γn(x) for all n and xS, then γ=γ.

Proof.

Apply Proposition 9 with f being the identity map on A and δ:=γ  .

2.4 Sub-Divided Power Ideals

In this section we describe the theory of sub-dp-ideals, following [15, §5] and [2, §3].

Definition 11.

Let (I,γ) be a divided power ideal of A. A subideal JI is called a sub-divided power ideal, or sub-dp-ideal of I if γn(x)J for all n>0,xJ.

As we did for divided power morphisms, we provide an unbundled and a bundled version of this definition, respectively called IsSubDPIdeal   and SubDPIdeal  .

structure IsSubDPIdeal (J : Ideal A) : Prop where
isSubideal : J I
dpow_mem : {n : ℕ} (_: n 0) {j : A} (_ : j J), hI.dpow n j J
structure SubDPIdeal where
carrier : Ideal A
isSubideal : carrier I
dpow_mem : {n : ℕ} (_ : n 0), j carrier, hI.dpow n j carrier

If J is a sub-dp-ideal of (I,γ), the family of maps obtained by restricting γ to J is a divided power structure on J  .

def IsSubDPIdeal.dividedPowers {J : Ideal A} (hJ : IsSubDPIdeal hI J) :
DividedPowers J where
dpow n x := if x J then hI.dpow n x else 0
...

The next three lemmas can be used to determine whether certain ideals in A are sub-dp-ideals of I. If J is any ideal in A, it is not always the case that the intersection JI is a sub-dp-ideal; indeed, this requires the divided power structure on I to satisfy the following compatibility condition modulo J.

Lemma 12.

Given an ideal J of A, the ideal JI is a sub-dp-ideal of (I,γ) if and only if for every n and every a,bI such that abJ, the element γn(a)γn(b) belongs to J  .

Lemma 13.

Let SI be a subset and let J be the ideal generated by S. Then J is a sub-dp-ideal of I if and only if for all n>0 and all sS, γn(s) belongs to J.

Proof.

Necessity is obvious. The converse direction is shown by an induction argument on the generating set. See [2, Lemma 3.6] for a detailed proof and span_isSubDPIdeal_iff   for our formalization.

Lemma 14 ([1, Proposition 1.6.1.(i)]).

For every ideal J of A, the ideal IJ is a sub-dp-ideal of (I,γ)  .

Next, we show that sub-dp-ideals of (I,γ) form a complete lattice with respect to inclusion, which we register as an instance  . Note that this is only possible by using the bundled version of the definition of sub-dp-ideal.

instance : CompleteLattice (SubDPIdeal hI) := by ...

In order to provide this instance, we first show that sub-ideals of I form a complete lattice  ; combining this with the fact that the forgetful function sending a sub-dp-ideal J of I to J regarded as a sub-ideal is injective, we can then apply Mathlib’s Function.Injective.completeLattice to conclude our desired result.

The lattice of sub-ideals of I is clearly bounded, with top element I and bot element (0). Recall that the supremum of two sub-ideals J and K of I is equal to their sum J+K, and their infimum is their intersection JK. After proving that sub-ideals form a complete lattice, to be able to carry out the outlined strategy we need to show that, if J and K are sub-dp-ideals of (I,γ), then so are these constructions (as well as the analogous claims for arbitrary families of sub-ideals). For instance, we prove in isSubDPIdeal_sup   that the sum of two sub-dp-ideals is again a sub-dp-ideal, and in isSubDPIdeal_iSup   the analogous statement for an indexed collection of sub-dp-ideals.

Note that there is a subtlety in defining the class instance InfSet (SubDPIdeal hI)   for the infimum of a set of sub-dp-ideals of (I,γ): instead of simply defining the underlying set as the intersection JS, we need to define it as I(JSJ), so that when the set S is empty, this yields the desired result that the infimum is I (instead of the whole ring A). We also study the relation between divided power morphisms and sub-dp-ideals.

Lemma 15.

Let f:(A,I,γ)(B,J,δ) be a divided power morphism. Then span(f(I)) is a sub-dp-ideal of J   and kerfI is a sub-dp-ideal of I  .

Finally, we wish to highlight a construction that will be useful for the formalization of the universal divided power algebra (see §4.2). Given a subset SI, we define SubDPIdeal.span   as the smallest sub-dp-ideal of I that contains S. We prove that this ideal is spanned by the family {γn(s)} for sS and n>0  .

def SubDPIdeal.span (S : Set A) : SubDPIdeal hI :=
sInf {J : SubDPIdeal hI | S J.carrier}

2.5 Divided Powers on Quotients

In this section we discuss the existence and uniqueness of divided power structures on quotient rings, following [2, Lemma 3.5]. Let (A,I,γ) be a divided power ring and let J be any ideal of A. We denote by IA/J the ideal generated by the image of I in the quotient ring A/J.

If there is a divided power structure on IA/J such that the quotient map AA/J is a divided power morphism, then JI is a sub-dp-ideal of I   (see Listing 2).

Listing 2: JI as a sub-dp-ideal of I.
def DividedPowers.subDPIdeal_inf_of_quot {J : Ideal A}
{hJ : DividedPowers (I.map (Ideal.Quotient.mk J))} : DPMorphism hI hJ}
(hφ : φ.toRingHom = Ideal.Quotient.mk J) :
SubDPIdeal hI where
carrier := J I
...

Conversely, if JI is a sub-dp-ideal of I, then there is a unique induced divided power structure on IA/J such that the quotient map is a divided power morphism  . Note that we actually formalize this statement in the more general setting333We mean “more general setting” in the type-theoretic sense. Mathematically, both are equivalent. of a surjective ring homomorphism f:AB such that kerfI is a sub-dp-ideal of I, and then specialize the result to the quotient map AA/J. Given such an f:AB, the divided power structure γ¯ on IB is defined by sending n,f(a)f(I) to f(γn(a))  ; note that by surjectivity of B, this is a function span(f(I))B. We check that γ¯ is the unique divided power structure on span(f(I)) such that the map f is a divided power morphism from I to span(f(I))  .

def Quotient.OfSurjective.dividedPowers {f : A →+* B}
(hf : Function.Surjective f) (hIf : IsSubDPIdeal hI (ker f I)) :
DividedPowers (I.map f) where
dpow n := Function.extend
-- If b is of the form f a for a in I’,
(fun a f a : I B)
-- then dpow n b is given by f (hI.dpow n a)’;
(fun a f (hI.dpow n a) : I B)
-- otherwise, it is zero.
0
...
def Quotient.dividedPowers (hIJ : hI.IsSubDPIdeal (J I)) :
DividedPowers (I.map (Ideal.Quotient.mk J)) :=
DividedPowers.Quotient.OfSurjective.dividedPowers hI
Ideal.Quotient.mk_surjective (IsSubDPIdeal_aux hI hIJ)

3 The Exponential Module

3.1 The Topology on the Multivariate Power Series Ring

Let A be a commutative ring and let σ be a set; we consider the ring A[[σ]] of multivariate power series with coefficients in A and indeterminates indexed by σ, and its subring A[σ] of polynomials. For clarity, one often writes Ts for the indeterminate corresponding to sσ. When σ={X,Y}, say, a more classical notation would be A[[X,Y]] for power series in X,Y, and A[X,Y] for polynomials.

Monomials, i.e., finite products of indeterminates, can be realized as functions with finite support from σ to , and a power series in A[[σ]] is nothing but a function from M to A, where M is the set of monomials. For mM, one writes Tm for the finite product sσTsms. We write coeffm(f) for the coefficient of a monomial m in f. Polynomials correspond to those power series for which all but finitely many coefficients are zero; then f is the finite sum mMcoeffm(f)Tm. When f is a power series, this sum is infinite, and hence it has no meaning a priori.

The Mathlib library provides the definition of multivariate   and univariate   power series rings, and develops some of their algebraic theory. However, before our work, the topological theory of power series rings was missing from the library.

If A has a topology, the ring A[[σ]] is naturally induced with the product topology. In particular, a sequence (fi) of power series converges to a power series f if and only if for each monomial m, the sequence coeffm(fi) converges to coeffm(f)  .

The product topology on the multivariate power series ring is not declared as a global instance because there are other topologies that one might want to consider on this ring; for example, if A is a normed ring, the supremum of the norm of the coefficients induces a topology on A[[σ]] that is finer than the product topology. Consequently, we declare this product topology as a scoped instance that can be loaded by writing the instruction open scoped MvPowerSeries.WithPiTopology.

scoped instance A : Type*) [TopologicalSpace A] :
TopologicalSpace (MvPowerSeries σ A) :=
Pi.topologicalSpace -- The product topology.

Note that, while in mathematical practice one typically considers the case where A is a ring, the above definition only assumes that A is a topological space. If A is a topological ring, meaning that the topology of A is such that the addition and multiplication are continuous, then the product topology makes A[[σ]] a topological ring as well  . The analogous statement holds when A is a topological semiring  .

If A is a Hausdorff topological space, then A[[σ]] is Hausdorff  . Hence, in this setting, we obtain for every power series f the equality f=mMcoeffm(f)Tm, where the right hand side is well-defined as a summable family  .

If the ring A is endowed with the discrete topology, then for fA[[σ]] the limit limnfn is equal to zero if and only if the constant coefficient of f is nilpotent  .

If A has a uniform structure, then A[[σ]] is naturally endowed with the product uniformity  . If A is a complete uniform space, then so is A[[σ]]  . Then A[σ] is dense in A[[σ]]  .

3.2 Linear Topologies on Multivariate Power Series Rings

Some ring topologies which are relevant in algebra have the particular property of being linear, meaning that zero has a basis of open neighborhoods consisting of two-sided ideals.

More generally, a topology on a left A-module M is said to be linear if the open left A-submodules of M form a basis of neighborhoods of zero. We formalize this as a typeclass IsLinearTopology  .

variable (A M : Type*) [Ring A] [AddCommGroup A] [Module A M] [TopologicalSpace M]
class IsLinearTopology where
hasBasis_submodule : (𝒩 (0 : M)).HasBasis
(fun N : Submodule A M (N : Set M) 𝒩 0)
(fun N : Submodule A M (N : Set M))

We show that the topology on the ring A is linear (i.e., there is a basis of open neighborhoods of zero consisting of two-sided ideals) if and only if it is linear both when A is regarded as an A-module and as an Amop-module, where Amop denotes the multiplicative opposite of A  .

theorem isLinearTopology_iff_hasBasis_twoSidedIdeal :
IsLinearTopology A A IsLinearTopology Amop A
(𝒩 0).HasBasis (fun I : TwoSidedIdeal A (I : Set A) 𝒩 0)
(fun I : TwoSidedIdeal A (I : Set A))

Considering this equivalence, instead of providing a special spelling for the property that the topology on the ring A is linear, we write this in Lean as

[IsLinearTopology A A] [IsLinearTopology Amop A]

If the topology on A is linear, I is an open ideal of A and m is a monomial, then the set Im of power series fA[[σ]] such that coeffk(f)I for all monomials km is an ideal of A[[σ]]. When I runs over all open ideals of A and m runs over all monomials, this gives a basis of open neighborhoods of 0 in A[[σ]]  . In other words, the topology on A[[σ]] is linear as well  . In particular, this applies when A is endowed with the discrete topology.

3.3 Evaluation and Substitution of Multivariate Power Series

Let B be a topological commutative A-algebra whose topology is linear. For any b:σB, one can evaluate polynomials fA[σ] at b. This gives a ring morphism evalb:A[σ]B. Contrary to what happens for polynomials, power series cannot always be evaluated at every point, at least if one wishes for good continuity properties. However, if bs0 in B along the filter of cofinite subsets, and if for every sσ, the sequence bsn converges to 0 (one says that bs is topologically nilpotent), then evalb is uniformly continuous, and extends uniquely to a continuous morphism from A[[σ]] to B.

We formalize the relevant conditions as a structure MvPowerSeries.HasEval  ,

Listing 3: Conditions for evaluation of power series being defined at b:σB.
structure HasEval (b : σ B) : Prop where
hpow : s, IsTopologicallyNilpotent (b s)
tendsto_zero : Tendsto b cofinite (𝒩 0)

in which we use our definition IsTopologicallyNilpotent  :

def IsTopologicallyNilpotent {A : Type*} [MonoidWithZero A]
[TopologicalSpace A] (a : A) : Prop :=
Tendsto (a ^ ·) atTop (𝒩 0) -- The powers of a converge to ‘0’.

We provide the definition MvPowerSeries.aeval   to evaluate a multivariate power series fA[[σ]] at a point b:σB. This agrees with the evaluation of f as a polynomial whenever fA[σ]. Otherwise, it is defined by density from polynomials; its values are irrelevant unless the algebra map AB is continuous and b satisfies the two conditions bundled in MvPowerSeries.HasEval b. The function MvPowerSeries.aeval is an A-algebra map, whose underlying function and ring homomorphism are denoted MvPowerSeries.eval   and MvPowerSeries.evalHom  , respectively (see Listing 4).

Listing 4: Evaluation of multivariate power series.
def eval (f : MvPowerSeries σ A) : A →+* B) (b : σ B): B :=
if H : p : MvPolynomial σ A, p = f then (MvPolynomial.eval φ b H.choose)
else IsDenseInducing.extend coeToMvPowerSeries_isDenseInducing (MvPolynomial.eval φ b) f
-- eval as a ring homomorphism
def evalHom (hφ : Continuous φ) (hb : HasEval b) := ...
--Specialize eval₂’ to the case where ‘φ’ is AlgebraMap A B’.
def aeval (hb : HasEval b) : MvPowerSeries σ A →ₐ[A] B where
toRingHom := MvPowerSeries.evalHom (continuous_algebraMap A B) hb
...

We specialize our work to provide a corresponding PowerSeries.aeval definition   for evaluation of univariate power series.

Under certain conditions, it is possible to substitute multivariate power series within other power series. This is a special case of evaluation of power series, in which the ground ring A is given the discrete topology. Indeed, let τ be a set and consider a map b:σB[[τ]] that assigns to each indeterminate in σ a power series in B[[τ]]. Provided that the constant coefficient of bs is nilpotent for each sσ, and that bs0 in B[[τ]] along the filter of cofinite subsets, then we can substitute b into a power series fA[[σ]]. We record these conditions in a structure MvPowerSeries.HasSubst  .

structure HasSubst (a : σ MvPowerSeries τ S) : Prop where
const_coeff s : IsNilpotent (constantCoeff τ S (a s))
coeff_zero d : {s | (a s).coeff S d 0}.Finite

Note that if the set σ is finite, to check that b can be substituted into f, it is enough to check the nilpotency condition on the coefficients  . This is in particular true if the constant coefficients of the bs are zero  , which is often the case in practical applications.

Substitution of multivariate power series is then defined in MvPowerSeries.subst  . As happened with the evaluation, the substitution is only well defined for maps b:σB[[τ]] satisfying HasSubst b. We provide an extensive API to work with this definition, describing its compatibility with multiple algebraic operations and providing formulas for the coefficients of the substitution. We also provide the specialization of this definition to the case where f is a univariate power series  .

variable (b : σ MvPowerSeries τ B) (f : MvPowerSeries σ A)
def MvPowerSeries.subst : MvPowerSeries τ B :=
letI : UniformSpace A := -- discrete uniformity on A
letI : UniformSpace B := -- discrete uniformity on B
MvPowerSeries.eval (algebraMap _ _) b f
-- MvPowerSeries.subst as an A’-algebra morphism.
def MvPowerSeries.substAlgHom (hb : HasSubst b) :
MvPowerSeries σ R →ₐ[R] MvPowerSeries τ S := ...

3.4 The Exponential Module

Let A be a ring. A power series fA[[X]] in one indeterminate is said to be of exponential type if f(0)=1 and if, substituting X for X0+X1 in f, one has the functional relation f(X0+X1)=f(X0)f(X1). We formalize this definition as a structure IsExponential  .

structure IsExponential (f : A[[X]]) : Prop where
add_mul : subst (S := A) (X0 + X1) f = subst X0 f * subst X1 f
constantCoeff : constantCoeff A f = 1

Let (A) be the set of power series of exponential type. For f,g(A), one has fg(A). Moreover, for every aA and every f(A), the rescaled power series f(aX) also belongs to (A). Because of that, the set (A) is an A-module: the addition law of the module is the product of power series, and the external law is given by rescaling.

There is a subtlety to consider in the formalization of the definition of (A). The functional equation f(X0+X1)=f(X0)f(X1) satisfied by an exponential power series relates an additive expression to a multiplicative one, so its formalization requires combining additive and multiplicative structures. Mathlib provides the definition Additive to deal with the required conversion: if M is a type that carries a multiplicative structure, then Additive M is a new type in bijection with M that carries the corresponding additive structure. The bijection ofMul : M Additive M satisfies ofMul(x * y) = ofMul x + ofMul y for all x y : M; its inverse is called toMul.

We formalize the definition of (A) as an additive submonoid of the type Additive A[[X]], which we call ExponentialModule A  . The underlying set of this submonoid consists of the terms f : Additive A[[X]] such that the corresponding power series toMul f : A[[X]] is exponential.

def ExponentialModule : AddSubmonoid (Additive A[[X]]) where
carrier := { f : Additive (A[[X]]) | IsExponential (toMul f) }
add_mem {f g} hf hg := by simp only [Set.mem_setOf_eq, toMul_add, hf.mul hg]
zero_mem := by simp only [Set.mem_setOf_eq, toMul_zero, IsExponential.one]

The instances instAddCommGroup   and instModule   show that ExponentialModule A is both a commutative additive group and an A-module. We also prove that if f is an exponential power series, then f is invertible  , and its inverse, given by the power series f(X)  , is also of exponential type  .

If (A,I,γ) is a divided power ideal, then for every aI, the power series expI(aX)=γn(a)Xn is of exponential type  . To give an intuitive explanation for this property, recall that for every real number a, exp(ax) is given by the power series an/n!xn. Moreover, the functional equation of the exponential function implies that exp(a(x+y))=exp(ax)exp(ay). In the algebraic setting, divided powers emulate the functions aan/n! and the proof that expI(aX) is of exponential type is established by manipulations of formal power series completely similar to those that establish the functional equation of the exponential power series in analysis. The map aexpI(aX) from I to (A) is a morphism of A-modules  .

def exp (hI : DividedPowers I) (a : A) : PowerSeries A :=
PowerSeries.mk fun n hI.dpow n a
def exp (hI : DividedPowers I) (a : I) : ExponentialModule A :=
hI.exp a, hI.exp_isExponential a.prop
def exp_linearMap (hI : DividedPowers I) : I l[A] ExponentialModule A where
toFun := hI.exp

3.5 Application: Divided Powers on a Sum of Ideals

If (I,γI) and (J,γJ) are two divided power A-ideals with divided powers that agree on IJ, then the ideal I+J has a unique divided power structure γI+J extending those on I and J. The starting point for the construction of this divided power structure is the construction of the linear map I+J(A) that extends the two linear maps I(A) and J(A) associated with the divided power structures on these ideals.

def IdealAdd.exp_linearMap (hIJ : n, a I J, hI.dpow n a = hJ.dpow n a) :
(I + J) l[A] (ExponentialModule A) :=
LinearMap.onSup (f := hI.exp_linearMap) (g := hJ.exp_linearMap)
(fun x hxI hxJ Subtype.coe_inj.mp
(Additive.toMul.injective (PowerSeries.ext (fun _ hIJ x hxI, hxJ⟩))))

In order to formalize this definition, we first formalize the more general construction LinearMap.onSup  , which given two A-submodules M,N of an A-module B, and two A-linear maps f:MB and g:NB that agree on MN, is the unique A-linear map M+NB that simultaneously extends f and g.

The divided power structure on I+J is then defined by extending IdealAdd.exp_linearMap by zero  .

def IdealAdd.dpow (n : ℕ) := Function.extend
-- If a is in I + J’,
(fun a a : (I + J) A)
-- then dpow n a is the nth coefficient of exp_{I + J} (a)’
(fun a coeff A n (exp_linearMap hIJ a))
--otherwise, it is zero
0

This furnishes the divided power map and also takes care of the axioms (i-v) of Definition 1. The verification of the two remaining axioms is essentially formal. For axiom (vii), it requires to check a combinatorial property which is itself proved using the theory of divided powers on the -algebra [X] of polynomials  .

Since γI+J is by construction compatible with γI and γJ, it follows that the identity map on A provides two divided power morphisms idA:(A,I,γI)(A,I+J,γI+J)   and idA:(A,J,γJ)(A,I+J,γI+J)  . Similarly, the compatibility condition implies that both (I,γI)   and (J,γJ)   are sub-dp-ideals of (I+J,γI+J) .

The fact that γI+J is the unique divided power structure on I+J which is compatible with both γI and γJ is proven in the theorem DividedPowers.IdealAdd.dividedPowers_unique  .

4 Discussion

4.1 Remarks about the Implementation

4.1.1 The Type of the dpow Map

In Definition 1, a divided power structure on an ideal I of a ring A is a family of maps {γn:IA}n satisfying properties (i) through (vii). The most literal representation of this family in Lean would be as a function dpow : I A. However, in the structure DividedPowers, we instead chose to represent this family as a map dpow : A A satisfying (i) through (vii) plus the condition that dpow n x = 0 for all n and all xI.

By opting for the second definition, we avoid having to provide explicit conversions between types. For example, to define divided powers on the sum of two ideals I and J of A, we need to impose the following compatibility condition on the elements of the intersection of these ideals.

(n : ℕ) (a : A), (ha : a I J), hI.dpow n a = hJ.dpow n a

If dpow were instead defined as a map I A, this would have to be rewritten as

(n : ℕ) (a : A), (ha : a I J), hI.dpow n a, haI = hJ.dpow n a, haJ

where haI and haJ are proofs that a belongs to the ideals I and J, respectively.

4.1.2 Divided Powers on Sums of Ideals

If (I,γI) and (J,γJ) are two divided power ideals of a ring A such that γI and γJ coincide on IJ, the construction of the divided power map γI+J on I+J combines the two A-linear maps I(A) and J(A) to a linear map on I+J.

This approach, while mathematically satisfying, posed several difficulties:

  • The most important one was the necessity of formalizing the construction of the exponential module (A), to define evaluation and substitution of power series. Despite its length, this detour brings a worthwhile addition to the Mathlib library.

  • A second one was the absence in the Mathlib library of the definitions that construct, given two modules M and N, two submodules P and Q of M and two linear maps f:PN and g:QN that agree on PQ, a linear map h:P+QN that extends f and g  .

  • A third one is that this construction only defines the divided power map on the ideal I+J, and one still has to extend it by 0.

In a first implementation, our construction of the divided power structure on the sum of two ideals had been more elementary. It consisted in proving that for xI and yJ, the expression k=0nγI,k(x)γJ,nk(y) only depends on x+y  ; call it γI+J,n(x+y). Since any element of I+J can be decomposed in this manner, this defines a function γI+J,n on I+J  , and it remains to prove that the axioms of a divided power structure are satisfied.

def IdealAdd_v1.dpow : A A := fun n => Function.extend
-- if c is of the form a + b’, for a in I and b in J’,
(fun a, b => (a : A) + (b : A) : I × J A)
-- then dpow n c is given by k=0nγI,k(x)γJ,nk(y)
(fun a, b => Finset.sum (range (n + 1)) fun k =>
hI.dpow k (a : A) * hJ.dpow (n - k) (b : A))
-- otherwise it is 0.
0

For comparison purposes, we provide both versions of the implementation of divided powers on sums of ideals: our preferred implementation using the exponential map is in the file IdealAdd.lean  , while the older implementation is in IdealAdd_v1.lean  .

4.1.3 Evaluation and Substitution of Power Series

Recall that the evaluation of a power series fA[[σ]] at a point b:σB is only mathematically relevant when b satisfies the conditions recorded in the structure MvPowerSeries.HasEval (see Listing 3).

However, to formalize the evaluation in Lean, it is more practical to extend it to all b:σB by providing “dummy” values outside the relevant domain of definition. As usual, we choose the value zero, except when f is (the coercion of) a polynomial, in which case we can provide the natural evaluation of that polynomial. Since substitution of power series is a special case of evaluation, the same remark applies.

The downside is that the function thus obtained has weak algebraic properties, and this makes the verification of functional equations somewhat complicated. For instance, when proving theorems that involve nested substitutions, one needs to check that the HasSubst condition is satisfied for all relevant power series. Since these verifications are often mathematically obvious, and performed in a similar way, it would be interesting to implement tactics that automate these tasks.

4.1.4 Inverting Factorials

We showed in Section 2.2 that, whenever I is an ideal in a commutative ring A and n is a natural number such that (n1)! is invertible in A and In=0, the family γm(x)=xmm! is a divided power structure on I. This is true in particular in the three cases described in Examples 5.

The proofs of these examples require to manipulate inverses of factorial elements. For instance, an intermediate step in the proof of dpow_mul_of_add_lt is to check that the following equality holds in A:

Ring.inverse m ! * Ring.inverse k ! = ((m + k).choose m) * Ring.inverse (m + k)!

In this situation, m!, k! and (m+k)! are all invertible in A, so an easy algebraic manipulation yields the following equivalent equality.

↑(m + k)! = k ! * (↑m ! * ↑((m + k).choose m))

However, currently this manipulation has to be performed manually. It would be useful to implement a tactic that can remove uses of Ring.inverse as in the example above (creating side goals to prove the required invertibility hypotheses). The resulting expressions could then, at least in certain cases, be further simplified by using tactics like ring (which does not deal with inversion) or norm_cast.

4.2 Future Work

4.2.1 Divided Powers on Discrete Valuation Rings

Example 6 can be generalized to construct divided powers on discrete valuation rings. Indeed, let R be a discrete valuation ring of mixed characteristic p and uniformizer π and write p=uπe, where uR is a unit and e. Then the ideal (π) has divided powers if and only if e<p [2, §3, Examples 3]. This result relies on the theory of extensions of valuations to ring extensions, which has been formalized in [8] but is not yet available in Mathlib.

4.2.2 The Divided Power Envelope

If (A,I,γ) is a divided power ring and JB is an ideal in an A-algebra B such that IBJ, then there exists a divided power A-algebra, called the divided power envelope of J relative to (A,I,γ) and denoted by DB,γ(J), with the following universal property: for every divided power morphism (A,I,γ)(C,K,δ), there is a one-to-one correspondence between ring homomorphisms BC that map J into K and A-linear divided power morphisms DB,γ(J)(C,K,δ) [2, Theorem 3.19].

The construction of the divided power envelope relies on a second universal construction, called the universal divided power algebra [14, 15]. When M is a module over a ring A, the universal divided power algebra of M is a graded ring ΓA(M), together with an A-linear map MΓA1(M), whose augmentation ideal ΓA+(M) has a divided power structure, and which is universal for these properties.

The construction of ΓA(M) as a plain graded algebra, together with the map MΓA1(M), is relatively straightforward, but it is a difficult theorem of Roby [15] that the augmentation ideal has divided powers. In fact, we discovered a gap in his proof during the formalization process. However, the ideas of that paper suggest an alternative argument, which is explained in the appendix of [2] and which we, incidentally, rediscovered independently, see [5].

We plan to conclude the formalization of this construction and that of the envelope in the forthcoming months. Note that the complete informal proof of the existence of these universal objects expands dozens of pages, with most of the work devoted to showing that the universal divided power algebra of a free module has free graded components.

4.2.3 The Rings of 𝒑-adic Periods

Once the divided power envelope has been formalized, we will use it to formalize the construction of the Fontaine period ring Bcris. The definition of this ring is highly technical, and it involves several steps which include defining the p-adic complex numbers [7], taking a ring of Witt vectors [6] and constructing the divided power envelope with respect to a certain ring homomorphism.

Fontaine period rings, including Bcris, are a fundamental tool in p-adic Hodge theory, an active area of research in number theory devoted to the study of p-adic Galois representations. Besides being used to detect interesting properties of representations, these period rings are also prominently used in comparison theorems between different cohomology theories; for instance, the ring Bcris is used in a comparison theorem between étale cohomology and crystalline cohomology of p-adic varieties. Hence, the formalization of these rings will open the door to formalizing key research in number theory and algebraic geometry.

In particular, as mentioned in the introduction, the work described in this paper is a prerequisite for the formalization of a complete proof of Fermat’s Last Theorem. More concretely, this proof relies on an “R=T” isomorphism between two deformations rings, where the ring R corresponds to crystalline deformations of a given mod p-representation.

The ring Bcris is used to identify crystalline representations; hence, while the formalization of the full theory of crystalline cohomology is not required for the proof of Fermat’s Last Theorem, the formalization of the divided power envelope certainly is.

References

  • [1] Pierre Berthelot. Cohomologie cristalline des schémas de caractéristique p>0, volume 407 of Lectures Notes in Mathematics. Springer-Verlag, 1974. doi:10.1007/BFb0068636.
  • [2] Pierre Berthelot and Arthur Ogus. Notes on crystalline cohomology, volume 21 of Mathematical Notes. Princeton University Press, 1978. URL: http://www.jstor.org/stable/j.ctt130hk6f.
  • [3] Henri Cartan. Puissances divisées. In Séminaire Henri Cartan, volume 7, pages 1–11, 1954-1955. URL: http://www.numdam.org/item/SHC_1954-1955__7_1_A7_0.pdf.
  • [4] Amine Chaieb. Formal Power Series. Journal of Automated Reasoning, 47(3):291–318, 2011. doi:10.1007/s10817-010-9195-9.
  • [5] Antoine Chambert-Loir and María Inés de Frutos-Fernández. Formalizing the divided power envelope in Lean. Big proof: formalizing mathematics at scale, 2025. URL: https://www.newton.ac.uk/seminar/46704/.
  • [6] Johan Commelin and Robert Y. Lewis. Formalizing the Ring of Witt Vectors. In Proceedings of the 10th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2021, pages 264–277, New York, NY, USA, 2021. Association for Computing Machinery. doi:10.1145/3437992.3439919.
  • [7] María Inés de Frutos-Fernández. Formalizing Norm Extensions and Applications to Number Theory. In Adam Naumowicz and René Thiemann, editors, 14th International Conference on Interactive Theorem Proving (ITP 2023), volume 268 of Leibniz International Proceedings in Informatics (LIPIcs), pages 13:1–13:18, Dagstuhl, Germany, 2023. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.ITP.2023.13.
  • [8] María Inés de Frutos-Fernández and Filippo Alberto Edoardo Nuccio Mortarino Majno di Capriglio. A Formalization of Complete Discrete Valuation Rings and Local Fields. In Proceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2024, pages 190–204, New York, NY, USA, 2024. Association for Computing Machinery. doi:10.1145/3636501.3636942.
  • [9] Leonardo de Moura, Soonho Kong, Jeremy Avigad, Floris van Doorn, and Jakob von Raumer. The Lean Theorem Prover (System Description). In Amy P. Felty and Aart Middeldorp, editors, Automated Deduction - CADE-25, volume 9195 of Lecture Notes in Computer Science, pages 378–388, Cham, 2015. Springer International Publishing. doi:10.1007/978-3-319-21401-6_26.
  • [10] Florent Hivert. Machine Checked Proofs and Programs in Algebraic Combinatorics. In Proceedings of the 14th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2025, pages 214–230, New York, NY, USA, 2025. Association for Computing Machinery. doi:10.1145/3703595.3705885.
  • [11] The mathlib Community. The Lean Mathematical Library. In Jasmin Blanchette and Cătălin Hriţcu, editors, Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, pages 367–381, New York, NY, USA, 2020. Association for Computing Machinery. doi:10.1145/3372885.3373824.
  • [12] Leonardo de Moura and Sebastian Ullrich. The Lean 4 Theorem Prover and Programming Language. In André Platzer and Geoff Sutcliffe, editors, Automated Deduction – CADE 28, pages 625–635, Cham, 2021. Springer International Publishing. doi:10.1007/978-3-030-79876-5_37.
  • [13] Álvaro Pelayo, Vladimir Voevodsky, and Michael A. Warren. A univalent formalization of the p-adic numbers. Mathematical Structures in Computer Science, 25(5):1147–1171, 2015. doi:10.1017/S0960129514000541.
  • [14] Norbert Roby. Lois polynomes et lois formelles en théorie des modules. Annales scientifiques de l’École normale supérieure, 80(3):213–348, 1963. doi:10.24033/asens.1124.
  • [15] Norbert Roby. Les algèbres à puissances divisées. Bulletin des Sciences Mathématiques, 89:75–92, 1965.
  • [16] Norbert Roby. Sur l’algèbre des puissances divisées d’un module et le module de ses différentielles. Annales scientifiques de l’École normale supérieure, 83(2):75–89, 1966. doi:10.24033/asens.1148.
  • [17] Piotr Rudnicki, Christoph Schwarzweller, and Andrzej Trybulec. Commutative Algebra in the Mizar System. Journal of Symbolic Computation, 32(1):143–169, 2001. doi:10.1006/jsco.2001.0456.