Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Core function fields, places, reduction data, and Frobenius objects

Definition
N25_Endgame

by FormallyCorrect · Nov 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

mazur-n25

This interface fixes the algebraic closure Q‾\overline{ℚ}Q​, the subgroup ΓH(25)Γ_H(25)ΓH​(25), the rational and geometric modular function fields, their versions over an arbitrary coefficient field, and the corresponding place types. It defines rational geometric places, the constant-field embedding, the modular jjj-function, residue-field specializations, reduction and Frobenius maps, the Frobenius-fixed Picard subgroup and its fixed-point equivalence, and a carrier for cusp choices. These objects form the common vocabulary for good reduction, place counts, cuspidal divisors, and the final Kummer argument.

Definition code
import Mathlib
import Definitions.Def_N25
import Definitions.Def_ModularCurve_QAdicPlace
import Definitions.Def_ModularCurve_QExpReductionModL
import Definitions.Def_ModularCurve_QExpFrobeniusModL
import Definitions.Def_FLTPrelim_Ramification
import Definitions.Def_ModularCurve_X0
import Definitions.Def_ModularCurve_X1
import Definitions.Def_ModularCurve_JqCoeff
set_option autoImplicit false
noncomputable section

/-! ### The `j`-invariant as a ratio of integral forms

`jBase25` needs that the `q`-expansion of `j` lies in the field generated by ratios of
integral weight-12 forms of every level. The proof writes `j = E₄³ / Δ` and identifies the
`q`-expansion of the discriminant with `X · η²⁴`; it is proved here because the definition
of `jBase25` depends on it. -/

section

noncomputable section

open UpperHalfPlane Complex Filter Topology
open scoped MatrixGroups PowerSeries.WithPiTopology

local notation "𝕢" => Function.Periodic.qParam

namespace ModularCurve

open Polynomial in

private def truncPoly (N : ℕ) : ℂ[X] := ∏ n ∈ Finset.range N, (1 - Polynomial.X ^ (n + 1)) ^ 24

private def etaPow : PowerSeries ℂ := ∏' n : ℕ, (1 - PowerSeries.X ^ (n + 1)) ^ 24

private def gfun (q : ℂ) : ℂ := ∏' n : ℕ, (1 - q ^ (n + 1)) ^ 24

private lemma multipliable_factor_pow :
    Multipliable fun n : ℕ => ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24 :=
  (PowerSeries.WithPiTopology.multipliable_one_sub_X_pow ℂ).pow 24

