Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarMatchingFibers

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

Direct imports

  • Mathlib.SetTheory.Cardinal.Finite dependency
  • Mathlib.Data.Fintype.Perm dependency
  • Mathlib.Data.Fintype.BigOperators dependency
  • Mathlib.Algebra.BigOperators.Ring.Finset dependency
  • Mathlib.Algebra.Order.BigOperators.Group.Finset dependency

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

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

15 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Mathlib.SetTheory.Cardinal.Finite7import Mathlib.Data.Fintype.Perm8import Mathlib.Data.Fintype.BigOperators9import Mathlib.Algebra.BigOperators.Ring.Finset10import Mathlib.Algebra.Order.BigOperators.Group.Finset1112/-! # Counting bijections that preserve actual entry labels1314A label-preserving bijection restricts to a bijection of each pair of fibers.15This gives the exact factorial counting bound used after the values of a Haar16matching have been fixed on its disagreement support.17-/18noncomputable section19set_option backward.isDefEq.respectTransparency false20set_option maxHeartbeats 40000021namespace Nonadditivity.HaarMatchingFibers22open scoped BigOperators23attribute [local instance] Classical.propDecidable2425variable {A B E : Type*}2627/-- Literal bijections of the occurrence sets preserving their entry labels. -/28def LabelEquiv (x : A → E) (y : B → E) := {σ : A ≃ B // ∀ a, y (σ a) = x a}2930instance [Fintype A] [Fintype B] (x : A → E) (y : B → E) : Fintype (LabelEquiv x y) :=31  by32    classical33    exact inferInstanceAs (Fintype {σ : A ≃ B // ∀ a, y (σ a) = x a})3435/-- A label-preserving matching induces an actual equivalence on each fiber. -/36def fiberEquiv (x : A → E) (y : B → E) (σ : LabelEquiv x y) (e : E) :37    {a : A // x a = e} ≃ {b : B // y b = e} where38  toFun a := ⟨σ.val a.val, (σ.property a.val).trans a.property⟩39  invFun b := ⟨σ.val.symm b.val, (σ.property (σ.val.symm b.val)).symm.trans40    (by rw [σ.val.apply_symm_apply]; exact b.property)⟩41  left_inv a := by apply Subtype.ext; exact σ.val.symm_apply_apply _42  right_inv b := by apply Subtype.ext; exact σ.val.apply_symm_apply _4344/-- All fiber restrictions together determine the entire matching. -/45theorem fiberEquiv_injective (x : A → E) (y : B → E) :46    Function.Injective (fun σ : LabelEquiv x y => fiberEquiv x y σ) := by47  intro σ τ h48  apply Subtype.ext49  apply Equiv.ext50  intro a51  have he := congrFun h (x a)52  have hv := congrArg (fun f : {a' : A // x a' = x a} ≃ {b : B // y b = x a} =>53    (f ⟨a,rfl⟩).val) he54  exact hv5556/-- Even for unequal fiber sizes, the number of bijections is at most the57factorial of the source size: an incompatible fiber contributes zero. -/58theorem card_equiv_le_factorial [Fintype A] [Fintype B] :59    Fintype.card (A ≃ B) ≤ (Fintype.card A).factorial := by60  classical61  by_cases h : Nonempty (A ≃ B)62  · obtain ⟨e⟩ := h63    exact le_of_eq (Fintype.card_equiv e)64  · letI : IsEmpty (A ≃ B) := not_nonempty_iff.mp h65    simp6667/-- The sharp fiber-factorial bound, with no premise asserting compatible68fiber cardinalities or existence of a matching. -/69theorem card_labelEquiv_le [Fintype A] [Fintype B] [Fintype E]70    (x : A → E) (y : B → E) :71    Fintype.card (LabelEquiv x y) ≤72      ∏ e : E, (Fintype.card {a : A // x a = e}).factorial := by73  classical74  calc75    _ ≤ Fintype.card (∀ e : E, {a : A // x a = e} ≃ {b : B // y b = e}) :=76      Fintype.card_le_of_injective (fun σ => fiberEquiv x y σ) (fiberEquiv_injective x y)77    _ = ∏ e : E, Fintype.card ({a : A // x a = e} ≃ {b : B // y b = e}) :=78      Fintype.card_pi79    _ ≤ _ := by80      have h (e : E) := card_equiv_le_factorial81        (A := {a : A // x a = e}) (B := {b : B // y b = e})82      simp only [← Nat.card_eq_fintype_card] at h ⊢83      exact Finset.prod_le_prod' (fun e _ => h e)848586/-- Only fibers with total multiplicity at least four cost a nontrivial87factorial.  Matching uses at most half of the total occurrences in each fiber. -/88theorem prod_factorial_le_pow_half_high [Fintype E]89    (p : ℕ) (hp : 0 < p) (a t : E → ℕ)90    (ha : ∀ e, a e ≤ p) (hat : ∀ e, 2*a e ≤ t e) :91    (∏ e : E, (a e).factorial) ≤92      p ^ ((∑ e : E, if 4 ≤ t e then t e else 0)/2) := by93  classical94  let c : E → ℕ := fun e => if 4 ≤ t e then a e else 095  have hfactor (e : E) : (a e).factorial ≤ p ^ c e := by96    by_cases h : 4 ≤ t e97    · simp only [c, if_pos h]98      exact (Nat.factorial_le_pow (a e)).trans (Nat.pow_le_pow_left (ha e) _)99    · have hsmall : a e ≤ 1 := by have := hat e; omega100      simp [c, h, Nat.factorial_eq_one.mpr hsmall]101  have hexp : (∑ e : E, c e) ≤ (∑ e : E, if 4 ≤ t e then t e else 0)/2 := by102    apply (Nat.le_div_iff_mul_le (by decide : 0 < 2)).mpr103    rw [Finset.sum_mul]104    apply Finset.sum_le_sum105    intro e he106    by_cases h : 4 ≤ t e107    · simpa [c, h, mul_comm] using hat e108    · simp [c, h]109  calc110    _ ≤ ∏ e : E, p ^ c e := Finset.prod_le_prod' (fun e _ => hfactor e)111    _ = p ^ (∑ e : E, c e) := Finset.prod_pow_eq_pow_sum _ _ _112    _ ≤ _ := Nat.pow_le_pow_right hp hexp113114end Nonadditivity.HaarMatchingFibers