Fermat's Last Theorem in Lean 4

← all definition modules

Definitions/Def_AutomorphicForm_CentreCutSiegelSet.lean

definition module

Centre-cut Siegel sets and capped compact blocks for adelic GL(2)

Fix a number field F and work in the project's adelic group AdelicGL2 (π“ž F) F of invertible 2\times 2 matrices over the adele ring of F, with its finite and archimedean projections glFin, glArch and, for each infinite place w, the component map archComponent F w landing in \mathrm{GL}_2(F_w). The module defines, for real parameters c,u,d_1,d_2, the set centreCutSiegelSet F c u d₁ dβ‚‚ of all g such that (i) the finite part of g lies in the subgroup finiteIntegralGL2 (integral matrices, integral inverse), and, for every infinite place w, (ii) localHeight of g_w is \ge c, (iii) xWindowSq of g_w is \le u^2, (iv) archDetNorm w g lies in the closed interval [d_1,d_2]. The three archimedean quantities are defined in the imported modules; the proofs here use the identities \texttt{localHeight}(g)=\lVert\det g\rVert/\texttt{rowNormSq}(g) and \texttt{topNormSq}(g)=\texttt{rowNormSq}(g)\,(\texttt{xWindowSq}(g)+\texttt{localHeight}(g)^2), with rowNormSq, topNormSq the squared norms of the second, respectively first, row, and archDetNorm w g =\lVert\det g_w\rVert. Note that the determinant window is imposed separately at each infinite place. The second definition, cappedSiegelBlock F c u d₁ dβ‚‚, intersects the above with the ceiling condition \texttt{localHeight}(g_w)\le 4c at every infinite place.

The accompanying lemmas give: the membership unfolding; membership of 1 under c\le 1, d_1\le 1\le d_2; failure of stability under the centre (for d_2<4 there is a central element, a scalar 2 at one infinite place, moving 1 out of the set); containment in integralWindowedSiegelSet F (c ^ βˆ‘ w, w.mult) u; measurability and closedness; continuity of the local height and of the x-window at a fixed place; membership of 1 in the interior under the strict margins c<1, u\ne 0, d_1<1<d_2, hence a nonempty open subset. A generic section bounds, over any normed field K, the entries of g and of g^{-1} in terms of c,u,d_1,d_2 under the clauses c\le\texttt{localHeight}(g)\le 4c, \texttt{xWindowSq}(g)\le u^2, \lVert\det g\rVert\in[d_1,d_2], and deduces compactness of that block of \mathrm{GL}_2(K) when K is proper and c,d_1>0; properSpace_completion supplies properness of F_w, and isCompact_cappedSiegelBlock transfers the argument to the adelic capped block. No covering statement and no Haar-measure statement is made here.

Relation to Mathlib

Mathlib has no Siegel sets for adelic \mathrm{GL}_2; the sets and the height/window functions are the project's own (the latter from the imported modules). properSpace_completion proves a ProperSpace instance for InfinitePlace.Completion used locally rather than taken from Mathlib; the compactness arguments otherwise run through Mathlib's Units.embedProduct and product-of-closed-balls machinery.

Where it is used

These sets provide the measure-theoretic domain on \mathrm{GL}_2(\mathbb{A}_F) used in the project's adelic volume computations for automorphic forms on \mathrm{GL}_2: the determinant windows remove the central directions along which a pure product-height Siegel set has zero or infinite Haar measure, and the capped blocks supply the compact pieces out of which finiteness and positivity of the volume are assembled.

References

  1. A. Borel, Introduction aux groupes arithmΓ©tiques, Publications de l'Institut de MathΓ©matique de l'UniversitΓ© de Strasbourg XV, Hermann, 1969
  2. D. Bump, Automorphic Forms and Representations, Cambridge Studies in Advanced Mathematics 55, Cambridge University Press, 1997
  3. V. Platonov and A. Rapinchuk, Algebraic Groups and Number Theory, Pure and Applied Mathematics 139, Academic Press, 1994

References are suggested automatically and have not been individually verified.

English text generated automatically from the Lean source; the Lean statement is authoritative.

Source file: Definitions/Def_AutomorphicForm_CentreCutSiegelSet.lean

Imports

Imported by

Declarations

Source

import Definitions.Def_NumberField_AdelicVolume

open MeasureTheory Set IsDedekindDomain NumberField Metric

noncomputable section

namespace AutomorphicForm

namespace WindowedSiegel

open NumberField.AdelicLevel NumberField.AdelicVolume NumberField.AdelicCentre

variable (F : Type) [Field F] [NumberField F]

def centreCutSiegelSet (c u d₁ dβ‚‚ : ℝ) : Set (AdelicGL2 (π“ž F) F) :=
  {g | glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F ∧
    (βˆ€ w : InfinitePlace F,
      c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))) ∧
    (βˆ€ w : InfinitePlace F,
      xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2) ∧
    (βˆ€ w : InfinitePlace F, archDetNorm w g ∈ Icc d₁ dβ‚‚)}

