Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarChainMultiplicity

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

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

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

18 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarCoreChainLabels7import Nonadditivity.HaarPathChainProfiles89/-! # Edge multiplicities in the actual maximal-chain decomposition1011An original colored edge occurs exactly as often as its orientation-free12core-chain label. In particular the singleton edge budget is exactly the sum13of the lengths of singleton core chains.14-/15noncomputable section16open scoped BigOperators17namespace Nonadditivity.HaarPathGraph.Path18variable {V : Type*} [DecidableEq V] {d m : ℕ} (P : Path V d m)1920def chainEdges (c : P.CoreChain) : List (Edge V d) := c.val.map Prod.fst2122@[simp] theorem chainEdges_reverse (c : P.CoreChain) :23    P.chainEdges (P.coreChainReverse c) = (P.chainEdges c).reverse := by24  change ((c.val.reverse.map reverse).map Prod.fst) = (c.val.map Prod.fst).reverse25  simp [List.map_map, reverse, List.map_reverse]2627theorem chainLabel_eq_of_common_edge (c c' : P.CoreChain) {e : Edge V d}28    (he : e ∈ P.chainEdges c) (he' : e ∈ P.chainEdges c') :29    P.chainLabel c = P.chainLabel c' := by30  obtain ⟨q,hq,hqe⟩ := List.mem_map.mp he31  obtain ⟨q',hq',hq'e⟩ := List.mem_map.mp he'32  have hfst : q.1 = q'.1 := hqe.trans hq'e.symm33  have hor : q = q' ∨ q = reverse q' := by34    obtain ⟨a,b⟩ := q35    obtain ⟨a',b'⟩ := q'36    change a=a' at hfst37    subst a'38    cases b <;> cases b' <;> simp [reverse]39  rcases hor with rfl | hrev40  · rw [P.coreChain_eq_of_common_dart c c' hq hq']41  · have hmem : q ∈ (P.coreChainReverse c').val := by42      change q ∈ c'.val.reverse.map reverse43      exact List.mem_map.mpr ⟨q',List.mem_reverse.mpr hq',hrev.symm⟩44    rw [P.coreChain_eq_of_common_dart c (P.coreChainReverse c') hq hmem,45      P.chainLabel_reverse]4647theorem chainEdges_mem_of_label_eq (c c' : P.CoreChain)48    (h : P.chainLabel c = P.chainLabel c') {e : Edge V d}49    (he : e ∈ P.chainEdges c) : e ∈ P.chainEdges c' := by50  have hmem : c ∈ ({c',P.coreChainReverse c'} : Finset P.CoreChain) := by51    have hv := congrArg Subtype.val h52    change {c,P.coreChainReverse c} = {c',P.coreChainReverse c'} at hv53    rw [←hv]54    simp55  rcases Finset.mem_insert.mp hmem with rfl | hc56  · exact he57  · have hc := Finset.mem_singleton.mp hc58    simpa [hc] using he5960theorem chainEdges_count (c c' : P.CoreChain) {e : Edge V d}61    (he : e ∈ P.chainEdges c') :62    (P.chainEdges c).count e = if P.chainLabel c = P.chainLabel c' then 1 else 0 := by63  split_ifs with h64  · exact List.count_eq_one_of_mem (P.coreChain_edges_nodup c)65      (P.chainEdges_mem_of_label_eq c' c h.symm he)66  · apply List.count_eq_zero.mpr67    intro hc68    exact h (P.chainLabel_eq_of_common_edge c c' hc he)6970theorem edgeList_eq_flatMap_chainEdges (cs : List P.CoreChain)71    (hcs : (cs.map Subtype.val).flatten = P.traversalList) :72    P.edgeList = cs.flatMap P.chainEdges := by73  have hh := congrArg (List.map Prod.fst) hcs74  have he : P.traversalList.map Prod.fst = P.edgeList := by75    simp only [traversalList,edgeList,List.map_ofFn]76    rfl77  rw [he,List.map_flatten,List.map_map] at hh78  exact hh.symm7980theorem count_flatMap_chainEdges (cs : List P.CoreChain) (c : P.CoreChain)81    {e : Edge V d} (he : e ∈ P.chainEdges c) :82    (cs.flatMap P.chainEdges).count e = (cs.map P.chainLabel).count (P.chainLabel c) := by83  induction cs with84  | nil => simp85  | cons a cs ih =>86      simp only [List.flatMap_cons,List.count_append,List.map_cons,List.count_cons]87      rw [P.chainEdges_count a c he,ih]88      by_cases h : P.chainLabel a = P.chainLabel c89      · simp [h]90        omega91      · simp [h]9293theorem edge_count_eq_chain_count (cs : List P.CoreChain)94    (hcs : (cs.map Subtype.val).flatten = P.traversalList)95    (c : P.CoreChain) {e : Edge V d} (he : e ∈ P.chainEdges c) :96    P.edgeList.count e = (cs.map P.chainLabel).count (P.chainLabel c) := by97  rw [P.edgeList_eq_flatMap_chainEdges cs hcs]98  exact P.count_flatMap_chainEdges cs c he99100def labelEdges (e : P.unorientedChains) : Finset (Edge V d) :=101  (P.chainEdges (P.representative e)).toFinset102103theorem labelEdges_card (e : P.unorientedChains) :104    (P.labelEdges e).card = (P.representative e).val.length := by105  rw [labelEdges,chainEdges,List.toFinset_card_of_nodup (P.coreChain_edges_nodup _)]106  exact List.length_map _107108theorem labelEdges_disjoint {e e' : P.unorientedChains} (h : e ≠ e') :109    Disjoint (P.labelEdges e) (P.labelEdges e') := by110  apply Finset.disjoint_left.mpr111  intro q hq hq'112  apply h113  have he := P.chainLabel_eq_of_common_edge (P.representative e) (P.representative e')114    (List.mem_toFinset.mp hq) (List.mem_toFinset.mp hq')115  simpa [P.label_representative] using he116117theorem edge_mem_labelEdges (cs : List P.CoreChain)118    (hcs : (cs.map Subtype.val).flatten = P.traversalList)119    (q : Edge V d) (hq : q ∈ P.edges) :120    ∃ e : P.unorientedChains, q ∈ P.labelEdges e := by121  have hm : q ∈ cs.flatMap P.chainEdges := by122    rw [←P.edgeList_eq_flatMap_chainEdges cs hcs]123    exact List.mem_toFinset.mp hq124  obtain ⟨c,hc,hqc⟩ := List.mem_flatMap.mp hm125  refine ⟨P.chainLabel c,List.mem_toFinset.mpr ?_⟩126  exact P.chainEdges_mem_of_label_eq c (P.representative (P.chainLabel c))127    (P.label_representative _).symm hqc128129theorem labelEdges_subset (e : P.unorientedChains) : P.labelEdges e ⊆ P.edges := by130  intro q hq131  obtain ⟨a,ha,rfl⟩ := List.mem_map.mp (List.mem_toFinset.mp hq)132  exact (Finset.mem_product.mp (P.toCore_mem (P.representative e).property.1 ha)).1133134theorem singletonEdges_eq_biUnion (cs : List P.CoreChain)135    (hcs : (cs.map Subtype.val).flatten = P.traversalList) :136    HaarPathMultiplicity.singletonEdges P.edgeList =137      (Finset.univ.filter (fun e => (cs.map P.chainLabel).count e = 1)).biUnion138        P.labelEdges := by139  ext q140  constructor141  · intro hq142    obtain ⟨hqe,hcount⟩ := Finset.mem_filter.mp hq143    obtain ⟨e,he⟩ := P.edge_mem_labelEdges cs hcs q hqe144    refine Finset.mem_biUnion.mpr ⟨e,Finset.mem_filter.mpr ⟨Finset.mem_univ _,?_⟩,he⟩145    have hh := P.edge_count_eq_chain_count cs hcs (P.representative e)146      (List.mem_toFinset.mp he)147    have hcount' : P.edgeList.count q=1 := by148      simpa only [List.count_eq_countP,Bool.beq_eq_decide_eq] using hcount149    simpa [P.label_representative] using hh.symm.trans hcount'150  · intro hq151    obtain ⟨e,he,hqe⟩ := Finset.mem_biUnion.mp hq152    refine Finset.mem_filter.mpr ⟨P.labelEdges_subset e hqe,?_⟩153    have hh := P.edge_count_eq_chain_count cs hcs (P.representative e)154      (List.mem_toFinset.mp hqe)155    simpa only [List.count_eq_countP,Bool.beq_eq_decide_eq] using hh.trans156      (by simpa [P.label_representative] using (Finset.mem_filter.mp he).2)157158/-- Exact transfer of the original singleton budget to compressed labels. -/159theorem singletonEdges_card_eq_chain_lengths (cs : List P.CoreChain)160    (hcs : (cs.map Subtype.val).flatten = P.traversalList) :161    (HaarPathMultiplicity.singletonEdges P.edgeList).card =162      ∑ e ∈ Finset.univ.filter (fun e => (cs.map P.chainLabel).count e = 1),163        (P.representative e).val.length := by164  rw [P.singletonEdges_eq_biUnion cs hcs]165  rw [Finset.card_biUnion]166  · exact Finset.sum_congr rfl (fun e he => P.labelEdges_card e)167  · intro e he e' he' hne168    exact P.labelEdges_disjoint hne169170end Nonadditivity.HaarPathGraph.Path