Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarMatchingCount

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

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

19 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarMatchingSingletons7import Mathlib.Algebra.BigOperators.Fin89/-! # Counting entry matchings at a fixed relative permutation1011Away from exceptional positions, an entry of total multiplicity at most two12has at most one possible partner. Restricting a matching permutation to the13exceptional positions is therefore injective. Higher multiplicities are14charged to the literal excess-occurrence statistic.15-/16noncomputable section17namespace Nonadditivity.HaarMatchingCount18open HaarPathMultiplicity HaarMatchingSingletons19open scoped BigOperators20variable {E : Type*} [DecidableEq E] {p : ℕ}2122lemma count_ofFn_eq_card (f : Fin p → E) (e : E) :23    (List.ofFn f).count e=(Finset.univ.filter (fun a => f a=e)).card := by24  have hs : (List.ofFn f).count e=∑ a, if f a=e then 1 else 0 := by25    induction p with26    | zero => simp27    | succ p ih =>28      rw [List.ofFn_succ,List.count_cons,Fin.sum_univ_succ,ih]29      by_cases h : f 0=e <;> simp [h,Nat.add_comm]30  simpa using hs3132lemma two_le_count_ofFn (f : Fin p → E) (e : E) (a b : Fin p)33    (ha : f a=e) (hb : f b=e) (hab : a≠b) : 2 ≤ (List.ofFn f).count e := by34  rw [count_ofFn_eq_card]35  have hsub : ({a,b} : Finset (Fin p)) ⊆ Finset.univ.filter (fun i => f i=e) := by36    intro i hi37    simp only [Finset.mem_insert,Finset.mem_singleton] at hi38    rcases hi with rfl | rfl <;> simp [ha,hb]39  have h := Finset.card_le_card hsub40  simpa [hab] using h4142/-- Positive occurrences whose combined entry multiplicity is at least three. -/43def marked (x y : Fin p → E) : Finset (Fin p) :=44  Finset.univ.filter (fun a => 3 ≤ (List.ofFn x ++ List.ofFn y).count (x a))4546lemma target_unique_of_not_marked (x y : Fin p → E) (a : Fin p)47    (ha : a ∉ marked x y) (b c : Fin p) (hb : y b=x a) (hc : y c=x a) : b=c := by48  by_contra hbc49  have hn : ¬3 ≤ (List.ofFn x ++ List.ofFn y).count (x a) := by50    simpa [marked] using ha51  have hp : 0 < (List.ofFn x).count (x a) :=52    List.count_pos_iff.mpr (List.mem_ofFn.mpr ⟨a,rfl⟩)53  have hm := two_le_count_ofFn y (x a) b c hb hc hbc54  rw [List.count_append] at hn55  omega5657/-- The number of marked positive occurrences is controlled by three times58all occurrences beyond the second copy of each entry. -/59theorem marked_card_le_three_excess (x y : Fin p → E) :60    (marked x y).card ≤ 3*excessOccurrences (List.ofFn x ++ List.ofFn y) := by61  let L := List.ofFn x ++ List.ofFn y62  let f : E → ℕ := fun e => if 3 ≤ L.count e then 1 else 063  have he : (marked x y).card=((List.ofFn x).map f).sum := by64    simp [marked,f,L,List.map_ofFn,Fin.sum_ofFn]65  rw [he]66  calc67    _ ≤ (L.map f).sum := by68      dsimp only [L]69      rw [List.map_append,List.sum_append]70      omega71    _ = ∑ e ∈ L.toFinset, L.count e*f e := by72      simpa only [nsmul_eq_mul] using sum_occurrence_weights L f73    _ ≤ 3*excessOccurrences L := by74      rw [excessOccurrences,Finset.mul_sum]75      apply Finset.sum_le_sum76      intro e _77      dsimp only [f]78      split_ifs <;> omega7980/-- Over-approximation of all matchings: only the nonexceptional positions81are required to pair identical entries. -/82abbrev AgreementMatching (x y : Fin p → E) (S : Finset (Fin p)) :=83  {σ : Equiv.Perm (Fin p) // ∀ a, a ∉ S → x a=y (σ a)}8485/-- Restriction to the exceptional and marked positions determines the86entire permutation. This estimate has no probabilistic hypotheses. -/87theorem card_agreementMatching_le (x y : Fin p → E) (S : Finset (Fin p)) :88    Fintype.card (AgreementMatching x y S) ≤ p^(S.card+3*excessOccurrences89      (List.ofFn x ++ List.ofFn y)) := by90  classical91  let B := S ∪ marked x y92  let enc : AgreementMatching x y S → (B → Fin p) := fun σ a => σ.val a.val93  have hi : Function.Injective enc := by94    intro σ τ h95    apply Subtype.ext96    apply Equiv.ext97    intro a98    by_cases ha : a ∈ B99    · exact congrFun h ⟨a,ha⟩100    · have hS : a ∉ S := fun hs => ha (Finset.mem_union_left _ hs)101      have hM : a ∉ marked x y := fun hm => ha (Finset.mem_union_right _ hm)102      exact target_unique_of_not_marked x y a hM (σ.val a) (τ.val a)103        (σ.property a hS).symm (τ.property a hS).symm104  have hcard := Fintype.card_le_of_injective enc hi105  have hpow : B.card ≤ S.card+3*excessOccurrences (List.ofFn x ++ List.ofFn y) :=106    (Finset.card_union_le S (marked x y)).trans107      (Nat.add_le_add_left (marked_card_le_three_excess x y) S.card)108  calc109    _ ≤ p^B.card := by simpa only [Fintype.card_fun,Fintype.card_fin,Fintype.card_coe] using hcard110    _ ≤ _ := by111      by_cases hp : p=0112      · subst p113        simp [B,S.eq_empty_of_isEmpty,marked,excessOccurrences]114      · exact Nat.pow_le_pow_right (by omega) hpow115116/-- Actual row and column matchings with prescribed relative permutation. -/117abbrev RelativeMatching {R C : Type*} (i k : Fin p → R) (j l : Fin p → C)118    (α : Equiv.Perm (Fin p)) :=119  {σ : Equiv.Perm (Fin p) // i=k ∘ σ ∧ j=l ∘ (σ*α)}120121/-- With the relative matching fixed, the number of compatible pairs is122bounded by support size and the actual entry-multiplicity excess. -/123theorem card_relativeMatching_le {R C : Type*} [DecidableEq R] [DecidableEq C]124    (i k : Fin p → R) (j l : Fin p → C) (α : Equiv.Perm (Fin p)) :125    Fintype.card (RelativeMatching i k j l α) ≤ p^(α.support.card+126      3*excessOccurrences (List.ofFn (fun a => (i a,j a)) ++127        List.ofFn (fun a => (k a,l a)))) := by128  classical129  let f : RelativeMatching i k j l α →130      AgreementMatching (fun a => (i a,j a)) (fun a => (k a,l a)) α.support := fun σ =>131    ⟨σ.val,by132      intro a ha133      have hα : α a=a := by simpa only [Equiv.Perm.mem_support,not_not] using ha134      apply Prod.ext135      · exact congrFun σ.property.1 a136      · simpa only [Function.comp_apply,Equiv.Perm.mul_apply,hα] using congrFun σ.property.2 a⟩137  have hf : Function.Injective f := by138    intro σ τ h139    apply Subtype.ext140    exact congrArg (fun z : AgreementMatching (fun a => (i a,j a))141      (fun a => (k a,l a)) α.support => z.val) h142  exact (Fintype.card_le_of_injective f hf).trans (card_agreementMatching_le _ _ α.support)143144end Nonadditivity.HaarMatchingCount