variable {F}

theorem mem_centreCutSiegelSet_iff {c u d₁ dβ‚‚ : ℝ} {g : AdelicGL2 (π“ž F) F} :
    g ∈ centreCutSiegelSet F c u d₁ dβ‚‚ ↔
      glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F ∧
      (βˆ€ w : InfinitePlace F,
        c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))) ∧
      (βˆ€ w : InfinitePlace F,
        xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2) ∧
      (βˆ€ w : InfinitePlace F, archDetNorm w g ∈ Icc d₁ dβ‚‚) :=
  Iff.rfl

theorem one_mem_centreCutSiegelSet {c u d₁ dβ‚‚ : ℝ} (hc : c ≀ 1) (hd₁ : d₁ ≀ 1)
    (hdβ‚‚ : 1 ≀ dβ‚‚) : (1 : AdelicGL2 (π“ž F) F) ∈ centreCutSiegelSet F c u d₁ dβ‚‚ := by
  refine ⟨?_, fun w => ?_, fun w => ?_, fun w => ?_⟩
  Β· rw [map_one]
    exact Subgroup.one_mem _
  Β· rw [map_one, map_one, localHeight_one]
    exact hc
  Β· rw [map_one, map_one, xWindowSq_one]
    positivity
  Β· unfold archDetNorm
    rw [map_one, map_one, Units.val_one, Matrix.det_one, norm_one]
    exact ⟨hd₁, hdβ‚‚βŸ©

theorem not_centrally_stable_centreCutSiegelSet {c u d₁ dβ‚‚ : ℝ} (hc : c ≀ 1)
    (hd₁ : d₁ ≀ 1) (hdβ‚‚ : 1 ≀ dβ‚‚) (hdβ‚‚4 : dβ‚‚ < 4) :
    βˆƒ z g, g ∈ centreCutSiegelSet F c u d₁ dβ‚‚ ∧
      z * g βˆ‰ centreCutSiegelSet F c u d₁ dβ‚‚ ∧
      z ∈ Subgroup.center (AdelicGL2 (π“ž F) F) := by
  obtain ⟨vβ‚€βŸ© := (inferInstance : Nonempty (InfinitePlace F))
  have haβ‚€ : β€–(2 : vβ‚€.Completion)β€– = 2 := norm_two_completion vβ‚€
  have ha0 : (2 : vβ‚€.Completion) β‰  0 := by
    intro h
    rw [h, norm_zero] at haβ‚€
    norm_num at haβ‚€
  refine ⟨centralScalar (π“ž F) F (archCentralUnit F vβ‚€ (Units.mk0 2 ha0)), 1,
    one_mem_centreCutSiegelSet hc hd₁ hdβ‚‚, fun hmem => ?_, ?_⟩
  case refine_2 =>
    rw [center_eq_range_scalar]
    exact ⟨_, rfl⟩
  have h4 := (mem_centreCutSiegelSet_iff.mp hmem).2.2.2 vβ‚€
  rw [archDetNorm_centralScalar_mul] at h4
  unfold archDetNorm at h4
  rw [map_one, map_one, Units.val_one, Matrix.det_one, norm_one, mul_one, Units.val_mk0,
    haβ‚€] at h4
  have : (2 : ℝ) * 2 ≀ dβ‚‚ := h4.2
  linarith

theorem centreCutSiegelSet_subset_integralWindowedSiegelSet {c u d₁ dβ‚‚ : ℝ}
    (hc : 0 ≀ c) :
    centreCutSiegelSet F c u d₁ dβ‚‚ βŠ†
      integralWindowedSiegelSet F (c ^ (βˆ‘ w : InfinitePlace F, w.mult)) u := by
  rintro g ⟨hK, hfloor, hwin, -⟩
  refine ⟨hK, ?_, hwin⟩
  unfold archHeight
  rw [← Finset.prod_pow_eq_pow_sum]
  exact Finset.prod_le_prod (fun w _ => pow_nonneg hc _)
    (fun w _ => pow_le_pow_leftβ‚€ hc (hfloor w) _)

