Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.NoncommutativeCSAssignmentProducts

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

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

45 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.NoncommutativeCSAssignments78/-! # Ordered products over named global assignments910For a closed register program the boundary condition disappears. Its global11assignment sum is literally a sum of list products of the original factors.12The profile variables may be indexed by any equivalent finite label type.13-/1415noncomputable section16set_option backward.isDefEq.respectTransparency false17set_option linter.unusedSectionVars false18namespace Nonadditivity.NoncommutativeCS.AssignmentProgram19open scoped BigOperators InnerProduct2021variable {𝕜 E J : Type*} [RCLike 𝕜]22variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [CompleteSpace E]23variable [Fintype J] [DecidableEq J]2425/-- The final active assignment under one fixed global profile choice. -/26def finalState {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n) :27    (Fin P.variableCount → J) → (Fin m → J) → (Fin n → J) :=28  match P with29  | .done _ => fun _ t => t30  | .openReg p _ P => fun σ t =>31      P.finalState (Fin.tail σ) (p.insertNth (σ (0 : Fin (P.variableCount + 1))) t)32  | .closeReg p _ P => fun σ t => P.finalState σ (p.removeNth t)33  | .middle _ P => fun σ t => P.finalState σ t34  | .singleton _ P => fun σ t => P.finalState (Fin.tail σ) t3536/-- The original factors, in their operator multiplication order. -/37def factors {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n) :38    (Fin P.variableCount → J) → (Fin m → J) → List (E →L[𝕜] E) :=39  match P with40  | .done _ => fun _ _ => []41  | .openReg p A P => fun σ t =>42      P.factors (Fin.tail σ) (p.insertNth (σ (0 : Fin (P.variableCount + 1))) t) ++43        [A (σ (0 : Fin (P.variableCount + 1)))]44  | .closeReg p A P => fun σ t => P.factors σ (p.removeNth t) ++ [A (t p)]45  | .middle A P => fun σ t => P.factors σ t ++ [A t]46  | .singleton A P => fun σ t => P.factors (Fin.tail σ) t ++47      [A (σ (0 : Fin (P.variableCount + 1)))]4849/-- The only constraint remaining after a global profile is chosen is that50the final register state agrees with the requested output state. -/51theorem coefficient_eq_product {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n)52    (σ : Fin P.variableCount → J) (s : Fin n → J) (t : Fin m → J) :53    P.coefficient σ s t =54      if s = P.finalState σ t then (P.factors σ t).prod else 0 := by55  induction P with56  | done n => rfl57  | openReg p A P ih =>58      simp only [coefficient, finalState, factors, List.prod_append, List.prod_singleton, ih]59      split_ifs <;> rfl60  | closeReg p A P ih =>61      simp only [coefficient, finalState, factors, List.prod_append, List.prod_singleton, ih]62      split_ifs <;> rfl63  | middle A P ih =>64      simp only [coefficient, finalState, factors, List.prod_append, List.prod_singleton, ih]65      split_ifs <;> rfl66  | singleton A P ih =>67      simp only [coefficient, finalState, factors, List.prod_append, List.prod_singleton, ih]68      split_ifs <;> rfl6970/-- With no remaining open register, every global assignment contributes71its full ordered product, without a boundary indicator. -/72theorem coefficient_closed_eq_product {m : ℕ} (P : AssignmentProgram 𝕜 E J m 0)73    (σ : Fin P.variableCount → J) (s : Fin 0 → J) (t : Fin m → J) :74    P.coefficient σ s t = (P.factors σ t).prod := by75  rw [coefficient_eq_product, if_pos (Subsingleton.elim _ _)]7677/-- The exact endpoint/middle cost. Singleton variables incur the norm of78their actual sum, rather than a gratuitous cardinality factor. -/79def cost {m n : ℕ} : AssignmentProgram 𝕜 E J m n → ℝ80  | .done _ => 181  | .openReg _ A P => P.cost * Real.sqrt ‖columnGram A‖82  | .closeReg _ A P => P.cost * Real.sqrt ‖rowGram A‖83  | .middle A P => P.cost * ‖A‖84  | .singleton A P => P.cost * ‖∑ j, A j‖8586theorem cost_nonneg {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n) : 0 ≤ P.cost := by87  induction P <;> simp only [cost] <;> positivity8889theorem compile_cost_le {m n : ℕ} (P : AssignmentProgram 𝕜 E J m n) :90    P.compile.cost ≤ P.cost := by91  induction P with92  | done n => rfl93  | openReg p A P ih =>94      exact mul_le_mul_of_nonneg_right ih (Real.sqrt_nonneg _)95  | closeReg p A P ih =>96      exact mul_le_mul_of_nonneg_right ih (Real.sqrt_nonneg _)97  | middle A P ih =>98      exact mul_le_mul_of_nonneg_right ih (norm_nonneg _)99  | singleton A P ih =>100      exact mul_le_mul ih (pi_norm_le_iff_of_nonneg (norm_nonneg (∑ j, A j)) |>.mpr101        (fun _ => le_rfl)) (norm_nonneg _) P.cost_nonneg102103/-- The BC global profile sum, as an actual finite sum of ordered products. -/104theorem sum_products_norm_le (P : AssignmentProgram 𝕜 E J 0 0) :105    ‖∑ σ : Fin P.variableCount → J, (P.factors σ Fin.elim0).prod‖ ≤ P.cost := by106  have h := P.assignmentSum_norm_le (s := Fin.elim0) (t := Fin.elim0)107  simp only [coefficient_closed_eq_product] at h108  exact h.trans P.compile_cost_le109110/-- The same theorem with profiles indexed by any finite set of edge labels.111The label enumeration is an equivalence, so no profile is lost or repeated. -/112theorem named_sum_products_norm_le {I : Type*} [Fintype I] [DecidableEq I]113    (P : AssignmentProgram 𝕜 E J 0 0) (e : Fin P.variableCount ≃ I) :114    ‖∑ σ : I → J, (P.factors (fun k => σ (e k)) Fin.elim0).prod‖ ≤ P.cost := by115  let E : (I → J) ≃ (Fin P.variableCount → J) :=116    { toFun := fun σ k => σ (e k)117      invFun := fun σ i => σ (e.symm i)118      left_inv := by intro σ; funext i; simp119      right_inv := by intro σ; funext i; simp }120  have he := Fintype.sum_equiv E121    (fun σ : I → J => (P.factors (fun k => σ (e k)) Fin.elim0).prod)122    (fun σ : Fin P.variableCount → J => (P.factors σ Fin.elim0).prod) (fun _ => rfl)123  rw [he]124  exact P.sum_products_norm_le125126end Nonadditivity.NoncommutativeCS.AssignmentProgram