Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | module |
| 2 | |
| 3 | public import Lib.Weil.DualPair.MixedModel |
| 4 | import Lib.Weil.DualPair.WeilAction |
| 5 | |
| 6 | /-! |
| 7 | # Adapted splittings: hyperbolic polarisation, Hom spaces, composition and stages |
| 8 | |
| 9 | A splitting `D : V'.Splitting V p` (`New.Space.Splitting`) writes a hermitian space `V'` as `V` plus |
| 10 | `p` hyperbolic planes, by dual isotropic frames `D.l`, `D.k` and an isometry `D.i`. An adelic matrix |
| 11 | is `New.Exchange.IsOrthoIntegral` if it has orthonormal columns at the infinite places and integral |
| 12 | finite part. The splitting `D` is adapted, `New.Exchange.IsBaseAdapted D`, if its adelic frame |
| 13 | `(l, k, i)` has this property. |
| 14 | |
| 15 | ## Main definitions and results |
| 16 | |
| 17 | * `New.hyperbolicSplitting`: the hyperbolic space `New.hyperbolicSpace E p` splits |
| 18 | (`New.Space.Splitting`) over the zero space `New.stdSpace E Empty`. Here `l` is the first `p` |
| 19 | basis vectors and `k` is the last `p` basis vectors. |
| 20 | * `New.Exchange.removePlanes`: the tautological splitting over V of the sum |
| 21 | `New.Exchange.hyperbolicSum` of hyperbolic planes and V. An instance shows that the tautological |
| 22 | splitting is adapted. |
| 23 | * `New.Exchange.adaptedHomBasis`: the change of basis `(x⁻¹)ᴴ ⊗ 1` given by the adelic frame `x` of |
| 24 | `T`. |
| 25 | * `New.Exchange.homSlice_eq_adapted_slice`: the term `A.homSlice T x` is a mixed term of |
| 26 | `A.homSource T`, after the change of basis `adaptedHomBasis p T`. |
| 27 | * `New.Exchange.isAdapted_homSource`: if `A` is adapted, `A.homSource T` is adapted in the basis |
| 28 | `adaptedHomBasis p T`. |
| 29 | * `New.Exchange.exists_isBaseAdapted_reindex`, |
| 30 | `New.Exchange.exists_isBaseAdapted_comp_removePlanes`: an adapted splitting with a single plane |
| 31 | (`e : Unit ≃ p`) can be reindexed by `Unit`. An adapted splitting can be factored through `V` plus |
| 32 | some of the planes. |
| 33 | |
| 34 | Notions from other files: |
| 35 | * `New.Space`: a hermitian space with a point, given by a matrix J over E and x in GL_n(𝔸) with xᴴJx |
| 36 | equal to the diagonal matrix of its signs at the infinite places and 1 at the finite places. |
| 37 | * `New.Space.Splitting.IsAdapted`: `D.IsAdapted g t` says that the matrix g⁻¹(l tᴴ⁻¹, k t, ι) of |
| 38 | adelic frames (`frameAt`) is `IsOrthoIntegral`. |
| 39 | * `New.Space.Splitting.homSource`: From a splitting (k, l, ι) of V over V₀, the splitting of |
| 40 | Hom(V,T) over Hom(V₀,T) with frames J_T⁻¹⊗(kᴴJ)ᵀ, 1⊗(lᴴJ)ᵀ, 1⊗(J₀⁻¹ιᴴJ)ᵀ. |
| 41 | * `New.Space.Splitting.comp`: From splittings of V over V₀ (rank p) and V₀ over V₁ (rank q), the |
| 42 | splitting of V over V₁ with frames (k, ik'), (l, il') and embedding ii'. |
| 43 | * `New.Space.Splitting.kCoord`, `lCoord`: the adelic matrices lᴴε, kᴴε (ε = `stdForm`), which send |
| 44 | la + ιw + kb to b and to a; `iCoord`, built from ιᴴε and the signs, sends it to w. |
| 45 | * `New.Space.Splitting.homSlice`: `A.homSlice T x` is the zero term of `A.homSource T` after the |
| 46 | Heisenberg operator of the map `x * A.kCoord` in `Hom(W', T)`. |
| 47 | |
| 48 | ## Relation to the literature |
| 49 | |
| 50 | Known; see `Lib.Weil.MixedModel.ZeroTerm` for sources. |
| 51 | -/ |
| 52 | |
| 53 | @[expose] public section |
| 54 | |
| 55 | open Matrix in |
| 56 | /-- Restricting the Gram matrix `Mᴴ * J * M` to the rows and columns chosen by `e` gives the Gram |
| 57 | matrix of the columns of `M` chosen by `e`. -/ |
| 58 | lemma Matrix.submatrix_conjTranspose_mul_mul {α m k l : Type*} [Fintype m] |
| 59 | [NonUnitalNonAssocSemiring α] [Star α] (M : Matrix m k α) (J : Matrix m m α) (e : l → k) : |
| 60 | (Mᴴ * J * M).submatrix e e = (M.submatrix id e)ᴴ * J * M.submatrix id e := rfl |
| 61 | |
| 62 | /-! ## The hyperbolic space as a splitting over the zero space -/ |
| 63 | |
| 64 | /-- The splitting of hyperbolic space of rank 2p over the zero space. Here l is the first p basis |
| 65 | vectors and k is the last p basis vectors. -/ |
| 66 | noncomputable def New.hyperbolicSplitting (E p : Type*) [Field E] [CMType E] [WeilData E] |
| 67 | [Fintype p] [DecidableEq p] : (hyperbolicSpace E p).Splitting (stdSpace E Empty) p := |
| 68 | Space.Splitting.ofDualFrames (Matrix.fromRows 0 1) (Matrix.fromRows 1 0) (by |
| 69 | simp [Matrix.conjTranspose_fromRows_eq_fromCols_conjTranspose, Matrix.fromCols_mul_fromBlocks, |
| 70 | Matrix.fromCols_mul_fromRows]) |
| 71 | |
| 72 | namespace New.Exchange |
| 73 | |
| 74 | /-! ## Adapted splittings and the removal of all hyperbolic planes -/ |
| 75 | |
| 76 | section AdaptedSplitting |
| 77 | |
| 78 | open Matrix Space Splitting |
| 79 | |
| 80 | /-- The splitting `D` of `V'` over `V` (with `card p` hyperbolic planes) is adapted: the adelic |
| 81 | matrix with column blocks `lAdelic`, `kAdelic`, `iAdelic` has orthonormal columns at every infinite |
| 82 | place and integral entries at every finite place. -/ |
| 83 | class IsBaseAdapted {E : Type} [Field E] [CMType E] {n m p : Type} [Fintype n] |
| 84 | [DecidableEq n] [Fintype m] [DecidableEq m] [Fintype p] [DecidableEq p] {s : n → ℤˣ} |
| 85 | {t : m → ℤˣ} {V' : Space E m t} {V : Space E n s} (D : V'.Splitting V p) : Prop where |
| 86 | /-- The block matrix of the three adelic frames is orthonormal at the infinite places and integral |
| 87 | at the finite places. -/ |
| 88 | isOrthoIntegral : IsOrthoIntegral ((D.lAdelic.fromCols D.kAdelic).fromCols D.iAdelic) |
| 89 | |
| 90 | variable {E : Type} [Field E] [CMType E] [WeilData E] {n : Type} (p : Type) [Fintype n] |
| 91 | [DecidableEq n] [Fintype p] [DecidableEq p] {s : n → ℤˣ} (V : Space E n s) |
| 92 | |
| 93 | /-- The tautological splitting over V of the sum of `card p` hyperbolic planes and V: the |
| 94 | frames l, k, i are the column blocks of the identity matrix. -/ |
| 95 | noncomputable def removePlanes : (hyperbolicSum p V).Splitting V p := by |
| 96 | use (fromRows 0 1).fromRows 0, (fromRows 1 0).fromRows 0, fromRows 0 1 |
| 97 | all_goals simp +arith [hyperbolicSum, conjTranspose_fromRows_eq_fromCols_conjTranspose, |
| 98 | fromCols_mul_fromBlocks, fromCols_mul_fromRows] |
| 99 | |
| 100 | /-- The tautological splitting `removePlanes p V` is adapted. -/ |
| 101 | instance : IsBaseAdapted (removePlanes p V) where |
| 102 | isOrthoIntegral := by |
| 103 | -- The frame is the block matrix of the inverse base point of hyperbolic space and `1`. |
| 104 | convert (isOrthoIntegral_hyperbolicSpace (E := E) (p := p)).right.block_diag |
| 105 | (.one (n := n)) using 1 |
| 106 | simp [← ext_iff, Matrix.mul_apply, lAdelic, kAdelic, iAdelic, Space.ratMap, removePlanes, |
| 107 | hyperbolicSum, sum, blockGL, fromRows_map, fromBlocks_mul_fromRows, Matrix.one_apply] |
| 108 | |
| 109 | end AdaptedSplitting |
| 110 | |
| 111 | /-! |
| 112 | ## Adapted splittings of Hom spaces |
| 113 | |
| 114 | Here `A` is a splitting of `W'` over `W`, `T` is a space, and `A.homSource T` is the induced |
| 115 | splitting of `Hom(W', T)`. |
| 116 | -/ |
| 117 | |
| 118 | section AdaptedHom |
| 119 | |
| 120 | open Matrix Kronecker Space Splitting Equiv |
| 121 | |
| 122 | variable {E : Type _} [Field E] [CMType E] {n n' r : Type _} {p : Type _} |
| 123 | [Fintype n] [DecidableEq n] [Fintype n'] [DecidableEq n'] [Fintype r] [DecidableEq r] |
| 124 | [Fintype p] [DecidableEq p] {s : n → ℤˣ} {s' : n' → ℤˣ} {t : r → ℤˣ} {W : Space E n s} |
| 125 | {W' : Space E n' s'} (A : W'.Splitting W p) (T : Space E r t) |
| 126 | |
| 127 | /-- The invertible adelic matrix (x⁻¹)ᴴ ⊗ 1, where x is the adelic frame of T and 1 is the p×p |
| 128 | identity. -/ |
| 129 | noncomputable def adaptedHomBasis {E : Type*} [Field E] [CMType E] {r : Type*} |
| 130 | (p : Type*) [Fintype r] [DecidableEq r] [Fintype p] [DecidableEq p] {t : r → ℤˣ} |
| 131 | (T : Space E r t) : GL (r × p) (𝔸 E) := |
| 132 | Matrix.GeneralLinearGroup.kronecker (m := p) (star T.x⁻¹) 1 |
| 133 | |
| 134 | variable {M : Matrix n' n (𝔸 E)} |
| 135 | |
| 136 | /-- In the basis `adaptedHomBasis p T`, the adelic frame of the induced splitting `A.homSource T` |
| 137 | (for the group element `1`) has the three column blocks `1 ⊗ₖ A.kCoordᵀ`, |
| 138 | `stdForm E t ⊗ₖ A.lCoordᵀ` and `1 ⊗ₖ A.iCoordᵀ`. -/ |
| 139 | lemma frameAt_homSource : |
| 140 | (A.homSource T).frameAt 1 (adaptedHomBasis p T) = |
| 141 | ((1 ⊗ₖ A.kCoordᵀ).fromCols (stdForm E t ⊗ₖ A.lCoordᵀ)).fromCols (1 ⊗ₖ A.iCoordᵀ) := by |
| 142 | simp [Splitting.frameAt, homSource_iAdelic, mul_assoc, dualFrame, homSource_lAdelic, |
| 143 | adaptedHomBasis, Matrix.GeneralLinearGroup.kronecker, star_eq_conjTranspose, |
| 144 | conjTranspose_kronecker, ← mul_kronecker_mul, homSource_kAdelic, ← conjTranspose_mul] |
| 145 | |
| 146 | /-- The term `A.homSlice T x` is the mixed term `slice` of the induced splitting |
| 147 | `A.homSource T` at the vector of entries of `x` (`matrixToVec x`), after the change of basis |
| 148 | `adaptedHomBasis p T`. -/ |
| 149 | lemma homSlice_eq_adapted_slice [WeilData E] (x : Matrix r p (𝔸 E)) : |
| 150 | A.homSlice T x = (A.homSource T).slice ((adaptedHomBasis p T)⁻¹.valᴴ *ᵥ matrixToVec x) := by |
| 151 | simp [slice, homSlice, kronecker_mulVec_eq_matrixToVec, homSource_lAdelic, adaptedHomBasis, |
| 152 | Matrix.GeneralLinearGroup.kronecker, star_eq_conjTranspose, conjTranspose_kronecker, |
| 153 | ← mul_kronecker_mul] |
| 154 | |
| 155 | omit [Fintype n] [DecidableEq n'] [DecidableEq r] [Fintype p] in |
| 156 | /-- If `M` and `B` are `IsOrthoIntegral`, so is the Kronecker product of `M` and the entrywise |
| 157 | conjugate `Bᴴᵀ` of `B`. -/ |
| 158 | lemma IsOrthoIntegral.kronecker {B : Matrix r p (𝔸 E)} (hM : IsOrthoIntegral M) |
| 159 | (hB : IsOrthoIntegral B) : IsOrthoIntegral (M ⊗ₖ Bᴴᵀ) := by |
| 160 | -- Evaluation at an infinite place commutes with `ᴴ`. |
| 161 | have h_conj (w : NumberField.InfinitePlace E) : Bᴴ.map (evalInf w) = (B.map (evalInf w))ᴴ := |
| 162 | B.conjTranspose_map (evalInf w) fun _ ↦ rfl |
| 163 | refine ⟨fun w ↦ ?_, fun i k ↦ ?_⟩ |
| 164 | · -- Evaluation at `w` commutes with `⊗ₖ`, so the product is `MᴴM ⊗ₖ (BᴴB)ᵀ = 1 ⊗ₖ 1`. |
| 165 | simp [map_kronecker, h_conj, transpose_map, conjTranspose_kronecker, |
| 166 | conjTranspose_transpose_eq_transpose_conjTranspose, ← mul_kronecker_mul, ← transpose_mul, |
| 167 | hM.conjTranspose_map_mul_map w, hB.conjTranspose_map_mul_map w] |
| 168 | · -- Each entry is an entry of `M` times the conjugate of an entry of `B`. |
| 169 | simp [mul_mem, star_mem_Ô, hM.right, hB.right] |
| 170 | |
| 171 | /-- If the splitting `A` of `W'` over `W` is adapted (`IsBaseAdapted`: its adelic frame is |
| 172 | orthonormal at the infinite places and integral at the finite places), then so is the induced |
| 173 | splitting `A.homSource T` of `Hom(W', T)` over `Hom(W, T)` (`Space.Splitting.IsAdapted`) for the |
| 174 | group element `1` and the change of basis `t = adaptedHomBasis p T = (x⁻¹)ᴴ ⊗ 1`, where `x` is the |
| 175 | adelic frame of `T`. That is, the matrix `(l (t⁻¹)ᴴ, k t, ι)` built from the frames of |
| 176 | `A.homSource T` has orthonormal columns at every infinite place and integral entries at every finite |
| 177 | place. -/ |
| 178 | lemma isAdapted_homSource [h : IsBaseAdapted A] : |
| 179 | (A.homSource T).IsAdapted 1 (adaptedHomBasis p T) := by |
| 180 | -- Up to signs on rows and columns and a reordering `e` of the columns, the frame of the induced |
| 181 | -- splitting is `1 ⊗ₖ Fᴴᵀ`, where `F` is the frame of `A`. |
| 182 | let F : Matrix n' ((p ⊕ p) ⊕ n) (𝔸 E) := (A.lAdelic.fromCols A.kAdelic).fromCols A.iAdelic |
| 183 | let e : ((r × p) ⊕ (r × p)) ⊕ (r × n) → r × ((p ⊕ p) ⊕ n) := |
| 184 | (prodSumDistrib r (p ⊕ p) n).symm ∘ Sum.map (prodSumDistrib r p p).symm id |
| 185 | let ε : ((r × p) ⊕ (r × p)) ⊕ (r × n) → ℤˣ := |
| 186 | 1 ⊕ᵥ (fun x : r × p ↦ t x.1) ⊕ᵥ fun x : r × n ↦ s x.2 |
| 187 | have h_kron : IsOrthoIntegral |
| 188 | ((stdForm E fun x : r × n' ↦ s' x.2) * (1 : Matrix r r (𝔸 E)) ⊗ₖ Fᴴᵀ) := |
| 189 | .mul (.of_stdForm fun x : r × n' ↦ s' x.2) (.kronecker .one h.isOrthoIntegral) |
| 190 | have h_frame : (A.homSource T).frameAt 1 (adaptedHomBasis p T) = |
| 191 | ((stdForm E fun x : r × n' ↦ s' x.2) * (1 : Matrix r r (𝔸 E)) ⊗ₖ Fᴴᵀ).submatrix id e * |
| 192 | stdForm E ε := by |
| 193 | -- By `frameAt_homSource` the entries agree block by block, up to the order of the factors. |
| 194 | rw [frameAt_homSource] |
| 195 | ext ⟨i, j⟩ ((⟨a, b⟩ | ⟨a, b⟩) | ⟨a, b⟩) : 1 |
| 196 | · -- The `l` block `1 ⊗ₖ A.kCoordᵀ`: both sides are `δ i a * star (A.lAdelic j b)` times a sign. |
| 197 | simp [F, e, ε, kCoord, stdForm, Matrix.one_apply, ← Pi.one_def, Prod.mk_one_one] |
| 198 | · -- The `k` block `stdForm E t ⊗ₖ A.lCoordᵀ`: both sides are `δ i a * star (A.kAdelic j b)` |
| 199 | -- times signs. |
| 200 | simp +contextual [F, e, ε, lCoord, stdForm, Matrix.one_apply, diagonal_apply, mul_comm] |
| 201 | · -- The `ι` block `1 ⊗ₖ A.iCoordᵀ`: both sides are `δ i a * star (A.iAdelic j b)` times signs. |
| 202 | simp [F, e, ε, iCoord, stdForm, Matrix.one_apply, mul_comm, mul_left_comm] |
| 203 | change IsOrthoIntegral ((A.homSource T).frameAt 1 (adaptedHomBasis p T)) |
| 204 | exact h_kron.of_eq_submatrix_mul e (.of_stdForm ε) h_frame (by simp [e, Function.Injective]) |
| 205 | |
| 206 | end AdaptedHom |
| 207 | |
| 208 | /-! |
| 209 | ## Composition, reindexing and staging of adapted splittings |
| 210 | |
| 211 | Bookkeeping for removing hyperbolic planes from a hermitian space in several steps. |
| 212 | -/ |
| 213 | |
| 214 | section AdaptedStages |
| 215 | |
| 216 | open Matrix Space Splitting Fintype Equiv |
| 217 | |
| 218 | variable {E : Type} [Field E] [CMType E] [WeilData E] |
| 219 | {n m p q n₁ : Type} [Fintype n] [DecidableEq n] [Fintype m] [DecidableEq m] [Fintype p] |
| 220 | [DecidableEq p] [Fintype q] [DecidableEq q] [Fintype n₁] [DecidableEq n₁] |
| 221 | {s : n → ℤˣ} {t : m → ℤˣ} {V' : Space E m t} {V : Space E n s} (D : V'.Splitting V p) |
| 222 | |
| 223 | /-- If `D` is adapted, so is `D.symm`, the splitting with the frames `k` and `l` exchanged. -/ |
| 224 | instance [hD : IsBaseAdapted D] : IsBaseAdapted D.symm where |
| 225 | isOrthoIntegral := by |
| 226 | -- Exchanging `k` and `l` permutes the columns of the adelic frame. |
| 227 | convert hD.isOrthoIntegral.submatrix_cols (Sum.map Sum.swap id) using 1 |
| 228 | aesop |
| 229 | |
| 230 | omit [WeilData E] in |
| 231 | /-- For an adapted splitting `D`, the adelic matrices `D.kAdelic` (the frame `k` in standard |
| 232 | coordinates) and `D.lCoord` have integral entries: they lie in the ring `O` of adeles whose finite |
| 233 | part lies in `Ô E`, the integral finite adeles. -/ |
| 234 | lemma isIntMatrix_kAdelic_and_lCoord [hD : IsBaseAdapted D] : |
| 235 | let O := (Ô E).comap (RingHom.snd (NumberField.InfinitePlace E → ℂ) (𝔸f E)) |
| 236 | IsIntMatrix O D.kAdelic ∧ IsIntMatrix O D.lCoord := by |
| 237 | intro O |
| 238 | -- The columns of `D.kAdelic` are among those of the adapted frame. |
| 239 | have h_k (i : m) (j : p) : (D.kAdelic i j).2 ∈ Ô E := by |
| 240 | simpa using hD.isOrthoIntegral.snd_mem_Ô i (.inl (.inr j)) |
| 241 | -- `D.lCoord` is `D.kAdelicᴴ` times the diagonal matrix of signs; `star` keeps integrality. |
| 242 | exact ⟨fun i j ↦ by simpa [O] using h_k i j, |
| 243 | fun i j ↦ by simpa [O, lCoord, stdForm] using star_mem_Ô (h_k j i)⟩ |
| 244 | |
| 245 | /-- Let `D` be an adapted splitting of `V'` over `V` with a single hyperbolic plane, given by |
| 246 | `e : Unit ≃ p`. Then there is an adapted splitting indexed by `Unit` with the same embedding `i`, |
| 247 | whose frame `k` is that of `D` reindexed by `e`. -/ |
| 248 | lemma exists_isBaseAdapted_reindex [hD : IsBaseAdapted D] (e : Unit ≃ p) : |
| 249 | ∃ A' : V'.Splitting V Unit, IsBaseAdapted A' ∧ A'.k = D.k.submatrix id e ∧ A'.i = D.i := by |
| 250 | -- Reindex the columns of the frame `(l, k, i)` of `D` along `e`. |
| 251 | let ε : (Unit ⊕ Unit) ⊕ n ≃ (p ⊕ p) ⊕ n := (e.sumCongr e).sumCongr (.refl n) |
| 252 | let M : Matrix m ((p ⊕ p) ⊕ n) E := (D.l.fromCols D.k).fromCols D.i |
| 253 | have h_gram : (M.submatrix id ε)ᴴ * V'.J * M.submatrix id ε = (hyperbolicSum Unit V).J := by |
| 254 | rw [← Matrix.submatrix_conjTranspose_mul_mul, D.gram_eq_hyperbolicSum] |
| 255 | aesop (add simp hyperbolicSum) |
| 256 | let A' : V'.Splitting V Unit := |
| 257 | splittingOfGram (M.submatrix id ε) h_gram (by rw [card_congr e, D.card_eq]) |
| 258 | refine ⟨A', ⟨?_⟩, rfl, rfl⟩ |
| 259 | convert hD.isOrthoIntegral.submatrix_cols ε using 1 |
| 260 | aesop |
| 261 | |
| 262 | /-- Let `D` be an adapted splitting (`IsBaseAdapted`) of `V'` over `V` with `card p` hyperbolic |
| 263 | planes. A splitting is a Witt decomposition with isotropic frames `l`, `k` and an embedding `i` of |
| 264 | `V`. Adapted means the adelic matrix of `l`, `k`, `i` has orthonormal columns at every infinite |
| 265 | place and integral entries at every finite place. For any `e : n₁ ⊕ q ≃ p`, there is an adapted |
| 266 | splitting `A₁` of `V'` over `hyperbolicSum q V` with `card n₁` planes such that |
| 267 | `A₁.comp (removePlanes q V)` has frame `k` equal to `D.k` reindexed by `e` and embedding `i` equal |
| 268 | to `D.i`, where `removePlanes q V` is the tautological splitting of `hyperbolicSum q V` over `V` |
| 269 | with `card q` planes. -/ |
| 270 | lemma exists_isBaseAdapted_comp_removePlanes [hD : IsBaseAdapted D] (e : n₁ ⊕ q ≃ p) : |
| 271 | ∃ A₁ : V'.Splitting (hyperbolicSum q V) n₁, |
| 272 | IsBaseAdapted A₁ ∧ |
| 273 | (A₁.comp (removePlanes q V)).k = D.k.submatrix id e ∧ |
| 274 | (A₁.comp (removePlanes q V)).i = D.i := by |
| 275 | -- Regroup the columns of the frame `(l, k, i)` of `D`: first the planes indexed by `n₁`, then |
| 276 | -- those indexed by `q` together with `V`. |
| 277 | let ε : (n₁ ⊕ n₁) ⊕ (q ⊕ q) ⊕ n ≃ (p ⊕ p) ⊕ n := |
| 278 | (sumAssoc (n₁ ⊕ n₁) (q ⊕ q) n).symm.trans |
| 279 | (((sumSumSumComm n₁ n₁ q q).trans (e.sumCongr e)).sumCongr (Equiv.refl n)) |
| 280 | let M : Matrix m ((p ⊕ p) ⊕ n) E := (D.l.fromCols D.k).fromCols D.i |
| 281 | have h_gram : (M.submatrix id ε)ᴴ * V'.J * M.submatrix id ε = |
| 282 | (hyperbolicSum n₁ (hyperbolicSum q V)).J := by |
| 283 | -- It is the Gram matrix of `(l, k, i)`, with rows and columns reordered by `ε`. |
| 284 | rw [← Matrix.submatrix_conjTranspose_mul_mul, D.gram_eq_hyperbolicSum] |
| 285 | simp [← ext_iff, ε, sum, hyperbolicSum, Matrix.one_apply] |
| 286 | have h_card : card m = card ((q ⊕ q) ⊕ n) + 2 * card n₁ := by |
| 287 | simp +arith [D.card_eq, ← card_congr e] |
| 288 | let A₁ : V'.Splitting (hyperbolicSum q V) n₁ := splittingOfGram (M.submatrix id ε) h_gram h_card |
| 289 | -- The change of frame: `1` on the planes indexed by `n₁`, the base point of hyperbolic space |
| 290 | -- on the planes indexed by `q`, and `1` on `V`. |
| 291 | let C : Matrix ((n₁ ⊕ n₁) ⊕ (q ⊕ q) ⊕ n) ((n₁ ⊕ n₁) ⊕ (q ⊕ q) ⊕ n) (𝔸 E) := |
| 292 | fromBlocks 1 0 0 (fromBlocks (hyperbolicSpace E q).x.val 0 0 1) |
| 293 | have h_C : IsOrthoIntegral C := .block_diag .one |
| 294 | (isOrthoIntegral_hyperbolicSpace.left.block_diag .one) |
| 295 | have h_frame : (A₁.lAdelic.fromCols A₁.kAdelic).fromCols A₁.iAdelic = |
| 296 | ((D.lAdelic.fromCols D.kAdelic).fromCols D.iAdelic).submatrix id ε * C := by |
| 297 | simp [← ext_iff, Matrix.mul_apply, ε, A₁, M, C, sum, splittingOfGram, toCols₁, toCols₂, lAdelic, |
| 298 | hyperbolicSum, kAdelic, iAdelic, ratMap, Matrix.one_apply] |
| 299 | refine ⟨A₁, ⟨hD.isOrthoIntegral.of_eq_submatrix_mul ε h_C h_frame⟩, ?_⟩ |
| 300 | -- The composite has the frame `k` of `D`, reindexed by `e`, and the embedding `i` of `D`. |
| 301 | simp [← ext_iff, Matrix.mul_apply, ε, A₁, M, removePlanes, splittingOfGram, toCols₁, toCols₂, |
| 302 | Splitting.comp, Matrix.one_apply] |
| 303 | |
| 304 | /-- If `D` (a splitting of `V'` over `V`) and `A` (a splitting of `V` over `W`) are adapted, so |
| 305 | is their composite `D.comp A`, a splitting of `V'` over `W`. -/ |
| 306 | instance [hD : IsBaseAdapted D] {r : n₁ → ℤˣ} {W : Space E n₁ r} {A : V.Splitting W q} |
| 307 | [hA : IsBaseAdapted A] : IsBaseAdapted (D.comp A) where |
| 308 | isOrthoIntegral := by |
| 309 | -- Up to the order of the columns, the frame of the composite is the frame of `D` times the |
| 310 | -- block matrix of `1` and the frame of `A`. |
| 311 | convert (hD.isOrthoIntegral.mul (.block_diag (.one (n := p ⊕ p)) |
| 312 | hA.isOrthoIntegral)).submatrix_cols |
| 313 | (sumAssoc (p ⊕ p) (q ⊕ q) n₁ ∘ Sum.map (sumSumSumComm p q p q) id) using 1 |
| 314 | -- The frames `k`, `l` of the composite are `(k, i k')`, `(l, i l')`, its embedding is `i i'`. |
| 315 | aesop (add simp [comp_lAdelic, comp_kAdelic, comp_iAdelic, Matrix.mul_assoc, |
| 316 | fromCols_mul_fromBlocks]) |
| 317 | |
| 318 | end AdaptedStages |
| 319 | |
| 320 | end New.Exchange |