Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.NoncommutativeCSAssignments

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

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

104 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.NoncommutativeCSPaths78/-! # Global profile assignments and arbitrary register crossings910A program introduces one independent profile variable at every first or11singleton occurrence. Closing a register may select any still open variable.12The coefficient of a global assignment is a single ordered operator product,13with no intermediate summation. Summing those coefficients is proved equal14to the compiled register contraction, including arbitrary crossing patterns.15-/1617noncomputable section18set_option backward.isDefEq.respectTransparency false19namespace Nonadditivity.NoncommutativeCS20open scoped BigOperators InnerProduct2122variable {𝕜 E J : Type*} [RCLike 𝕜]23variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [CompleteSpace E]24variable [Fintype J] [DecidableEq J]2526/-- Reindex a sum over all profiles by one distinguished register. -/27theorem sum_assignment_insert {M : Type*} [AddCommMonoid M] {n : ℕ}28    (p : Fin (n + 1)) (f : (Fin (n + 1) → J) → M) :29    (∑ s, f s) = ∑ j, ∑ t : Fin n → J, f (p.insertNth j t) := by30  calc31    _ = ∑ z : J × (Fin n → J), f (p.insertNth z.1 z.2) :=32      (Fintype.sum_equiv (Fin.insertNthEquiv (fun _ => J) p)33        (fun z : J × (Fin n → J) => f (p.insertNth z.1 z.2)) f (fun _ => rfl)).symm34    _ = _ := Fintype.sum_prod_type _3536theorem sum_assignment_cons {M : Type*} [AddCommMonoid M] {n : ℕ}37    (f : (Fin (n + 1) → J) → M) :38    (∑ s, f s) = ∑ j, ∑ t : Fin n → J, f (Fin.cons j t) := by39  simpa only [Fin.insertNth_zero'] using sum_assignment_insert (0 : Fin (n + 1)) f4041/-- A chronological sequence of first, last, middle, and singleton factors.42The source and target indices are the exact numbers of active registers. -/43inductive AssignmentProgram (𝕜 E J : Type*) [RCLike 𝕜] [NormedAddCommGroup E]44    [InnerProductSpace 𝕜 E] : ℕ → ℕ → Type _45  | done (n : ℕ) : AssignmentProgram 𝕜 E J n n46  | openReg {n m : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)47      (rest : AssignmentProgram 𝕜 E J (n + 1) m) : AssignmentProgram 𝕜 E J n m48  | closeReg {n m : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)49      (rest : AssignmentProgram 𝕜 E J n m) : AssignmentProgram 𝕜 E J (n + 1) m50  | middle {n m : ℕ} (A : (Fin n → J) → E →L[𝕜] E)51      (rest : AssignmentProgram 𝕜 E J n m) : AssignmentProgram 𝕜 E J n m52  | singleton {n m : ℕ} (A : J → E →L[𝕜] E)53      (rest : AssignmentProgram 𝕜 E J n m) : AssignmentProgram 𝕜 E J n m5455namespace AssignmentProgram5657def variableCount {m n : ℕ} : AssignmentProgram 𝕜 E J m n → ℕ58  | .done _ => 059  | .openReg _ _ P => P.variableCount + 160  | .closeReg _ _ P => P.variableCount61  | .middle _ P => P.variableCount62  | .singleton _ P => P.variableCount + 16364def compile {m n : ℕ} : AssignmentProgram 𝕜 E J m n → Contraction 𝕜 E J m n65  | .done n => .identity n66  | .openReg p A P => P.compile.comp (.openReg p A)67  | .closeReg p A P => P.compile.comp (.closeReg p A)68  | .middle A P => P.compile.comp (.diagonalReg _ A)69  | .singleton A P => P.compile.comp (.diagonalReg _ (fun _ => ∑ j, A j))7071/-- The literal ordered coefficient product at one global assignment.72Every variable is read once when introduced and retained until its last visit. -/73def coefficient {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n) :74    (Fin P.variableCount → J) → (Fin n → J) → (Fin m → J) → E →L[𝕜] E :=75  match P with76  | .done _ => fun _ s t => if s = t then ContinuousLinearMap.id 𝕜 E else 077  | .openReg p A P => fun σ s t =>78      P.coefficient (Fin.tail σ) s (p.insertNth (σ (0 : Fin (P.variableCount + 1))) t) ∘L79        A (σ (0 : Fin (P.variableCount + 1)))80  | .closeReg p A P => fun σ s t =>81      P.coefficient σ s (p.removeNth t) ∘L A (t p)82  | .middle A P => fun σ s t => P.coefficient σ s t ∘L A t83  | .singleton A P => fun σ s t =>84      P.coefficient (Fin.tail σ) s t ∘L A (σ (0 : Fin (P.variableCount + 1)))8586/-- A single sum over all global profile assignments. -/87def assignmentSum {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n)88    (s : Fin n → J) (t : Fin m → J) : E →L[𝕜] E :=89  ∑ σ : Fin P.variableCount → J, P.coefficient σ s t9091theorem assignmentSum_open {m n : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)92    (P : AssignmentProgram 𝕜 E J (n + 1) m) (s : Fin m → J) (t : Fin n → J) :93    (openReg p A P).assignmentSum s t =94      ∑ j, P.assignmentSum s (p.insertNth j t) ∘L A j := by95  unfold assignmentSum96  change (∑ σ : Fin (P.variableCount + 1) → J, _) = _97  rw [sum_assignment_cons]98  ext x99  simp [coefficient, variableCount]100101theorem assignmentSum_close {m n : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)102    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin (n + 1) → J) :103    (closeReg p A P).assignmentSum s t =104      P.assignmentSum s (p.removeNth t) ∘L A (t p) := by105  ext x106  simp [assignmentSum, coefficient, variableCount]107108theorem assignmentSum_middle {m n : ℕ} (A : (Fin n → J) → E →L[𝕜] E)109    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin n → J) :110    (middle A P).assignmentSum s t = P.assignmentSum s t ∘L A t := by111  ext x112  simp [assignmentSum, coefficient, variableCount]113114theorem assignmentSum_singleton {m n : ℕ} (A : J → E →L[𝕜] E)115    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin n → J) :116    (singleton A P).assignmentSum s t = ∑ j, P.assignmentSum s t ∘L A j := by117  unfold assignmentSum118  change (∑ σ : Fin (P.variableCount + 1) → J, _) = _119  rw [sum_assignment_cons]120  ext x121  simp [coefficient, variableCount]122123theorem kernel_compile_open {m n : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)124    (P : AssignmentProgram 𝕜 E J (n + 1) m) (s : Fin m → J) (t : Fin n → J) :125    (openReg p A P).compile.kernel s t =126      ∑ j, P.compile.kernel s (p.insertNth j t) ∘L A j := by127  rw [compile, Contraction.kernel_comp, sum_assignment_insert p]128  ext x129  simp [Contraction.kernel_open, Fin.removeNth_insertNth, ite_apply, apply_ite]130131theorem kernel_compile_close {m n : ℕ} (p : Fin (n + 1)) (A : J → E →L[𝕜] E)132    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin (n + 1) → J) :133    (closeReg p A P).compile.kernel s t =134      P.compile.kernel s (p.removeNth t) ∘L A (t p) := by135  rw [compile, Contraction.kernel_comp]136  ext x137  simp [Contraction.kernel_close, ite_apply, apply_ite]138139theorem kernel_compile_middle {m n : ℕ} (A : (Fin n → J) → E →L[𝕜] E)140    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin n → J) :141    (middle A P).compile.kernel s t = P.compile.kernel s t ∘L A t := by142  rw [compile, Contraction.kernel_comp]143  ext x144  simp [Contraction.kernel_diagonal, ite_apply, apply_ite]145146theorem kernel_compile_singleton {m n : ℕ} (A : J → E →L[𝕜] E)147    (P : AssignmentProgram 𝕜 E J n m) (s : Fin m → J) (t : Fin n → J) :148    (singleton A P).compile.kernel s t = ∑ j, P.compile.kernel s t ∘L A j := by149  rw [compile, Contraction.kernel_comp]150  ext x151  simp [Contraction.kernel_diagonal, ite_apply, apply_ite, map_sum]152153/-- The actual single global assignment sum equals the compiled memory154operator coefficient. No path-sum identity is supplied as a hypothesis. -/155theorem assignmentSum_eq_kernel {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n)156    (s : Fin n → J) (t : Fin m → J) :157    P.assignmentSum s t = P.compile.kernel s t := by158  induction P with159  | done n => simp [assignmentSum, coefficient, compile, variableCount]160  | openReg p A P ih =>161      simp only [assignmentSum_open, kernel_compile_open, ih]162  | closeReg p A P ih =>163      simp only [assignmentSum_close, kernel_compile_close, ih]164  | middle A P ih =>165      simp only [assignmentSum_middle, kernel_compile_middle, ih]166  | singleton A P ih =>167      simp only [assignmentSum_singleton, kernel_compile_singleton, ih]168169/-- A dimension-free norm bound for the literal global profile sum.170All crossings are represented by the arbitrary `Fin` chosen at each close. -/171theorem assignmentSum_norm_le {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n)172    (s : Fin n → J) (t : Fin m → J) :173    ‖∑ σ : Fin P.variableCount → J, P.coefficient σ s t‖ ≤ P.compile.cost := by174  change ‖P.assignmentSum s t‖ ≤ _175  rw [assignmentSum_eq_kernel]176  exact P.compile.kernel_norm_le s t177178end AssignmentProgram179end Nonadditivity.NoncommutativeCS