Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.ProductPolynomialReduction

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

Direct imports

Imported by project modules

4 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

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

81 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.PolynomialReduction7import Mathlib.Algebra.BigOperators.Fin89/-! # Actual word shortening on products of free groups1011A canonical concatenation of coordinate words supplies a finite word12presentation. Prefix/suffix cuts therefore reduce the total product degree;13no commutation assumption between letters within a factor is used.14-/15noncomputable section16set_option backward.isDefEq.respectTransparency false17set_option linter.unusedSectionVars false1819namespace Nonadditivity.ProductPolynomialReduction20open scoped BigOperators Matrix Matrix.Norms.L2Operator Kronecker21open PolynomialReduction2223variable {α : Type} [DecidableEq α] {n : ℕ}24abbrev GroupWord (α : Type) (n : ℕ) := Fin n → FreeGroup α2526def degree (w : GroupWord α n) : ℕ := ∑ j, FreeGroup.norm (w j)2728@[simp] theorem degree_one : degree (1 : GroupWord α n) = 0 := by simp [degree]29@[simp] theorem degree_inv (w : GroupWord α n) : degree w⁻¹ = degree w := by simp [degree]3031theorem degree_mul_le (v w : GroupWord α n) : degree (v*w) ≤ degree v + degree w := by32  simpa [degree, Finset.sum_add_distrib] using33    Finset.sum_le_sum (fun j (_ : j ∈ (Finset.univ : Finset (Fin n))) =>34      FreeGroup.norm_mul_le (v j) (w j))3536def generator (x : Fin n × α) : GroupWord α n :=37  fun j => if j=x.1 then FreeGroup.of x.2 else 13839@[simp] theorem degree_generator (x : Fin n × α) : degree (generator x) = 1 := by40  simp [degree, generator, apply_ite FreeGroup.norm]4142def evaluate : FreeGroup (Fin n × α) →* GroupWord α n := FreeGroup.lift generator4344theorem degree_evaluate_le (v : FreeGroup (Fin n × α)) :45    degree (evaluate v) ≤ FreeGroup.norm v := by46  have hlist : ∀ l : List ((Fin n × α) × Bool), degree (evaluate (FreeGroup.mk l)) ≤ l.length := by47    intro l48    induction l with49    | nil => simp [evaluate]50    | cons x l ih =>51      rw [evaluate, FreeGroup.lift_mk] at ih ⊢52      simp only [List.map_cons, List.prod_cons, List.length_cons]53      have hx : degree (cond x.2 (generator x.1) (generator x.1)⁻¹) = 1 := by54        cases x.2 <;> simp55      exact (degree_mul_le _ _).trans (by omega)56  simpa only [FreeGroup.mk_toWord] using hlist v.toWord5758/-- A coordinate word mapped into the free group on all labeled generators. -/59def localWord (j : Fin n) (v : FreeGroup α) : FreeGroup (Fin n × α) :=60  FreeGroup.map (fun a => (j,a)) v6162theorem norm_localWord_le (j : Fin n) (v : FreeGroup α) :63    FreeGroup.norm (localWord j v) ≤ FreeGroup.norm v := by64  calc65    FreeGroup.norm (localWord j v) =66      FreeGroup.norm (FreeGroup.mk (v.toWord.map (fun x => ((j,x.1),x.2)))) := by67        rw [← FreeGroup.map.mk, FreeGroup.mk_toWord]68        rfl69    _ ≤ (v.toWord.map (fun x => ((j,x.1),x.2))).length := FreeGroup.norm_mk_le70    _ = FreeGroup.norm v := by simp [FreeGroup.norm]7172theorem evaluate_localWord (j : Fin n) (v : FreeGroup α) (k : Fin n) :73    evaluate (localWord j v) k = if k=j then v else 1 := by74  have heq : (Pi.evalMonoidHom (fun _ : Fin n => FreeGroup α) k).comp75      (evaluate.comp (FreeGroup.map (fun a : α => (j,a)))) =76      (if k=j then MonoidHom.id (FreeGroup α) else 1) := by77    apply FreeGroup.ext_hom78    intro a79    by_cases h : k=j <;> simp [evaluate, generator, h]80  by_cases h : k=j <;>81    simpa [localWord, h] using congrArg (fun f : FreeGroup α →* FreeGroup α => f v) heq8283/-- Canonical ordered concatenation, preserving the sum of coordinate lengths. -/84def flatten (w : GroupWord α n) : FreeGroup (Fin n × α) :=85  ((List.finRange n).map (fun j => localWord j (w j))).prod8687theorem evaluate_flatten (w : GroupWord α n) : evaluate (flatten w) = w := by88  funext k89  change ((Pi.evalMonoidHom (fun _ : Fin n => FreeGroup α) k).comp evaluate) (flatten w) = w k90  simp only [flatten, map_list_prod, List.map_map, Function.comp_def]91  have heq : ∀ j : Fin n,92      ((Pi.evalMonoidHom (fun _ : Fin n => FreeGroup α) k).comp evaluate) (localWord j (w j)) =93        if k=j then w j else 1 := fun j => evaluate_localWord j (w j) k94  simp only [heq]95  rw [List.prod_map_eq_pow_single k]96  · simp97  · intro j hj hmem98    simp [Ne.symm hj]99100theorem norm_flatten_le (w : GroupWord α n) : FreeGroup.norm (flatten w) ≤ degree w := by101  have hlist : ∀ l : List (Fin n),102      FreeGroup.norm ((l.map (fun j => localWord j (w j))).prod) ≤103        (l.map (fun j => FreeGroup.norm (w j))).sum := by104    intro l105    induction l with106    | nil => simp107    | cons j l ih =>108      simp only [List.map_cons, List.prod_cons, List.sum_cons]109      exact (FreeGroup.norm_mul_le _ _).trans (Nat.add_le_add (norm_localWord_le j (w j)) ih)110  simpa only [flatten, degree, Fin.sum_univ_def] using hlist (List.finRange n)111112def firstPart (r : ℕ) (w : GroupWord α n) : GroupWord α n :=113  evaluate (firstHalf r (flatten w))114def secondPart (r : ℕ) (w : GroupWord α n) : GroupWord α n :=115  evaluate (suffix r (flatten w))116117theorem parts_mul (r : ℕ) (w : GroupWord α n) : firstPart r w * secondPart r w = w := by118  rw [firstPart, secondPart, ← map_mul, firstHalf_mul_suffix, evaluate_flatten]119120theorem degree_firstPart_le (r : ℕ) (w : GroupWord α n) : degree (firstPart r w) ≤ r :=121  (degree_evaluate_le _).trans (norm_firstHalf_le _ _)122123theorem degree_secondPart_le (r : ℕ) (w : GroupWord α n) (hw : degree w ≤ 2*r) :124    degree (secondPart r w) ≤ r :=125  (degree_evaluate_le _).trans (norm_suffix_le _ _ ((norm_flatten_le w).trans hw))126127/-- Deterministic support obtained from the two halves of every canonical word. -/128def splitSupport (T : Finset (GroupWord α n)) (r : ℕ) : Finset (GroupWord α n) :=129  insert 1 ((T.image fun w => (firstPart r w)⁻¹) ∪ T.image (secondPart r))130131@[simp] theorem one_mem_splitSupport (T : Finset (GroupWord α n)) (r : ℕ) :132    (1 : GroupWord α n) ∈ splitSupport T r := by simp [splitSupport]133134theorem subset_difference_splitSupport (T : Finset (GroupWord α n)) (r : ℕ) :135    T ⊆ Linearization.differenceSupport (splitSupport T r) := by136  intro w hw137  apply Linearization.mem_differenceSupport.mpr138  refine ⟨(firstPart r w)⁻¹, ?_, secondPart r w, ?_, ?_⟩139  · simp [splitSupport, Finset.mem_image_of_mem _ hw]140  · simp [splitSupport, Finset.mem_image_of_mem _ hw]141  · simpa using parts_mul r w142143theorem splitSupport_degree (T : Finset (GroupWord α n)) (r : ℕ)144    (hT : ∀ w ∈ T, degree w ≤ 2*r) :145    ∀ w ∈ splitSupport T r, degree w ≤ r := by146  intro w hw147  simp only [splitSupport, Finset.mem_insert, Finset.mem_union, Finset.mem_image] at hw148  rcases hw with rfl | (⟨v,hv,rfl⟩ | ⟨v,hv,rfl⟩)149  · simp150  · simpa only [degree_inv] using degree_firstPart_le r v151  · exact degree_secondPart_le r v (hT v hv)152153theorem splitSupport_card (T : Finset (GroupWord α n)) (r : ℕ) :154    (splitSupport T r).card ≤ 1 + 2*T.card := by155  calc156    (splitSupport T r).card ≤157        (((T.image fun w => (firstPart r w)⁻¹) ∪ T.image (secondPart r))).card + 1 :=158      Finset.card_insert_le _ _159    _ ≤ (T.image fun w => (firstPart r w)⁻¹).card + (T.image (secondPart r)).card + 1 :=160      Nat.add_le_add_right (Finset.card_union_le _ _) 1161    _ ≤ T.card + T.card + 1 := Nat.add_le_add_right162      (Nat.add_le_add Finset.card_image_le Finset.card_image_le) 1163    _ = 1 + 2*T.card := by omega164165/-- Degree one is genuine linear support in the individual tensor-factor generators. -/166theorem degree_le_one_letters (w : GroupWord α n) (hw : degree w ≤ 1) :167    w = 1 ∨ ∃ x : Fin n × α, w = generator x ∨ w = (generator x)⁻¹ := by168  have hlen : (flatten w).toWord.length ≤ 1 := (norm_flatten_le w).trans hw169  have heval : evaluate (FreeGroup.mk (flatten w).toWord) = w := by170    rw [FreeGroup.mk_toWord, evaluate_flatten]171  cases hl : (flatten w).toWord with172  | nil =>173    left174    simpa [hl] using heval.symm175  | cons x l =>176    cases l with177    | nil =>178      right179      refine ⟨x.1, ?_⟩180      rw [hl] at heval181      cases hx : x.2 with182      | false =>183        right184        simpa [evaluate, FreeGroup.lift_mk, hx] using heval.symm185      | true =>186        left187        simpa [evaluate, FreeGroup.lift_mk, hx] using heval.symm188    | cons y l => simp [hl] at hlen189190def halve (P : Polynomial (GroupWord α n)) (r : ℕ) : Polynomial (GroupWord α n) :=191  P.step (splitSupport P.support r) (one_mem_splitSupport _ _)192193theorem halve_degree (P : Polynomial (GroupWord α n)) (r : ℕ)194    (hP : ∀ w ∈ P.support, degree w ≤ 2*r) :195    ∀ w ∈ (halve P r).support, degree w ≤ r :=196  splitSupport_degree P.support r hP197198/-- Repeat the actual square-root factorization, ending with words of length one. -/199def reduce (P : Polynomial (GroupWord α n)) : ℕ → Polynomial (GroupWord α n)200  | 0 => P201  | k+1 => reduce (halve P (2^k)) k202203/-- Exact enlargement multiplier of the recursively constructed coefficient space. -/204def dimensionCost (P : Polynomial (GroupWord α n)) : ℕ → ℕ205  | 0 => 1206  | k+1 => 2 * (splitSupport P.support (2^k)).card * dimensionCost (halve P (2^k)) k207208/-- Actual product of the backward-error factors `6 |S|`. -/209def errorCost (P : Polynomial (GroupWord α n)) : ℕ → ℕ210  | 0 => 1211  | k+1 => 6 * (splitSupport P.support (2^k)).card * errorCost (halve P (2^k)) k212213theorem dimensionCost_pos (P : Polynomial (GroupWord α n)) (k : ℕ) :214    0 < dimensionCost P k := by215  induction k generalizing P with216  | zero => simp [dimensionCost]217  | succ k ih =>218    have hB := Finset.card_pos.mpr (show (splitSupport P.support (2^k)).Nonempty from219      ⟨1, one_mem_splitSupport _ _⟩)220    exact Nat.mul_pos (Nat.mul_pos (by omega) hB) (ih _)221222theorem errorCost_eq (P : Polynomial (GroupWord α n)) (k : ℕ) :223    errorCost P k = 3^k * dimensionCost P k := by224  induction k generalizing P with225  | zero => simp [errorCost, dimensionCost]226  | succ k ih => simp only [errorCost, dimensionCost, ih, pow_succ]; ring227228theorem errorCost_pos (P : Polynomial (GroupWord α n)) (k : ℕ) : 0 < errorCost P k := by229  rw [errorCost_eq]230  exact Nat.mul_pos (by positivity) (dimensionCost_pos P k)231232theorem reduce_dimension (P : Polynomial (GroupWord α n)) (k : ℕ) :233    Fintype.card (reduce P k).Index = Fintype.card P.Index * dimensionCost P k := by234  induction k generalizing P with235  | zero => simp [reduce, dimensionCost]236  | succ k ih =>237    rw [reduce, ih]238    change Fintype.card (P.step _ _).Index * _ = _239    rw [Polynomial.step_dimension]240    simp only [dimensionCost]241    ring242243theorem reduce_degree (P : Polynomial (GroupWord α n)) (k : ℕ)244    (hP : ∀ w ∈ P.support, degree w ≤ 2^k) :245    ∀ w ∈ (reduce P k).support, degree w ≤ 1 := by246  induction k generalizing P with247  | zero => simpa only [reduce, pow_zero] using hP248  | succ k ih =>249    apply ih (halve P (2^k))250    apply halve_degree251    simpa only [pow_succ, Nat.mul_comm] using hP252253/-- Every error-transfer hypothesis is discharged by the constructed factors.254Only the comparison for the final linear polynomial is supplied. -/255theorem reduce_error_transfer (P : Polynomial (GroupWord α n)) (k : ℕ)256    {ν : Type*} [Fintype ν] [DecidableEq ν] [Nonempty ν]257    (π : GroupWord α n →* unitary (Matrix ν ν ℂ))258    (ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1)259    (hfinal : ‖(reduce P k).finiteEval π‖ ≤260      (1+ε/(errorCost P k:ℝ))*‖(reduce P k).regularEval‖) :261    ‖P.finiteEval π‖ ≤ (1+ε)*‖P.regularEval‖ := by262  induction k generalizing P ε with263  | zero => simpa only [reduce, errorCost, Nat.cast_one, div_one] using hfinal264  | succ k ih =>265    let B := (splitSupport P.support (2^k)).card266    have hB : 1 ≤ B := Finset.one_le_card.mpr ⟨1, one_mem_splitSupport _ _⟩267    have hBreal : (1:ℝ) ≤ B := by exact_mod_cast hB268    have h6B : (0:ℝ) < 6*(B:ℝ) := by positivity269    have hδ0 : 0 ≤ ε/(6*(B:ℝ)) := div_nonneg hε h6B.le270    have hδ1 : ε/(6*(B:ℝ)) ≤ 1 := by271      apply (div_le_iff₀ h6B).mpr272      nlinarith273    have hnorm := ih (halve P (2^k)) (ε/(6*(B:ℝ))) hδ0 hδ1 (by274      simpa only [reduce, errorCost, Nat.cast_mul, Nat.cast_ofNat, div_div,275        mul_assoc, B] using hfinal)276    have hstep := Polynomial.step_error_transfer P (splitSupport P.support (2^k))277      (one_mem_splitSupport _ _) (subset_difference_splitSupport _ _) π278      (ε/(6*(B:ℝ))) hδ0 hδ1 hnorm279    have heq : 6*(B:ℝ)*(ε/(6*(B:ℝ))) = ε := mul_div_cancel₀ ε h6B.ne'280    change ‖P.finiteEval π‖ ≤ (1 + 6*(B:ℝ)*(ε/(6*(B:ℝ)))) * ‖P.regularEval‖ at hstep281    simpa only [heq] using hstep282283/-- Complete deterministic reduction of a degree `2^k` polynomial to a linear one.284The output coefficients, exact dimension cost, and comparison transfer are285constructed, without any assumed family of intermediate polynomials. -/286theorem constructed_linear_reduction (P : Polynomial (GroupWord α n)) (k : ℕ)287    (hP : ∀ w ∈ P.support, degree w ≤ 2^k) :288    ∃ Q : Polynomial (GroupWord α n),289      (∀ w ∈ Q.support, degree w ≤ 1) ∧290      Fintype.card Q.Index = Fintype.card P.Index * dimensionCost P k ∧291      errorCost P k = 3^k * dimensionCost P k ∧292      ∀ {ν : Type} [Fintype ν] [DecidableEq ν] [Nonempty ν]293        (π : GroupWord α n →* unitary (Matrix ν ν ℂ)) (ε : ℝ),294        0 ≤ ε → ε ≤ 1 →295        ‖Q.finiteEval π‖ ≤ (1+ε/(errorCost P k:ℝ))*‖Q.regularEval‖ →296        ‖P.finiteEval π‖ ≤ (1+ε)*‖P.regularEval‖ := by297  refine ⟨reduce P k, reduce_degree P k hP, reduce_dimension P k,298    errorCost_eq P k, ?_⟩299  intro ν _ _ _ π ε hε hε1 hfinal300  exact reduce_error_transfer P k π ε hε hε1 hfinal301302/-- Safe closed-form bound on the actual coefficient enlargement. This deliberately303uses the constructed support cardinalities, not the sharper manuscript counts. -/304theorem dimensionCost_le (P : Polynomial (GroupWord α n)) (k : ℕ) :305    dimensionCost P k ≤ (2 * 3^k * max 1 P.support.card)^k := by306  induction k generalizing P with307  | zero => simp [dimensionCost]308  | succ k ih =>309    let M := max 1 P.support.card310    let B := (splitSupport P.support (2^k)).card311    have hM : 1 ≤ M := le_max_left _ _312    have hT : P.support.card ≤ M := le_max_right _ _313    have hB : B ≤ 3*M := by314      have hc := splitSupport_card P.support (2^k)315      dsimp [B]316      omega317    have hmax : max 1 (halve P (2^k)).support.card ≤ 3*M := by318      change max 1 B ≤ 3*M319      exact max_le (by omega) hB320    have hp : 1 ≤ 3^k := Nat.one_le_pow k 3 (by omega)321    have hbase : 2*B ≤ 2*3^(k+1)*M := by322      rw [pow_succ]323      nlinarith324    calc325      dimensionCost P (k+1) = 2*B*dimensionCost (halve P (2^k)) k := rfl326      _ ≤ 2*B*(2*3^k*max 1 (halve P (2^k)).support.card)^k :=327        Nat.mul_le_mul_left _ (ih _)328      _ ≤ 2*B*(2*3^(k+1)*M)^k := by329        apply Nat.mul_le_mul_left330        apply Nat.pow_le_pow_left331        calc332          2*3^k*max 1 (halve P (2^k)).support.card ≤ 2*3^k*(3*M) :=333            Nat.mul_le_mul_left _ hmax334          _ = _ := by rw [pow_succ]; ring335      _ ≤ (2*3^(k+1)*M)*(2*3^(k+1)*M)^k := Nat.mul_le_mul_right _ hbase336      _ = (2*3^(k+1)*M)^(k+1) := by rw [pow_succ]; ring337338theorem errorCost_le (P : Polynomial (GroupWord α n)) (k : ℕ) :339    errorCost P k ≤ (6 * 3^k * max 1 P.support.card)^k := by340  rw [errorCost_eq]341  calc342    3^k * dimensionCost P k ≤ 3^k * (2*3^k*max 1 P.support.card)^k :=343      Nat.mul_le_mul_left _ (dimensionCost_le P k)344    _ = _ := by rw [← mul_pow]; congr 1; ring345346end Nonadditivity.ProductPolynomialReduction