theorem measurableSet_centreCutSiegelSet {mS : MeasurableSpace (AdelicGL2 (π“ž F) F)}
    [BorelSpace (AdelicGL2 (π“ž F) F)] (c u d₁ dβ‚‚ : ℝ) :
    MeasurableSet (centreCutSiegelSet F c u d₁ dβ‚‚) := by
  have hK : IsOpen {g : AdelicGL2 (π“ž F) F |
      glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F} :=
    (isOpen_finiteLevelZero (R := π“ž F) (K := F) (N := ⊀) (by simp)).preimage
      (continuous_glFin (π“ž F) F)
  have hfloor : βˆ€ w : InfinitePlace F, IsClosed {g : AdelicGL2 (π“ž F) F |
      c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))} := fun w =>
    isClosed_le continuous_const ((continuous_localHeight).comp
      ((continuous_archComponent F w).comp (continuous_glArch (π“ž F) F)))
  have hwin : βˆ€ w : InfinitePlace F, IsClosed {g : AdelicGL2 (π“ž F) F |
      xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2} := fun w =>
    isClosed_le ((continuous_xWindowSq).comp
      ((continuous_archComponent F w).comp (continuous_glArch (π“ž F) F))) continuous_const
  have hdet : βˆ€ w : InfinitePlace F, IsClosed {g : AdelicGL2 (π“ž F) F |
      archDetNorm w g ∈ Icc d₁ dβ‚‚} := fun w =>
    isClosed_Icc.preimage (continuous_archDetNorm w)
  have : centreCutSiegelSet F c u d₁ dβ‚‚ =
      {g | glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F} ∩
      ((β‹‚ w : InfinitePlace F, {g | c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))}) ∩
       ((β‹‚ w : InfinitePlace F, {g | xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2}) ∩
        (β‹‚ w : InfinitePlace F, {g | archDetNorm w g ∈ Icc d₁ dβ‚‚}))) := by
    ext g
    simp only [mem_centreCutSiegelSet_iff, mem_inter_iff, mem_setOf_eq, mem_iInter]
  rw [this]
  exact hK.measurableSet.inter
    (((isClosed_iInter hfloor).measurableSet).inter
      (((isClosed_iInter hwin).measurableSet).inter
        ((isClosed_iInter hdet).measurableSet)))

theorem continuous_localHeight_place (w : InfinitePlace F) :
    Continuous fun g : AdelicGL2 (π“ž F) F =>
      localHeight (archComponent F w (glArch (π“ž F) F g)) :=
  continuous_localHeight.comp ((continuous_archComponent F w).comp
    (continuous_glArch (π“ž F) F))

theorem continuous_xWindowSq_place (w : InfinitePlace F) :
    Continuous fun g : AdelicGL2 (π“ž F) F =>
      xWindowSq (archComponent F w (glArch (π“ž F) F g)) :=
  continuous_xWindowSq.comp ((continuous_archComponent F w).comp
    (continuous_glArch (π“ž F) F))

theorem one_mem_interior_centreCutSiegelSet {c u d₁ dβ‚‚ : ℝ} (hc : c < 1) (hu : u β‰  0)
    (hd₁ : d₁ < 1) (hdβ‚‚ : 1 < dβ‚‚) :
    (1 : AdelicGL2 (π“ž F) F) ∈ interior (centreCutSiegelSet F c u d₁ dβ‚‚) := by
  have hK : IsOpen {g : AdelicGL2 (π“ž F) F |
      glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F} :=
    (isOpen_finiteLevelZero (R := π“ž F) (K := F) (N := ⊀) (by simp)).preimage
      (continuous_glFin (π“ž F) F)
  have hfloor : IsOpen {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      c < localHeight (archComponent F w (glArch (π“ž F) F g))} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        c < localHeight (archComponent F w (glArch (π“ž F) F g))}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            c < localHeight (archComponent F w (glArch (π“ž F) F g))} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isOpen_iInter_of_finite fun w =>
      isOpen_lt continuous_const (continuous_localHeight_place w)
  have hwin : IsOpen {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      xWindowSq (archComponent F w (glArch (π“ž F) F g)) < u ^ 2} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        xWindowSq (archComponent F w (glArch (π“ž F) F g)) < u ^ 2}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            xWindowSq (archComponent F w (glArch (π“ž F) F g)) < u ^ 2} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isOpen_iInter_of_finite fun w =>
      isOpen_lt (continuous_xWindowSq_place w) continuous_const
  have hdet : IsOpen {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      archDetNorm w g ∈ Ioo d₁ dβ‚‚} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        archDetNorm w g ∈ Ioo d₁ dβ‚‚}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            archDetNorm w g ∈ Ioo d₁ dβ‚‚} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isOpen_iInter_of_finite fun w => isOpen_Ioo.preimage (continuous_archDetNorm w)
  rw [mem_interior]
  refine ⟨{g : AdelicGL2 (π“ž F) F |
        glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F}
      ∩ ({g | βˆ€ w : InfinitePlace F,
            c < localHeight (archComponent F w (glArch (π“ž F) F g))}
      ∩ ({g | βˆ€ w : InfinitePlace F,
            xWindowSq (archComponent F w (glArch (π“ž F) F g)) < u ^ 2}
      ∩ {g | βˆ€ w : InfinitePlace F, archDetNorm w g ∈ Ioo d₁ dβ‚‚})),
    fun g hg => ⟨hg.1, fun w => (hg.2.1 w).le, fun w => (hg.2.2.1 w).le,
      fun w => ⟨(hg.2.2.2 w).1.le, (hg.2.2.2 w).2.le⟩⟩,
    hK.inter (hfloor.inter (hwin.inter hdet)), ?_, ?_, ?_, ?_⟩
  Β· show glFin (π“ž F) F 1 ∈ finiteIntegralGL2 (π“ž F) F
    rw [map_one]
    exact Subgroup.one_mem _
  Β· intro w
    show c < localHeight (archComponent F w (glArch (π“ž F) F 1))
    rw [map_one, map_one, localHeight_one]
    exact hc
  Β· intro w
    show xWindowSq (archComponent F w (glArch (π“ž F) F 1)) < u ^ 2
    rw [map_one, map_one, xWindowSq_one]
    positivity
  Β· intro w
    show archDetNorm w 1 ∈ Ioo d₁ dβ‚‚
    unfold archDetNorm
    rw [map_one, map_one, Units.val_one, Matrix.det_one, norm_one]
    exact ⟨hd₁, hdβ‚‚βŸ©