private lemma coeff_mul_factor_eq {m n : ℕ} (hmn : m < n + 1) (Q : PowerSeries ℂ) :
    PowerSeries.coeff m (Q * ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m Q := by

  obtain ⟨R, hR⟩ : PowerSeries.X ^ (n + 1) ∣
      ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24 - 1 := by
    have h := sub_dvd_pow_sub_pow ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) 1 24
    rw [one_pow, sub_sub_cancel_left] at h
    exact neg_dvd.mp h
  replace hR : ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24 =
      1 + PowerSeries.X ^ (n + 1) * R := by
    rw [← hR]; ring
  rw [hR, mul_add, mul_one, map_add, ← mul_assoc, mul_comm Q, mul_assoc,
    PowerSeries.coeff_X_pow_mul', if_neg (not_le.mpr hmn), add_zero]

private lemma coeff_trunc_eq_coeff_etaPow (m : ℕ) {N : ℕ} (hN : m < N) :
    PowerSeries.coeff m (∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m etaPow := by

  have hlim : Tendsto (fun N => PowerSeries.coeff m
      (∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24)) atTop
      (𝓝 (PowerSeries.coeff m etaPow)) :=
    ((PowerSeries.WithPiTopology.continuous_coeff ℂ m).tendsto _).comp
      multipliable_factor_pow.hasProd.tendsto_prod_nat

  have hconst : ∀ N', m < N' → ∀ N, N' ≤ N →
      PowerSeries.coeff m (∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m (∏ n ∈ Finset.range N', ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) := by
    intro N' hN' N hle
    induction N, hle using Nat.le_induction with
    | base => rfl
    | succ N hle ih => rw [Finset.prod_range_succ, coeff_mul_factor_eq (by omega), ih]
  have hev : (fun N => PowerSeries.coeff m
      (∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24)) =ᶠ[atTop]
      fun _ => PowerSeries.coeff m
        (∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) :=
    eventually_atTop.mpr ⟨N, fun N'' h => hconst N hN N'' h⟩
  exact (tendsto_nhds_unique (hlim.congr' hev) tendsto_const_nhds).symm

open Polynomial in
private lemma truncPoly_toPowerSeries (N : ℕ) :
    ((truncPoly N : ℂ[X]) : PowerSeries ℂ) =
      ∏ n ∈ Finset.range N, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24 := by
  rw [truncPoly, ← Polynomial.coeToPowerSeries.ringHom_apply, map_prod]
  simp [Polynomial.coeToPowerSeries.ringHom_apply, Polynomial.coe_pow, Polynomial.coe_X]

open Polynomial in

private lemma iterate_deriv_polynomial_eval (p : ℂ[X]) (m : ℕ) :
    deriv^[m] (fun q : ℂ => p.eval q) = fun q => (derivative^[m] p).eval q := by
  induction m generalizing p with
  | zero => rfl
  | succ m ih =>
    rw [Function.iterate_succ', Function.comp_apply, ih, Function.iterate_succ',
      Function.comp_apply]
    funext q
    exact Polynomial.deriv _

open Polynomial in
private lemma truncPoly_eval (N : ℕ) (q : ℂ) :
    (truncPoly N).eval q = ∏ n ∈ Finset.range N, (1 - q ^ (n + 1)) ^ 24 := by
  simp [truncPoly, Polynomial.eval_prod]

private lemma tendstoLocallyUniformlyOn_trunc :
    TendstoLocallyUniformlyOn (fun N q => ∏ n ∈ Finset.range N, (1 - q ^ (n + 1)) ^ 24) gfun atTop
      (Metric.ball (0 : ℂ) 1) := by
  have h1 : TendstoLocallyUniformlyOn (fun N q => ∏ n ∈ Finset.range N, (1 - q ^ (n + 1)))
      (fun q => ∏' n : ℕ, (1 - q ^ (n + 1))) atTop (Metric.ball (0 : ℂ) 1) := by
    have := ModularForm.multipliableLocallyUniformlyOn_one_sub_pow.hasProdLocallyUniformlyOn
      |>.tendstoLocallyUniformlyOn_finsetRange
    refine this.congr (fun N => ?_)
    intro q _
    simp
  have hc : ContinuousOn (fun q : ℂ => ∏' n : ℕ, (1 - q ^ (n + 1))) (Metric.ball (0 : ℂ) 1) :=
    ModularForm.differentiableOn_tprod_one_sub_pow.continuousOn

  have hpow : ∀ k : ℕ, TendstoLocallyUniformlyOn
      (fun N q => (∏ n ∈ Finset.range N, (1 - q ^ (n + 1))) ^ k)
      (fun q => (∏' n : ℕ, (1 - q ^ (n + 1))) ^ k) atTop (Metric.ball (0 : ℂ) 1) := by
    intro k
    induction k with
    | zero =>
      simp only [pow_zero]
      intro u hu x _
      exact ⟨Set.univ, Filter.univ_mem, Eventually.of_forall fun n y _ => refl_mem_uniformity hu⟩
    | succ k ih =>
      simp only [pow_succ]
      exact ih.mul₀ h1 (hc.pow k) hc
  refine ((hpow 24).congr fun N q _ => ?_).congr_right fun q hq => ?_
  · exact (Finset.prod_pow _ _ _).symm
  · exact ((ModularForm.multipliable_one_sub_pow (by simpa using hq)).tprod_pow 24).symm

private lemma differentiableOn_gfun : DifferentiableOn ℂ gfun (Metric.ball (0 : ℂ) 1) :=
  ModularForm.differentiableOn_tprod_one_sub_pow_pow 24

open Polynomial in

private lemma tendstoLocallyUniformlyOn_iterate_deriv_trunc (m : ℕ) :
    TendstoLocallyUniformlyOn (fun N q => (derivative^[m] (truncPoly N)).eval q) (deriv^[m] gfun)
      atTop (Metric.ball (0 : ℂ) 1) := by
  induction m with
  | zero =>
    simpa only [Function.iterate_zero, id_eq, truncPoly_eval] using tendstoLocallyUniformlyOn_trunc
  | succ m ih =>
    have h := ih.deriv (Eventually.of_forall fun N => (Polynomial.differentiable _).differentiableOn)
      Metric.isOpen_ball
    rw [Function.iterate_succ', Function.iterate_succ']
    refine h.congr fun N q _ => ?_
    simp only [Function.comp_apply, Polynomial.deriv]

open Polynomial in

private lemma iteratedDeriv_gfun_zero (m : ℕ) :
    iteratedDeriv m gfun 0 = m.factorial * PowerSeries.coeff m etaPow := by
  have h0 : (0 : ℂ) ∈ Metric.ball (0 : ℂ) 1 := Metric.mem_ball_self one_pos
  have hlim : Tendsto (fun N => (derivative^[m] (truncPoly N)).eval 0) atTop
      (𝓝 (deriv^[m] gfun 0)) :=
    (tendstoLocallyUniformlyOn_iterate_deriv_trunc m).tendsto_at h0

  have hev : (fun N => (derivative^[m] (truncPoly N)).eval 0) =ᶠ[atTop]
      fun _ => (m.factorial : ℂ) * PowerSeries.coeff m etaPow := by
    refine eventually_atTop.mpr ⟨m + 1, fun N hN => ?_⟩
    simp only
    rw [← Polynomial.coeff_zero_eq_eval_zero, Polynomial.coeff_iterate_derivative, zero_add,
      Nat.descFactorial_self, nsmul_eq_mul, ← Polynomial.coeff_coe, truncPoly_toPowerSeries,
      coeff_trunc_eq_coeff_etaPow m (by omega)]
  rw [iteratedDeriv_eq_iterate]
  exact tendsto_nhds_unique hlim (tendsto_const_nhds.congr' hev.symm)

private lemma hasSum_coeff_etaPow {q : ℂ} (hq : ‖q‖ < 1) :
    HasSum (fun m : ℕ => PowerSeries.coeff m etaPow * q ^ m) (gfun q) := by
  have hq' : q ∈ Metric.ball (0 : ℂ) 1 := by simpa using hq
  have h := Complex.hasSum_taylorSeries_on_ball differentiableOn_gfun hq'
  refine h.congr_fun fun m => ?_
  rw [iteratedDeriv_gfun_zero, sub_zero, smul_eq_mul, smul_eq_mul]
  field_simp
  rw [mul_div_assoc, div_self (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m)), mul_one]

private lemma hasSum_coeff_X_mul_etaPow {q : ℂ} (hq : ‖q‖ < 1) :
    HasSum (fun m : ℕ => PowerSeries.coeff m (PowerSeries.X * etaPow) * q ^ m) (q * gfun q) := by
  have h := (hasSum_coeff_etaPow hq).mul_left q
  rw [← hasSum_nat_add_iff' 1]
  simp only [Finset.range_one, Finset.sum_singleton, pow_zero, mul_one, PowerSeries.coeff_zero_X_mul,
    sub_zero]
  refine h.congr_fun fun m => ?_
  rw [PowerSeries.coeff_succ_X_mul, pow_succ]
  ring

private lemma discriminant_eq_qParam_mul_gfun (τ : ℍ) :
    ModularForm.discriminant τ = 𝕢 1 (τ : ℂ) * gfun (𝕢 1 (τ : ℂ)) := by

  rw [ModularForm.discriminant_eq_q_prod, gfun]

end ModularCurve

open ModularCurve in
private theorem ModularCurve.qExpansion_discriminant_eq_X_mul_tprod : UpperHalfPlane.qExpansion 1 ModularForm.discriminant = PowerSeries.X * ∏' n : ℕ, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24 := by
  have hsum : ∀ τ : ℍ, HasSum (fun m : ℕ =>
      PowerSeries.coeff m (PowerSeries.X * etaPow) • 𝕢 1 (τ : ℂ) ^ m) (CuspForm.discriminant τ) := by
    intro τ
    simp_rw [smul_eq_mul, CuspForm.coe_discriminant, discriminant_eq_qParam_mul_gfun τ]
    exact hasSum_coeff_X_mul_etaPow (by exact_mod_cast UpperHalfPlane.norm_qParam_lt_one 1 τ)
  ext m
  have h := ModularFormClass.qExpansion_coeff_unique one_pos
    one_mem_strictPeriods_SL (f := CuspForm.discriminant) hsum m
  rw [CuspForm.coe_discriminant] at h
  rw [← h]
  rfl
end

end

section

noncomputable section

open UpperHalfPlane Complex Filter Topology
open scoped MatrixGroups PowerSeries.WithPiTopology

local notation "𝕢" => Function.Periodic.qParam

namespace ModularCurve

private lemma coeff_mul_factor_eq' {R : Type*} [CommRing R] {m n : ℕ} (hmn : m < n + 1)
    (Q : PowerSeries R) :
    PowerSeries.coeff m (Q * ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m Q := by
  obtain ⟨S, hS⟩ : PowerSeries.X ^ (n + 1) ∣
      ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24 - 1 := by
    have h := sub_dvd_pow_sub_pow ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) 1 24
    rw [one_pow, sub_sub_cancel_left] at h
    exact neg_dvd.mp h
  replace hS : ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24 =
      1 + PowerSeries.X ^ (n + 1) * S := by
    rw [← hS]; ring
  rw [hS, mul_add, mul_one, map_add, ← mul_assoc, mul_comm Q, mul_assoc,
    PowerSeries.coeff_X_pow_mul', if_neg (not_le.mpr hmn), add_zero]

private lemma coeff_trunc_eq_coeff_tprod (R : Type*) [CommRing R] [TopologicalSpace R]
    [IsTopologicalRing R] [T2Space R] (m : ℕ) {N : ℕ} (hN : m < N) :
    PowerSeries.coeff m (∏ n ∈ Finset.range N, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m (∏' n : ℕ, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) := by
  have hmul : Multipliable fun n : ℕ => ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24 :=
    (PowerSeries.WithPiTopology.multipliable_one_sub_X_pow R).pow 24
  have hlim : Tendsto (fun N => PowerSeries.coeff m
      (∏ n ∈ Finset.range N, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24)) atTop
      (𝓝 (PowerSeries.coeff m (∏' n : ℕ, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24))) :=
    ((PowerSeries.WithPiTopology.continuous_coeff R m).tendsto _).comp hmul.hasProd.tendsto_prod_nat
  have hconst : ∀ N', N ≤ N' →
      PowerSeries.coeff m (∏ n ∈ Finset.range N', ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) =
      PowerSeries.coeff m (∏ n ∈ Finset.range N, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) := by
    intro N' hle
    induction N', hle using Nat.le_induction with
    | base => rfl
    | succ N' hle ih => rw [Finset.prod_range_succ, coeff_mul_factor_eq' (by omega), ih]
  have hev : (fun N' => PowerSeries.coeff m
      (∏ n ∈ Finset.range N', ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24)) =ᶠ[atTop]
      fun _ => PowerSeries.coeff m
        (∏ n ∈ Finset.range N, ((1 : PowerSeries R) - PowerSeries.X ^ (n + 1)) ^ 24) :=
    eventually_atTop.mpr ⟨N, hconst⟩
  exact tendsto_nhds_unique tendsto_const_nhds (hlim.congr' hev)

private lemma tprod_eq_map_dedekindEtaUnit :
    (∏' n : ℕ, ((1 : PowerSeries ℂ) - PowerSeries.X ^ (n + 1)) ^ 24) =
      dedekindEtaUnit.map (Int.castRingHom ℂ) := by
  ext m
  rw [dedekindEtaUnit, etaProd,
    ← ((PowerSeries.WithPiTopology.multipliable_one_sub_X_pow ℤ).tprod_pow 24),
    PowerSeries.coeff_map, ← coeff_trunc_eq_coeff_tprod ℂ m (Nat.lt_succ_self m),
    ← coeff_trunc_eq_coeff_tprod ℤ m (Nat.lt_succ_self m), ← PowerSeries.coeff_map,
    map_prod (PowerSeries.map (Int.castRingHom ℂ))]
  simp

end ModularCurve

open _root_.ModularCurve in
private theorem ModularCurve.qExpansion_discriminant_eq_map_X_mul_dedekindEtaUnit : UpperHalfPlane.qExpansion 1 ModularForm.discriminant = PowerSeries.map (Int.castRingHom ℂ) (PowerSeries.X * ModularCurve.dedekindEtaUnit) := by
  rw [qExpansion_discriminant_eq_X_mul_tprod, map_mul, PowerSeries.map_X,
    tprod_eq_map_dedekindEtaUnit]
end

end

section

noncomputable section

namespace JqMemRatios

open ModularForm UpperHalfPlane EisensteinSeries ModularCurve HahnSeries
open scoped MatrixGroups ModularForm

private theorem isIntegralQExp_E4 : IsIntegralQExp (E₄ : ℍ → ℂ) eisenstein4 := by
  rw [isIntegralQExp_iff]
  intro n
  rw [E_qExpansion_coeff (by norm_num) (by decide) n, eisenstein4, PowerSeries.coeff_mk]
  split_ifs with h
  · simp
  · rw [show _root_.bernoulli 4 = -1 / 30 by
      rw [bernoulli_eq_bernoulli'_of_ne_one (by norm_num), bernoulli'_four], ArithmeticFunction.sigma_apply]
    push_cast
    ring

variable (Γ : Subgroup SL(2, ℤ))

private def e4cube : ModularForm (Γ : Subgroup (GL (Fin 2) ℝ)) 12 :=
  restrictForm (Subgroup.map_le_range _ Γ) ((E₄.pow 3).mcast (by norm_num))

private def delta : ModularForm (Γ : Subgroup (GL (Fin 2) ℝ)) 12 :=
  restrictForm (Subgroup.map_le_range _ Γ) (CuspForm.discriminant : ModularForm 𝒮ℒ 12)

private theorem isIntegralQExp_e4cube : IsIntegralQExp (e4cube Γ : ℍ → ℂ) (eisenstein4 ^ 3) := by
  rw [IsIntegralQExp, e4cube, coe_restrictForm, map_pow, isIntegralQExp_E4,
    ModularForm.qExpansion_mcast, ModularForm.qExpansion_pow one_pos one_mem_strictPeriods_SL]

private theorem coe_delta : (delta Γ : ℍ → ℂ) = ModularForm.discriminant := rfl

private theorem isIntegralQExp_delta :
    IsIntegralQExp (delta Γ : ℍ → ℂ) (PowerSeries.X * dedekindEtaUnit) := by
  rw [IsIntegralQExp, coe_delta]
  exact ModularCurve.qExpansion_discriminant_eq_map_X_mul_dedekindEtaUnit.symm

variable (K : Type*) [Field K]

private theorem intSeriesC_delta_ne_zero : intSeriesC K (PowerSeries.X * dedekindEtaUnit) ≠ 0 := by
  intro h
  have h1 := congrArg (fun z : LaurentSeries K => z.coeff 1) h
  simp only [intSeriesC, HahnSeries.coeff_zero] at h1
  have h2 : (HahnSeries.ofPowerSeries ℤ K
      ((PowerSeries.X * dedekindEtaUnit).map (Int.castRingHom K))).coeff ((1 : ℕ) : ℤ) = 1 := by
    rw [HahnSeries.ofPowerSeries_apply_coeff, PowerSeries.coeff_map,
      show (1 : ℕ) = 0 + 1 from rfl, PowerSeries.coeff_succ_X_mul,
      PowerSeries.coeff_zero_eq_constantCoeff_apply, constantCoeff_dedekindEtaUnit, map_one]
  rw [show ((1 : ℕ) : ℤ) = 1 from rfl] at h2
  rw [h2] at h1
  exact one_ne_zero h1

private theorem jqModC_mul_delta :
    jqModC K * intSeriesC K (PowerSeries.X * dedekindEtaUnit) = intSeriesC K (eisenstein4 ^ 3) := by
  rw [jqModC, intSeriesC, intSeriesC, jNum, mul_assoc, ← map_mul, ← map_mul,
    show eisenstein4 ^ 3 * dedekindEtaUnitInv * (PowerSeries.X * dedekindEtaUnit) =
      PowerSeries.X * eisenstein4 ^ 3 by
        rw [mul_comm PowerSeries.X dedekindEtaUnit, ← mul_assoc, mul_assoc (eisenstein4 ^ 3),
          mul_comm dedekindEtaUnitInv, dedekindEtaUnit_mul_inv, mul_one, mul_comm],
    map_mul, PowerSeries.map_X, map_mul, HahnSeries.ofPowerSeries_X, ← mul_assoc,
    HahnSeries.single_mul_single]
  simp

private theorem jqModC_eq_div :
    jqModC K = intSeriesC K (eisenstein4 ^ 3) / intSeriesC K (PowerSeries.X * dedekindEtaUnit) := by
  rw [eq_div_iff (intSeriesC_delta_ne_zero K), jqModC_mul_delta]

end JqMemRatios

open JqMemRatios in
private theorem ModularCurve.jqModC_mem_intFormRatiosC (K : Type*) [Field K]
    (Γ : Subgroup (Matrix.SpecialLinearGroup (Fin 2) ℤ)) :
    ModularCurve.jqModC K ∈ ModularCurve.intFormRatiosC K Γ :=
  ⟨12, e4cube Γ, delta Γ, ModularCurve.eisenstein4 ^ 3, PowerSeries.X * ModularCurve.dedekindEtaUnit,
    isIntegralQExp_e4cube Γ, isIntegralQExp_delta Γ, intSeriesC_delta_ne_zero K, jqModC_eq_div K⟩

end

end

namespace N25.Endgame

abbrev Qbar := AlgebraicClosure ℚ
abbrev Γ25 : Subgroup (Matrix.SpecialLinearGroup (Fin 2) ℤ) :=
  CohCarrier.GammaH 25 N25.H25

abbrev FQ := ModularCurve.xHFunctionField 25 N25.H25
abbrev FG := ModularCurve.xHFunctionFieldBar 25 N25.H25
abbrev FBase (K : Type*) [Field K] :=
  ModularCurve.xHFunctionFieldC K 25 N25.H25

/-- The canonical coefficient algebra, exposed to avoid scalar-tower search. -/
instance FBaseAlgebra25 (K : Type*) [Field K] : Algebra K (FBase K) :=
  (FBase K).algebra

abbrev QPlace := AlgebraicCurve.Place ℚ FQ
abbrev GPlace := AlgebraicCurve.Place Qbar FG

def IsRationalGeomPlace (P : GPlace) : Prop :=
  P.deg = 1 ∧
    ∀ σ : N25.Gal, ModularCurve.arithmeticGalois FQ σ • P = P

abbrev RationalGeomPlace := {P : GPlace // IsRationalGeomPlace P}

noncomputable def emb25 : FQ →ₐ[ℚ] FG :=
  { toFun := fun f => ⟨ModularCurve.coeffEmb Qbar f,
      ModularCurve.coeffEmb_mem_laurentBaseChange Qbar f.property⟩
    map_zero' := Subtype.ext (map_zero _)
    map_one' := Subtype.ext (map_one _)
    map_add' := fun f g => Subtype.ext (map_add (ModularCurve.coeffEmb Qbar) (f : LaurentSeries ℚ) (g : LaurentSeries ℚ))
    map_mul' := fun f g => Subtype.ext (map_mul (ModularCurve.coeffEmb Qbar) (f : LaurentSeries ℚ) (g : LaurentSeries ℚ))
    commutes' := fun q => Subtype.ext (by
      exact RingHom.congr_fun (RingHom.ext_rat
        ((ModularCurve.coeffEmb Qbar).comp (FQ.toSubfield.subtype.comp (algebraMap ℚ FQ)))
        (FG.toSubfield.subtype.comp (algebraMap ℚ FG))) q) }

theorem coe_emb25 (f : FQ) :
    (emb25 f : LaurentSeries Qbar) =
      ModularCurve.coeffEmb Qbar (f : LaurentSeries ℚ) := rfl

def jBase25 (K : Type*) [Field K] : FBase K :=
  ⟨ModularCurve.jqModC K,
    ModularCurve.intFormRatiosC_subset K Γ25
      (ModularCurve.jqModC_mem_intFormRatiosC K Γ25)⟩

abbrev j25 : FQ := jBase25 ℚ

abbrev κ (A : ValuationSubring Qbar) := IsLocalRing.ResidueField A
abbrev FSpecial (A : ValuationSubring Qbar) := FBase (κ A)
abbrev SpecialPlace (A : ValuationSubring Qbar) :=
  AlgebraicCurve.Place (κ A) (FSpecial A)
abbrev SpecialPic (A : ValuationSubring Qbar) :=
  AlgebraicCurve.Pic0 (κ A) (FSpecial A)

structure RedDatum25 (ℓ : ℕ) [Fact ℓ.Prime] where
  A : ValuationSubring Qbar
  hA : A.LiesOverPrime ℓ
  charp : CharP (κ A) ℓ
  hred : ModularCurve.ReductionInputsQExpModL A Γ25

attribute [instance] RedDatum25.charp

abbrev red25 {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    N25.J →+ SpecialPic D.A :=
  ModularCurve.reductionQExpModL D.A Γ25

abbrev redPlace25 {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    GPlace → SpecialPlace D.A :=
  ModularCurve.placeReductionQExpModL D.hred

abbrev frobPic25 {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    SpecialPic D.A →+ SpecialPic D.A :=
  ModularCurve.qExpFrobeniusPushforwardModL (κ D.A) Γ25 ℓ

abbrev frobPlace25 {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    SpecialPlace D.A → SpecialPlace D.A :=
  ModularCurve.qExpFrobeniusPlaceModL (κ D.A) Γ25 ℓ

def RedFixed25 {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    AddSubgroup (SpecialPic D.A) :=
  (frobPic25 D - AddMonoidHom.id (SpecialPic D.A)).ker

noncomputable def redFixedEquivFixedPoints25
    {ℓ : ℕ} [Fact ℓ.Prime] (D : RedDatum25 ℓ) :
    ↥(RedFixed25 D) ≃ Function.fixedPoints (frobPic25 D) where
  toFun x := ⟨x.val, by
    have h := x.property
    change frobPic25 D x.val - x.val = 0 at h
    exact sub_eq_zero.mp h⟩
  invFun x := ⟨x.val, by
    change frobPic25 D x.val - x.val = 0
    exact sub_eq_zero.mpr x.property⟩
  left_inv _ := rfl
  right_inv _ := rfl

structure CuspChoice25 where
  hQ : ∃ j : FQ, (ModularCurve.qSeriesBar ℚ FQ j).order = -1
  hG : ∃ j : FG, (ModularCurve.qSeriesBar Qbar FG j).order = -1
  tauQ : FQ ≃ₐ[ℚ] FQ

end N25.Endgame
Source
B. Mazur, Modular curves and the Eisenstein ideal, Publ. IHES 47 (1977); Lean formalization of the order-25 case for this mission. Modules in the MazurProof/Keystone/Tate families are adapted from anthropics/fermats-last-theorem (Apache-2.0) via the xiangyazi24/FLT fork.

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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me