import Lib.DiscreteSeries.Bruhat.FloorGroups /-! # Sizes, lengths and balanced frames A filtration `ofSize i` of the ring `A` measures numbers, vectors and matrices on one scale L. It gives the length of a vector at a point `g` of the unitary group, the induced length on the quotient Y^(l) along the frame, and balanced frame vectors. Letters used in this folder: G^(l) = `floorGroup l`, R^(l) = `partialUnitriangularGroup l`, U_( a, the middle block and the e*_b with b > a. have h_blocks : Fintype.card {i : 𝔰.BesselIndex // a + 1 ≤ floorOf i} = (𝔰.ϱ - 1 - a) + (𝔰.k + 1 + (𝔰.ϱ - 1 - a)) := by simp [card_congr .subtypeSum, Fintype.card_subtype, filter_lt_eq_Ioi] lia /-! ### Quotients along the frame For `l ≤ ϱ` the space Y^(l) is the quotient of the vectors orthogonal to e_0, …, e_(l-1) by the span of these vectors, so e_a lies in Y^(a). Its elements are handled through their lifts. -/ section Lifts variable {l : ℕ} {ω ω' o : 𝔰.BesselIndex → A} /-- The vector ω is orthogonal to the e_b, b < l. The product ⟨e_b, ω⟩ is the coordinate of ω at e*_b. -/ def IsOrthogonalBelow (l : ℕ) (ω : 𝔰.BesselIndex → A) : Prop := ∀ b : Fin 𝔰.ϱ, b.val < l → ω (eStar b) = 0 /-- The vectors ω and ω' differ by an element of the span of the e_b, b < l, for l ≤ ϱ: they are two lifts of one class. The indices of level at least l are those other than the e_b, b < l. -/ def CongrBelow (l : ℕ) (ω ω' : 𝔰.BesselIndex → A) : Prop := ∀ k : 𝔰.BesselIndex, l ≤ level k → ω' k = ω k /-- The index e*_b has level 2ϱ - b, which is at least ϱ. -/ lemma le_level_eStar (b : Fin 𝔰.ϱ) : 𝔰.ϱ ≤ level (eStar b : 𝔰.BesselIndex) := by change 𝔰.ϱ ≤ 2 * 𝔰.ϱ - b lia /-- For l ≤ ϱ, a basis index of level below l is the index of some e_b, b < l. -/ lemma exists_eq_inl_of_level_lt {k : 𝔰.BesselIndex} (hk : level k < l) (hl : l ≤ 𝔰.ϱ) : ∃ b : Fin 𝔰.ϱ, b.val < l ∧ k = inl b := by obtain b | (m | b) := k · exact ⟨b, by simpa [level] using hk, rfl⟩ · simpa [level] using hk.trans_le hl · exact absurd (hk.trans_le hl) (le_level_eStar b).not_gt /-- Congruence modulo the e_b, b < l, is reflexive. -/ lemma CongrBelow.refl {A : Type} {𝔰 : Shape} (l : ℕ) (ω : 𝔰.BesselIndex → A) : CongrBelow l ω ω := fun _ _ ↦ rfl /-- Congruence modulo the e_b, b < l, is symmetric. -/ lemma CongrBelow.symm {A : Type} {𝔰 : Shape} {l : ℕ} {ω ω' : 𝔰.BesselIndex → A} (h : CongrBelow l ω ω') : CongrBelow l ω' ω := fun k hk ↦ (h k hk).symm /-- Congruence modulo the e_b, b < l, is transitive. -/ lemma CongrBelow.trans {A : Type} {𝔰 : Shape} {l : ℕ} {ω ω' ω'' : 𝔰.BesselIndex → A} (h : CongrBelow l ω ω') (h' : CongrBelow l ω' ω'') : CongrBelow l ω ω'' := fun k hk ↦ (h' k hk).trans (h k hk) /-- For l ≤ ϱ, two vectors that are congruent modulo the e_b, b < l, have the same coordinate at every e*_b. -/ lemma CongrBelow.apply_eStar {A : Type} {𝔰 : Shape} {l : ℕ} {ω ω' : 𝔰.BesselIndex → A} (h : CongrBelow l ω ω') (hl : l ≤ 𝔰.ϱ) (b : Fin 𝔰.ϱ) : ω' (eStar b) = ω (eStar b) := h (eStar b) (hl.trans (le_level_eStar b)) /-- For l ≤ ϱ, a vector congruent modulo the e_b, b < l, to a vector orthogonal to these e_b is orthogonal to them as well. -/ lemma IsOrthogonalBelow.of_congrBelow {A : Type} [CommRing A] {𝔰 : Shape} {l : ℕ} {ω ω' : 𝔰.BesselIndex → A} (hω : IsOrthogonalBelow l ω) (h : CongrBelow l ω ω') (hl : l ≤ 𝔰.ϱ) : IsOrthogonalBelow l ω' := fun b hb ↦ (h.apply_eStar hl b).trans (hω b hb) /-- A multiple of a vector orthogonal to the e_b, b < l, is orthogonal to them. -/ lemma IsOrthogonalBelow.smul {A : Type} [CommRing A] {𝔰 : Shape} {l : ℕ} {ω : 𝔰.BesselIndex → A} (hω : IsOrthogonalBelow l ω) (c : A) : IsOrthogonalBelow l (c • ω) := fun b hb ↦ by simp [hω b hb] /-- Congruence modulo the e_b, b < l, is kept under multiplication by a scalar. -/ lemma CongrBelow.smul {A : Type} [CommRing A] {𝔰 : Shape} {l : ℕ} {ω ω' : 𝔰.BesselIndex → A} (h : CongrBelow l ω ω') (c : A) : CongrBelow l (c • ω) (c • ω') := fun k hk ↦ by simp [h k hk] /-- Let l ≤ j. An element of R^(j) = `partialUnitriangularGroup j`, which changes each e_b, b < j, by a combination of the earlier ones, keeps vectors orthogonal to the e_b, b < l, orthogonal to them. -/ lemma IsOrthogonalBelow.mulVec (hω : IsOrthogonalBelow l ω) (hs : s ∈ partialUnitriangularGroup j) (hl : l ≤ j) : IsOrthogonalBelow l ((s : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) *ᵥ ω) := by intro b hb have h_below (b' : Fin 𝔰.ϱ) (hb' : b' < b) : ω (eStar b') = 0 := hω b' (Nat.lt_trans hb' hb) rw [partialUnitriangularGroup_mulVec_eStar hs (hb.trans_le hl) h_below, hω b hb] /-- Let l ≤ j and l ≤ ϱ = `𝔰.ϱ`, the number of hyperbolic planes. An element `s` of R^(j) = `partialUnitriangularGroup j` changes each e_b, b < j, by a combination of the earlier ones. It respects congruence modulo the e_b, b < l: if ω and ω' are congruent, so are `s *ᵥ ω` and `s *ᵥ ω'`. -/ lemma CongrBelow.mulVec (h : CongrBelow l ω ω') (hs : s ∈ partialUnitriangularGroup j) (hl : l ≤ j) (hl_le : l ≤ 𝔰.ϱ) : CongrBelow l ((s : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) *ᵥ ω) ((s : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) *ᵥ ω') := by -- In the row k only the columns e_b, b < l, can contribute a difference, and there s vanishes. intro k hk simp only [Matrix.mulVec, dotProduct] refine Finset.sum_congr rfl fun n _ ↦ ?_ obtain hn | hn := le_or_gt l (level n) · rw [h n hn] · have h_ne : k ≠ n := ne_of_apply_ne level (hn.trans_le hk).ne' obtain ⟨b, hb, rfl⟩ := exists_eq_inl_of_level_lt hn hl_le have h_entry : s.val.val k (inl b) = (1 : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A) k (inl b) := mem_partialUnitriangularGroup.1 hs k (inl b) (hn.le.trans hk) (Or.inl ⟨hb.trans_le hl, hn.trans_le hl⟩) rw [h_entry, one_apply_ne h_ne, zero_mul, zero_mul] /-- The unipotent group U_( simp [zero_one_mem_ofSize] | succ j ih => -- Expand along the first row: each term has size 7 + 8 j, and the sum costs one more. have h_minor (b : Fin (j + 1)) : S.HasMatrixSize 7 (Z.submatrix Fin.succ b.succAbove) := fun a c ↦ hZ a.succ (b.succAbove c) have h_term (b : Fin (j + 1)) : (-1) ^ (b : ℕ) * Z 0 b * (Z.submatrix Fin.succ b.succAbove).det ∈ S.ofSize (7 + 8 * j) := S.mul_mem_ofSize (neg_one_pow_mul_mem_ofSize (hZ 0 b) b) (ih _ (Nat.le_of_succ_le hj) (h_minor b)) rw [det_succ_row_zero] exact mem_ofSize_mono (sum_fin_mem_ofSize (Nat.le_succ_of_le hj) h_term) /-- For the sizes `S`: let `Z` be a square matrix of order `j + 1`, where `j ≤ 𝔰.ϱ` and ϱ is the number of hyperbolic planes. If the last row `Z (last j)` has size 9 and the other rows have size 7, then `Z.det` has size `9 * (j + 1)`. -/ lemma det_mem_ofSize_of_last_row {j : ℕ} (Z : Matrix (Fin (j + 1)) (Fin (j + 1)) A) (hj : j ≤ 𝔰.ϱ) (h_rows : S.HasMatrixSize 7 (Z.submatrix castSucc id)) (h_last : Z (last j) ∈ S.vecsOfSize 9) : Z.det ∈ S.ofSize (9 * (j + 1)) := by -- Expand along the last row: each term has size 9 + 8 j, and the sum costs one more. have h_minor (b : Fin (j + 1)) : S.HasMatrixSize 7 (Z.submatrix castSucc b.succAbove) := fun a c ↦ h_rows a (b.succAbove c) have h_term (b : Fin (j + 1)) : (-1) ^ ((last j).val + b.val) * Z (last j) b * (Z.submatrix (last j).succAbove b.succAbove).det ∈ S.ofSize (9 + 8 * j) := by rw [succAbove_last] exact S.mul_mem_ofSize (neg_one_pow_mul_mem_ofSize (h_last b) _) (det_mem_ofSize _ hj (h_minor b)) -- For j = 0 there is one term and the bound has no room for a sum. obtain _ | j := j · rw [det_eq_elem_of_card_eq_one (Fintype.card_fin _) (last 0)] exact h_last (last 0) · rw [det_succ_row Z (last (j + 1))] exact mem_ofSize_mono (sum_fin_mem_ofSize (Nat.succ_le_succ hj) h_term) /-- Let the Gram matrix J = `T.splitGram` be hermitian and invertible (`IsHermitianUnit`), and let X be the adjoint of Y for J, that is, J X = Yᴴ J. Sizes are those of `S`, and a vector has size i if all its entries do. If the rows n of Y with J n b ≠ 0 have size i, then the entries of the column b of X have size i + 4. -/ lemma adjoint_apply_mem_ofSize {T : 𝔰.Form A} {i : ℕ} [IsHermitianUnit T.splitGram] {S : Size T} {X Y : Matrix 𝔰.BesselIndex 𝔰.BesselIndex A} (hXY : T.splitGram * X = Yᴴ * T.splitGram) (a b : 𝔰.BesselIndex) (hY : ∀ n : 𝔰.BesselIndex, T.splitGram n b ≠ 0 → Y n ∈ S.vecsOfSize i) : X a b ∈ S.ofSize (i + 4) := by -- X = J⁻¹ (Yᴴ J), where J and J⁻¹ have size 1 and each product costs one more. have h_det : IsUnit T.splitGram.det := IsHermitianUnit.isUnit.map detMonoidHom have hX : X = T.splitGram⁻¹ * (Yᴴ * T.splitGram) := by rw [← hXY, nonsing_inv_mul_cancel_left _ X h_det] have h_col (m : 𝔰.BesselIndex) : (Yᴴ * T.splitGram) m b ∈ S.ofSize (i + 1 + 1) := by rw [mul_apply'] exact dotProduct_mem_ofSize (fun n hn ↦ star_mem_ofSize (hY n hn m)) fun n ↦ hasMatrixSize_splitGram n b have h_gram_inv : S.HasMatrixSize 1 T.splitGram⁻¹ := S.splitGram_and_inv_mem.right rw [hX, mul_apply'] exact mem_ofSize_mono (dotProduct_mem_ofSize (fun n _ ↦ h_gram_inv a n) h_col) /-- If the matrix of x, an element of the unitary group of J = `T.splitGram`, has size i, then the matrix of x⁻¹ has size i + 4, since J x⁻¹ = xᴴ J. -/ lemma HasMatrixSize.inv [IsHermitianUnit T.splitGram] {x : T.G} {S : Size T} (h : S.HasMatrixSize i x.val.val) : S.HasMatrixSize (i + 4) x⁻¹.val.val := fun a b ↦ adjoint_apply_mem_ofSize (U.form_mul_inv_eq x) a b fun n _ ↦ h n end Size end Size end New.Floors end