/-Copyright (c) 2026 Carles MarΓn. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles MarΓn, Claude (AI assistant)-/module public import Formalizations.RepresentationTheory.Symplectic.RhoLinepublic import Mathlib.Data.Nat.Factorial.Basicpublic import Mathlib.LinearAlgebra.Matrix.Determinant.Basicpublic import Mathlib.LinearAlgebra.Vandermonde /-!# The value on the Ο-line at `k = 2` (Theorem 8.1, `conj:val`), by pairs Arithmetic of integers on the right-hand side of `RhoLine.thm_valgen`. For `q = m + 1`(`d = 2`) every pair of `Ο` divisible by `q` equals `q`, hence`β_{q β£ b} b = q ^ N_q Ο` and the ratio of `thm_valgen` is `β_{q β£ a} (a / q)`. Stage A of the commission only; the form "one factor per folded class `D_c`" is NOT done here.-/ @[expose] public section namespace RhoLine open ResidueCapacity /-- Every pair of `Ο_m` lies in `(0, 2m]`. -/lemma rhoZ_pairs_le (m : β) : β a β pairs (rhoZ m), a β€ 2 * (m : β€) := by induction m with | zero => simp [pairs, rhoZ, posRootVals] | succ m ih => intro a ha rw [pairs, rhoZ_succ] at ha simp only [posRootVals, List.mem_cons, List.mem_append, List.mem_flatMap] at ha rcases ha with (rfl | β¨b, hb, habβ©) | ha Β· rw [two_nsmul]; push_cast; omega Β· have := mem_rhoZ hb simp only [List.not_mem_nil, or_false] at hab rcases hab with rfl | rfl <;> push_cast <;> omega Β· have := ih a ha push_cast; omega /-- `rho_div_pairs_eq_q`: for `q = m + 1`, every pair of `Ο` divisible by `q` equals `q`. -/theorem rho_div_pairs_eq_q (m : β) {q : β} (hq : q = m + 1) : β b β pairs (rhoZ m), (q : β€) β£ b β b = q := by intro b hb hd have h1 := rhoZ_pairs_pos m b hb have h2 := rhoZ_pairs_le m b hb obtain β¨c, rflβ© := hd subst hq push_cast at h1 h2 β’ have hc1 : 0 < c := by nlinarith have hc2 : c < 2 := by nlinarith have : c = 1 := by omega subst this; ring lemma prod_const_of_forall (L : List β€) (q : β€) (h : β b β L, b = q) : (L.map fun b : β€ => (b : β)).prod = (q : β) ^ L.length := by induction L with | nil => simp | cons a L ih => have ha := h a (List.mem_cons_self ..) simp only [List.map_cons, List.prod_cons, List.length_cons, pow_succ, ha] rw [ih fun b hb => h b (List.mem_cons_of_mem _ hb)] ring lemma prod_div_const (L : List β€) (q : β) : (L.map fun a : β€ => (a : β) / q).prod = (L.map fun a : β€ => (a : β)).prod / q ^ L.length := by induction L with | nil => simp | cons a L ih => simp only [List.map_cons, List.prod_cons, List.length_cons, pow_succ, ih] rw [div_mul_div_comm]; ring lemma length_filter_eq_N (q : β) (x : List β€) : ((pairs x).filter fun a => (q : β€) β£ a).length = N q x := by unfold N Ncount rw [List.countP_eq_length_filter] /-- `β_{q β£ b} b = q ^ N_q Ο` for `q = m + 1`. -/theorem prod_rho_div (m : β) {q : β} (hq : q = m + 1) : (((pairs (rhoZ m)).filter fun b => (q : β€) β£ b).map fun b : β€ => (b : β)).prod = (q : β) ^ N q (rhoZ m) := by have := prod_const_of_forall ((pairs (rhoZ m)).filter fun b => (q : β€) β£ b) q (fun b hb => by obtain β¨hb1, hb2β© := List.mem_filter.1 hb exact rho_div_pairs_eq_q m hq b hb1 (by simpa using hb2)) rw [this, length_filter_eq_N] simp /-- **Theorem 8.1 (`conj:val`), `k = 2`, by pairs.** `q = m + 1`, `N_q β = N_q Ο`:`β_{q β£ a} a / β_{q β£ b} b = β_{q β£ a} (a / q)` in `β`. -/theorem thm_val_k2 (m : β) {q : β} (hq : q = m + 1) (l : List β€) (hN : N q l = N q (rhoZ m)) : (((pairs l).filter fun a => (q : β€) β£ a).map fun a : β€ => (a : β)).prod / (((pairs (rhoZ m)).filter fun b => (q : β€) β£ b).map fun b : β€ => (b : β)).prod = (((pairs l).filter fun a => (q : β€) β£ a).map fun a : β€ => (a : β) / q).prod := by rw [prod_rho_div m hq, prod_div_const, length_filter_eq_N, hN] /-- **Theorem 8.1 (`conj:val`), `k = 2`, on the modulus.** `d = 2`, `q = m + 1`:`βQ(ΞΆ)β = β_{a β pairs β, q β£ a} (a / q)` in `β`. -/theorem thm_val_k2_norm {q m : β} (hq : q = m + 1) {ΞΆ : β} (hΞΆ : IsPrimitiveRoot ΞΆ q) (l : List β€) (hl : l.length = m) (hpl : β a β pairs l, 0 < a) (hN : N q l = N q (rhoZ m)) (Q : Polynomial β) (hQ : F β (rhoZ m) * Q = F β l) : βQ.eval ΞΆβ = (((pairs l).filter fun a => (q : β€) β£ a).map fun a : β€ => (a : β) / q).prod := by have hqpos : 0 < q := by omega have hd : 2 * q = 2 * m + 2 := by omega rw [thm_valgen hqpos hd hΞΆ l hl hpl hN Q hQ] have h := thm_val_k2 m hq l hN have h' := congrArg (fun r : β => (r : β)) h simp only [Rat.cast_div, Rat.cast_list_prod, List.map_map, Function.comp_def, Rat.cast_intCast, Rat.cast_natCast] at h' exact h' /-! ## Stage B (partial): the dimension formulas and the Weyl-shift identities Index-based transcription (0-indexed) of `dim_gl`, `dim_sp`, `dim_so_odd` of `anc/dims_recuento.py`,valued in `β`. Only the algebraic core of Stage B is done here (B1-B3 as shift identities);the combinatorial assembly over folded classes (B4) is NOT done. -/ /-- `β_{i<j<n} (l_i - l_j)`. -/def vdm (n : β) (l : β β β) : β := β i β Finset.range n, β j β Finset.Ico (i + 1) n, (l i - l j) /-- Type-`C`/`B` Weyl numerator `β_i l_i β_{i<j} (l_i - l_j)(l_i + l_j)`. -/def weylC (n : β) (l : β β β) : β := β i β Finset.range n, (l i * β j β Finset.Ico (i + 1) n, ((l i - l j) * (l i + l j))) /-- `dim_gl`: `β_{i<j}(Ξ½_i - Ξ½_j + j - i) / β_{j<n} j!`. -/def dimGl (n : β) (Ξ½ : β β β€) : β := vdm n (fun i => ((Ξ½ i : β) + ((n : β) - i - 1))) / β j β Finset.range n, ((j.factorial : β) : β) /-- `dim_sp`: Weyl numerator at `Ξ½ + Ο_C`, `Ο_C = (n, β¦, 1)`, over that at `Ο_C`. -/def dimSp (n : β) (Ξ½ : β β β€) : β := weylC n (fun i => (Ξ½ i : β) + ((n : β) - i)) / weylC n (fun i => (n : β) - i) /-- `dim_so_odd`: Weyl numerator at `Ξ½ + Ο_B`, `Ο_B = (n - Β½, β¦, Β½)`, over that at `Ο_B`;`Ξ½` may be half-integral, hence valued in `β`. -/def dimSoOdd (n : β) (Ξ½ : β β β) : β := weylC n (fun i => Ξ½ i + (2 * ((n : β) - i) - 1) / 2) / weylC n (fun i => (2 * ((n : β) - i) - 1) / 2) def pad (L : List β€) : β β β€ := fun i => L.getD i 0def padQ (L : List β) : β β β := fun i => L.getD i 0 -- sanity values: GL_3 (1,0,0) = 3, (2,1,0) = 8; Sp(4) (1,0) = 4, (1,1) = 5;-- SO(5) (1/2,1/2) = 4, (1,0) = 5.example : dimGl 3 (pad [1, 0, 0]) = 3 := by norm_num [dimGl, vdm, pad, Finset.prod_Ico_eq_prod_range, Finset.prod_range_succ, Nat.factorial]example : dimGl 3 (pad [2, 1, 0]) = 8 := by norm_num [dimGl, vdm, pad, Finset.prod_Ico_eq_prod_range, Finset.prod_range_succ, Nat.factorial]example : dimSp 2 (pad [1, 0]) = 4 := by norm_num [dimSp, weylC, pad, Finset.prod_range_succ]example : dimSp 2 (pad [1, 1]) = 5 := by norm_num [dimSp, weylC, pad, Finset.prod_range_succ]example : dimSoOdd 2 (padQ [1 / 2, 1 / 2]) = 4 := by norm_num [dimSoOdd, weylC, padQ, Finset.prod_range_succ]example : dimSoOdd 2 (padQ [1, 0]) = 5 := by norm_num [dimSoOdd, weylC, padQ, Finset.prod_range_succ] /-- **B1 (non-fixed class), shift identity.** If `Ξ½_i = y_i - y_{n-1} - (n-1-i)` (the note's`Ξ½^{(c)}`, 0-indexed), then `dim_gl Ξ½ = β_{i<j}(y_i - y_j) / β_{j<n} j!`: the divisible pairs ofthe class are `q (y_i - y_j)` and the factor `q^{#}` cancels against `Ο`. -/theorem dimGl_shift (n : β) (Ξ½ : β β β€) (y : β β β€) (hΞ½ : β i < n, Ξ½ i = y i - y (n - 1) - ((n : β€) - 1 - i)) : dimGl n Ξ½ = vdm n (fun i => (y i : β)) / β j β Finset.range n, ((j.factorial : β) : β) := by unfold dimGl congr 1 unfold vdm refine Finset.prod_congr rfl fun i hi => Finset.prod_congr rfl fun j hj => ?_ have hi' := Finset.mem_range.1 hi have hj' := (Finset.mem_Ico.1 hj).2 have hn : 1 β€ n := by omega beta_reduce rw [hΞ½ i hi', hΞ½ j hj'] push_cast; ring lemma vdm_congr (n : β) (l l' : β β β) (h : β i < n, l i = l' i) : vdm n l = vdm n l' := by unfold vdm refine Finset.prod_congr rfl fun i hi => Finset.prod_congr rfl fun j hj => ?_ rw [h i (Finset.mem_range.1 hi), h j (Finset.mem_Ico.1 hj).2] /-- Number of pairs `i < j < n`. -/def npairs (n : β) : β := β i β Finset.range n, (n - (i + 1)) lemma vdm_scale (n : β) (a : β) (y : β β β) : vdm n (fun i => a * y i) = a ^ npairs n * vdm n y := by unfold vdm npairs rw [β Finset.prod_pow_eq_pow_sum, β Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun i _ => ?_ rw [β Nat.card_Ico (i + 1) n, β Finset.prod_const, β Finset.prod_mul_distrib] refine Finset.prod_congr rfl fun j _ => ?_ ring /-- **B-block (one non-fixed class), ratio form.** Rows `e_i = c + q y_i` of a non-fixed class(`e_i = Ξ΅_i β_i`, `c` the class representative): the divisible pairs are `e_i - e_j = q (y_i - y_j)`,and the ratio of their product to the one of the `Ο`-block (`q^{#pairs} β_{j<n} j!`, i.e.`y = (n-1, β¦, 0)`) is `dim_gl Ξ½^{(c)}`. -/theorem block_ratio (n q : β) (hq : 0 < q) (e y Ξ½ : β β β€) (c : β€) (hy : β i < n, e i = c + q * y i) (hΞ½ : β i < n, Ξ½ i = y i - y (n - 1) - ((n : β€) - 1 - i)) : vdm n (fun i => (e i : β)) / ((q : β) ^ npairs n * β j β Finset.range n, ((j.factorial : β) : β)) = dimGl n Ξ½ := by rw [dimGl_shift n Ξ½ y hΞ½] have h1 : vdm n (fun i => (e i : β)) = vdm n (fun i => (c : β) + q * y i) := vdm_congr n _ _ fun i hi => by rw [hy i hi]; push_cast; ring have h2 : vdm n (fun i => (c : β) + q * y i) = vdm n (fun i => (q : β) * y i) := by unfold vdm refine Finset.prod_congr rfl fun i _ => Finset.prod_congr rfl fun j _ => ?_ ring rw [h1, h2, vdm_scale, div_mul_eq_div_div, mul_div_assoc] have : ((q : β) ^ npairs n) β 0 := pow_ne_zero _ (by exact_mod_cast hq.ne') field_simp /-! ### (1) Pairs and folded classes -/ /-- Product of the `q`-divisible pairs of `x`. -/def prodDiv (q : β) (x : List β€) : β := (((pairs x).filter fun a => (q : β€) β£ a).map fun a : β€ => (a : β)).prod /-- Contribution of the two roots `e_i β e_j` of the pair of rows `(a, b)`. -/def fpair (q : β) (a b : β€) : β := (if (q : β€) β£ a - b then ((a - b : β€) : β) else 1) * (if (q : β€) β£ a + b then ((a + b : β€) : β) else 1) /-- Contribution of the long root `2 e_i`. -/def gdiag (q : β) (a : β€) : β := if (q : β€) β£ 2 * a then ((2 * a : β€) : β) else 1 lemma flatMap_prod_div (q : β) (a : β€) (xs : List β€) : ((((xs.flatMap fun b => [a - b, a + b]).filter fun c => (q : β€) β£ c).map fun c : β€ => (c : β))).prod = (xs.map (fpair q a)).prod := by induction xs with | nil => simp | cons b xs ih => simp only [List.flatMap_cons, List.filter_append, List.map_append, List.prod_append, List.map_cons, List.prod_cons, ih, fpair] by_cases h1 : (q : β€) β£ a - b <;> by_cases h2 : (q : β€) β£ a + b <;> simp [h1, h2] /-- Recursion for the divisible-pair product. -/lemma prodDiv_cons (q : β) (a : β€) (xs : List β€) : prodDiv q (a :: xs) = gdiag q a * (xs.map (fpair q a)).prod * prodDiv q xs := by unfold prodDiv have e : pairs (a :: xs) = (2 * a) :: (xs.flatMap fun b => [a - b, a + b]) ++ pairs xs := by simp [pairs, ResidueCapacity.posRootVals] rw [e, List.filter_append, List.map_append, List.prod_append, List.filter_cons, β flatMap_prod_div q a xs] unfold gdiag by_cases h : (q : β€) β£ 2 * a Β· simp [h, mul_assoc] Β· simp [h] lemma dvd_iff_zmod (q : β) (a : β€) : (q : β€) β£ a β (a : ZMod q) = 0 := (ZMod.intCast_zmod_eq_zero_iff_dvd a q).symm /-- Rows in different folded classes contribute nothing. -/lemma fpair_diff_class {q : β} (a b : β€) (h1 : (a : ZMod q) β b) (h2 : (a : ZMod q) β -b) : fpair q a b = 1 := by have n1 : Β¬ (q : β€) β£ a - b := by rw [dvd_iff_zmod]; push_cast; exact fun h => h1 (sub_eq_zero.1 h) have n2 : Β¬ (q : β€) β£ a + b := by rw [dvd_iff_zmod]; push_cast; exact fun h => h2 (eq_neg_of_add_eq_zero_left h) simp [fpair, n1, n2] /-- Same non-fixed class, `a β‘ b`: only `a - b` is divisible. -/lemma fpair_same_nonfixed_sub {q : β} (a b : β€) (h : (a : ZMod q) = b) (hfix : 2 * (a : ZMod q) β 0) : fpair q a b = ((a - b : β€) : β) := by have d1 : (q : β€) β£ a - b := by rw [dvd_iff_zmod]; push_cast; rw [h, sub_self] have n2 : Β¬ (q : β€) β£ a + b := by rw [dvd_iff_zmod]; push_cast; intro h0 apply hfix; rw [two_mul]; nth_rewrite 2 [h]; exact h0 simp [fpair, d1, n2] /-- Same non-fixed class, `a β‘ -b`: only `a + b` is divisible. -/lemma fpair_same_nonfixed_add {q : β} (a b : β€) (h : (a : ZMod q) = -b) (hfix : 2 * (a : ZMod q) β 0) : fpair q a b = ((a + b : β€) : β) := by have d2 : (q : β€) β£ a + b := by rw [dvd_iff_zmod]; push_cast; rw [h, neg_add_cancel] have n1 : Β¬ (q : β€) β£ a - b := by rw [dvd_iff_zmod]; push_cast; intro h0 apply hfix have hab : (a : ZMod q) = b := sub_eq_zero.1 h0 have := congrArgβ (Β· + Β·) hab h rw [add_neg_cancel] at this rw [two_mul]; exact this simp [fpair, d2, n1] /-- Fixed class (`2a β‘ 0`) and same class: both roots `a β b` are divisible. -/lemma fpair_fixed {q : β} (a b : β€) (hfix : 2 * (a : ZMod q) = 0) (h : (a : ZMod q) = b β¨ (a : ZMod q) = -b) : fpair q a b = ((a - b : β€) : β) * ((a + b : β€) : β) := by have hneg : (a : ZMod q) = -a := by rw [eq_neg_iff_add_eq_zero, β two_mul]; exact hfix have hb : (a : ZMod q) = b β§ (a : ZMod q) = -b := by rcases h with h | h Β· exact β¨h, by rw [β h]; exact hnegβ© Β· have hb' : (b : ZMod q) = -a := by rw [h, neg_neg] exact β¨by rw [hb']; exact hneg, hβ© have d1 : (q : β€) β£ a - b := by rw [dvd_iff_zmod]; push_cast; rw [hb.1, sub_self] have d2 : (q : β€) β£ a + b := by rw [dvd_iff_zmod]; push_cast; rw [hb.2, neg_add_cancel] simp [fpair, d1, d2] /-- The long root contributes `2a` exactly on fixed classes. -/lemma gdiag_fixed {q : β} (a : β€) (hfix : 2 * (a : ZMod q) = 0) : gdiag q a = ((2 * a : β€) : β) := by have : (q : β€) β£ 2 * a := by rw [dvd_iff_zmod]; push_cast; exact hfix simp [gdiag, this] lemma gdiag_nonfixed {q : β} (a : β€) (hfix : 2 * (a : ZMod q) β 0) : gdiag q a = 1 := by have : Β¬ (q : β€) β£ 2 * a := by rw [dvd_iff_zmod]; push_cast; exact hfix simp [gdiag, this] /-! ### (a) Grouping the pair product by class -/ /-- **Class grouping.** If `f i j = 1` whenever `cl i β cl j`, then `β_{i<j} f i j` is theproduct over the classes `c β T` of the same product restricted to the rows of class `c`. -/theorem prod_pairs_by_class {Ξ² : Type*} [DecidableEq Ξ²] (n : β) (cl : β β Ξ²) (f : β β β β β) (hf : β i j, cl i β cl j β f i j = 1) (T : Finset Ξ²) (hT : β i < n, cl i β T) : β i β Finset.range n, β j β Finset.Ico (i + 1) n, f i j = β c β T, β i β (Finset.range n).filter (fun i => cl i = c), β j β (Finset.Ico (i + 1) n).filter (fun j => cl j = c), f i j := by have h1 : β i β Finset.range n, β j β Finset.Ico (i + 1) n, f i j = β j β (Finset.Ico (i + 1) n).filter (fun j => cl j = cl i), f i j := by intro i _ symm apply Finset.prod_filter_of_ne intro j _ hne by_contra hc exact hne (hf i j (fun h => hc h.symm)) rw [Finset.prod_congr rfl h1, β Finset.prod_fiberwise_of_maps_to (s := Finset.range n) (t := T) (g := cl) (fun i hi => hT i (Finset.mem_range.1 hi))] refine Finset.prod_congr rfl fun c _ => Finset.prod_congr rfl fun i hi => ?_ have : cl i = c := (Finset.mem_filter.1 hi).2 rw [this] lemma list_map_prod_range (f : β€ β β) (xs : List β€) : (xs.map f).prod = β j β Finset.range xs.length, f (xs.getD j 0) := by induction xs with | nil => simp | cons a xs ih => rw [List.map_cons, List.prod_cons, ih, List.length_cons, Finset.prod_range_succ'] simp [mul_comm] /-- The divisible-pair product as an indexed double product over the rows. -/theorem prodDiv_idx (q : β) (x : List β€) : prodDiv q x = (β i β Finset.range x.length, gdiag q (x.getD i 0)) * β i β Finset.range x.length, β j β Finset.Ico (i + 1) x.length, fpair q (x.getD i 0) (x.getD j 0) := by induction x with | nil => simp [prodDiv, pairs, ResidueCapacity.posRootVals] | cons a xs ih => rw [prodDiv_cons, ih, list_map_prod_range, List.length_cons, Finset.prod_range_succ' _ xs.length, Finset.prod_range_succ' _ xs.length] have hI : β i : β, β j β Finset.Ico (i + 1 + 1) (xs.length + 1), fpair q ((a :: xs).getD (i + 1) 0) ((a :: xs).getD j 0) = β j β Finset.Ico (i + 1) xs.length, fpair q (xs.getD i 0) (xs.getD j 0) := by intro i rw [β Finset.prod_Ico_add' (fun j => fpair q ((a :: xs).getD (i + 1) 0) ((a :: xs).getD j 0)) (i + 1) xs.length 1] simp have h0 : β j β Finset.Ico (0 + 1) (xs.length + 1), fpair q ((a :: xs).getD 0 0) ((a :: xs).getD j 0) = β j β Finset.range xs.length, fpair q a (xs.getD j 0) := by rw [Finset.range_eq_Ico, β Finset.prod_Ico_add' (fun j => fpair q ((a :: xs).getD 0 0) ((a :: xs).getD j 0)) 0 xs.length 1] simp simp only [hI, h0] simp [mul_comm, mul_left_comm, mul_assoc] /-! ### (b) Permutation invariance of `|vdm|` -/ /-- `β_{i<j} |l_i - l_j|` over `range n`. -/def avdm (n : β) (l : β β β) : β := β i β Finset.range n, β j β Finset.Ico (i + 1) n, |l i - l j| lemma abs_vdm (n : β) (l : β β β) : |vdm n l| = avdm n l := by unfold vdm avdm rw [Finset.abs_prod] exact Finset.prod_congr rfl fun i _ => by rw [Finset.abs_prod] lemma avdm_fin (n : β) (l : β β β) : avdm n l = |Matrix.det (Matrix.vandermonde (fun i : Fin n => l i))| := by rw [Matrix.det_vandermonde, Finset.abs_prod] unfold avdm rw [β Fin.prod_univ_eq_prod_range (fun i => β j β Finset.Ico (i + 1) n, |l i - l j|) n] refine Finset.prod_congr rfl fun i _ => ?_ rw [Finset.abs_prod] have e : β j β Finset.Ico ((i : β) + 1) n, |l i - l j| = β j β Finset.Ioi i, |l i - l j| := by have h := Finset.prod_map (Finset.Ioi i) Fin.valEmbedding (fun j : β => |l i - l j|) rw [Fin.map_valEmbedding_Ioi] at h simp only [Fin.valEmbedding_apply] at h rw [β h] refine Finset.prod_congr ?_ fun _ _ => rfl ext j simp only [Finset.mem_Ico, Finset.mem_Ioo] omega rw [e] exact Finset.prod_congr rfl fun j _ => abs_sub_comm _ _ /-- **Permutation invariance (b).** Reordering the entries (a permutation `Ο` of `range n`given as a function `s` with `s` a bijection of `Fin n`) leaves `|vdm|` unchanged. -/theorem avdm_perm (n : β) (l : β β β) (Ο : Equiv.Perm (Fin n)) : avdm n (fun i => if h : i < n then l (Ο β¨i, hβ©) else 0) = avdm n l := by rw [avdm_fin, avdm_fin] have : (Matrix.vandermonde (fun i : Fin n => (fun i => if h : i < n then l (Ο β¨i, hβ©) else 0) (i : β))) = (Matrix.vandermonde (fun i : Fin n => l i)).submatrix Ο id := by ext i j simp [Matrix.vandermonde_apply] rw [this, Matrix.det_permute, abs_mul] rcases Int.units_eq_one_or (Equiv.Perm.sign Ο) with h | h <;> simp [h] /-- **(c) core.** Consecutive `y`-values: `β_{i<j<n} |i β j| = β_{j<n} j!`. (Via`Matrix.det_vandermonde_id_eq_superFactorial`.) -/theorem avdm_id (n : β) : avdm n (fun i => (i : β)) = β j β Finset.range n, ((j.factorial : β) : β) := by cases n with | zero => simp [avdm] | succ k => rw [avdm_fin] have h := Matrix.det_vandermonde_id_eq_superFactorial (R := β) k have e : (fun i : Fin (k + 1) => ((i : β) : β)) = fun i : Fin (k + 1) => (i : β) := rfl rw [e, h, Finset.prod_range_succ'] simp only [Nat.factorial_zero, Nat.cast_one, mul_one] rw [β Nat.prod_range_factorial_succ k, abs_of_nonneg (by positivity)] push_cast rfl /-- Shift invariance: the `y`'s may start at any rational `t`. -/lemma avdm_shift (n : β) (l : β β β) (t : β) : avdm n (fun i => l i + t) = avdm n l := by unfold avdm refine Finset.prod_congr rfl fun i _ => Finset.prod_congr rfl fun j _ => ?_ congr 1; ring lemma avdm_congr(n: β) (l l' : β β β) (h : β i < n, l i = l' i) : avdm n l = avdm n l' := by unfold avdm refine Finset.prod_congr rfl fun i hi => Finset.prod_congr rfl fun j hj => ?_ rw [h i (Finset.mem_range.1 hi), h j (Finset.mem_Ico.1 hj).2] lemma weylC_eq (n : β) (l : β β β) : weylC n l = (β i β Finset.range n, l i) * vdm n (fun i => l i ^ 2) := by unfold weylC vdm rw [Finset.prod_mul_distrib] congr 1 refine Finset.prod_congr rfl fun i _ => Finset.prod_congr rfl fun j _ => ?_ ring /-- **(b) for `weylC`:** a permutation of the entries changes `weylC` at most by a sign. -/theorem abs_weylC_perm (n : β) (l : β β β) (Ο : Equiv.Perm (Fin n)) : |weylC n (fun i => if h : i < n then l (Ο β¨i, hβ©) else 0)| = |weylC n l| := by rw [weylC_eq, weylC_eq, abs_mul, abs_mul, abs_vdm, abs_vdm] congr 1 Β· have e1 : β i β Finset.range n, (if h : i < n then l (Ο β¨i, hβ©) else 0) = β i : Fin n, l (Ο i) := by rw [β Fin.prod_univ_eq_prod_range (fun i => if h : i < n then l (Ο β¨i, hβ©) else 0) n] exact Finset.prod_congr rfl fun i _ => by simp have e2 : β i : Fin n, l (Ο i) = β i : Fin n, l i := Equiv.prod_comp Ο (fun i => l i) rw [e1, e2, β Fin.prod_univ_eq_prod_range (fun i => l i) n] Β· rw [β avdm_perm n (fun i => l i ^ 2) Ο] exact avdm_congr n _ _ fun i hi => by simp [hi] lemma weylC_congr(n: β) (l l' : β β β) (h : β i < n, l i = l' i) : weylC n l = weylC n l' := by unfold weylC refine Finset.prod_congr rfl fun i hi => ?_ have hi' := Finset.mem_range.1 hi rw [h i hi'] congr 1 refine Finset.prod_congr rfl fun j hj => ?_ rw [h j (Finset.mem_Ico.1 hj).2] /-- **B2 (class 0), shift identity.** If `Ξ½_i = L_i - (n - i)` (the note's `Ξ½^{(0)}`, with`L_i = β_i / q`), then `dim_sp Ξ½ = weylC(L) / weylC(Ο_C)`. -/theorem dimSp_shift (n : β) (Ξ½ L : β β β€) (hΞ½ : β i < n, Ξ½ i = L i - ((n : β€) - i)) : dimSp n Ξ½ = weylC n (fun i => (L i : β)) / weylC n (fun i => (n : β) - i) := by unfold dimSp congr 1 exact weylC_congr n _ _ fun i hi => by rw [hΞ½ i hi]; push_cast; ring /-- **B3 (class `q/2`), shift identity.** If `Ξ½_i = L_i - (2(n-i)-1)/2` (the note's`Ξ½^{(q/2)}`, `L_i = β_i / q`), then `dim_so_odd Ξ½ = weylC(L) / weylC(Ο_B)`. -/theorem dimSoOdd_shift (n : β) (Ξ½ L : β β β) (hΞ½ : β i < n, Ξ½ i = L i - (2 * ((n : β) - i) - 1) / 2) : dimSoOdd n Ξ½ = weylC n L / weylC n (fun i => (2 * ((n : β) - i) - 1) / 2) := by unfold dimSoOdd congr 1 exact weylC_congr n _ _ fun i hi => by rw [hΞ½ i hi]; ring /-! ### (i) List version of `avdm` and its invariance under `List.Perm` -/ /-- `β_{i<j} |L_i β L_j|` by recursion on the list. -/def avdmL : List β β β | [] => 1 | a :: L => (L.map fun b => |a - b|).prod * avdmL L lemma avdmL_perm {L L' : List β} (h : L.Perm L') : avdmL L = avdmL L' := by induction h with | nil => rfl | cons a hp ih => simp only [avdmL, ih] rw [(List.Perm.map (fun b => |a - b|) hp).prod_eq] | swap x y l => simp only [avdmL, List.map_cons, List.prod_cons] rw [abs_sub_comm y x] ring | trans _ _ ih1 ih2 => exact ih1.trans ih2 lemma avdmL_idx (L : List β) : avdmL L = avdm L.length (fun i => L.getD i 0) := by induction L with | nil => simp [avdmL, avdm] | cons a xs ih => rw [avdmL, ih] unfold avdm rw [List.length_cons, Finset.prod_range_succ'] have hI : β i : β, β j β Finset.Ico (i + 1 + 1) (xs.length + 1), |(a :: xs).getD (i + 1) 0 - (a :: xs).getD j 0| = β j β Finset.Ico (i + 1) xs.length, |xs.getD i 0 - xs.getD j 0| := by intro i rw [β Finset.prod_Ico_add' (fun j => |(a :: xs).getD (i + 1) 0 - (a :: xs).getD j 0|) (i + 1) xs.length 1] simp have h0 : β j β Finset.Ico (0 + 1) (xs.length + 1), |(a :: xs).getD 0 0 - (a :: xs).getD j 0| = β j β Finset.range xs.length, |a - xs.getD j 0| := by rw [Finset.range_eq_Ico, β Finset.prod_Ico_add' (fun j => |(a :: xs).getD 0 0 - (a :: xs).getD j 0|) 0 xs.length 1] simp have hm : β ys : List β, (ys.map fun b => |a - b|).prod = β j β Finset.range ys.length, |a - ys.getD j 0| := by intro ys induction ys with | nil => simp | cons b ys ih' => rw [List.map_cons, List.prod_cons, ih', List.length_cons, Finset.prod_range_succ'] simp [mul_comm] simp only [hI, h0, hm xs] simp [mul_comm] /-! ### Orientation of the rows of a non-fixed class -/ /-- Orientation `Ξ΅_i β_i β‘ c`: keep `v` if `v β‘ c`, otherwise (`v β‘ -c`) take `-v`. -/def orient (q : β) (c : ZMod q) (v : β€) : β€ := if (v : ZMod q) = c then v else -v lemma abs_fpair_nonfixed {q : β} (c : ZMod q) (hc : 2 * c β 0) (a b : β€) (ha : (a : ZMod q) = c β¨ (a : ZMod q) = -c) (hb : (b : ZMod q) = c β¨ (b : ZMod q) = -c) : |fpair q a b| = |((orient q c a : β€) : β) - ((orient q c b : β€) : β)| := by have hneg : (c : ZMod q) β -c := by intro h; apply hc; rw [two_mul]; nth_rewrite 2 [h]; exact add_neg_cancel c have hfa : 2 * (a : ZMod q) β 0 := by rcases ha with h | h Β· rw [h]; exact hc Β· rw [h, mul_neg]; exact neg_ne_zero.2 hc by_cases h1 : (a : ZMod q) = c <;> by_cases h2 : (b : ZMod q) = c Β· rw [fpair_same_nonfixed_sub a b (h1.trans h2.symm) hfa] simp [orient, h1, h2] Β· have hb' : (b : ZMod q) = -c := hb.resolve_left h2 rw [fpair_same_nonfixed_add a b (by rw [hb', neg_neg]; exact h1) hfa] simp [orient, h1, h2] Β· have ha' : (a : ZMod q) = -c := ha.resolve_left h1 rw [fpair_same_nonfixed_add a b (by rw [ha', h2]) hfa] simp only [orient, h1, h2, ite_true, ite_false, Int.cast_add, Int.cast_neg] rw [β abs_neg]; congr 1; ring Β· have ha' : (a : ZMod q) = -c := ha.resolve_left h1 have hb' : (b : ZMod q) = -c := hb.resolve_left h2 rw [fpair_same_nonfixed_sub a b (ha'.trans hb'.symm) hfa] simp only [orient, h1, h2, ite_false, Int.cast_sub, Int.cast_neg] rw [β abs_neg]; congr 1; ring /-- Product of `|fpair|` over the pairs of a block of rows. -/def pairProdL (q : β) : List β€ β β | [] => 1 | a :: L => (L.map fun b => |fpair q a b|).prod * pairProdL q L /-- **Block pair product = list Vandermonde of the oriented rows.** -/theorem pairProdL_eq_avdmL {q : β} (c : ZMod q) (hc : 2 * c β 0) (L : List β€) (hL : β v β L, (v : ZMod q) = c β¨ (v : ZMod q) = -c) : pairProdL q L = avdmL (L.map fun v => ((orient q c v : β€) : β)) := by induction L with | nil => simp [pairProdL, avdmL] | cons a L ih => have hL' : β v β L, (v : ZMod q) = c β¨ (v : ZMod q) = -c := fun v hv => hL v (List.mem_cons_of_mem _ hv) have ha := hL a (List.mem_cons_self ..) rw [pairProdL, List.map_cons, avdmL, ih hL', List.map_map] congr 1 congr 1 refine List.map_congr_left fun b hb => ?_ simp only [Function.comp_apply] exact abs_fpair_nonfixed c hc a b ha (hL' b hb) /-- Block pair product as `|vdm|` of the oriented rows (indexed form). -/lemma pairProdL_eq_abs_vdm {q : β} (c : ZMod q) (hc : 2 * c β 0) (L : List β€) (hL : β v β L, (v : ZMod q) = c β¨ (v : ZMod q) = -c) : pairProdL q L = |vdm L.length (fun i => ((orient q c (L.getD i 0) : β€) : β))| := by rw [pairProdL_eq_avdmL c hc L hL, avdmL_idx, abs_vdm, List.length_map] refine avdm_congr _ _ _ fun i hi => ?_ simp [List.getD_eq_getElem?_getD, hi] /-- **`D_c` for a non-fixed class (ratio form).** If the `β`-block `Lβ` and the `Ο`-block `LΟ`of a non-fixed class `c` both have `n` rows, the `Ο`-block product is `q^{npairs n} β_{j<n} j!`(the consecutive-`y` fact `hΟ`), and the oriented `β`-rows are `cβ + q y_i` with`Ξ½_i = y_i - y_{n-1} - (n-1-i)`, then the ratio of the two block products is `|dim_gl Ξ½|`. -/theorem D_nonfixed {q : β} (hq : 0 < q) (c : ZMod q) (hc : 2 * c β 0) (cβ : β€) (n : β) (Lβ LΟ : List β€) (hβn : Lβ.length = n) (hβ : β v β Lβ, (v : ZMod q) = c β¨ (v : ZMod q) = -c) (hΟ : pairProdL q LΟ = (q : β) ^ npairs n * β j β Finset.range n, ((j.factorial : β) : β)) (y Ξ½ : β β β€) (hy : β i < n, orient q c (Lβ.getD i 0) = cβ + q * y i) (hΞ½ : β i < n, Ξ½ i = y i - y (n - 1) - ((n : β€) - 1 - i)) : pairProdL q Lβ / pairProdL q LΟ = |dimGl n Ξ½| := by have hpos : 0 < (q : β) ^ npairs n * β j β Finset.range n, ((j.factorial : β) : β) := by apply mul_pos (pow_pos (by exact_mod_cast hq) _) exact Finset.prod_pos fun j _ => by exact_mod_cast Nat.factorial_pos j rw [hΟ, pairProdL_eq_abs_vdm c hc Lβ hβ, hβn, β block_ratio n q hq (fun i => orient q c (Lβ.getD i 0)) y Ξ½ cβ hy hΞ½, abs_div, abs_of_pos hpos] /-! ### (i) The `Ο`-block of a non-fixed class: oriented rows `cβ + q y`, `y = -s, β¦, s` -/ lemma cls_iff_c (q : β) (v cβ : β€) : (v : ZMod q) = (cβ : ZMod q) β (q : β€) β£ v - cβ := by rw [dvd_iff_zmod]; push_cast; exact sub_eq_zero.symm lemma cls_iff_negc (q : β) (v cβ : β€) : (v : ZMod q) = -(cβ : ZMod q) β (q : β€) β£ v + cβ := by rw [dvd_iff_zmod]; push_cast; exact eq_neg_iff_add_eq_zero lemma mem_rhoZ_of {m : β} {b : β€} (h1 : 1 β€ b) (h2 : b β€ m) : b β rhoZ m := by simp only [rhoZ, List.mem_map, List.mem_reverse, List.mem_range] refine β¨(b - 1).toNat, by omega, by omegaβ© /-- `2 cβ β’ 0 (mod 2h)` for `0 < cβ < h`. -/lemma two_c_ne_zero {h : β} (cβ : β€) (h1 : 1 β€ cβ) (h2 : cβ β€ (h : β€) - 1) : 2 * (cβ : ZMod (2 * h)) β 0 := by intro hz have : ((2 * cβ : β€) : ZMod (2 * h)) = 0 := by push_cast; exact hz rw [β dvd_iff_zmod] at this push_cast at this obtain β¨k, hkβ© := this have hk0 : 0 < k := by nlinarith have hk1 : k < 1 := by nlinarith omega lemma c_ne_neg_c {h : β} (cβ : β€) (h1 : 1 β€ cβ) (h2 : cβ β€ (h : β€) - 1) : (cβ : ZMod (2 * h)) β -(cβ : ZMod (2 * h)) := by intro he apply two_c_ne_zero cβ h1 h2 calc 2 * (cβ : ZMod (2 * h)) = cβ + cβ := two_mul _ _ = cβ + -(cβ : ZMod (2 * h)) := by rw [β he] _ = 0 := add_neg_cancel _ /-- Oriented rows of `Ο_m` in the class of `cβ`, for `q = 2h`, `m + 1 = (2s+1) h`: exactly`cβ + q y`, `y β [-s, s]`. -/theorem rho_orient_mem {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (cβ : β€) (h1 : 1 β€ cβ) (h2 : cβ β€ (h : β€) - 1) (a : β€) : (β v β rhoZ m, ((v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h))) β§ orient (2 * h) (cβ : ZMod (2 * h)) v = a) β β t : β, t < 2 * s + 1 β§ a = cβ + ((2 * h : β) : β€) * ((t : β€) - s) := by have hmZ : (m : β€) + 1 = (2 * s + 1) * h := by exact_mod_cast hm have hh : (2 : β€) β€ h := by omega have hqZ : ((2 * h : β) : β€) = 2 * h := by push_cast; ring have hneg := c_ne_neg_c (h := h) cβ h1 h2 constructor Β· rintro β¨v, hv, hcl, rflβ© obtain β¨hv1, hv2β© := mem_rhoZ hv rcases hcl with hvc | hvn Β· have hor : orient (2 * h) (cβ : ZMod (2 * h)) v = v := by simp [orient, hvc] rw [hor] obtain β¨y, hyβ© := (cls_iff_c _ v cβ).1 hvc rw [hqZ] at hy have hy0 : 0 β€ y := by by_contra hn; push Not at hn nlinarith have hy1 : y β€ s := by by_contra hn; push Not at hn nlinarith refine β¨(y + s).toNat, by omega, ?_β© rw [hqZ, show (((y + s).toNat : β) : β€) = y + s by omega] linarith Β· have hne : Β¬ (v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) := fun he => hneg (he.symm.trans hvn) have hor : orient (2 * h) (cβ : ZMod (2 * h)) v = -v := by simp [orient, hne] rw [hor] obtain β¨k, hkβ© := (cls_iff_negc _ v cβ).1 hvn rw [hqZ] at hk have hk0 : 1 β€ k := by by_contra hn; push Not at hn nlinarith have hk1 : k β€ s := by by_contra hn; push Not at hn nlinarith refine β¨(s - k).toNat, by omega, ?_β© rw [hqZ, show (((s - k).toNat : β) : β€) = s - k by omega] linarith Β· rintro β¨t, ht, rflβ© rw [hqZ] by_cases hts : s β€ t Β· have hY0 : 0 β€ (t : β€) - s := by omega have hY1 : (t : β€) - s β€ s := by omega have e1 : 0 β€ (h : β€) * ((t : β€) - s) := mul_nonneg (by omega) hY0 have e2 : (h : β€) * ((t : β€) - s) β€ h * s := mul_le_mul_of_nonneg_left hY1 (by omega) have hmem : cβ + 2 * h * ((t : β€) - s) β rhoZ m := mem_rhoZ_of (by nlinarith) (by nlinarith) have hcl : ((cβ + 2 * h * ((t : β€) - s) : β€) : ZMod (2 * h)) = (cβ : ZMod (2 * h)) := by rw [cls_iff_c, hqZ.symm] exact β¨(t : β€) - s, by push_cast; ringβ© exact β¨_, hmem, Or.inl hcl, by simp [orient, hcl]β© Β· push Not at hts have hk : 1 β€ (s : β€) - t := by omega have hk1 : (s : β€) - t β€ s := by omega have e1 : (h : β€) β€ h * ((s : β€) - t) := by nlinarith have e2 : (h : β€) * ((s : β€) - t) β€ h * s := mul_le_mul_of_nonneg_left hk1 (by omega) have hmem : -(cβ + 2 * h * ((t : β€) - s)) β rhoZ m := mem_rhoZ_of (by nlinarith) (by nlinarith) have hcl : ((-(cβ + 2 * h * ((t : β€) - s)) : β€) : ZMod (2 * h)) = -(cβ : ZMod (2 * h)) := by rw [cls_iff_negc, hqZ.symm] exact β¨(s : β€) - t, by push_cast; ringβ© have hne : Β¬ ((-(cβ + 2 * h * ((t : β€) - s)) : β€) : ZMod (2 * h)) = (cβ : ZMod (2 * h)) := fun he => hneg (he.symm.trans hcl) exact β¨_, hmem, Or.inr hcl, by unfold orient; simp only [hne, βreduceIte]; ringβ© lemma rhoZ_nodup (m : β) : (rhoZ m).Nodup := by unfold rhoZ refine List.Nodup.map (fun a b hab => ?_) (List.nodup_reverse.2 (List.nodup_range)) have : (a : β€) + 1 = b + 1 := by exact_mod_cast hab omega lemma avdm_scale (n : β) (a : β) (l : β β β) : avdm n (fun i => a * l i) = |a| ^ npairs n * avdm n l := by rw [β abs_vdm, β abs_vdm, vdm_scale, abs_mul, abs_pow] /-- **(i) `Ο`-block of a non-fixed class.** For `q = 2h`, `m + 1 = (2s+1) h` (`d = 2s+1` odd)and `0 < cβ < h`, the block of `Ο_m` in the folded class of `cβ` has pair product`q^{npairs d} β_{j<d} j!` (its oriented rows are `cβ + q y`, `y = -s..s`). -/theorem rho_block_prod {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (cβ : β€) (h1 : 1 β€ cβ) (h2 : cβ β€ (h : β€) - 1) : pairProdL (2 * h) ((rhoZ m).filter fun v : β€ => decide ((v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h)))) = ((2 * h : β) : β) ^ npairs (2 * s + 1) * β j β Finset.range (2 * s + 1), ((j.factorial : β) : β) := by have hh : (1 : β€) β€ h - 1 := le_trans h1 h2 have hq0 : 0 < (2 * h : β) := by omega have hneg := c_ne_neg_c (h := h) cβ h1 h2 have hc := two_c_ne_zero (h := h) cβ h1 h2 set L := (rhoZ m).filter fun v : β€ => decide ((v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h))) with hL have hLc : β v β L, (v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h)) := fun v hv => by simpa using (List.mem_filter.1 hv).2 rw [pairProdL_eq_avdmL (cβ : ZMod (2 * h)) hc L hLc] -- the oriented rows are a permutation of `cβ + q (t - s)`, `t < 2s+1` have hperm : (L.map (orient (2 * h) (cβ : ZMod (2 * h)))).Perm ((List.range (2 * s + 1)).map fun t : β => cβ + ((2 * h : β) : β€) * ((t : β€) - s)) := by rw [List.perm_ext_iff_of_nodup] Β· intro a rw [List.mem_map, List.mem_map] have := rho_orient_mem hm cβ h1 h2 a constructor Β· rintro β¨v, hv, rflβ© obtain β¨hv1, hv2β© := List.mem_filter.1 hv obtain β¨t, ht, eβ© := this.1 β¨v, hv1, by simpa using hv2, rflβ© exact β¨t, List.mem_range.2 ht, e.symmβ© Β· rintro β¨t, ht, rflβ© obtain β¨v, hv, hcl, eβ© := this.2 β¨t, List.mem_range.1 ht, rflβ© exact β¨v, List.mem_filter.2 β¨hv, by simpa using hclβ©, eβ© Β· refine List.Nodup.map_on (fun v hv w hw hvw => ?_) ((rhoZ_nodup m).filter _) obtain β¨hv1, hv2β© := List.mem_filter.1 hv obtain β¨hw1, hw2β© := List.mem_filter.1 hw have hvp := (mem_rhoZ hv1).1 have hwp := (mem_rhoZ hw1).1 have hv3 : (v : ZMod (2 * h)) = cβ β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h)) := by simpa using hv2 have hw3 : (w : ZMod (2 * h)) = cβ β¨ (w : ZMod (2 * h)) = -(cβ : ZMod (2 * h)) := by simpa using hw2 by_cases a1 : (v : ZMod (2 * h)) = cβ <;> by_cases a2 : (w : ZMod (2 * h)) = cβ <;> simp only [orient, a1, a2, βreduceIte] at hvw <;> omega Β· refine List.Nodup.map (fun t t' htt => ?_) (List.nodup_range) have h0 : ((2 * h : β) : β€) * ((t : β€) - s) = ((2 * h : β) : β€) * ((t' : β€) - s) := by linarith have := mul_left_cancelβ (by exact_mod_cast hq0.ne' : ((2 * h : β) : β€) β 0) h0 omega have e1 : L.map (fun v => ((orient (2 * h) (cβ : ZMod (2 * h)) v : β€) : β)) = (L.map (orient (2 * h) (cβ : ZMod (2 * h)))).map (Int.cast : β€ β β) := by rw [List.map_map]; rfl rw [e1, avdmL_perm (hperm.map (Int.cast : β€ β β)), List.map_map, avdmL_idx, List.length_map, List.length_range] have e2 : avdm (2 * s + 1) (fun i => (List.map ((Int.cast : β€ β β) β fun t : β => cβ + ((2 * h : β) : β€) * ((t : β€) - s)) (List.range (2 * s + 1))).getD i 0) = avdm (2 * s + 1) (fun i => ((2 * h : β) : β) * (i : β) + ((cβ : β) - ((2 * h : β) : β) * s)) := avdm_congr _ _ _ fun i hi => by simp [List.getD_eq_getElem?_getD, hi] ring rw [e2, avdm_shift (2 * s + 1) (fun i => ((2 * h : β) : β) * (i : β)), avdm_scale (2 * s + 1) _ (fun i => (i : β)), avdm_id, abs_of_nonneg (by positivity)] /-- **`D_c` for a non-fixed class, `d` odd (complete).** `q = 2h`, `m + 1 = (2s+1) h`,`0 < cβ < h`. If the `β`-block `Lβ` of the class of `cβ` has `d = 2s+1` rows whose orientedvalues are `cβ + q y_i` (`Ξ½_i = y_i - y_{d-1} - (d-1-i)`), then the product of the divisiblepairs inside the class for `β`, divided by the same for `Ο`, is `|dim_gl Ξ½|` (modulus form). -/theorem D_c_nonfixed_odd {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (cβ : β€) (h1 : 1 β€ cβ) (h2 : cβ β€ (h : β€) - 1) (Lβ : List β€) (hβn : Lβ.length = 2 * s + 1) (hβ : β v β Lβ, (v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h))) (y Ξ½ : β β β€) (hy : β i < 2 * s + 1, orient (2 * h) (cβ : ZMod (2 * h)) (Lβ.getD i 0) = cβ + ((2 * h : β) : β€) * y i) (hΞ½ : β i < 2 * s + 1, Ξ½ i = y i - y (2 * s + 1 - 1) - (((2 * s + 1 : β) : β€) - 1 - i)) : pairProdL (2 * h) Lβ / pairProdL (2 * h) ((rhoZ m).filter fun v : β€ => decide ((v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h)))) = |dimGl (2 * s + 1) Ξ½| := D_nonfixed (by omega) (cβ : ZMod (2 * h)) (two_c_ne_zero cβ h1 h2) cβ (2 * s + 1) Lβ _ hβn hβ (rho_block_prod hm cβ h1 h2) y Ξ½ hy hΞ½ /-! ### The fixed classes `0` and `q/2` (`d` odd): every pair is divisible -/ lemma getD_mem_of_lt (L : List β€) (i : β) (hi : i < L.length) : L.getD i 0 β L := by simp [List.getD_eq_getElem?_getD, hi] /-- If every root of the rows `L` is divisible by `q` and `a_i = q Β· Lf i`, then`prodDiv q L = (2q)^n (qΒ²)^{npairs n} Β· weylC n Lf`. -/theorem prodDiv_alldiv (q n : β) (L : List β€) (hn : L.length = n) (Lf : β β β) (hv : β i < n, ((L.getD i 0 : β€) : β) = q * Lf i) (hg : β i < n, (q : β€) β£ 2 * L.getD i 0) (hf : β i j, i < j β j < n β (q : β€) β£ L.getD i 0 - L.getD j 0 β§ (q : β€) β£ L.getD i 0 + L.getD j 0) : prodDiv q L = (2 * (q : β)) ^ n * ((q : β) ^ 2) ^ npairs n * weylC n Lf := by rw [prodDiv_idx, hn] have e1 : β i β Finset.range n, gdiag q (L.getD i 0) = 2 * q * Lf i := by intro i hi have hi' := Finset.mem_range.1 hi rw [gdiag]; simp only [hg i hi', βreduceIte] push_cast rw [hv i hi']; ring have e2 : β i β Finset.range n, β j β Finset.Ico (i + 1) n, fpair q (L.getD i 0) (L.getD j 0) = (q : β) ^ 2 * ((Lf i - Lf j) * (Lf i + Lf j)) := by intro i hi j hj have hi' := Finset.mem_range.1 hi have hj' := Finset.mem_Ico.1 hj obtain β¨d1, d2β© := hf i j (by omega) hj'.2 rw [fpair]; simp only [d1, d2, βreduceIte] push_cast rw [hv i hi', hv j hj'.2]; ring rw [Finset.prod_congr rfl e1, Finset.prod_congr rfl fun i hi => Finset.prod_congr rfl (e2 i hi), β Finset.prod_mul_distrib] have key : β i β Finset.range n, 2 * (q : β) * Lf i * β j β Finset.Ico (i + 1) n, ((q : β) ^ 2 * ((Lf i - Lf j) * (Lf i + Lf j))) = (2 * (q : β)) * ((q : β) ^ 2) ^ (n - (i + 1)) * (Lf i * β j β Finset.Ico (i + 1) n, ((Lf i - Lf j) * (Lf i + Lf j))) := by intro i _ rw [Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Ico]; ring rw [Finset.prod_congr rfl key, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range, Finset.prod_pow_eq_pow_sum] rfl lemma hpos_of_hm {h s m : β} (hm : m + 1 = (2 * s + 1) * h) : 0 < h := Nat.pos_of_ne_zero (by rintro rfl; simp at hm) lemma rhoZ_pairwise (m : β) : (rhoZ m).Pairwise (Β· > Β·) := by unfold rhoZ rw [List.pairwise_map, List.pairwise_reverse] refine (List.pairwise_lt_range (n := m)).imp ?_ intro a b hab have : a + 1 < b + 1 := by omega exact_mod_cast this /-- The rows of `Ο_m` divisible by `q = 2h`, for `m + 1 = (2s+1) h`: `q (s - i)`, `i < s`. -/lemma rho_filter_zero {h s m : β} (hm : m + 1 = (2 * s + 1) * h) : (rhoZ m).filter (fun v : β€ => decide ((v : ZMod (2 * h)) = 0)) = (List.range s).map fun i : β => ((2 * h : β) : β€) * ((s : β€) - i) := by have hmZ : (m : β€) + 1 = (2 * s + 1) * h := by exact_mod_cast hm have hh : 1 β€ h := hpos_of_hm hm have hqZ : ((2 * h : β) : β€) = 2 * h := by push_cast; ring refine List.Pairwise.eq_of_mem_iff (r := (Β· > Β·)) ((rhoZ_pairwise m).filter _) ?_ ?_ Β· rw [List.pairwise_map] refine (List.pairwise_lt_range (n := s)).imp ?_ intro a b hab have : (a : β€) < b := by exact_mod_cast hab rw [hqZ]; nlinarith Β· intro v simp only [List.mem_filter, List.mem_map, List.mem_range, decide_eq_true_eq] constructor Β· rintro β¨hv, hzβ© obtain β¨hv1, hv2β© := mem_rhoZ hv have hd : ((2 * h : β) : β€) β£ v := by rw [dvd_iff_zmod]; exact hz obtain β¨k, hkβ© := hd rw [hqZ] at hk have hk0 : 1 β€ k := by by_contra hn; push Not at hn nlinarith have hk1 : k β€ s := by by_contra hn; push Not at hn nlinarith exact β¨(s - k).toNat, by omega, by rw [hqZ, show (((s - k).toNat : β) : β€) = s - k by omega, hk]; ringβ© Β· rintro β¨i, hi, rflβ© have hi' : (i : β€) + 1 β€ s := by exact_mod_cast hi rw [hqZ] refine β¨mem_rhoZ_of (by nlinarith) (by nlinarith), ?_β© have : ((2 * h : β) : β€) β£ 2 * h * ((s : β€) - i) := by rw [hqZ]; exact Dvd.intro _ rfl have := (dvd_iff_zmod (2 * h) _).1 this simpa using this /-- **`D_0` for `d` odd.** `q = 2h`, `m + 1 = (2s+1) h`. If the `s` rows of `β` in the class`0` are `q Β· L_i` (`Ξ½_i = L_i - (s - i)`, the note's `Ξ½^{(0)}`), then the product of the divisiblepairs inside the class for `β`, divided by the same for `Ο`, has modulus `dim Sp_{2s} Ξ½^{(0)}`. -/theorem D_zero_odd {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (Lβ : List β€) (hβn : Lβ.length = s) (L Ξ½ : β β β€) (hL : β i < s, Lβ.getD i 0 = ((2 * h : β) : β€) * L i) (hΞ½ : β i < s, Ξ½ i = L i - ((s : β€) - i)) : |prodDiv (2 * h) Lβ / prodDiv (2 * h) ((rhoZ m).filter fun v : β€ => decide ((v : ZMod (2 * h)) = 0))| = |dimSp s Ξ½| := by have hh : 1 β€ h := hpos_of_hm hm have hq : (0 : β) < ((2 * h : β) : β) := by exact_mod_cast (by omega : 0 < 2 * h) rw [rho_filter_zero hm] have A := prodDiv_alldiv (2 * h) s Lβ hβn (fun i => (L i : β)) (fun i hi => by rw [hL i hi]; push_cast; ring) (fun i hi => β¨2 * L i, by rw [hL i hi]; ringβ©) (fun i j hij hj => by rw [hL i (hij.trans hj), hL j hj] exact β¨β¨L i - L j, by ringβ©, β¨L i + L j, by ringβ©β©) have hE : β i < s, ((List.range s).map fun i : β => ((2 * h : β) : β€) * ((s : β€) - i)).getD i 0 = ((2 * h : β) : β€) * ((s : β€) - i) := by intro i hi simp [List.getD_eq_getElem?_getD, hi] have B := prodDiv_alldiv (2 * h) s ((List.range s).map fun i : β => ((2 * h : β) : β€) * ((s : β€) - i)) (by simp) (fun i => (s : β) - i) (fun i hi => by rw [hE i hi]; push_cast; ring) (fun i hi => β¨2 * ((s : β€) - i), by rw [hE i hi]; ringβ©) (fun i j hij hj => by rw [hE i (hij.trans hj), hE j hj] exact β¨β¨(j : β€) - i, by ringβ©, β¨2 * s - i - j, by ringβ©β©) rw [A, B, mul_div_mul_left _ _ (by positivity), dimSp_shift s Ξ½ L hΞ½] /-- Rows of `Ο_m` in the class `q/2 = h`: `h (2(s-i) - 1)`, `i < s`. -/lemma rho_filter_half {h s m : β} (hm : m + 1 = (2 * s + 1) * h) : (rhoZ m).filter (fun v : β€ => decide ((v : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h)))) = (List.range s).map fun i : β => (h : β€) * (2 * ((s : β€) - i) - 1) := by have hmZ : (m : β€) + 1 = (2 * s + 1) * h := by exact_mod_cast hm have hh : 1 β€ h := hpos_of_hm hm have hqZ : ((2 * h : β) : β€) = 2 * h := by push_cast; ring refine List.Pairwise.eq_of_mem_iff (r := (Β· > Β·)) ((rhoZ_pairwise m).filter _) ?_ ?_ Β· rw [List.pairwise_map] refine (List.pairwise_lt_range (n := s)).imp ?_ intro a b hab have : (a : β€) < b := by exact_mod_cast hab nlinarith Β· intro v simp only [List.mem_filter, List.mem_map, List.mem_range, decide_eq_true_eq] constructor Β· rintro β¨hv, hzβ© obtain β¨hv1, hv2β© := mem_rhoZ hv obtain β¨k, hkβ© := (cls_iff_c _ v h).1 hz rw [hqZ] at hk have hk0 : 0 β€ k := by by_contra hn; push Not at hn nlinarith have hk1 : k β€ s - 1 := by by_contra hn; push Not at hn nlinarith exact β¨(s - 1 - k).toNat, by omega, by rw [show (((s - 1 - k).toNat : β) : β€) = s - 1 - k by omega]; linarithβ© Β· rintro β¨i, hi, rflβ© have hi' : (i : β€) + 1 β€ s := by exact_mod_cast hi refine β¨mem_rhoZ_of (by nlinarith) (by nlinarith), ?_β© rw [cls_iff_c, hqZ] exact β¨(s : β€) - i - 1, by ringβ© lemma half_param {h : β} {v : β€} (hv : (v : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h))) : β u : β€, v = h + ((2 * h : β) : β€) * u := by obtain β¨u, huβ© := (cls_iff_c _ v h).1 hv exact β¨u, by linarithβ© /-- **`D_{q/2}` for `d` odd.** `q = 2h`, `m + 1 = (2s+1) h`. If the `s` rows of `β` in the class`h` have `Ξ½_i = β_i / q - (s - i + Β½)^{-}` (here `(2(s-i)-1)/2`), the ratio of the divisible-pairproducts has modulus `dim SO_{2s+1} Ξ½^{(q/2)}`. -/theorem D_half_odd {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (Lβ : List β€) (hβn : Lβ.length = s) (hβ : β v β Lβ, (v : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h))) (Ξ½ : β β β) (hΞ½ : β i < s, Ξ½ i = (Lβ.getD i 0 : β) / ((2 * h : β) : β) - (2 * ((s : β) - i) - 1) / 2) : |prodDiv (2 * h) Lβ / prodDiv (2 * h) ((rhoZ m).filter fun v : β€ => decide ((v : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h))))| = |dimSoOdd s Ξ½| := by have hh : 1 β€ h := hpos_of_hm hm have hq : (0 : β) < ((2 * h : β) : β) := by exact_mod_cast (by omega : 0 < 2 * h) have hqZ : ((2 * h : β) : β€) = 2 * h := by push_cast; ring rw [rho_filter_half hm] have P : β i < s, β u : β€, Lβ.getD i 0 = h + ((2 * h : β) : β€) * u := fun i hi => half_param (hβ _ (getD_mem_of_lt Lβ i (by omega))) have A := prodDiv_alldiv (2 * h) s Lβ hβn (fun i => (Lβ.getD i 0 : β) / ((2 * h : β) : β)) (fun i hi => by field_simp) (fun i hi => by obtain β¨u, huβ© := P i hi exact β¨1 + 2 * u, by rw [hu, hqZ]; ringβ©) (fun i j hij hj => by obtain β¨u, huβ© := P i (hij.trans hj) obtain β¨w, hwβ© := P j hj rw [hu, hw, hqZ] exact β¨β¨u - w, by ringβ©, β¨1 + u + w, by ringβ©β©) have hE : β i < s, ((List.range s).map fun i : β => (h : β€) * (2 * ((s : β€) - i) - 1)).getD i 0 = (h : β€) * (2 * ((s : β€) - i) - 1) := by intro i hi simp [List.getD_eq_getElem?_getD, hi] have B := prodDiv_alldiv (2 * h) s ((List.range s).map fun i : β => (h : β€) * (2 * ((s : β€) - i) - 1)) (by simp) (fun i => (2 * ((s : β) - i) - 1) / 2) (fun i hi => by rw [hE i hi]; push_cast; ring) (fun i hi => β¨(2 * ((s : β€) - i) - 1), by rw [hE i hi, hqZ]; ringβ©) (fun i j hij hj => by rw [hE i (hij.trans hj), hE j hj, hqZ] exact β¨β¨(j : β€) - i, by ringβ©, β¨2 * s - i - j - 1, by ringβ©β©) rw [A, B, mul_div_mul_left _ _ (by positivity), dimSoOdd_shift s Ξ½ (fun i => (Lβ.getD i 0 : β) / ((2 * h : β) : β)) hΞ½] /-! ### Assembly (`d` odd): the product over the folded classes Grouping is done at the level of lists (induction on the row list), not through`prodDiv_idx` / `prod_pairs_by_class`: the indexed filtered double product would need a bridgeback to the filtered list anyway. -/ lemma map_fpair_filter {Ξ² : Type*} [DecidableEq Ξ²] (q : β) (cl : β€ β Ξ²) (hf : β a b, cl a β cl b β fpair q a b = 1) (a : β€) (xs : List β€) : (xs.map (fpair q a)).prod = ((xs.filter fun v => decide (cl v = cl a)).map (fpair q a)).prod := by induction xs with | nil => simp | cons b xs ih => by_cases hb : cl b = cl a Β· simp [hb, ih] Β· have : fpair q a b = 1 := hf a b (fun h => hb h.symm) simp [hb, ih, this] /-- **Class factorisation of the divisible-pair product.** If rows of different classescontribute `1`, `prodDiv q x` is the product over the classes of `prodDiv` of the class rows. -/theorem prodDiv_by_class {Ξ² : Type*} [DecidableEq Ξ²] (q : β) (cl : β€ β Ξ²) (hf : β a b, cl a β cl b β fpair q a b = 1) (T : Finset Ξ²) : β x : List β€, (β v β x, cl v β T) β prodDiv q x = β c β T, prodDiv q (x.filter fun v => decide (cl v = c)) := by intro x induction x with | nil => intro _; simp [prodDiv, pairs, ResidueCapacity.posRootVals] | cons a xs ih => intro hx have ha : cl a β T := hx a (by simp) have hxs : β v β xs, cl v β T := fun v hv => hx v (List.mem_cons_of_mem _ hv) have step : β c β T, prodDiv q ((a :: xs).filter fun v => decide (cl v = c)) = (if cl a = c then gdiag q a * ((xs.filter fun v => decide (cl v = cl a)).map (fpair q a)).prod else 1) * prodDiv q (xs.filter fun v => decide (cl v = c)) := by intro c _ by_cases hc : cl a = c Β· subst hc; simp [prodDiv_cons] Β· simp [hc] rw [prodDiv_cons, ih hxs, Finset.prod_congr rfl step, Finset.prod_mul_distrib, Finset.prod_ite_eq, map_fpair_filter q cl hf a xs] simp only [ha, βreduceIte] /-- The folded class of `v` modulo `2h`: `{v, -v}` in `ZMod (2h)`. -/def fcl (h : β) (v : β€) : Finset (ZMod (2 * h)) := {(v : ZMod (2 * h)), -(v : ZMod (2 * h))} lemma fcl_eq_iff (h : β) (v w : β€) : fcl h v = fcl h w β ((v : ZMod (2 * h)) = (w : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(w : ZMod (2 * h))) := by constructor Β· intro e have : (v : ZMod (2 * h)) β fcl h w := e βΈ (by simp [fcl]) simpa [fcl] using this Β· rintro (e | e) <;> ext z <;> simp [fcl, e, or_comm] lemma fcl_ne_imp {h : β} {a b : β€} (hab : fcl h a β fcl h b) : (a : ZMod (2 * h)) β b β§ (a : ZMod (2 * h)) β -(b : ZMod (2 * h)) := β¨fun e => hab ((fcl_eq_iff h a b).2 (Or.inl e)), fun e => hab ((fcl_eq_iff h a b).2 (Or.inr e))β© lemma fpair_fcl (h : β) (a b : β€) (hab : fcl h a β fcl h b) : fpair (2 * h) a b = 1 := fpair_diff_class a b (fcl_ne_imp hab).1 (fcl_ne_imp hab).2 /-- The rows of `L` in the folded class of `cβ`. -/def clsList (h : β) (cβ : β€) (L : List β€) : List β€ := L.filter fun v : β€ => decide ((v : ZMod (2 * h)) = (cβ : ZMod (2 * h)) β¨ (v : ZMod (2 * h)) = -(cβ : ZMod (2 * h))) lemma filter_fcl (h : β) (cβ : β€) (L : List β€) : L.filter (fun v => decide (fcl h v = fcl h cβ)) = clsList h cβ L := List.filter_congr fun v _ => by simp only [decide_eq_decide]; exact fcl_eq_iff h v cβ lemma neg_half (h : β) : -((h : β€) : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h)) := by have : ((2 * h : β) : ZMod (2 * h)) = 0 := ZMod.natCast_self _ push_cast at this rw [neg_eq_iff_add_eq_zero, Int.cast_natCast] linear_combination this lemma neg_half_nat (h : β) : -((h : β) : ZMod (2 * h)) = ((h : β) : ZMod (2 * h)) := by simpa using neg_half h lemma clsList_zero (h : β) (L : List β€) : clsList h 0 L = L.filter fun v : β€ => decide ((v : ZMod (2 * h)) = 0) := List.filter_congr fun v _ => by simp lemma clsList_half (h : β) (L : List β€) : clsList h (h : β€) L = L.filter fun v : β€ => decide ((v : ZMod (2 * h)) = ((h : β€) : ZMod (2 * h))) := List.filter_congr fun v _ => by simp [neg_half_nat h] lemma abs_list_prod_map (f : β€ β β) (L : List β€) : |(L.map f).prod| = (L.map fun v => |f v|).prod := by induction L with | nil => simp | cons a L ih => simp [abs_mul, ih] lemma two_ne_of_cls {q : β} (c : ZMod q) (hc : 2 * c β 0) (v : β€) (hv : (v : ZMod q) = c β¨ (v : ZMod q) = -c) : 2 * (v : ZMod q) β 0 := by rcases hv with h | h Β· rw [h]; exact hc Β· rw [h, mul_neg]; exact neg_ne_zero.2 hc /-- On a non-fixed class the long roots are not divisible: `|prodDiv| = pairProdL`. -/lemma abs_prodDiv_nonfixed {q : β} (L : List β€) (hL : β v β L, 2 * (v : ZMod q) β 0) : |prodDiv q L| = pairProdL q L := by induction L with | nil => simp [prodDiv, pairs, ResidueCapacity.posRootVals, pairProdL] | cons a L ih => have hL' : β v β L, 2 * (v : ZMod q) β 0 := fun v hv => hL v (List.mem_cons_of_mem _ hv) rw [prodDiv_cons, gdiag_nonfixed a (hL a (List.mem_cons_self ..)), one_mul, abs_mul, abs_list_prod_map, ih hL', pairProdL] lemma ratio_by_class (h : β) (T : Finset (Finset (ZMod (2 * h)))) (l r : List β€) (hl : β v β l, fcl h v β T) (hr : β v β r, fcl h v β T) : |prodDiv (2 * h) l / prodDiv (2 * h) r| = β C β T, |prodDiv (2 * h) (l.filter fun v => decide (fcl h v = C)) / prodDiv (2 * h) (r.filter fun v => decide (fcl h v = C))| := by rw [prodDiv_by_class (2 * h) (fcl h) (fpair_fcl h) T l hl, prodDiv_by_class (2 * h) (fcl h) (fpair_fcl h) T r hr, β Finset.prod_div_distrib, Finset.abs_prod] /-- The classes of `c β [0, h]` represent all folded classes. -/lemma fcl_mem_T (h : β) (hh : 0 < h) (v : β€) : fcl h v β (Finset.range (h + 1)).image (fun c : β => fcl h (c : β€)) := by have : NeZero (2 * h) := β¨by omegaβ© rw [Finset.mem_image] have hr : (((v : ZMod (2 * h)).val : β) : ZMod (2 * h)) = (v : ZMod (2 * h)) := ZMod.natCast_zmod_val _ have hrl : (v : ZMod (2 * h)).val < 2 * h := ZMod.val_lt _ by_cases hrh : (v : ZMod (2 * h)).val β€ h Β· exact β¨(v : ZMod (2 * h)).val, Finset.mem_range.2 (by omega), (fcl_eq_iff h _ _).2 (Or.inl (by simp))β© Β· refine β¨2 * h - (v : ZMod (2 * h)).val, Finset.mem_range.2 (by omega), (fcl_eq_iff h _ _).2 (Or.inr ?_)β© have h0 : ((2 * h : β) : ZMod (2 * h)) = 0 := ZMod.natCast_self _ rw [Int.cast_natCast, Nat.cast_sub (by omega), h0, zero_sub, hr] lemma fcl_inj (h : β) (hh : 0 < h) (c c' : β) (hc : c β€ h) (hc' : c' β€ h) (e : fcl h (c : β€) = fcl h (c' : β€)) : c = c' := by have hqZ : ((2 * h : β) : β€) = 2 * h := by push_cast; ring rcases (fcl_eq_iff h _ _).1 e with e | e Β· obtain β¨k, hkβ© := (cls_iff_c (2 * h) (c : β€) (c' : β€)).1 e rw [hqZ] at hk have hk0 : 0 β€ k := by by_contra hn; push Not at hn nlinarith have hk1 : k < 1 := by by_contra hn; push Not at hn nlinarith have : k = 0 := by omega subst this omega Β· obtain β¨k, hkβ© := (cls_iff_negc (2 * h) (c : β€) (c' : β€)).1 e rw [hqZ] at hk have hk0 : 0 β€ k := by by_contra hn; push Not at hn nlinarith have hk1 : k β€ 1 := by by_contra hn; push Not at hn nlinarith interval_cases k <;> omega lemma range_split (h : β) (hh : 0 < h) (F : β β β) : β c β Finset.range (h + 1), F c = F 0 * (β c β Finset.range (h - 1), F (c + 1)) * F h := by obtain β¨k, rflβ© : β k, h = k + 1 := β¨h - 1, by omegaβ© rw [Nat.add_sub_cancel, Finset.prod_range_succ, Finset.prod_range_succ'] ring /-- **Theorem 10.1 (`thm:dims`), `d = 2s+1` odd, `q = 2h` even, modulus form.**`m + 1 = (2s+1) h`. Write `β` for the list of rows; the class of a row is its folded residue`{v, -v} β β€/q`. With the occupancies given by the profile (`s` rows in each of the classes `0`and `q/2`, `2s+1` rows in each non-fixed class `cβ = c+1`, `c < h-1`) and the partitions`Ξ½^{(0)}`, `Ξ½^{(q/2)}`, `Ξ½^{(c)}` as in the note,`|β_{qβ£a} a / β_{qβ£b} b| = |D_0| Β· |D_{q/2}| Β· β_{c} |D_c|`(`dimSp`, `dimSoOdd`, `dimGl`), where the products run over the divisible pairs of `β` and of`Ο_m`. -/theorem dims_odd {h s m : β} (hm : m + 1 = (2 * s + 1) * h) (l : List β€) (hl0 : (clsList h 0 l).length = s) (L0 Ξ½0 : β β β€) (hL0 : β i < s, (clsList h 0 l).getD i 0 = ((2 * h : β) : β€) * L0 i) (hΞ½0 : β i < s, Ξ½0 i = L0 i - ((s : β€) - i)) (hlh : (clsList h (h : β€) l).length = s) (Ξ½h : β β β) (hΞ½h : β i < s, Ξ½h i = ((clsList h (h : β€) l).getD i 0 : β) / ((2 * h : β) : β) - (2 * ((s : β) - i) - 1) / 2) (hlc : β c < h - 1, (clsList h ((c + 1 : β) : β€) l).length = 2 * s + 1) (y Ξ½ : β β β β β€) (hy : β c < h - 1, β i < 2 * s + 1, orient (2 * h) (((c + 1 : β) : β€) : ZMod (2 * h)) ((clsList h ((c + 1 : β) : β€) l).getD i 0) = ((c + 1 : β) : β€) + ((2 * h : β) : β€) * y c i) (hΞ½ : β c < h - 1, β i < 2 * s + 1, Ξ½ c i = y c i - y c (2 * s + 1 - 1) - (((2 * s + 1 : β) : β€) - 1 - i)) : |prodDiv (2 * h) l / prodDiv (2 * h) (rhoZ m)| = |dimSp s Ξ½0| * |dimSoOdd s Ξ½h| * β c β Finset.range (h - 1), |dimGl (2 * s + 1) (Ξ½ c)| := by have hh : 0 < h := hpos_of_hm hm have hT : β v : β€, fcl h v β (Finset.range (h + 1)).image (fun c : β => fcl h (c : β€)) := fun v => fcl_mem_T h hh v rw [ratio_by_class h _ l (rhoZ m) (fun v _ => hT v) (fun v _ => hT v), Finset.prod_image (fun c hc c' hc' e => fcl_inj h hh c c' (by have := Finset.mem_range.1 (Finset.mem_coe.1 hc); omega) (by have := Finset.mem_range.1 (Finset.mem_coe.1 hc'); omega) e), range_split h hh] simp only [Nat.cast_zero, filter_fcl] have E0 : |prodDiv (2 * h) (clsList h 0 l) / prodDiv (2 * h) (clsList h 0 (rhoZ m))| = |dimSp s Ξ½0| := by rw [clsList_zero h (rhoZ m)] exact D_zero_odd hm _ hl0 L0 Ξ½0 hL0 hΞ½0 have Eh : |prodDiv (2 * h) (clsList h (h : β€) l) / prodDiv (2 * h) (clsList h (h : β€) (rhoZ m))| = |dimSoOdd s Ξ½h| := by rw [clsList_half h (rhoZ m)] refine D_half_odd hm _ hlh (fun v hv => ?_) Ξ½h hΞ½h have hv' := (List.mem_filter.1 hv).2 simp only [decide_eq_true_eq] at hv' rcases hv' with e | e Β· exact e Β· rw [e, neg_half] have Ec : β c β Finset.range (h - 1), |prodDiv (2 * h) (clsList h ((c + 1 : β) : β€) l) / prodDiv (2 * h) (clsList h ((c + 1 : β) : β€) (rhoZ m))| = |dimGl (2 * s + 1) (Ξ½ c)| := by intro c hc have hc' : c < h - 1 := Finset.mem_range.1 hc have h1 : 1 β€ ((c + 1 : β) : β€) := by omega have h2 : ((c + 1 : β) : β€) β€ (h : β€) - 1 := by omega have hc2 := two_c_ne_zero (h := h) _ h1 h2 have hnf : β L : List β€, β v β clsList h ((c + 1 : β) : β€) L, 2 * (v : ZMod (2 * h)) β 0 := fun L v hv => two_ne_of_cls _ hc2 v (by simpa [clsList] using (List.mem_filter.1 hv).2) rw [abs_div, abs_prodDiv_nonfixed _ (hnf l), abs_prodDiv_nonfixed _ (hnf (rhoZ m))] exact D_c_nonfixed_odd hm _ h1 h2 (clsList h ((c + 1 : β) : β€) l) (hlc c hc') (fun v hv => by simpa using (List.mem_filter.1 hv).2) (y c) (Ξ½ c) (hy c hc') (hΞ½ c hc') rw [E0, Eh, Finset.prod_congr rfl Ec] ring end RhoLine