theorem exists_isOpen_subset_centreCutSiegelSet {c u d₁ dβ‚‚ : ℝ} (hc : c < 1)
    (hu : u β‰  0) (hd₁ : d₁ < 1) (hdβ‚‚ : 1 < dβ‚‚) :
    βˆƒ U : Set (AdelicGL2 (π“ž F) F), IsOpen U ∧ U.Nonempty ∧
      U βŠ† centreCutSiegelSet F c u d₁ dβ‚‚ :=
  ⟨interior (centreCutSiegelSet F c u d₁ dβ‚‚), isOpen_interior,
    ⟨1, one_mem_interior_centreCutSiegelSet hc hu hd₁ hdβ‚‚βŸ©, interior_subset⟩
section GenericBlock

variable {K : Type*} [NormedField K]

theorem rowNormSq_le_of_clauses {g : GL (Fin 2) K} {c dβ‚‚ : ℝ} (hc : 0 < c)
    (hlh : c ≀ localHeight g)
    (hdet : β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ≀ dβ‚‚) :
    rowNormSq (g : Matrix (Fin 2) (Fin 2) K) ≀ dβ‚‚ / c := by
  have hrow := rowNormSq_pos g
  have h1 : c * rowNormSq (g : Matrix (Fin 2) (Fin 2) K)
      ≀ β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– := by
    have h2 : c ≀ β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€–
        / rowNormSq (g : Matrix (Fin 2) (Fin 2) K) := hlh
    rw [le_div_iffβ‚€ hrow] at h2
    linarith
  rw [le_div_iffβ‚€ hc]
  nlinarith

theorem topNormSq_le_of_clauses {g : GL (Fin 2) K} {c u dβ‚‚ : ℝ} (hc : 0 < c)
    (hlh : c ≀ localHeight g) (hlh4 : localHeight g ≀ 4 * c)
    (hxw : xWindowSq g ≀ u ^ 2)
    (hdet : β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ≀ dβ‚‚) :
    topNormSq (g : Matrix (Fin 2) (Fin 2) K) ≀ dβ‚‚ / c * (u ^ 2 + (4 * c) ^ 2) := by
  have hrow := rowNormSq_pos g
  have hrowle := rowNormSq_le_of_clauses hc hlh hdet

  have htop : topNormSq (g : Matrix (Fin 2) (Fin 2) K)
      = rowNormSq (g : Matrix (Fin 2) (Fin 2) K) * (xWindowSq g + localHeight g ^ 2) := by
    unfold xWindowSq
    field_simp
    ring
  rw [htop]
  have hlh0 : 0 ≀ localHeight g := le_trans hc.le hlh
  have hxlh : xWindowSq g + localHeight g ^ 2 ≀ u ^ 2 + (4 * c) ^ 2 := by
    have : localHeight g ^ 2 ≀ (4 * c) ^ 2 := by nlinarith
    linarith
  have hxlh0 : 0 ≀ xWindowSq g + localHeight g ^ 2 := by
    have h1 : 0 ≀ topNormSq (g : Matrix (Fin 2) (Fin 2) K) := by
      unfold topNormSq; positivity
    nlinarith [htop, hrow]
  have hd20 : 0 ≀ dβ‚‚ / c := hrow.le.trans hrowle
  exact mul_le_mul hrowle hxlh hxlh0 hd20

