Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The Birch and Swinnerton-Dyer conjecture: the rank of E(Q)E(\mathbb{Q})E(Q) and the L-function of an elliptic curve over Q\mathbb{Q}Q

Definition
BSD

by korbonits · Sep 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

arithmetic-geometrybirch-swinnerton-dyerelliptic-curvesl-functionsmillennium-prizenumber-theory

This bundle fixes, in the namespace BSD, the two quantities compared by the Birch and Swinnerton-Dyer conjecture for an elliptic curve over Q\mathbb{Q}Q, as set out on pp. 1–2 of Andrew Wiles' official description of the Clay Millennium Prize Problem. Throughout, EEE is a Weierstrass equation

y2+a1xy+a3y=x3+a2x2+a4x+a6,ai∈Qy^2 + a_1 xy + a_3 y = x^3 + a_2 x^2 + a_4 x + a_6, \qquad a_i \in \mathbb{Q}y2+a1​xy+a3​y=x3+a2​x2+a4​x+a6​,ai​∈Q

(Mathlib's WeierstrassCurve ℚ); the theorems of the mission add the hypothesis that its discriminant is non-zero, so that EEE is an elliptic curve.

The rank (BSD.rank E). The rational points E(Q)E(\mathbb{Q})E(Q), i.e. the rational solutions (x,y)(x,y)(x,y) together with the point at infinity, form an abelian group under the chord-and-tangent law (Mathlib's W.toAffine.Point). The rank of EEE is the rank of this group as a Z\mathbb{Z}Z-module,

rank⁡E=rank⁡ZE(Q),\operatorname{rank} E = \operatorname{rank}_{\mathbb{Z}} E(\mathbb{Q}),rankE=rankZ​E(Q),

which by Mordell's theorem E(Q)≃Zr⊕E(Q)torsE(\mathbb{Q}) \simeq \mathbb{Z}^r \oplus E(\mathbb{Q})_{\mathrm{tors}}E(Q)≃Zr⊕E(Q)tors​ is the integer rrr of Wiles' text.

The L-function (BSD.IsLFunction E Λ). The Hasse–Weil L-series of EEE is Mathlib's WeierstrassCurve.LSeries: for each prime ppp a Weierstrass equation for EEE minimal at ppp is reduced modulo ppp, and the local factor is (1−app−s+p1−2s)−1(1 - a_p p^{-s} + p^{1-2s})^{-1}(1−ap​p−s+p1−2s)−1 with ap=p+1−#E~(Fp)a_p = p + 1 - \#\tilde E(\mathbb{F}_p)ap​=p+1−#E~(Fp​) at primes of good reduction, (1−p−s)−1(1 - p^{-s})^{-1}(1−p−s)−1 at split multiplicative primes, (1+p−s)−1(1 + p^{-s})^{-1}(1+p−s)−1 at non-split multiplicative primes and 111 at additive primes; the product over all primes is expanded as a Dirichlet series L(E,s)=∑n≥1ann−sL(E,s) = \sum_{n\ge1} a_n n^{-s}L(E,s)=∑n≥1​an​n−s, which converges for Re⁡s>3/2\operatorname{Re} s > 3/2Res>3/2 by Hasse's bound ∣ap∣≤2p|a_p| \le 2\sqrt p∣ap​∣≤2p​. This is the complete L-series L∗(C,s)L^*(C,s)L∗(C,s) of Wiles' Remark 1 (the incomplete product over p∤2Δp \nmid 2\Deltap∤2Δ in Wiles' display differs from it by finitely many factors holomorphic and non-zero at s=1s = 1s=1). A function Λ:C→C\Lambda : \mathbb{C} \to \mathbb{C}Λ:C→C is the L-function of EEE when

  1. Λ\LambdaΛ is entire (complex-differentiable at every point of C\mathbb{C}C), and
  2. Λ(s)=L(E,s)\Lambda(s) = L(E,s)Λ(s)=L(E,s) for every sss with Re⁡s>3/2\operatorname{Re} s > 3/2Res>3/2.

By the identity theorem such a Λ\LambdaΛ is unique if it exists; that it exists is the theorem of Wiles, Taylor–Wiles and Breuil–Conrad–Diamond–Taylor recorded as a milestone of the mission.

Formalization Note No minimality or integrality is imposed on the chosen Weierstrass equation: Mathlib's L-series passes to a minimal model at each prime internally, and the group of points depends only on the curve, so both quantities are invariant under change of Weierstrass equation. Mathlib's LSeries takes the junk value 000 at points where the Dirichlet series does not converge, which is why IsLFunction only asks for agreement on the half-plane Re⁡s>3/2\operatorname{Re} s > 3/2Res>3/2. Mathlib's Module.finrank is 000 for a module that is not of finite rank; by Mordell's theorem this case does not occur for elliptic curves. Neither definition assumes Δ≠0\Delta \ne 0Δ=0; that hypothesis is carried by the theorems.

Definition code
import Mathlib

/-!
A. Wiles, *The Birch and Swinnerton-Dyer Conjecture*, Clay Mathematics Institute Millennium
Prize Problem description (2000), pp. 1–2.

The two quantities compared by the conjecture, for an elliptic curve `W` over `ℚ` given by a
Weierstrass equation: the rank `r` of the Mordell–Weil group `W(ℚ)`, and the analytic
continuation of the Hasse–Weil L-series `L(W, s)`.

The L-series itself is Mathlib's `WeierstrassCurve.LSeries`: the Dirichlet series `∑ aₙ n⁻ˢ`
whose coefficients are those of the Euler product over all primes `p` of
`(1 - aₚ p⁻ˢ + p¹⁻²ˢ)⁻¹` at primes of good reduction (`aₚ = p + 1 - #W̃(𝔽ₚ)`, computed on a
model minimal at `p`), `(1 - p⁻ˢ)⁻¹` at split multiplicative primes, `(1 + p⁻ˢ)⁻¹` at
non-split multiplicative primes and `1` at additive primes — the complete L-series
`L*(C, s)` of Wiles' Remark 1.  The Dirichlet series converges for `Re s > 3/2`; Mathlib's
`LSeries` takes the junk value `0` where it does not converge.
-/

namespace BSD

open WeierstrassCurve

/-- `Λ` is *the* L-function of `W`: an entire function `ℂ → ℂ` that agrees with the Hasse–Weil
Dirichlet series `L(W, s)` on the half-plane `Re s > 3/2` on which the series converges. -/
structure IsLFunction (W : WeierstrassCurve ℚ) (Λ : ℂ → ℂ) : Prop where
  differentiable : Differentiable ℂ Λ
  eq_LSeries : ∀ s : ℂ, 3 / 2 < s.re → Λ s = W.LSeries s

/-- The rank `r` of `W(ℚ)`: the rank of the abelian group of rational points of `W`, regarded
as a `ℤ`-module (the `r` in `W(ℚ) ≃ ℤ^r ⊕ W(ℚ)_tors`). -/
noncomputable def rank (W : WeierstrassCurve ℚ) : ℕ := Module.finrank ℤ W.toAffine.Point

end BSD
Source
A. Wiles, The Birch and Swinnerton-Dyer Conjecture, Clay Mathematics Institute Millennium Prize Problem description (2000), https://www.claymath.org/wp-content/uploads/2022/05/birchswin.pdf, p. 1 (Mordell's theorem C(Q) ≃ Z^r ⊕ C(Q)_tors and the definition of the rank r; definition of N_p, a_p) and p. 2 (the Euler product L(C,s), its convergence for Re(s) > 3/2, Hasse's conjecture on holomorphic continuation, and Remark 1 on the completed L-series L*(C,s) with Euler factors at all primes)
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1

Read-back

Throughout, a Weierstrass curve over Q\mathbb{Q}Q is nothing more than an ordered quintuple of rational numbers (a1,a2,a3,a4,a6)(a_1, a_2, a_3, a_4, a_6)(a1​,a2​,a3​,a4​,a6​), thought of as the coefficients of the equation

Y2+a1XY+a3Y=X3+a2X2+a4X+a6.Y^2 + a_1 XY + a_3 Y = X^3 + a_2 X^2 + a_4 X + a_6 .Y2+a1​XY+a3​Y=X3+a2​X2+a4​X+a6​.

Nothing in this bundle requires the discriminant Δ\DeltaΔ of WWW to be nonzero, requires WWW to be an elliptic curve, or imposes any other condition on the five coefficients. Both declarations accept an arbitrary such quintuple.


BSD.IsLFunction W Λ

This is a proposition about two pieces of data: a Weierstrass curve WWW over Q\mathbb{Q}Q (any quintuple as above) and an arbitrary function Λ:C→C\Lambda : \mathbb{C} \to \mathbb{C}Λ:C→C. The proposition holds exactly when both of the following conditions are satisfied.

(1) Entireness. Λ\LambdaΛ is complex-differentiable at every point of C\mathbb{C}C (i.e. Λ\LambdaΛ is an entire function).

(2) Agreement on a half-plane. For every complex number sss with Re⁡(s)>32\operatorname{Re}(s) > \tfrac{3}{2}Re(s)>23​ (strict inequality; 32\tfrac3223​ is the real number 1.51.51.5),

Λ(s)=LW(s),\Lambda(s) = L_W(s),Λ(s)=LW​(s),

where LW(s)L_W(s)LW​(s) is the Mathlib quantity WeierstrassCurve.LSeries W s, unfolded as follows. Nothing is asserted about Λ\LambdaΛ on the closed half-plane Re⁡(s)≤32\operatorname{Re}(s) \le \tfrac32Re(s)≤23​ beyond entireness.

Unfolding LW(s)L_W(s)LW​(s). Let aW:N→Za_W : \mathbb{N} \to \mathbb{Z}aW​:N→Z be the arithmetic function WeierstrassCurve.LFunction W described below (an arithmetic function is a function on N={0,1,2,… }\mathbb{N} = \{0,1,2,\dots\}N={0,1,2,…} with value 000 at 000). Then

LW(s)  =  ∑n′  ts(n),ts(0)=0,ts(n)=aW(n)ns(n≥1),L_W(s) \;=\; {\sum_{n}}' \; t_s(n), \qquad t_s(0) = 0, \qquad t_s(n) = \frac{a_W(n)}{n^{s}} \quad (n \ge 1),LW​(s)=n∑​′ts​(n),ts​(0)=0,ts​(n)=nsaW​(n)​(n≥1),

where aW(n)a_W(n)aW​(n) is cast from Z\mathbb{Z}Z to C\mathbb{C}C, nsn^sns is the complex power exp⁡(slog⁡n)\exp(s \log n)exp(slogn), and ∑′{\sum}'∑′ is the total unconditional sum: if the family (ts(n))n∈N(t_s(n))_{n \in \mathbb{N}}(ts​(n))n∈N​ is unconditionally summable in C\mathbb{C}C (i.e. the finite partial sums over finite sets of indices converge along the filter of finite subsets), LW(s)L_W(s)LW​(s) is that sum; if it is not summable, LW(s)L_W(s)LW​(s) is defined to be 000. No hypothesis in the bundle asserts summability at any sss; at any sss with Re⁡(s)>32\operatorname{Re}(s) > \tfrac32Re(s)>23​ at which the series fails to be summable, condition (2) demands Λ(s)=0\Lambda(s) = 0Λ(s)=0.

Unfolding aWa_WaW​ (the formal Dirichlet series). Let O\mathcal{O}O be the ring of integers of the number field Q\mathbb{Q}Q, and let p\mathfrak{p}p range over the height-one spectrum of O\mathcal{O}O: the nonzero prime ideals of O\mathcal{O}O. For each such p\mathfrak{p}p write KpK_\mathfrak{p}Kp​ for the p\mathfrak{p}p-adic completion of Q\mathbb{Q}Q (Mathlib's adicCompletion), and Rp⊂KpR_\mathfrak{p} \subset K_\mathfrak{p}Rp​⊂Kp​ for its valuation subring (adicCompletionIntegers, the elements of valuation ≤1\le 1≤1). Let WpW_\mathfrak{p}Wp​ be WWW with its five coefficients mapped into KpK_\mathfrak{p}Kp​ via the canonical map Q→Kp\mathbb{Q} \to K_\mathfrak{p}Q→Kp​. Then

aW  =  ∏p′  Ep,a_W \;=\; {\prod_{\mathfrak{p}}}' \; E_\mathfrak{p},aW​=p∏​′Ep​,

where EpE_\mathfrak{p}Ep​ is the local Euler factor (an arithmetic function with values in Z\mathbb{Z}Z) defined below, and ∏′{\prod}'∏′ is the total unconditional product in the ring of Z\mathbb{Z}Z-valued arithmetic functions under Dirichlet convolution, taken in the topology of pointwise convergence with Z\mathbb{Z}Z discrete (a net of arithmetic functions converges to ggg iff for each nnn, the nnn-th coefficients are eventually equal to g(n)g(n)g(n)). If the family (Ep)p(E_\mathfrak{p})_\mathfrak{p}(Ep​)p​ is multipliable in this sense, aWa_WaW​ is its product (when the product exists but is not unique, or when only finitely many factors differ from 111, Mathlib's specific choice conventions apply); if it is not multipliable, aWa_WaW​ is the constant arithmetic function 1\mathbf{1}1, i.e. 1(1)=1\mathbf{1}(1) = 11(1)=1 and 1(n)=0\mathbf{1}(n) = 01(n)=0 for n≠1n \ne 1n=1.

Unfolding EpE_\mathfrak{p}Ep​ (the local Euler factor). Fix p\mathfrak{p}p, and write K=KpK = K_\mathfrak{p}K=Kp​, R=RpR = R_\mathfrak{p}R=Rp​, κ=R/mR\kappa = R/\mathfrak{m}_Rκ=R/mR​ for the residue field of RRR, and vvv for the multiplicative valuation on KKK associated to mR\mathfrak{m}_RmR​ (values in Z0m={0}∪{powers of a generator}\mathbb{Z}^{\mathrm{m}}_0 = \{0\} \cup \{\text{powers of a generator}\}Z0m​={0}∪{powers of a generator}, normalised so that v(x)=1v(x) = 1v(x)=1 means xxx is a unit of RRR and v(x)<1v(x) < 1v(x)<1 means x∈mRx \in \mathfrak{m}_Rx∈mR​).

Step (a): a minimal model. A Weierstrass curve VVV over KKK is called integral (relative to RRR) if there exists a Weierstrass curve over RRR whose coefficients map to those of VVV. It is called minimal if the change of variables C=1C = 1C=1 is maximal, among all changes of variables CCC over KKK such that C⋅VC \cdot VC⋅V is integral, for the quantity v~(C⋅V)\tilde v(C \cdot V)v~(C⋅V), where v~(U)=v(ΔU)\tilde v(U) = v(\Delta_U)v~(U)=v(ΔU​) if UUU is integral and v~(U)=⊥\tilde v(U) = \botv~(U)=⊥ (the smallest possible value) otherwise. (Since v(Δ)≤1v(\Delta) \le 1v(Δ)≤1 for integral curves, maximality of the multiplicative valuation means the discriminant is "least divisible" by mR\mathfrak{m}_RmR​ among integral models.) Let W′:=Wpmin⁡W' := W_\mathfrak{p}^{\min}W′:=Wpmin​ be C0⋅WpC_0 \cdot W_\mathfrak{p}C0​⋅Wp​ for some change of variables C0C_0C0​ over KKK, chosen by the axiom of choice, such that C0⋅WpC_0 \cdot W_\mathfrak{p}C0​⋅Wp​ is minimal. (Mathlib proves such a C0C_0C0​ exists for every Weierstrass curve over KKK; which one is chosen is unspecified.) W′W'W′ is minimal and in particular integral.

Step (b): the reduction and the point count. Let III be a Weierstrass curve over RRR, again chosen by the axiom of choice, whose coefficients map to those of W′W'W′ (an "integral model" of W′W'W′). Let W′‾\overline{W'}W′ be the Weierstrass curve over κ\kappaκ obtained by reducing the five coefficients of III modulo mR\mathfrak{m}_RmR​. Set

q:=#κ∈N,N:=# W′‾(κ)∈N,a:=q+1−N∈Z,q := \#\kappa \in \mathbb{N}, \qquad N := \#\,\overline{W'}(\kappa) \in \mathbb{N}, \qquad a := q + 1 - N \in \mathbb{Z},q:=#κ∈N,N:=#W′(κ)∈N,a:=q+1−N∈Z,

where both #\## are Mathlib's Nat.card: the cardinality of the type if it is finite, and 000 if it is infinite. Here W′‾(κ)\overline{W'}(\kappa)W′(κ) denotes the type of nonsingular points in affine coordinates on W′‾\overline{W'}W′: it consists of one distinguished element (the point at infinity) together with all pairs (x,y)∈κ×κ(x,y) \in \kappa \times \kappa(x,y)∈κ×κ such that

y2+aˉ1xy+aˉ3y=x3+aˉ2x2+aˉ4x+aˉ6and(aˉ1y≠3x2+2aˉ2x+aˉ4    or    2y+aˉ1x+aˉ3≠0),y^2 + \bar a_1 xy + \bar a_3 y = x^3 + \bar a_2 x^2 + \bar a_4 x + \bar a_6 \quad\text{and}\quad \bigl(\bar a_1 y \ne 3x^2 + 2\bar a_2 x + \bar a_4 \;\;\text{or}\;\; 2y + \bar a_1 x + \bar a_3 \ne 0\bigr),y2+aˉ1​xy+aˉ3​y=x3+aˉ2​x2+aˉ4​x+aˉ6​and(aˉ1​y=3x2+2aˉ2​x+aˉ4​or2y+aˉ1​x+aˉ3​=0),

i.e. the pairs satisfying the Weierstrass equation at which at least one partial derivative of the Weierstrass polynomial is nonzero. (Points of W′‾\overline{W'}W′ that satisfy the equation but at which both partial derivatives vanish are not counted.) In particular, if κ\kappaκ were infinite then q=0q = 0q=0, and N=0N = 0N=0 whenever the point type is infinite.

Step (c): the local polynomial. Define fp(T)∈Z[T]f_\mathfrak{p}(T) \in \mathbb{Z}[T]fp​(T)∈Z[T] by the following case split (the first applicable case is used; the case split is classical, i.e. not required to be decidable):

  • if W′W'W′ has good reduction — meaning W′W'W′ is minimal and v(ΔW′)=1v(\Delta_{W'}) = 1v(ΔW′​)=1 (the discriminant of W′W'W′ is a unit of RRR) — then fp(T)=1−aT+qT2f_\mathfrak{p}(T) = 1 - aT + qT^2fp​(T)=1−aT+qT2 with a,qa, qa,q as in step (b);
  • otherwise, if W′W'W′ has split multiplicative reduction — meaning W′W'W′ is minimal, v(ΔW′)<1v(\Delta_{W'}) < 1v(ΔW′​)<1, v(c4(W′))=1v(c_4(W')) = 1v(c4​(W′))=1, and the polynomial
c4(I) T2+a1(I) c4(I) T−(54 b6(I)−3 b2(I) b4(I)+a2(I) c4(I)),c_4(I)\,T^2 + a_1(I)\,c_4(I)\,T - \bigl(54\, b_6(I) - 3\, b_2(I)\, b_4(I) + a_2(I)\, c_4(I)\bigr),c4​(I)T2+a1​(I)c4​(I)T−(54b6​(I)−3b2​(I)b4​(I)+a2​(I)c4​(I)),

with coefficients computed from the chosen integral model III and then reduced to κ\kappaκ, splits over κ\kappaκ (belongs to the multiplicative monoid generated by constant polynomials and monic linear polynomials T+cT + cT+c, c∈κc \in \kappac∈κ) — then fp(T)=1−Tf_\mathfrak{p}(T) = 1 - Tfp​(T)=1−T;

  • otherwise, if W′W'W′ has multiplicative reduction — meaning W′W'W′ is minimal, v(ΔW′)<1v(\Delta_{W'}) < 1v(ΔW′​)<1 and v(c4(W′))=1v(c_4(W')) = 1v(c4​(W′))=1 (given the previous case failed, this is the non-split case) — then fp(T)=1+Tf_\mathfrak{p}(T) = 1 + Tfp​(T)=1+T;
  • otherwise (which, W′W'W′ being minimal, is exactly the case v(ΔW′)<1v(\Delta_{W'}) < 1v(ΔW′​)<1 and v(c4(W′))<1v(c_4(W')) < 1v(c4​(W′))<1, "additive reduction"), fp(T)=1f_\mathfrak{p}(T) = 1fp​(T)=1.

Here b2,b4,b6,c4,Δb_2, b_4, b_6, c_4, \Deltab2​,b4​,b6​,c4​,Δ are the standard polynomial expressions in the coefficients aia_iai​ (b2=a12+4a2b_2 = a_1^2 + 4a_2b2​=a12​+4a2​, b4=2a4+a1a3b_4 = 2a_4 + a_1 a_3b4​=2a4​+a1​a3​, b6=a32+4a6b_6 = a_3^2 + 4a_6b6​=a32​+4a6​, b8=a12a6+4a2a6−a1a3a4+a2a32−a42b_8 = a_1^2 a_6 + 4a_2 a_6 - a_1 a_3 a_4 + a_2 a_3^2 - a_4^2b8​=a12​a6​+4a2​a6​−a1​a3​a4​+a2​a32​−a42​, c4=b22−24b4c_4 = b_2^2 - 24 b_4c4​=b22​−24b4​, Δ=−b22b8−8b43−27b62+9b2b4b6\Delta = -b_2^2 b_8 - 8 b_4^3 - 27 b_6^2 + 9 b_2 b_4 b_6Δ=−b22​b8​−8b43​−27b62​+9b2​b4​b6​).

Step (d): the reciprocal power series. Let gp(T)∈Z[[T]]g_\mathfrak{p}(T) \in \mathbb{Z}[[T]]gp​(T)∈Z[[T]] be the formal power series obtained from fpf_\mathfrak{p}fp​ by Mathlib's invOfUnit with the unit 111: its constant coefficient is 111, and for n≥1n \ge 1n≥1 its nnn-th coefficient is −∑i+j=n,  j<n[Ti]fp⋅[Tj]gp-\sum_{i + j = n,\; j < n} [T^i] f_\mathfrak{p} \cdot [T^j] g_\mathfrak{p}−∑i+j=n,j<n​[Ti]fp​⋅[Tj]gp​. Since in all four cases fpf_\mathfrak{p}fp​ has constant coefficient 111, this is the genuine multiplicative inverse gp=1/fpg_\mathfrak{p} = 1/f_\mathfrak{p}gp​=1/fp​ in Z[[T]]\mathbb{Z}[[T]]Z[[T]].

Step (e): substituting T=q−sT = q^{-s}T=q−s. EpE_\mathfrak{p}Ep​ is the arithmetic function ofPowerSeries q g_p:

  • if q>1q > 1q>1: Ep(n)=[Tk] gpE_\mathfrak{p}(n) = [T^k]\, g_\mathfrak{p}Ep​(n)=[Tk]gp​ when n=qkn = q^kn=qk for some k∈Nk \in \mathbb{N}k∈N, and Ep(n)=0E_\mathfrak{p}(n) = 0Ep​(n)=0 when nnn is not a power of qqq;
  • if q≤1q \le 1q≤1 (in particular if q=0q = 0q=0 because κ\kappaκ is infinite): EpE_\mathfrak{p}Ep​ is the junk value c⋅1c \cdot \mathbf{1}c⋅1 where ccc is the constant coefficient of gpg_\mathfrak{p}gp​ (here c=1c = 1c=1), i.e. Ep(1)=1E_\mathfrak{p}(1) = 1Ep​(1)=1 and Ep(n)=0E_\mathfrak{p}(n) = 0Ep​(n)=0 for n≠1n \ne 1n=1.

This completes the unfolding of aWa_WaW​, hence of LW(s)L_W(s)LW​(s), hence of condition (2).

Summary of what is not assumed by IsLFunction: no condition on ΔW\Delta_WΔW​ (singular curves are allowed); no summability of the Dirichlet series anywhere; no convergence of the Euler product; no uniqueness statement about Λ\LambdaΛ; no functional equation; no condition on Λ\LambdaΛ for Re⁡(s)≤32\operatorname{Re}(s) \le \tfrac32Re(s)≤23​ other than being part of an entire function.


BSD.rank W

This is a natural number attached to any Weierstrass curve WWW over Q\mathbb{Q}Q (again any quintuple; no elliptic hypothesis). It is defined as

rank⁡(W)  :=  finrank⁡Z(W(Q)),\operatorname{rank}(W) \;:=\; \operatorname{finrank}_{\mathbb{Z}}\bigl(W(\mathbb{Q})\bigr),rank(W):=finrankZ​(W(Q)),

with the following meanings.

The module W(Q)W(\mathbb{Q})W(Q). W.toAffine is WWW itself, regarded in affine coordinates (a notational re-labelling, not a change of data). Its type of points, W.toAffine.Point, consists of one distinguished element 000 (the point at infinity) together with all pairs (x,y)∈Q×Q(x,y) \in \mathbb{Q} \times \mathbb{Q}(x,y)∈Q×Q satisfying

y2+a1xy+a3y=x3+a2x2+a4x+a6and(a1y≠3x2+2a2x+a4    or    2y+a1x+a3≠0),y^2 + a_1 xy + a_3 y = x^3 + a_2 x^2 + a_4 x + a_6 \quad\text{and}\quad \bigl(a_1 y \ne 3x^2 + 2a_2 x + a_4 \;\;\text{or}\;\; 2y + a_1 x + a_3 \ne 0\bigr),y2+a1​xy+a3​y=x3+a2​x2+a4​x+a6​and(a1​y=3x2+2a2​x+a4​or2y+a1​x+a3​=0),

i.e. the rational solutions of the Weierstrass equation at which at least one partial derivative is nonzero. If WWW happens to be singular, its singular rational points (if any) are simply excluded from this type; the type is defined regardless. This type carries the standard chord–tangent abelian group law of Mathlib (negation (x,y)↦(x,−y−a1x−a3)(x,y) \mapsto (x, -y - a_1 x - a_3)(x,y)↦(x,−y−a1​x−a3​); the sum of two points is 000 when they are negatives of one another and otherwise is given by the usual secant/tangent formulas), which Mathlib defines for every Weierstrass curve over a field, without requiring the curve to be elliptic. The abelian group is regarded as a Z\mathbb{Z}Z-module in the usual way (n⋅P=P+⋯+Pn \cdot P = P + \dots + Pn⋅P=P+⋯+P).

finrank⁡Z\operatorname{finrank}_\mathbb{Z}finrankZ​. For a Z\mathbb{Z}Z-module MMM, Mathlib defines

rank⁡Z(M):=sup⁡{ ∣S∣:S⊆M, S is Z-linearly independent }\operatorname{rank}_\mathbb{Z}(M) := \sup\{\, |S| : S \subseteq M,\ S \text{ is } \mathbb{Z}\text{-linearly independent}\,\}rankZ​(M):=sup{∣S∣:S⊆M, S is Z-linearly independent}

as a cardinal (the supremum over all subsets SSS such that no nontrivial finite Z\mathbb{Z}Z-linear combination of distinct elements of SSS is 000; the supremum need not be attained), and

finrank⁡Z(M):=toNat⁡(rank⁡Z(M)),\operatorname{finrank}_\mathbb{Z}(M) := \operatorname{toNat}\bigl(\operatorname{rank}_\mathbb{Z}(M)\bigr),finrankZ​(M):=toNat(rankZ​(M)),

where toNat⁡\operatorname{toNat}toNat sends a finite cardinal to the corresponding natural number and sends every infinite cardinal to 000. Consequently:

  • if the supremum of sizes of Z\mathbb{Z}Z-linearly independent subsets of W(Q)W(\mathbb{Q})W(Q) is a finite number rrr, then rank⁡(W)=r\operatorname{rank}(W) = rrank(W)=r;
  • if that supremum is infinite (there are arbitrarily large, or an infinite, Z\mathbb{Z}Z-linearly independent subset), then rank⁡(W)=0\operatorname{rank}(W) = 0rank(W)=0;
  • torsion elements (elements P≠0P \ne 0P=0 with nP=0nP = 0nP=0 for some n≥1n \ge 1n≥1) never belong to a linearly independent subset, so they do not contribute;
  • the definition does not require W(Q)W(\mathbb{Q})W(Q) to be finitely generated, and for Z\mathbb{Z}Z-modules finrank⁡Z\operatorname{finrank}_\mathbb{Z}finrankZ​ can be nonzero for non-finitely-generated modules (e.g. finrank⁡Z(Q)=1\operatorname{finrank}_\mathbb{Z}(\mathbb{Q}) = 1finrankZ​(Q)=1); no finiteness hypothesis of any kind is stated or used in this declaration.
Human review
  • Endorsed by Shuze Chen · Sep 8, 2026

  • Endorsed by korbonits · Sep 8, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me