Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.NoncommutativeCSSkeletonDecoration

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

Direct imports

Imported by project modules

3 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

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

59 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.NoncommutativeCSEndpointSkeleton7import Mathlib.Data.List.FinRange89/-! # Whole-block coefficient decoration and global sum bound1011A middle block is decorated by one arbitrary coefficient operator depending12on its whole list of profile choices. No product decomposition of that13operator is required. The preceding compiler supplies all endpoint bookkeeping.14-/1516noncomputable section17set_option backward.isDefEq.respectTransparency false18set_option linter.unusedSectionVars false19namespace Nonadditivity.NoncommutativeCS.EndpointSkeleton20open scoped BigOperators InnerProduct2122variable {𝕜 E I J : Type*} [RCLike 𝕜]23variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [CompleteSpace E]24variable [Fintype J] [DecidableEq J]2526def decorate {m n : ℕ} {a : Fin m → I} {b : Fin n → I}27    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E)28    (k : ℕ) : EndpointTrace 𝕜 E I J a b :=29  match P with30  | .done a => .done a31  | .first i P => .first i (fun j => A k [i] [j]) (P.decorate A (k + 1))32  | .last (a := a) p P => .last p (fun j => A k [a p] [j]) (P.decorate A (k + 1))33  | .middle (a := a) v P =>34      .middle (fun s => A k (v.map a) (v.map s)) (P.decorate A (k + 1))35  | .singleton i P => .singleton i (fun j => A k [i] [j]) (P.decorate A (k + 1))3637/-- The independent variable names are determined by the occurrence trace,38and are independent of every coefficient operator. -/39theorem decorate_labels {m n : ℕ} {a : Fin m → I} {b : Fin n → I}40    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E) (k : ℕ) :41    List.ofFn (P.decorate A k).labels = P.profileLabels := by42  induction P generalizing k with43  | done => rfl44  | first i P ih =>45      simpa [decorate, EndpointTrace.labels, EndpointTrace.compile,46        AssignmentProgram.variableCount, List.ofFn_succ, profileLabels] using47        congrArg (List.cons i) (ih (k + 1))48  | last p P ih => exact ih (k + 1)49  | middle v P ih => exact ih (k + 1)50  | singleton i P ih =>51      simpa [decorate, EndpointTrace.labels, EndpointTrace.compile,52        AssignmentProgram.variableCount, List.ofFn_succ, profileLabels] using53        congrArg (List.cons i) (ih (k + 1))5455def markedFlags {m n : ℕ} {a : Fin m → I} {b : Fin n → I} :56    EndpointSkeleton I a b → List Bool57  | .done _ => []58  | .first _ P => true :: P.markedFlags59  | .last _ P => true :: P.markedFlags60  | .middle _ P => false :: P.markedFlags61  | .singleton _ P => true :: P.markedFlags6263/-- Every independent label pays at most two marked occurrences, allowing64for the registers already open at the two boundaries. -/65theorem marked_count_boundary {m n : ℕ} {a : Fin m → I} {b : Fin n → I}66    (P : EndpointSkeleton I a b) :67    P.markedFlags.count true + n ≤ 2 * P.profileLabels.length + m := by68  induction P <;> simp_all [markedFlags, profileLabels] <;> omega6970/-- Compression prevents adjacent middle blocks. The one possible extra71block occurs only if the trace itself starts in the middle. -/72theorem compressed_length_le {m n : ℕ} {a : Fin m → I} {b : Fin n → I}73    (P : EndpointSkeleton I a b) (hP : P.Compressed) :74    P.markedFlags.length ≤ 2 * P.markedFlags.count true +75      (if P.startsMiddle then 1 else 0) := by76  induction P with77  | done => simp [markedFlags, startsMiddle]78  | first i P ih =>79      have h := ih hP80      cases hs : P.startsMiddle <;> simp_all [markedFlags, startsMiddle] <;> omega81  | last p P ih =>82      have h := ih hP83      cases hs : P.startsMiddle <;> simp_all [markedFlags, startsMiddle] <;> omega84  | middle v P ih =>85      obtain ⟨_, hs, hc⟩ := hP86      have h := ih hc87      simp_all [markedFlags, startsMiddle]88  | singleton i P ih =>89      have h := ih hP90      cases hs : P.startsMiddle <;> simp_all [markedFlags, startsMiddle] <;> omega9192theorem startsMiddle_false_of_empty {n : ℕ} {b : Fin n → I}93    (P : EndpointSkeleton I (Fin.elim0 : Fin 0 → I) b) (hP : P.Compressed) :94    P.startsMiddle = false := by95  cases P with96  | done => rfl97  | first => rfl98  | singleton => rfl99  | middle v P =>100      cases v with101      | nil => exact (hP.1 rfl).elim102      | cons p v => exact Fin.elim0 p103104/-- The corrected BC coefficient exponent for an actual compressed trace.105This uses the true block count and counts the costly marked factors only. -/106theorem coefficient_exponent_le107    (P : EndpointSkeleton I (Fin.elim0 : Fin 0 → I) (Fin.elim0 : Fin 0 → I))108    (hP : P.Compressed) :109    P.markedFlags.length - 1 + P.markedFlags.count true ≤110      6 * P.profileLabels.length - 1 := by111  have hl := P.compressed_length_le hP112  rw [P.startsMiddle_false_of_empty hP] at hl113  have hm := P.marked_count_boundary114  simp only [Bool.false_eq_true, if_false, Nat.add_zero] at hl hm115  omega116117theorem decorate_markedFlags {m n : ℕ} {a : Fin m → I} {b : Fin n → I}118    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E) (k : ℕ) :119    (P.decorate A k).markedFlags = P.markedFlags := by120  induction P generalizing k <;> simp_all [decorate, markedFlags, EndpointTrace.markedFlags]121122/-- Ordered factors read directly from a global assignment; middle blocks123receive their full profile list in one call to `A`. -/124def blockFactors {m n : ℕ} {a : Fin m → I} {b : Fin n → I}125    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E)126    (k : ℕ) (σ : I → J) : List (E →L[𝕜] E) :=127  match P with128  | .done _ => []129  | .first i P => P.blockFactors A (k + 1) σ ++ [A k [i] [σ i]]130  | .last (a := a) p P => P.blockFactors A (k + 1) σ ++ [A k [a p] [σ (a p)]]131  | .middle (a := a) v P =>132      P.blockFactors A (k + 1) σ ++ [A k (v.map a) ((v.map a).map σ)]133  | .singleton i P => P.blockFactors A (k + 1) σ ++ [A k [i] [σ i]]134135theorem decorate_factors {m n : ℕ} {a : Fin m → I} {b : Fin n → I}136    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E)137    (k : ℕ) (σ : I → J) :138    (P.decorate A k).factors σ = P.blockFactors A k σ := by139  induction P generalizing k <;>140    simp_all [decorate, EndpointTrace.factors, blockFactors, List.map_map]141142theorem coversLabels_of_profileLabels {m n : ℕ} {a : Fin m → I} {b : Fin n → I}143    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E) (k : ℕ)144    (hn : P.profileLabels.Nodup) (hc : ∀ i : I, i ∈ P.profileLabels) :145    (P.decorate A k).CoversLabels := by146  constructor147  · apply List.nodup_ofFn.mp148    rw [decorate_labels]149    exact hn150  · intro i151    have hi := hc i152    rw [← decorate_labels P A k, List.mem_ofFn] at hi153    exact hi154155/-- A fully compiled, literal sum over all global profiles for whole-block156operators, with the exact endpoint and middle operator costs. -/157theorem block_sum_norm_le [Fintype I] [DecidableEq I]158    (P : EndpointSkeleton I (Fin.elim0 : Fin 0 → I) (Fin.elim0 : Fin 0 → I))159    (A : ℕ → List I → List J → E →L[𝕜] E) (k : ℕ)160    (hn : P.profileLabels.Nodup) (hc : ∀ i : I, i ∈ P.profileLabels) :161    ‖∑ σ : I → J, (P.blockFactors A k σ).prod‖ ≤ (P.decorate A k).compile.cost := by162  have h := (P.decorate A k).sum_products_norm_le (P.coversLabels_of_profileLabels A k hn hc)163  simpa only [decorate_factors] using h164165theorem profileLabels_length_eq_card [Fintype I] [DecidableEq I]166    {m n : ℕ} {a : Fin m → I} {b : Fin n → I} (P : EndpointSkeleton I a b)167    (hn : P.profileLabels.Nodup) (hc : ∀ i : I, i ∈ P.profileLabels) :168    P.profileLabels.length = Fintype.card I := by169  have hu : P.profileLabels.toFinset = Finset.univ := by170    apply Finset.eq_univ_of_forall171    intro i172    exact List.mem_toFinset.mpr (hc i)173  simpa [hu] using (List.toFinset_card_of_nodup hn).symm174175/-- For a word containing every label, the automatic compiler supplies all176coverage and distinctness facts needed by the global profile inequality. -/177theorem exists_closed_compiler [Fintype I] [DecidableEq I]178    (l : List I) (hl : ∀ i : I, i ∈ l) :179    ∃ P : EndpointSkeleton I (Fin.elim0 : Fin 0 → I) (Fin.elim0 : Fin 0 → I),180      P.word = l ∧ P.Compressed ∧ P.profileLabels.Nodup ∧181        (∀ i : I, i ∈ P.profileLabels) ∧182        P.markedFlags.length - 1 + P.markedFlags.count true ≤ 6 * Fintype.card I - 1 := by183  obtain ⟨P, hw, hp, hn, hc⟩ := exists_compressed l (Fin.elim0 : Fin 0 → I)184    (fun p => Fin.elim0 p) (fun p => Fin.elim0 p)185  have hc' : ∀ i : I, i ∈ P.profileLabels := by186    intro i187    apply (hc i).mpr188    exact ⟨hl i, by rintro ⟨p, _⟩; exact Fin.elim0 p⟩189  refine ⟨P, hw, hp, hn, hc', ?_⟩190  have h := P.coefficient_exponent_le hp191  rwa [P.profileLabels_length_eq_card hn hc'] at h192193end Nonadditivity.NoncommutativeCS.EndpointSkeleton