theorem entry_norm_le_of_clauses {g : GL (Fin 2) K} {c u d₁ dβ‚‚ : ℝ} (hc : 0 < c)
    (hlh : c ≀ localHeight g) (hlh4 : localHeight g ≀ 4 * c)
    (hxw : xWindowSq g ≀ u ^ 2)
    (hdet : β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ∈ Icc d₁ dβ‚‚) (i j : Fin 2) :
    β€–(g : Matrix (Fin 2) (Fin 2) K) i jβ€–
      ≀ Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) := by
  have hrowle := rowNormSq_le_of_clauses hc hlh hdet.2
  have htople := topNormSq_le_of_clauses hc hlh hlh4 hxw hdet.2
  have hdβ‚‚0 : 0 ≀ dβ‚‚ / c := div_nonneg (le_trans (norm_nonneg _) hdet.2) hc.le
  have h00 : β€–(g : Matrix (Fin 2) (Fin 2) K) 0 0β€– ^ 2
      ≀ topNormSq (g : Matrix (Fin 2) (Fin 2) K) := by
    unfold topNormSq
    nlinarith [sq_nonneg β€–(g : Matrix (Fin 2) (Fin 2) K) 0 1β€–]
  have h01 : β€–(g : Matrix (Fin 2) (Fin 2) K) 0 1β€– ^ 2
      ≀ topNormSq (g : Matrix (Fin 2) (Fin 2) K) := by
    unfold topNormSq
    nlinarith [sq_nonneg β€–(g : Matrix (Fin 2) (Fin 2) K) 0 0β€–]
  have h10 : β€–(g : Matrix (Fin 2) (Fin 2) K) 1 0β€– ^ 2
      ≀ rowNormSq (g : Matrix (Fin 2) (Fin 2) K) := by
    unfold rowNormSq
    nlinarith [sq_nonneg β€–(g : Matrix (Fin 2) (Fin 2) K) 1 1β€–]
  have h11 : β€–(g : Matrix (Fin 2) (Fin 2) K) 1 1β€– ^ 2
      ≀ rowNormSq (g : Matrix (Fin 2) (Fin 2) K) := by
    unfold rowNormSq
    nlinarith [sq_nonneg β€–(g : Matrix (Fin 2) (Fin 2) K) 1 0β€–]
  have hsplit : dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)
      = dβ‚‚ / c + dβ‚‚ / c * (u ^ 2 + (4 * c) ^ 2) := by ring
  have hterm : 0 ≀ dβ‚‚ / c * (u ^ 2 + (4 * c) ^ 2) :=
    mul_nonneg hdβ‚‚0 (by positivity)
  have hRtop : topNormSq (g : Matrix (Fin 2) (Fin 2) K)
      ≀ dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2) := by
    rw [hsplit]
    linarith
  have hRrow : rowNormSq (g : Matrix (Fin 2) (Fin 2) K)
      ≀ dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2) := by
    rw [hsplit]
    linarith
  refine Real.le_sqrt_of_sq_le ?_
  fin_cases i <;> fin_cases j
  Β· exact h00.trans hRtop
  Β· exact h01.trans hRtop
  Β· exact h10.trans hRrow
  Β· exact h11.trans hRrow

theorem inv_entry_norm_le_of_clauses {g : GL (Fin 2) K} {c u d₁ dβ‚‚ : ℝ} (hc : 0 < c)
    (hd₁ : 0 < d₁) (hlh : c ≀ localHeight g) (hlh4 : localHeight g ≀ 4 * c)
    (hxw : xWindowSq g ≀ u ^ 2)
    (hdet : β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ∈ Icc d₁ dβ‚‚) (i j : Fin 2) :
    β€–((g⁻¹ : GL (Fin 2) K) : Matrix (Fin 2) (Fin 2) K) i jβ€–
      ≀ Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) / d₁ := by
  have hB := entry_norm_le_of_clauses hc hlh hlh4 hxw hdet
  have hdet0 : ((g : Matrix (Fin 2) (Fin 2) K)).det β‰  0 := by
    intro h
    rw [h, norm_zero] at hdet
    exact absurd hdet.1 (not_le.mpr hd₁)

  have hcoe : ((g⁻¹ : GL (Fin 2) K) : Matrix (Fin 2) (Fin 2) K)
      = ((g : Matrix (Fin 2) (Fin 2) K))⁻¹ := Matrix.coe_units_inv g
  rw [hcoe, Matrix.inv_def, Ring.inverse_eq_inv, Matrix.smul_apply, norm_smul, norm_inv]
  have hadj : β€–((g : Matrix (Fin 2) (Fin 2) K)).adjugate i jβ€–
      ≀ Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) := by
    rw [Matrix.adjugate_fin_two]
    fin_cases i <;> fin_cases j
    Β· show β€–(g : Matrix (Fin 2) (Fin 2) K) 1 1β€– ≀ _
      exact hB 1 1
    Β· show β€–-(g : Matrix (Fin 2) (Fin 2) K) 0 1β€– ≀ _
      rw [norm_neg]; exact hB 0 1
    Β· show β€–-(g : Matrix (Fin 2) (Fin 2) K) 1 0β€– ≀ _
      rw [norm_neg]; exact hB 1 0
    Β· show β€–(g : Matrix (Fin 2) (Fin 2) K) 0 0β€– ≀ _
      exact hB 0 0
  have hdinv : β€–((g : Matrix (Fin 2) (Fin 2) K)).det‖⁻¹ ≀ d₁⁻¹ := by
    rw [← one_div, ← one_div]
    exact one_div_le_one_div_of_le hd₁ hdet.1
  have h0 : (0 : ℝ) ≀ β€–((g : Matrix (Fin 2) (Fin 2) K)).det‖⁻¹ := by positivity
  calc β€–((g : Matrix (Fin 2) (Fin 2) K)).det‖⁻¹ * β€–((g : Matrix (Fin 2) (Fin 2) K)).adjugate i jβ€–
      ≀ d₁⁻¹ * Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) := by
        exact mul_le_mul hdinv hadj (norm_nonneg _) (by positivity)
    _ = Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) / d₁ := by
        ring

