Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.WordBallReduction

Download original .lean · View on GitHub · Jump to source

Direct imports

Imported by project modules

2 direct reverse imports

Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.

Declarations in this module

106 project constants, including generated, internal and private declarations.

106 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.ProductPolynomialReduction7import Mathlib.Algebra.Order.Floor.Div8import Mathlib.Data.Nat.Log910/-! Actual balls of reduced words in one tensor factor and their Gram reductions. -/11noncomputable section12set_option backward.isDefEq.respectTransparency false13set_option linter.unusedSectionVars false14set_option maxHeartbeats 120000015namespace Nonadditivity.WordBallReduction16open scoped BigOperators Matrix Matrix.Norms.L2Operator17open PolynomialReduction18open Linearization1920abbrev F₂ := FreeGroup (Fin 2)21abbrev G (n : ℕ) := Fin n → F₂2223def letter (a : Letter) : Fin 2 × Bool := ![(0,true),(1,true),(1,false),(0,false)] a2425def code (a : Fin 2 × Bool) : Letter :=26  if a.1=0 then (if a.2 then 0 else 3) else (if a.2 then 1 else 2)2728@[simp] theorem letter_code (a : Fin 2 × Bool) : letter (code a) = a := by29  rcases a with ⟨a,b⟩30  fin_cases a <;> cases b <;> decide3132@[simp] theorem code_letter (a : Letter) : code (letter a) = a := by fin_cases a <;> decide3334theorem legal_iff (a b : Letter) :35    b ≠ inverseLetter a ↔ ((letter a).1 = (letter b).1 → (letter a).2 = (letter b).2) := by36  fin_cases a <;> fin_cases b <;> decide3738def tailLetters (a : Letter) : (t : ℕ) → ReducedTail a t → List (Fin 2 × Bool)39  | 0, _ => []40  | t+1, ⟨b,w⟩ => letter b.val :: tailLetters b.val t w4142theorem length_tailLetters (a : Letter) (t : ℕ) (w : ReducedTail a t) :43    (tailLetters a t w).length = t := by44  induction t generalizing a with45  | zero => rfl46  | succ t ih => rcases w with ⟨b,w⟩; simp [tailLetters, ih]4748def wordLetters {t : ℕ} (w : ReducedWord t) : List (Fin 2 × Bool) :=49  letter w.1 :: tailLetters w.1 t w.25051@[simp] theorem length_wordLetters {t : ℕ} (w : ReducedWord t) :52    (wordLetters w).length = t+1 := by simp [wordLetters, length_tailLetters]5354theorem exists_tail (l : List (Fin 2 × Bool)) (a : Letter)55    (hl : FreeGroup.IsReduced (letter a :: l)) :56    ∃ w : ReducedTail a l.length, tailLetters a l.length w = l := by57  induction l generalizing a with58  | nil => exact ⟨(),rfl⟩59  | cons b l ih =>60    have hb := (FreeGroup.isReduced_cons_cons.mp hl).161    have hr := (FreeGroup.isReduced_cons_cons.mp hl).262    have hlegal : code b ≠ inverseLetter a := (legal_iff a (code b)).mpr (by simpa using hb)63    obtain ⟨w,hw⟩ := ih (code b) (by simpa using hr)64    exact ⟨⟨⟨code b,hlegal⟩,w⟩, by simp [tailLetters, hw]⟩6566theorem exists_word (l : List (Fin 2 × Bool)) (hl : FreeGroup.IsReduced l)67    (hlen : l.length = t+1) : ∃ w : ReducedWord t, wordLetters w = l := by68  cases l with69  | nil => simp at hlen70  | cons a l =>71    have heq : l.length = t := by simpa using hlen72    subst t73    obtain ⟨w,hw⟩ := exists_tail l (code a) (by simpa using hl)74    exact ⟨⟨code a,w⟩,by simp [wordLetters,hw]⟩7576abbrev WordIndex (r : ℕ) := Σ t : Fin r, ReducedWord t.val7778def wordValue {r : ℕ} (w : WordIndex r) : F₂ := FreeGroup.mk (wordLetters w.2)7980theorem wordValue_norm_le {r : ℕ} (w : WordIndex r) : FreeGroup.norm (wordValue w) ≤ r := by81  exact FreeGroup.norm_mk_le.trans (by simp)8283def single {n : ℕ} (j : Fin n) (v : F₂) : G n := fun k => if k=j then v else 18485@[simp] theorem single_one {n : ℕ} (j : Fin n) : single j 1 = 1 := by ext k; simp [single]86@[simp] theorem single_inv {n : ℕ} (j : Fin n) (v : F₂) : single j v⁻¹ = (single j v)⁻¹ := by87  ext k; by_cases h:k=j <;> simp [single,h]88@[simp] theorem single_mul {n : ℕ} (j : Fin n) (v w : F₂) :89    single j (v*w) = single j v * single j w := by90  ext k; by_cases h:k=j <;> simp [single,h]9192def wordBall (n r : ℕ) : Finset (G n) :=93  insert 1 (Finset.univ.image (fun x : Fin n × WordIndex r => single x.1 (wordValue x.2)))9495@[simp] theorem one_mem_wordBall (n r : ℕ) : (1:G n) ∈ wordBall n r := by simp [wordBall]9697def SingleFactorBound {n : ℕ} (r : ℕ) (w : G n) : Prop :=98  ∃ j : Fin n, ∃ v : F₂, FreeGroup.norm v ≤ r ∧ w = single j v99100theorem mem_wordBall_of_bound {n r : ℕ} {w : G n} (hw : SingleFactorBound r w) :101    w ∈ wordBall n r := by102  rcases hw with ⟨j,v,hv,rfl⟩103  by_cases h:v=1104  · simp [h]105  · have hpos : 0 < v.toWord.length := by106      by_contra hh107      have he : v.toWord=[] := List.length_eq_zero_iff.mp (by omega)108      exact h (FreeGroup.toWord_eq_nil_iff.mp he)109    obtain ⟨u,hu⟩ := exists_word v.toWord FreeGroup.isReduced_toWord110      (show v.toWord.length = (v.toWord.length-1)+1 by omega)111    have ht : v.toWord.length-1 < r := by change v.toWord.length ≤ r at hv; omega112    have he : wordValue (⟨⟨v.toWord.length-1,ht⟩,u⟩ : WordIndex r) = v := by113      simp [wordValue,hu,FreeGroup.mk_toWord]114    apply Finset.mem_insert_of_mem115    apply Finset.mem_image.mpr116    exact ⟨⟨j,⟨⟨_,ht⟩,u⟩⟩,Finset.mem_univ _,by simp only [he]⟩117118theorem bound_of_mem_wordBall {n r : ℕ} (hn : 1≤n) {w : G n} (hw : w ∈ wordBall n r) :119    SingleFactorBound r w := by120  simp only [wordBall,Finset.mem_insert,Finset.mem_image] at hw121  rcases hw with rfl | ⟨⟨j,u⟩,_,rfl⟩122  · exact ⟨⟨0,by omega⟩,1,by simp,by simp⟩123  · exact ⟨j,wordValue u,wordValue_norm_le u,rfl⟩124125theorem card_wordBall_le (n r : ℕ) (hn : 1≤n) : (wordBall n r).card ≤ 2*n*3^r := by126  have hcard : Fintype.card (WordIndex r) = ∑ t ∈ Finset.range r,4*3^t := by127    rw [Fintype.card_sigma]128    simp only [card_reducedWord]129    exact Fin.sum_univ_eq_sum_range (fun t => 4*3^t) r130  calc131    (wordBall n r).card ≤ (Finset.univ.image132        (fun x : Fin n × WordIndex r => single x.1 (wordValue x.2))).card + 1 :=133      Finset.card_insert_le _ _134    _ ≤ Fintype.card (Fin n × WordIndex r) + 1 := Nat.add_le_add_right135      (Finset.card_image_le.trans (by simp)) 1136    _ = 1+n*(∑ t ∈ Finset.range r,4*3^t) := by simp [hcard]; omega137    _ ≤ 2*n*3^r := short_word_count_bound n r hn138139theorem bound_split {n r : ℕ} {w : G n} (hw : SingleFactorBound (2*r) w) :140    w ∈ Linearization.differenceSupport (wordBall n r) := by141  rcases hw with ⟨j,v,hv,rfl⟩142  apply Linearization.mem_differenceSupport.mpr143  refine ⟨single j (firstHalf r v)⁻¹,?_,single j (suffix r v),?_,?_⟩144  · apply mem_wordBall_of_bound145    exact ⟨j,(firstHalf r v)⁻¹,by simpa using norm_firstHalf_le r v,rfl⟩146  · exact mem_wordBall_of_bound ⟨j,suffix r v,norm_suffix_le r v hv,rfl⟩147  · simp only [single_inv,inv_inv,←single_mul,firstHalf_mul_suffix]148149/-- The manuscript's ceiling of the word length divided by a power of two. -/150def radius (ell i : ℕ) : ℕ := ell ⌈/⌉ (2^i)151152@[simp] theorem radius_zero (ell : ℕ) : radius ell 0 = ell := by simp [radius]153154theorem radius_halve (ell i : ℕ) : radius ell i ≤ 2 * radius ell (i+1) := by155  unfold radius156  apply (ceilDiv_le_iff_le_mul (show 0 < (2:ℕ)^i by positivity)).mpr157  have h := le_smul_ceilDiv (b := ell) (show 0 < (2:ℕ)^(i+1) by positivity)158  simpa [smul_eq_mul,pow_succ,mul_assoc] using h159160theorem radius_le_one (ell i : ℕ) (h : ell ≤ 2^i) : radius ell i ≤ 1 := by161  exact (ceilDiv_le_iff_le_mul (show 0 < (2:ℕ)^i by positivity)).mpr (by simpa using h)162163theorem SingleFactorBound.mono {n r s : ℕ} {w : G n}164    (hw : SingleFactorBound r w) (hrs : r≤s) : SingleFactorBound s w := by165  rcases hw with ⟨j,v,hv,heq⟩166  exact ⟨j,v,hv.trans hrs,heq⟩167168/-- Every shortening step uses the entire actual one-factor reduced-word ball. -/169def stage {n : ℕ} (P : Polynomial (G n)) (ell : ℕ) : ℕ → Polynomial (G n)170  | 0 => P171  | i+1 => (stage P ell i).step (wordBall n (radius ell (i+1))) (one_mem_wordBall _ _)172173def dimensionCost (n ell : ℕ) : ℕ → ℕ174  | 0 => 1175  | i+1 => dimensionCost n ell i * (2 * (wordBall n (radius ell (i+1))).card)176177def errorCost (n ell : ℕ) : ℕ → ℕ178  | 0 => 1179  | i+1 => errorCost n ell i * (6 * (wordBall n (radius ell (i+1))).card)180181theorem dimensionCost_pos (n ell i : ℕ) : 0 < dimensionCost n ell i := by182  induction i with183  | zero => simp [dimensionCost]184  | succ i ih =>185    exact Nat.mul_pos ih (Nat.mul_pos (by omega)186      (Finset.card_pos.mpr ⟨1,one_mem_wordBall _ _⟩))187188theorem errorCost_eq (n ell i : ℕ) : errorCost n ell i = 3^i * dimensionCost n ell i := by189  induction i with190  | zero => simp [errorCost,dimensionCost]191  | succ i ih => simp only [errorCost,dimensionCost,ih,pow_succ]; ring192193theorem errorCost_pos (n ell i : ℕ) : 0 < errorCost n ell i := by194  rw [errorCost_eq]195  exact Nat.mul_pos (by positivity) (dimensionCost_pos n ell i)196197theorem dimensionCost_product (n ell i : ℕ) : dimensionCost n ell i =198    ∏ j ∈ Finset.range i, 2 * (wordBall n (radius ell (j+1))).card := by199  induction i with200  | zero => simp [dimensionCost]201  | succ i ih => simp [dimensionCost,Finset.prod_range_succ,ih]202203theorem errorCost_product (n ell i : ℕ) : errorCost n ell i =204    ∏ j ∈ Finset.range i, 6 * (wordBall n (radius ell (j+1))).card := by205  induction i with206  | zero => simp [errorCost]207  | succ i ih => simp [errorCost,Finset.prod_range_succ,ih]208209theorem dimensionCost_le (n ell i : ℕ) (hn : 1≤n) : dimensionCost n ell i ≤210    ∏ j ∈ Finset.range i, 4*n*3^(radius ell (j+1)) := by211  rw [dimensionCost_product]212  apply Finset.prod_le_prod'213  intro j _214  have h := Nat.mul_le_mul_left 2 (card_wordBall_le n (radius ell (j+1)) hn)215  nlinarith216217theorem errorCost_le (n ell i : ℕ) (hn : 1≤n) : errorCost n ell i ≤218    ∏ j ∈ Finset.range i, 12*n*3^(radius ell (j+1)) := by219  rw [errorCost_product]220  apply Finset.prod_le_prod'221  intro j _222  have h := Nat.mul_le_mul_left 6 (card_wordBall_le n (radius ell (j+1)) hn)223  nlinarith224225theorem stage_dimension {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) :226    Fintype.card (stage P ell i).Index = Fintype.card P.Index * dimensionCost n ell i := by227  induction i with228  | zero => simp [stage,dimensionCost]229  | succ i ih =>230    rw [stage,Polynomial.step_dimension,ih]231    simp only [dimensionCost]232    ring233234theorem stage_bound {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)235    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) :236    ∀ w ∈ (stage P ell i).support, SingleFactorBound (radius ell i) w := by237  cases i with238  | zero => simpa only [stage,radius_zero] using hP239  | succ i => exact fun w hw => bound_of_mem_wordBall hn hw240241theorem stage_cover {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)242    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) :243    (stage P ell i).support ⊆ Linearization.differenceSupport (wordBall n (radius ell (i+1))) := by244  intro w hw245  exact bound_split ((stage_bound P ell i hn hP w hw).mono (radius_halve ell i))246247theorem stage_finite_norm_sq {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)248    (hP : ∀ w ∈ P.support, SingleFactorBound ell w)249    {ν : Type*} [Fintype ν] [DecidableEq ν] [Nonempty ν]250    (π : G n →* unitary (Matrix ν ν ℂ)) :251    ‖(stage P ell (i+1)).finiteEval π‖^2 = ‖(stage P ell i).finiteEval π‖ +252      (stage P ell i).correction (wordBall n (radius ell (i+1))) :=253  Polynomial.step_finite_norm_sq _ _ _ (stage_cover P ell i hn hP) π254255theorem stage_regular_norm_sq {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)256    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) :257    ‖(stage P ell (i+1)).regularEval‖^2 = ‖(stage P ell i).regularEval‖ +258      (stage P ell i).correction (wordBall n (radius ell (i+1))) :=259  Polynomial.step_regular_norm_sq _ _ _ (stage_cover P ell i hn hP)260261theorem stage_correction_le {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)262    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) :263    (stage P ell i).correction (wordBall n (radius ell (i+1))) ≤264      ((wordBall n (radius ell (i+1))).card : ℝ) * ‖(stage P ell i).regularEval‖ :=265  Polynomial.correction_le _ _ (one_mem_wordBall _ _) (stage_cover P ell i hn hP)266267theorem stage_error_transfer {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)268    (hP : ∀ w ∈ P.support, SingleFactorBound ell w)269    {ν : Type*} [Fintype ν] [DecidableEq ν] [Nonempty ν]270    (π : G n →* unitary (Matrix ν ν ℂ)) (ε : ℝ) (hε : 0≤ε) (hε1 : ε≤1)271    (hfinal : ‖(stage P ell i).finiteEval π‖ ≤272      (1+ε/(errorCost n ell i:ℝ))*‖(stage P ell i).regularEval‖) :273    ‖P.finiteEval π‖ ≤ (1+ε)*‖P.regularEval‖ := by274  induction i with275  | zero => simpa only [stage,errorCost,Nat.cast_one,div_one] using hfinal276  | succ i ih =>277    let B := (wordBall n (radius ell (i+1))).card278    have hB : 0 < B := Finset.card_pos.mpr ⟨1,one_mem_wordBall _ _⟩279    have hE : 0 < errorCost n ell (i+1) := errorCost_pos n ell (i+1)280    have hEreal : (1:ℝ) ≤ errorCost n ell (i+1) := by exact_mod_cast hE281    have hδ0 : 0 ≤ ε/(errorCost n ell (i+1):ℝ) := div_nonneg hε (by positivity)282    have hδ1 : ε/(errorCost n ell (i+1):ℝ) ≤ 1 :=283      (div_le_iff₀ (by positivity)).mpr (by linarith)284    have hstep := Polynomial.step_error_transfer (stage P ell i)285      (wordBall n (radius ell (i+1))) (one_mem_wordBall _ _)286      (stage_cover P ell i hn hP) π (ε/(errorCost n ell (i+1):ℝ)) hδ0 hδ1 hfinal287    apply ih288    have hBreal : (B:ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hB)289    have heq : 6*(B:ℝ)*(ε/(errorCost n ell (i+1):ℝ)) = ε/(errorCost n ell i:ℝ) := by290      simp only [errorCost,Nat.cast_mul,Nat.cast_ofNat]291      change 6*(B:ℝ)*(ε/((errorCost n ell i:ℝ)*(6*(B:ℝ)))) = _292      field_simp293    simpa only [heq,B] using hstep294295theorem degree_single {n : ℕ} (j : Fin n) (v : F₂) :296    ProductPolynomialReduction.degree (single j v) = FreeGroup.norm v := by297  simp [ProductPolynomialReduction.degree,single,apply_ite FreeGroup.norm]298299theorem final_linear {n : ℕ} (P : Polynomial (G n)) (ell i : ℕ) (hn : 1≤n)300    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) (hell : ell ≤ 2^i) :301    ∀ w ∈ (stage P ell i).support, w=1 ∨ ∃ x : Fin n × Fin 2,302      w=ProductPolynomialReduction.generator x ∨ w=(ProductPolynomialReduction.generator x)⁻¹ := by303  intro w hw304  apply ProductPolynomialReduction.degree_le_one_letters305  rcases stage_bound P ell i hn hP w hw with ⟨j,v,hv,rfl⟩306  rw [degree_single]307  exact hv.trans (radius_le_one ell i hell)308309/-- The number of word-shortening steps specified in the manuscript suffices. -/310theorem stage_clog_linear {n : ℕ} (P : Polynomial (G n)) (ell : ℕ) (hn : 1≤n)311    (hP : ∀ w ∈ P.support, SingleFactorBound ell w) :312    ∀ w ∈ (stage P ell (Nat.clog 2 ell)).support, w=1 ∨ ∃ x : Fin n × Fin 2,313      w=ProductPolynomialReduction.generator x ∨ w=(ProductPolynomialReduction.generator x)⁻¹ :=314  final_linear P ell _ hn hP (Nat.le_pow_clog (by omega) ell)315316end Nonadditivity.WordBallReduction