Exact Lean source
YoungRSKTableau
formalization/Cloning/YoungRSKTableau.lean
Source hash: 69047221d830bac65a77f65bb1049c57edbdc0f50551f188b26f800d6ce7be56
Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.
The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.
Declarations in this module
definition
Cloning.YoungGeneral.tableauInsertdefinition Cloning.YoungGeneral.tableauContentdefinition Cloning.YoungGeneral.rowMassdefinition Cloning.YoungGeneral.tableauShapedefinition Cloning.YoungGeneral.shapeAddtheorem Cloning.YoungGeneral.tableauContent_niltheorem Cloning.YoungGeneral.tableauContent_constheorem Cloning.YoungGeneral.tableauInsert_cons_headtheorem Cloning.YoungGeneral.tableauInsert_nonemptytheorem Cloning.YoungGeneral.tableauInsert_corner_lttheorem Cloning.YoungGeneral.tableauInsert_length_of_boundtheorem Cloning.YoungGeneral.tableauInsert_fixed_lengththeorem Cloning.YoungGeneral.pairwise_interlaces_constheorem Cloning.YoungGeneral.tableauInsert_pairwisetheorem Cloning.YoungGeneral.tableauInsert_contenttheorem Cloning.YoungGeneral.tableauInsert_shapedefinition Cloning.YoungGeneral.tableauMonomialtheorem Cloning.YoungGeneral.tableauInsert_monomial1import Cloning.YoungRSKInterlacing
2
3/-!
4# Actual RSK insertion through all rows
5
6The recursive algorithm records the row receiving the final new box. Rows
7are retained, including zero trailing rows. An alphabet-size bound prevents
8insertion from creating a row beyond a fixed list of `d` rows.
9-/
10
11noncomputable section
12open scoped BigOperators Classical
13namespace Cloning.YoungGeneral
14
15noncomputable def tableauInsert {d : ℕ} : List (RowContent d) → Fin d → List (RowContent d) × ℕ
16 | [], x => ([rowAdd 0 x], 0)
17 | U :: T, x =>
18 match rowBump U x with
19 | none => (rowInserted U x :: T, 0)
20 | some y =>
21 let out := tableauInsert T y
22 (rowInserted U x :: out.1, out.2 + 1)
23
24def tableauContent {d : ℕ} (T : List (RowContent d)) (j : Fin d) : ℕ :=
25 (T.map (fun A => A j)).sum
26
27def rowMass {d : ℕ} (A : RowContent d) : ℕ := ∑ j, A j
28
29def tableauShape {d : ℕ} (T : List (RowContent d)) : List ℕ := T.map rowMass
30
31noncomputable def shapeAdd : List ℕ → ℕ → List ℕ
32 | [], _ => [1]
33 | m :: M, 0 => (m + 1) :: M
34 | m :: M, r + 1 => m :: shapeAdd M r
35
36@[simp] theorem tableauContent_nil {d : ℕ} (j : Fin d) :
37 tableauContent ([] : List (RowContent d)) j = 0 := rfl
38
39@[simp] theorem tableauContent_cons {d : ℕ} (U : RowContent d)
40 (T : List (RowContent d)) (j : Fin d) :
41 tableauContent (U :: T) j = U j + tableauContent T j := rfl
42
43theorem tableauInsert_cons_head {d : ℕ} (U : RowContent d)
44 (T : List (RowContent d)) (x : Fin d) :
45 ∃ R, (tableauInsert (U :: T) x).1 = rowInserted U x :: R := by
46 cases h : rowBump U x <;> simp [tableauInsert, h]
47
48theorem tableauInsert_nonempty {d : ℕ} (T : List (RowContent d)) (x : Fin d) :
49 (tableauInsert T x).1 ≠ [] := by
50 cases T with
51 | nil => simp [tableauInsert]
52 | cons U T => obtain ⟨R, hR⟩ := tableauInsert_cons_head U T x; simp [hR]
53
54theorem tableauInsert_corner_lt {d : ℕ} (T : List (RowContent d)) (x : Fin d) :
55 (tableauInsert T x).2 < (tableauInsert T x).1.length := by
56 induction T generalizing x with
57 | nil => simp [tableauInsert]
58 | cons U T ih =>
59 cases h : rowBump U x with
60 | none => simp [tableauInsert, h]
61 | some y => simpa [tableauInsert, h] using ih y
62
63theorem tableauInsert_length_of_bound {d : ℕ} (T : List (RowContent d)) (x : Fin d)
64 (h : d ≤ x.val + T.length) : (tableauInsert T x).1.length = T.length := by
65 induction T generalizing x with
66 | nil => have := x.isLt; simp only [List.length_nil, Nat.add_zero] at h; omega
67 | cons U T ih =>
68 cases hb : rowBump U x with
69 | none => simp [tableauInsert, hb]
70 | some y =>
71 have hxy := ((rowBump_eq_some_iff U x y).mp hb).1
72 have hy : d ≤ y.val + T.length := by
73 simp only [List.length_cons] at h
74 have : x.val < y.val := hxy
75 omega
76 simp [tableauInsert, hb, ih y hy]
77
78theorem tableauInsert_fixed_length {d : ℕ} (T : List (RowContent d)) (x : Fin d)
79 (h : T.length = d) : (tableauInsert T x).1.length = d := by
80 rw [tableauInsert_length_of_bound T x (by omega), h]
81
82theorem pairwise_interlaces_cons {d : ℕ} {U V : RowContent d}
83 {T : List (RowContent d)} (hUV : RowInterlaces U V)
84 (hT : List.Pairwise RowInterlaces (V :: T)) :
85 List.Pairwise RowInterlaces (U :: V :: T) := by
86 rw [List.pairwise_cons]
87 refine ⟨?_, hT⟩
88 intro W hW
89 rcases List.mem_cons.mp hW with rfl | hW
90 · exact hUV
91 · exact hUV.trans ((List.pairwise_cons.mp hT).1 W hW)
92
93theorem tableauInsert_pairwise {d : ℕ} (T : List (RowContent d))
94 (hT : List.Pairwise RowInterlaces T) (x : Fin d) :
95 List.Pairwise RowInterlaces (tableauInsert T x).1 := by
96 induction T generalizing x with
97 | nil => simp [tableauInsert]
98 | cons U T ih =>
99 obtain ⟨hU, hT⟩ := List.pairwise_cons.mp hT
100 cases hb : rowBump U x with
101 | none =>
102 simp only [tableauInsert, hb]
103 exact List.pairwise_cons.mpr ⟨fun V hV => (hU V hV).insert_upper x, hT⟩
104 | some y =>
105 simp only [tableauInsert, hb]
106 cases T with
107 | nil =>
108 simp only [tableauInsert]
109 exact pairwise_interlaces_cons (RowInterlaces.insert_new_row U x y hb)
110 (List.pairwise_singleton _ _)
111 | cons V R =>
112 have hUV := hU V (List.mem_cons_self)
113 obtain ⟨S, hS⟩ := tableauInsert_cons_head V R y
114 have hp := ih hT y
115 rw [hS] at hp ⊢
116 exact pairwise_interlaces_cons (hUV.insert_bumped x y hb) hp
117
118theorem tableauInsert_content {d : ℕ} (T : List (RowContent d)) (x j : Fin d) :
119 tableauContent (tableauInsert T x).1 j =
120 tableauContent T j + if j = x then 1 else 0 := by
121 induction T generalizing x with
122 | nil => simp [tableauInsert, rowAdd_content]
123 | cons U T ih =>
124 cases hb : rowBump U x with
125 | none => simp [tableauInsert, hb, rowInserted, rowAdd_content, Nat.add_assoc,
126 Nat.add_left_comm, Nat.add_comm]
127 | some y =>
128 obtain ⟨hxy, hy, _⟩ := (rowBump_eq_some_iff U x y).mp hb
129 have he := rowReplace_content U x y j (ne_of_lt hxy) hy
130 simp only [tableauInsert, hb, tableauContent_cons, rowInserted]
131 rw [ih y]
132 omega
133
134theorem tableauInsert_shape {d : ℕ} (T : List (RowContent d)) (x : Fin d) :
135 tableauShape (tableauInsert T x).1 =
136 shapeAdd (tableauShape T) (tableauInsert T x).2 := by
137 induction T generalizing x with
138 | nil => simp [tableauInsert, tableauShape, rowMass, rowAdd_mass, shapeAdd]
139 | cons U T ih =>
140 cases hb : rowBump U x with
141 | none => simp [tableauInsert, hb, tableauShape, rowMass, rowInserted,
142 rowAdd_mass, shapeAdd]
143 | some y =>
144 obtain ⟨hxy, hy, _⟩ := (rowBump_eq_some_iff U x y).mp hb
145 have he := rowReplace_mass U x y (ne_of_lt hxy) hy
146 simp only [tableauInsert, hb, tableauShape, List.map_cons, shapeAdd,
147 rowInserted]
148 change rowMass (rowReplace U x y) :: tableauShape (tableauInsert T y).1 = _
149 rw [show rowMass (rowReplace U x y) = rowMass U from he, ih y]
150 rfl
151
152def tableauMonomial {d : ℕ} (p : Fin d → ℝ) (T : List (RowContent d)) : ℝ :=
153 ∏ j, p j ^ tableauContent T j
154
155/-- Exact insertion weight identity, valid even when some probabilities vanish. -/
156theorem tableauInsert_monomial {d : ℕ} (p : Fin d → ℝ)
157 (T : List (RowContent d)) (x : Fin d) :
158 tableauMonomial p (tableauInsert T x).1 = tableauMonomial p T * p x := by
159 simp only [tableauMonomial, tableauInsert_content, pow_add, Finset.prod_mul_distrib]
160 simp
161
162end Cloning.YoungGeneral