theorem isCompact_glBlock [ProperSpace K] {c u d₁ dβ‚‚ : ℝ} (hc : 0 < c)
    (hd₁ : 0 < d₁) :
    IsCompact {g : GL (Fin 2) K |
      (c ≀ localHeight g ∧ localHeight g ≀ 4 * c) ∧ xWindowSq g ≀ u ^ 2 ∧
      β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ∈ Icc d₁ dβ‚‚} := by
  set B := Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) with hB_def
  set C : Set (Matrix (Fin 2) (Fin 2) K) :=
    Set.pi Set.univ fun _ : Fin 2 => Set.pi Set.univ fun _ : Fin 2 =>
      closedBall (0 : K) B with hC_def
  set C' : Set (Matrix (Fin 2) (Fin 2) K) :=
    Set.pi Set.univ fun _ : Fin 2 => Set.pi Set.univ fun _ : Fin 2 =>
      closedBall (0 : K) (B / d₁) with hC'_def
  have hC : IsCompact C :=
    isCompact_univ_pi fun _ => isCompact_univ_pi fun _ => isCompact_closedBall _ _
  have hC' : IsCompact C' :=
    isCompact_univ_pi fun _ => isCompact_univ_pi fun _ => isCompact_closedBall _ _
  have hK : IsCompact ((Units.embedProduct (Matrix (Fin 2) (Fin 2) K)) ⁻¹'
      (C Γ—Λ’ (MulOpposite.op '' C'))) :=
    Units.isClosedEmbedding_embedProduct.isCompact_preimage
      (hC.prod (hC'.image MulOpposite.continuous_op))
  have hclosed : IsClosed {g : GL (Fin 2) K |
      (c ≀ localHeight g ∧ localHeight g ≀ 4 * c) ∧ xWindowSq g ≀ u ^ 2 ∧
      β€–((g : Matrix (Fin 2) (Fin 2) K)).detβ€– ∈ Icc d₁ dβ‚‚} := by
    refine IsClosed.inter (IsClosed.inter ?_ ?_) (IsClosed.inter ?_ ?_)
    Β· exact isClosed_le continuous_const continuous_localHeight
    Β· exact isClosed_le continuous_localHeight continuous_const
    Β· exact isClosed_le continuous_xWindowSq continuous_const
    Β· exact (isClosed_Icc).preimage continuous_det_gl.norm
  refine hK.of_isClosed_subset hclosed ?_
  rintro g ⟨⟨hlh, hlh4⟩, hxw, hdet⟩
  have hent := entry_norm_le_of_clauses hc hlh hlh4 hxw hdet
  have hinv := inv_entry_norm_le_of_clauses hc hd₁ hlh hlh4 hxw hdet
  refine ⟨fun i _ => fun j _ => ?_, ?_⟩
  Β· rw [mem_closedBall_zero_iff]
    exact hent i j
  · refine ⟨((g⁻¹ : GL (Fin 2) K) : Matrix (Fin 2) (Fin 2) K), fun i _ => fun j _ => ?_, rfl⟩
    rw [mem_closedBall_zero_iff]
    exact hinv i j

end GenericBlock

section PerPlace

omit [NumberField F] in

theorem properSpace_completion (w : InfinitePlace F) : ProperSpace w.Completion := by
  obtain ⟨r, rpos, hr⟩ := exists_isCompact_closedBall (0 : w.Completion)
  have h2 : β€–(2 : w.Completion)β€– = 2 := norm_two_completion w
  have h20 : (2 : w.Completion) β‰  0 := by
    intro h
    rw [h, norm_zero] at h2
    norm_num at h2
  have hC : βˆ€ n : β„•, IsCompact (Metric.closedBall (0 : w.Completion) (2 ^ n * r)) := by
    intro n
    have h2n : (2 : w.Completion) ^ n β‰  0 := pow_ne_zero _ h20
    have hs := hr.smul ((2 : w.Completion) ^ n)
    rw [_root_.smul_closedBall' h2n, smul_zero, norm_pow, h2] at hs
    exact hs
  have hTop : Filter.Tendsto (fun n : β„• => (2 : ℝ) ^ n * r) Filter.atTop Filter.atTop :=
    Filter.Tendsto.atTop_mul_const rpos
      (tendsto_pow_atTop_atTop_of_one_lt (by norm_num : (1 : ℝ) < 2))
  exact ProperSpace.of_seq_closedBall hTop (Filter.Eventually.of_forall hC)

omit [NumberField F] in

theorem isCompact_archBlock (w : InfinitePlace F) {c u d₁ dβ‚‚ : ℝ} (hc : 0 < c)
    (hd₁ : 0 < d₁) :
    IsCompact {g : GL (Fin 2) w.Completion |
      (c ≀ localHeight g ∧ localHeight g ≀ 4 * c) ∧ xWindowSq g ≀ u ^ 2 ∧
      β€–((g : Matrix (Fin 2) (Fin 2) w.Completion)).detβ€– ∈ Icc d₁ dβ‚‚} := by
  haveI := properSpace_completion w
  exact isCompact_glBlock hc hd₁

end PerPlace

variable (F)

def cappedSiegelBlock (c u d₁ dβ‚‚ : ℝ) : Set (AdelicGL2 (π“ž F) F) :=
  centreCutSiegelSet F c u d₁ dβ‚‚ ∩
    {g | βˆ€ w : InfinitePlace F,
      localHeight (archComponent F w (glArch (π“ž F) F g)) ≀ 4 * c}

variable {F}

theorem mem_cappedSiegelBlock_iff {c u d₁ dβ‚‚ : ℝ} {g : AdelicGL2 (π“ž F) F} :
    g ∈ cappedSiegelBlock F c u d₁ dβ‚‚ ↔
      g ∈ centreCutSiegelSet F c u d₁ dβ‚‚ ∧
      βˆ€ w : InfinitePlace F,
        localHeight (archComponent F w (glArch (π“ž F) F g)) ≀ 4 * c := Iff.rfl

theorem isClosed_centreCutSiegelSet (c u d₁ dβ‚‚ : ℝ) :
    IsClosed (centreCutSiegelSet F c u d₁ dβ‚‚) := by
  have hK : IsClosed {g : AdelicGL2 (π“ž F) F |
      glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F} :=
    ((finiteIntegralGL2 (π“ž F) F).isClosed_of_isOpen
      (isOpen_finiteLevelZero (R := π“ž F) (K := F) (N := ⊀) (by simp))).preimage
      (continuous_glFin (π“ž F) F)
  have hfloor : IsClosed {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isClosed_iInter fun w =>
      isClosed_le continuous_const (continuous_localHeight_place w)
  have hwin : IsClosed {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isClosed_iInter fun w =>
      isClosed_le (continuous_xWindowSq_place w) continuous_const
  have hdet : IsClosed {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      archDetNorm w g ∈ Icc d₁ dβ‚‚} := by
    have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
        archDetNorm w g ∈ Icc d₁ dβ‚‚}
        = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
            archDetNorm w g ∈ Icc d₁ dβ‚‚} := by
      ext g
      simp [Set.mem_iInter]
    rw [hset]
    exact isClosed_iInter fun w => isClosed_Icc.preimage (continuous_archDetNorm w)
  have hdecomp : centreCutSiegelSet F c u d₁ dβ‚‚ =
      {g : AdelicGL2 (π“ž F) F | glFin (π“ž F) F g ∈ finiteIntegralGL2 (π“ž F) F} ∩
      ({g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
          c ≀ localHeight (archComponent F w (glArch (π“ž F) F g))} ∩
       ({g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
          xWindowSq (archComponent F w (glArch (π“ž F) F g)) ≀ u ^ 2} ∩
        {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
          archDetNorm w g ∈ Icc d₁ dβ‚‚})) := by
    ext g
    simp only [mem_centreCutSiegelSet_iff, Set.mem_inter_iff, Set.mem_setOf_eq]
  rw [hdecomp]
  exact hK.inter (hfloor.inter (hwin.inter hdet))

theorem isClosed_cappedSiegelBlock (c u d₁ dβ‚‚ : ℝ) :
    IsClosed (cappedSiegelBlock F c u d₁ dβ‚‚) := by
  refine (isClosed_centreCutSiegelSet c u d₁ dβ‚‚).inter ?_
  have hset : {g : AdelicGL2 (π“ž F) F | βˆ€ w : InfinitePlace F,
      localHeight (archComponent F w (glArch (π“ž F) F g)) ≀ 4 * c}
      = β‹‚ w : InfinitePlace F, {g : AdelicGL2 (π“ž F) F |
          localHeight (archComponent F w (glArch (π“ž F) F g)) ≀ 4 * c} := by
    ext g
    simp [Set.mem_iInter]
  rw [hset]
  exact isClosed_iInter fun w =>
    isClosed_le (continuous_localHeight_place w) continuous_const

theorem isCompact_cappedSiegelBlock {c u d₁ dβ‚‚ : ℝ} (hc : 0 < c) (hd₁ : 0 < d₁) :
    IsCompact (cappedSiegelBlock F c u d₁ dβ‚‚) := by
  classical
  set B := Real.sqrt (dβ‚‚ / c * (1 + u ^ 2 + (4 * c) ^ 2)) with hB_def
  set A : Set (AdeleRing (π“ž F) F) :=
    (Set.pi Set.univ fun w : InfinitePlace F => Metric.closedBall (0 : w.Completion) B) Γ—Λ’
      integralFiniteAdeles (π“ž F) F with hA_def
  set A' : Set (AdeleRing (π“ž F) F) :=
    (Set.pi Set.univ fun w : InfinitePlace F =>
      Metric.closedBall (0 : w.Completion) (B / d₁)) Γ—Λ’
      integralFiniteAdeles (π“ž F) F with hA'_def
  have hApi : IsCompact A := by
    refine IsCompact.prod (isCompact_univ_pi fun w => ?_)
      (isCompact_integralFiniteAdeles (π“ž F) F)
    haveI := properSpace_completion (F := F) w
    exact isCompact_closedBall _ _
  have hA'pi : IsCompact A' := by
    refine IsCompact.prod (isCompact_univ_pi fun w => ?_)
      (isCompact_integralFiniteAdeles (π“ž F) F)
    haveI := properSpace_completion (F := F) w
    exact isCompact_closedBall _ _
  set C : Set (Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) :=
    Set.pi Set.univ fun _ : Fin 2 => Set.pi Set.univ fun _ : Fin 2 => A with hC_def
  set C' : Set (Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) :=
    Set.pi Set.univ fun _ : Fin 2 => Set.pi Set.univ fun _ : Fin 2 => A' with hC'_def
  have hC : IsCompact C := isCompact_univ_pi fun _ => isCompact_univ_pi fun _ => hApi
  have hC' : IsCompact C' := isCompact_univ_pi fun _ => isCompact_univ_pi fun _ => hA'pi
  have hK : IsCompact ((Units.embedProduct
      (Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F))) ⁻¹'
      (C Γ—Λ’ (MulOpposite.op '' C'))) :=
    Units.isClosedEmbedding_embedProduct.isCompact_preimage
      (hC.prod (hC'.image MulOpposite.continuous_op))
  refine hK.of_isClosed_subset (isClosed_cappedSiegelBlock c u d₁ dβ‚‚) ?_
  rintro g ⟨⟨hKf, hfloor, hwin, hdet⟩, hcap⟩
  have hKf2 := mem_finiteIntegralGL2_iff.mp hKf

  have harch : βˆ€ (w : InfinitePlace F) (i j : Fin 2),
      β€–(archComponent F w (glArch (π“ž F) F g) :
          Matrix (Fin 2) (Fin 2) w.Completion) i jβ€– ≀ B := fun w i j =>
    entry_norm_le_of_clauses hc (hfloor w) (hcap w) (hwin w) (hdet w) i j
  have harch' : βˆ€ (w : InfinitePlace F) (i j : Fin 2),
      β€–(((archComponent F w (glArch (π“ž F) F g))⁻¹ : GL (Fin 2) w.Completion) :
          Matrix (Fin 2) (Fin 2) w.Completion) i jβ€– ≀ B / d₁ := fun w i j =>
    inv_entry_norm_le_of_clauses hc hd₁ (hfloor w) (hcap w) (hwin w) (hdet w) i j
  constructor
  Β·
    intro i _ j _
    constructor
    Β· intro w _
      rw [mem_closedBall_zero_iff]
      show β€–((g : Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) i j).1 wβ€– ≀ B
      have hbridge : ((g : Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) i j).1 w
          = (archComponent F w (glArch (π“ž F) F g) :
              Matrix (Fin 2) (Fin 2) w.Completion) i j := rfl
      rw [hbridge]
      exact harch w i j
    Β· exact hKf2.1 i j
  Β·
    refine ⟨((g⁻¹ : AdelicGL2 (π“ž F) F) : Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)),
      ?_, rfl⟩
    intro i _ j _
    constructor
    Β· intro w _
      rw [mem_closedBall_zero_iff]
      show β€–(((g⁻¹ : AdelicGL2 (π“ž F) F) :
          Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) i j).1 wβ€– ≀ B / d₁
      have hbridge : (((g⁻¹ : AdelicGL2 (π“ž F) F) :
            Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) i j).1 w
          = (((archComponent F w (glArch (π“ž F) F g))⁻¹ : GL (Fin 2) w.Completion) :
              Matrix (Fin 2) (Fin 2) w.Completion) i j := by
        have h1 : (((g⁻¹ : AdelicGL2 (π“ž F) F) :
              Matrix (Fin 2) (Fin 2) (AdeleRing (π“ž F) F)) i j).1 w
            = (archComponent F w (glArch (π“ž F) F (g⁻¹ : AdelicGL2 (π“ž F) F)) :
                Matrix (Fin 2) (Fin 2) w.Completion) i j := rfl
        rw [h1, map_inv (glArch (π“ž F) F), map_inv (archComponent F w)]
      rw [hbridge]
      exact harch' w i j
    Β· exact hKf2.2 i j

end WindowedSiegel

end AutomorphicForm

end

Statements phrased using this module (37)