Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.TensorPartitionReduction

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

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

97 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.Data.Nat.Log89/-! # Constructed balanced tensor-coordinate factorization1011Residue classes modulo `2^j` form a balanced partition of the coordinates.12Each class splits into two at the next level.  The constructed supports13include both signs and have the manuscript's `1 + 2^(j+1) K^ceil(n/2^j)` bound.14-/15noncomputable section16set_option backward.isDefEq.respectTransparency false17set_option linter.unusedSectionVars false18set_option maxHeartbeats 8000001920namespace Nonadditivity.TensorPartitionReduction21open scoped BigOperators Matrix Matrix.Norms.L2Operator Kronecker22open PolynomialReduction ProductPolynomialReduction2324variable {α : Type} [DecidableEq α] {n K : ℕ} [NeZero K]2526/-- Integer ceiling of the number of coordinates per residue class. -/27def width (n j : ℕ) : ℕ := (n + 2^j - 1) / 2^j2829theorem quotient_lt_width (i : Fin n) (j : ℕ) : i.val / 2^j < width n j := by30  have hp : 0 < 2^j := by positivity31  unfold width32  have hi := Nat.mul_div_le i.val (2^j)33  apply Nat.lt_of_succ_le34  apply (Nat.le_div_iff_mul_le hp).mpr35  have hsub : n + 2^j - 1 + 1 = n + 2^j := Nat.sub_add_cancel (by omega)36  nlinarith [i.isLt]3738/-- The positive word on one part of the coordinate partition. -/39def partWord (v : Fin n → Fin K → FreeGroup α) (j : ℕ) (t : Fin (2^j))40    (a : Fin n → Fin K) : GroupWord α n :=41  fun i => if i.val % 2^j = t.val then v i (a i) else 14243/-- An equivalent coding using only `ceil(n/2^j)` local choices. -/44def codedWord (v : Fin n → Fin K → FreeGroup α) (j : ℕ)45    (c : Fin (2^j) × (Fin (width n j) → Fin K)) : GroupWord α n :=46  fun i => if i.val % 2^j = c.1.val then47    v i (c.2 ⟨i.val / 2^j, quotient_lt_width i j⟩) else 14849/-- Extract local choices from a full coordinate assignment. -/50def restrictChoices (j : ℕ) (t : Fin (2^j)) (a : Fin n → Fin K) :51    Fin (width n j) → Fin K :=52  fun q => if h : t.val + 2^j * q.val < n then a ⟨_,h⟩ else 05354theorem partWord_eq_codedWord (v : Fin n → Fin K → FreeGroup α)55    (j : ℕ) (t : Fin (2^j)) (a : Fin n → Fin K) :56    partWord v j t a = codedWord v j (t, restrictChoices j t a) := by57  funext i58  dsimp only [partWord, codedWord]59  split_ifs with h60  · congr 161    have hi : t.val + 2^j * (i.val / 2^j) = i.val := by62      simpa only [h] using Nat.mod_add_div i.val (2^j)63    simp only [restrictChoices]64    split_ifs with hh65    · congr 166      exact Fin.ext hi.symm67    · omega68  · rfl6970/-- The actual finite support at partition level `j`. -/71def stageSupport (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :72    Finset (GroupWord α n) :=73  insert 1 ((Finset.univ.image (codedWord v j)) ∪74    Finset.univ.image (fun c => (codedWord v j c)⁻¹))7576@[simp] theorem one_mem_stageSupport (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :77    (1 : GroupWord α n) ∈ stageSupport v j := by simp [stageSupport]7879theorem partWord_mem (v : Fin n → Fin K → FreeGroup α) (j : ℕ)80    (t : Fin (2^j)) (a : Fin n → Fin K) : partWord v j t a ∈ stageSupport v j := by81  rw [partWord_eq_codedWord]82  simp [stageSupport]8384theorem inv_partWord_mem (v : Fin n → Fin K → FreeGroup α) (j : ℕ)85    (t : Fin (2^j)) (a : Fin n → Fin K) : (partWord v j t a)⁻¹ ∈ stageSupport v j := by86  rw [partWord_eq_codedWord]87  simp [stageSupport]8889theorem codedWord_eq_partWord (v : Fin n → Fin K → FreeGroup α) (j : ℕ)90    (c : Fin (2^j) × (Fin (width n j) → Fin K)) :91    codedWord v j c = partWord v j c.1 (fun i => c.2 ⟨_,quotient_lt_width i j⟩) := rfl9293theorem mem_stageSupport_iff (v : Fin n → Fin K → FreeGroup α) (j : ℕ)94    (w : GroupWord α n) : w ∈ stageSupport v j ↔95    w = 1 ∨ ∃ t : Fin (2^j), ∃ a : Fin n → Fin K,96      w = partWord v j t a ∨ w = (partWord v j t a)⁻¹ := by97  constructor98  · intro hw99    simp only [stageSupport, Finset.mem_insert, Finset.mem_union, Finset.mem_image,100      Finset.mem_univ, true_and] at hw101    rcases hw with h | ⟨c,h⟩ | ⟨c,h⟩102    · exact Or.inl h103    · exact Or.inr ⟨c.1, _, Or.inl (h.symm.trans (codedWord_eq_partWord v j c))⟩104    · exact Or.inr ⟨c.1, _, Or.inr (h.symm.trans (congrArg Inv.inv (codedWord_eq_partWord v j c)))⟩105  · rintro (rfl | ⟨t,a,rfl | rfl⟩)106    · exact one_mem_stageSupport v j107    · exact partWord_mem v j t a108    · exact inv_partWord_mem v j t a109110/-- The exact manuscript cardinal budget, proved for the constructed support. -/111theorem stageSupport_card (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :112    (stageSupport v j).card ≤ 1 + 2^(j+1) * K^(width n j) := by113  let T := Fin (2^j) × (Fin (width n j) → Fin K)114  have hcard : Fintype.card T = 2^j * K^(width n j) := by simp [T]115  calc116    (stageSupport v j).card ≤117        ((Finset.univ.image (codedWord v j)) ∪118          Finset.univ.image (fun c => (codedWord v j c)⁻¹)).card + 1 :=119      Finset.card_insert_le _ _120    _ ≤ (Finset.univ.image (codedWord v j)).card +121        (Finset.univ.image (fun c => (codedWord v j c)⁻¹)).card + 1 :=122      Nat.add_le_add_right (Finset.card_union_le _ _) 1123    _ ≤ Fintype.card T + Fintype.card T + 1 := by124      exact Nat.add_le_add_right (Nat.add_le_add Finset.card_image_le Finset.card_image_le) 1125    _ = _ := by rw [hcard, pow_succ]; ring126127128/-- A parent residue class is the disjoint union of its two children. -/129theorem residue_split (i m t : ℕ) (hm : 0 < m) (ht : t < m) :130    i % m = t ↔ i % (2*m) = t ∨ i % (2*m) = t+m := by131  have hmod : i % (2*m) % m = i % m :=132    Nat.mod_mod_of_dvd i ⟨2, by omega⟩133  have hr := Nat.mod_lt i (show 0 < 2*m by omega)134  rcases lt_or_ge (i % (2*m)) m with h | h135  · rw [Nat.mod_eq_of_lt h] at hmod136    omega137  · rw [Nat.mod_eq_sub_mod h, Nat.mod_eq_of_lt (show i % (2*m)-m < m by omega)] at hmod138    omega139140def leftChild {j : ℕ} (t : Fin (2^j)) : Fin (2^(j+1)) :=141  ⟨t.val, by have := t.isLt; rw [pow_succ]; omega⟩142143def rightChild {j : ℕ} (t : Fin (2^j)) : Fin (2^(j+1)) :=144  ⟨t.val+2^j, by have := t.isLt; rw [pow_succ]; omega⟩145146/-- Splitting uses only commutation of distinct coordinates, encoded pointwise. -/147theorem partWord_split (v : Fin n → Fin K → FreeGroup α) (j : ℕ)148    (t : Fin (2^j)) (a : Fin n → Fin K) :149    partWord v j t a =150      partWord v (j+1) (leftChild t) a * partWord v (j+1) (rightChild t) a := by151  funext i152  have hp : 0 < 2^j := by positivity153  have hs := residue_split i.val (2^j) t.val hp t.isLt154  have he : 2^(j+1) = 2*2^j := by rw [pow_succ]; omega155  simp only [partWord, Pi.mul_apply, leftChild, rightChild, he]156  by_cases h₁ : i.val % (2*2^j) = t.val157  · have h₂ : ¬ i.val % (2*2^j) = t.val+2^j := by omega158    simp [h₁, hs.mpr (Or.inl h₁)]159  · by_cases h₂ : i.val % (2*2^j) = t.val+2^j160    · simp [h₂, hs.mpr (Or.inr h₂)]161    · have h₀ : ¬ i.val % 2^j = t.val := by simpa [h₁,h₂] using hs162      simp [h₁,h₂,h₀]163164/-- Every word and inverse at one stage is a difference of two words at the next. -/165theorem stage_difference_cover (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :166    stageSupport v j ⊆ Linearization.differenceSupport (stageSupport v (j+1)) := by167  intro w hw168  rcases (mem_stageSupport_iff v j w).mp hw with rfl | ⟨t,a,rfl | rfl⟩169  · exact Linearization.mem_differenceSupport.mpr170      ⟨1, one_mem_stageSupport v (j+1), 1, one_mem_stageSupport v (j+1), by simp⟩171  · apply Linearization.mem_differenceSupport.mpr172    refine ⟨(partWord v (j+1) (leftChild t) a)⁻¹,173      inv_partWord_mem _ _ _ _, partWord v (j+1) (rightChild t) a,174      partWord_mem _ _ _ _, ?_⟩175    simpa only [inv_inv] using (partWord_split v j t a).symm176  · apply Linearization.mem_differenceSupport.mpr177    refine ⟨partWord v (j+1) (rightChild t) a, partWord_mem _ _ _ _,178      (partWord v (j+1) (leftChild t) a)⁻¹, inv_partWord_mem _ _ _ _, ?_⟩179    rw [partWord_split v j t a, mul_inv_rev]180181/-- The original individual tensor words lie in the initial support. -/182theorem initial_support_subset (v : Fin n → Fin K → FreeGroup α) :183    Finset.univ.image (fun a : Fin n → Fin K => fun i => v i (a i)) ⊆184      stageSupport v 0 := by185  intro w hw186  obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hw187  have he : partWord v 0 (0 : Fin (2^0)) a = (fun i => v i (a i)) := by188    funext i189    change (if i.val % 1 = 0 then v i (a i) else 1) = v i (a i)190    rw [Nat.mod_one]191    rfl192  rw [← he]193  exact partWord_mem v 0 0 a194195196/-- At the last partition level, each word acts in only one factor. -/197theorem stageSupport_single_factor (v : Fin n → Fin K → FreeGroup α) (j ℓ : ℕ)198    (hn : 1 ≤ n) (hnj : n ≤ 2^j)199    (hv : ∀ i a, FreeGroup.norm (v i a) ≤ ℓ) :200    ∀ w ∈ stageSupport v j, ∃ i : Fin n, ∃ g : FreeGroup α,201      FreeGroup.norm g ≤ ℓ ∧ w = fun k => if k=i then g else 1 := by202  have hpart (t : Fin (2^j)) (a : Fin n → Fin K) :203      ∃ i : Fin n, ∃ g : FreeGroup α, FreeGroup.norm g ≤ ℓ ∧204        partWord v j t a = fun k => if k=i then g else 1 := by205    by_cases ht : t.val < n206    · let i : Fin n := ⟨t.val,ht⟩207      refine ⟨i, v i (a i), hv _ _, ?_⟩208      funext k209      have hk : k.val < 2^j := k.isLt.trans_le hnj210      simp only [partWord, Nat.mod_eq_of_lt hk]211      by_cases hki : k=i212      · subst k213        simp [i]214      · have hne : k.val ≠ t.val := by intro h; exact hki (Fin.ext h)215        simp [hne,hki]216    · refine ⟨⟨0,by omega⟩,1,by simp,?_⟩217      funext k218      have hk : k.val < 2^j := k.isLt.trans_le hnj219      have hne : k.val ≠ t.val := by have := k.isLt; omega220      simp [partWord, Nat.mod_eq_of_lt hk,hne]221  intro w hw222  rcases (mem_stageSupport_iff v j w).mp hw with rfl | ⟨t,a,rfl | rfl⟩223  · refine ⟨⟨0,by omega⟩,1,by simp,?_⟩224    funext k225    simp226  · exact hpart t a227  · obtain ⟨i,g,hg,heq⟩ := hpart t a228    refine ⟨i,g⁻¹,by simpa using hg,?_⟩229    rw [heq]230    funext k231    simp only [Pi.inv_apply]232    split_ifs <;> simp233234/-- The actual stage sequence, with freshly constructed coefficient matrices. -/235def reduce (v : Fin n → Fin K → FreeGroup α) (P : Polynomial (GroupWord α n)) :236    ℕ → Polynomial (GroupWord α n)237  | 0 => P238  | j+1 => (reduce v P j).step (stageSupport v (j+1)) (one_mem_stageSupport v (j+1))239240/-- Actual enlargement factor accumulated along the constructed sequence. -/241def dimensionCost (v : Fin n → Fin K → FreeGroup α) : ℕ → ℕ242  | 0 => 1243  | j+1 => 2*(stageSupport v (j+1)).card * dimensionCost v j244245/-- Actual relative-error factor accumulated along the constructed sequence. -/246def errorCost (v : Fin n → Fin K → FreeGroup α) : ℕ → ℕ247  | 0 => 1248  | j+1 => 6*(stageSupport v (j+1)).card * errorCost v j249250theorem dimensionCost_pos (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :251    0 < dimensionCost v j := by252  induction j with253  | zero => simp [dimensionCost]254  | succ j ih =>255    have hb := Finset.card_pos.mpr ⟨1, one_mem_stageSupport v (j+1)⟩256    exact Nat.mul_pos (Nat.mul_pos (by omega) hb) ih257258theorem errorCost_eq (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :259    errorCost v j = 3^j * dimensionCost v j := by260  induction j with261  | zero => simp [errorCost,dimensionCost]262  | succ j ih => simp only [errorCost,dimensionCost,ih,pow_succ]; ring263264theorem errorCost_pos (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :265    0 < errorCost v j := by266  rw [errorCost_eq]267  exact Nat.mul_pos (by positivity) (dimensionCost_pos v j)268269theorem reduce_dimension (v : Fin n → Fin K → FreeGroup α)270    (P : Polynomial (GroupWord α n)) (j : ℕ) :271    Fintype.card (reduce v P j).Index = Fintype.card P.Index * dimensionCost v j := by272  induction j with273  | zero => simp [reduce,dimensionCost]274  | succ j ih =>275    rw [reduce,Polynomial.step_dimension,ih]276    simp only [dimensionCost]277    ring278279theorem reduce_support (v : Fin n → Fin K → FreeGroup α)280    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0) (j : ℕ) :281    (reduce v P j).support ⊆ stageSupport v j := by282  cases j with283  | zero => exact hP284  | succ j => exact Finset.Subset.refl _285286/-- Every constructed Gram step has its exact regular norm identity. -/287theorem reduce_regular_norm_sq (v : Fin n → Fin K → FreeGroup α)288    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0) (j : ℕ) :289    ‖(reduce v P (j+1)).regularEval‖^2 = ‖(reduce v P j).regularEval‖ +290      (reduce v P j).correction (stageSupport v (j+1)) :=291  Polynomial.step_regular_norm_sq _ _ (one_mem_stageSupport v (j+1))292    ((reduce_support v P hP j).trans (stage_difference_cover v j))293294/-- The same constructed coefficients satisfy the finite norm identity. -/295theorem reduce_finite_norm_sq (v : Fin n → Fin K → FreeGroup α)296    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0) (j : ℕ)297    {ν : Type*} [Fintype ν] [DecidableEq ν] [Nonempty ν]298    (π : GroupWord α n →* unitary (Matrix ν ν ℂ)) :299    ‖(reduce v P (j+1)).finiteEval π‖^2 = ‖(reduce v P j).finiteEval π‖ +300      (reduce v P j).correction (stageSupport v (j+1)) :=301  Polynomial.step_finite_norm_sq _ _ (one_mem_stageSupport v (j+1))302    ((reduce_support v P hP j).trans (stage_difference_cover v j)) π303304/-- The additive constants have the required actual support-cardinality bound. -/305theorem reduce_correction_bounds (v : Fin n → Fin K → FreeGroup α)306    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0) (j : ℕ) :307    0 ≤ (reduce v P j).correction (stageSupport v (j+1)) ∧308    (reduce v P j).correction (stageSupport v (j+1)) ≤309      ((stageSupport v (j+1)).card : ℝ) * ‖(reduce v P j).regularEval‖ :=310  ⟨Polynomial.correction_nonneg _ _,311    Polynomial.correction_le _ _ (one_mem_stageSupport v (j+1))312      ((reduce_support v P hP j).trans (stage_difference_cover v j))⟩313314315/-- Only the final-polynomial norm comparison is assumed; all intermediate316support covers and all backward error transfers are proved for the construction. -/317theorem reduce_error_transfer (v : Fin n → Fin K → FreeGroup α)318    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0) (j : ℕ)319    {ν : Type*} [Fintype ν] [DecidableEq ν] [Nonempty ν]320    (π : GroupWord α n →* unitary (Matrix ν ν ℂ))321    (ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1)322    (hfinal : ‖(reduce v P j).finiteEval π‖ ≤323      (1+ε/(errorCost v j:ℝ))*‖(reduce v P j).regularEval‖) :324    ‖P.finiteEval π‖ ≤ (1+ε)*‖P.regularEval‖ := by325  induction j with326  | zero => simpa only [reduce,errorCost,Nat.cast_one,div_one] using hfinal327  | succ j ih =>328    have hE : (0:ℝ) < errorCost v (j+1) := by exact_mod_cast errorCost_pos v (j+1)329    have hE1 : (1:ℝ) ≤ errorCost v (j+1) := by exact_mod_cast errorCost_pos v (j+1)330    have hδ0 : 0 ≤ ε/(errorCost v (j+1):ℝ) := div_nonneg hε hE.le331    have hδ1 : ε/(errorCost v (j+1):ℝ) ≤ 1 := by332      exact (div_le_iff₀ hE).mpr (by linarith)333    have hs := Polynomial.step_error_transfer (reduce v P j) (stageSupport v (j+1))334      (one_mem_stageSupport v (j+1))335      ((reduce_support v P hP j).trans (stage_difference_cover v j)) π336      (ε/(errorCost v (j+1):ℝ)) hδ0 hδ1 hfinal337    have hB : (0:ℝ) < (stageSupport v (j+1)).card := by338      exact_mod_cast Finset.card_pos.mpr ⟨1,one_mem_stageSupport v (j+1)⟩339    have hEprev : (0:ℝ) < errorCost v j := by exact_mod_cast errorCost_pos v j340    have heq : 6*((stageSupport v (j+1)).card:ℝ)*(ε/(errorCost v (j+1):ℝ)) =341        ε/(errorCost v j:ℝ) := by342      simp only [errorCost,Nat.cast_mul,Nat.cast_ofNat]343      field_simp344    apply ih345    simpa only [heq] using hs346347theorem dimensionCost_prod (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :348    dimensionCost v j = ∏ i ∈ Finset.range j, 2*(stageSupport v (i+1)).card := by349  induction j with350  | zero => simp [dimensionCost]351  | succ j ih => rw [dimensionCost,Finset.prod_range_succ,ih,Nat.mul_comm]352353theorem errorCost_prod (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :354    errorCost v j = ∏ i ∈ Finset.range j, 6*(stageSupport v (i+1)).card := by355  induction j with356  | zero => simp [errorCost]357  | succ j ih => rw [errorCost,Finset.prod_range_succ,ih,Nat.mul_comm]358359/-- Manuscript product budget for the actual coefficient dimensions. -/360theorem dimensionCost_le_prod (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :361    dimensionCost v j ≤362      ∏ i ∈ Finset.range j, 2*(1+2^(i+2)*K^(width n (i+1))) := by363  rw [dimensionCost_prod]364  apply Finset.prod_le_prod'365  intro i hi366  exact Nat.mul_le_mul_left 2 (stageSupport_card v (i+1))367368/-- Manuscript product budget for the actual backward-error transfer. -/369theorem errorCost_le_prod (v : Fin n → Fin K → FreeGroup α) (j : ℕ) :370    errorCost v j ≤371      ∏ i ∈ Finset.range j, 6*(1+2^(i+2)*K^(width n (i+1))) := by372  rw [errorCost_prod]373  apply Finset.prod_le_prod'374  intro i hi375  exact Nat.mul_le_mul_left 6 (stageSupport_card v (i+1))376377/-- A complete constructed tensor-factor reduction with the manuscript's support378budgets and exactly `ceil(log₂ n)` stages. The output acts on single factors. -/379theorem constructed_tensor_reduction (v : Fin n → Fin K → FreeGroup α)380    (P : Polynomial (GroupWord α n)) (hP : P.support ⊆ stageSupport v 0)381    (ℓ : ℕ) (hn : 1 ≤ n) (hv : ∀ i a, FreeGroup.norm (v i a) ≤ ℓ) :382    ∃ Q : Polynomial (GroupWord α n),383      (∀ w ∈ Q.support, ∃ i : Fin n, ∃ g : FreeGroup α,384        FreeGroup.norm g ≤ ℓ ∧ w = fun k => if k=i then g else 1) ∧385      Fintype.card Q.Index = Fintype.card P.Index * dimensionCost v (Nat.clog 2 n) ∧386      errorCost v (Nat.clog 2 n) = 3^(Nat.clog 2 n) * dimensionCost v (Nat.clog 2 n) ∧387      ∀ {ν : Type} [Fintype ν] [DecidableEq ν] [Nonempty ν]388        (π : GroupWord α n →* unitary (Matrix ν ν ℂ)) (ε : ℝ),389        0 ≤ ε → ε ≤ 1 →390        ‖Q.finiteEval π‖ ≤ (1+ε/(errorCost v (Nat.clog 2 n):ℝ))*‖Q.regularEval‖ →391        ‖P.finiteEval π‖ ≤ (1+ε)*‖P.regularEval‖ := by392  refine ⟨reduce v P (Nat.clog 2 n), ?_, reduce_dimension _ _ _, errorCost_eq _ _, ?_⟩393  · intro w hw394    exact stageSupport_single_factor v _ ℓ hn (Nat.le_pow_clog (by omega) n) hv w395      (reduce_support v P hP _ hw)396  · intro ν _ _ _ π ε hε hε1 hfinal397    exact reduce_error_transfer v P hP _ π ε hε hε1 hfinal398399end Nonadditivity.TensorPartitionReduction