Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarProfilePermutations

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

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

13 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathRefined7import Nonadditivity.HaarMatchingCount8import Mathlib.GroupTheory.Perm.Support910/-! # Profile-preserving permutations of chain positions -/11noncomputable section12attribute [local instance 2000] instBEqOfDecidableEq13attribute [local instance 2000] instBEqOfDecidableEq14set_option backward.isDefEq.respectTransparency false15set_option maxHeartbeats 100000016namespace Nonadditivity.HaarProfilePermutations17open scoped BigOperators18variable {I E : Type*} [Fintype I] [DecidableEq I] [DecidableEq E]1920/-- Equal label-fiber sizes supply an actual label-preserving bijection. -/21def labelEquiv (f g : I → E)22    (h : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e}) : I ≃ I :=23  Equiv.ofFiberEquiv (fun e => Fintype.equivOfCardEq (h e))2425theorem labelEquiv_map (f g : I → E)26    (h : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e}) (i : I) :27    g (labelEquiv f g h i)=f i := Equiv.ofFiberEquiv_map _ i2829lemma restricted_fiber_card (f : I → E) (S : Finset I) (e : E) :30    Fintype.card {i : {i : I // i ∉ S} // f i.val=e} =31      ((Finset.univ.filter (fun i => f i=e)).filter (fun i => i ∉ S)).card := by32  let e' : {i : {i : I // i ∉ S} // f i.val=e} ≃ {i : I // i ∉ S ∧ f i=e} :=33    ⟨fun i => ⟨i.val.val,i.val.property,i.property⟩,34      fun i => ⟨⟨i.val,i.property.1⟩,i.property.2⟩,35      fun _ => rfl,fun _ => rfl⟩36  rw [Fintype.card_congr e',Fintype.card_subtype,Finset.filter_filter]37  congr 138  ext i39  simp [and_comm]4041/-- A matching can be chosen to fix any designated positions at which the42labels already agree. This is used for the first and last edges of a chain. -/43theorem exists_perm_labels_fix (f g : I → E) (S : Finset I)44    (hcount : ∀ e, Fintype.card {i // f i=e}=Fintype.card {i // g i=e})45    (hfix : ∀ i ∈ S, f i=g i) :46    ∃ σ : Equiv.Perm I, (∀ i, g (σ i)=f i) ∧ ∀ i ∈ S, σ i=i := by47  have hr : ∀ e, Fintype.card {i : {i : I // i ∉ S} // f i.val=e} =48      Fintype.card {i : {i : I // i ∉ S} // g i.val=e} := by49    intro e50    rw [restricted_fiber_card,restricted_fiber_card]51    have hc := hcount e52    rw [Fintype.card_subtype,Fintype.card_subtype] at hc53    have hs : ((Finset.univ.filter (fun i => f i=e)).filter (fun i => i ∈ S)) =54        ((Finset.univ.filter (fun i => g i=e)).filter (fun i => i ∈ S)) := by55      ext i56      simp only [Finset.mem_filter,Finset.mem_univ,true_and]57      constructor58      · rintro ⟨he,hi⟩59        exact ⟨(hfix i hi).symm.trans he,hi⟩60      · rintro ⟨he,hi⟩61        exact ⟨(hfix i hi).trans he,hi⟩62    have h₁ := Finset.card_filter_add_card_filter_not63      (s := Finset.univ.filter (fun i => f i=e)) (fun i => i ∈ S)64    have h₂ := Finset.card_filter_add_card_filter_not65      (s := Finset.univ.filter (fun i => g i=e)) (fun i => i ∈ S)66    rw [hs] at h₁67    omega68  let e := labelEquiv (fun i : {i : I // i ∉ S} => f i.val)69    (fun i : {i : I // i ∉ S} => g i.val) hr70  refine ⟨Equiv.Perm.ofSubtype e,?_,?_⟩71  · intro i72    by_cases hi : i ∈ S73    · rw [Equiv.Perm.ofSubtype_apply_of_not_mem e (by simpa using hi)]74      exact (hfix i hi).symm75    · rw [Equiv.Perm.ofSubtype_apply_of_mem e hi]76      exact labelEquiv_map _ _ hr ⟨i,hi⟩77  · intro i hi78    exact Equiv.Perm.ofSubtype_apply_of_not_mem e (by simpa using hi)7980section Chains81open HaarPathGraph HaarPathClasses82variable {V : Type*} [Fintype V] [DecidableEq V] {d m : ℕ}83variable {P Q : Path V d m}8485lemma coreChainProfile_count (c : P.CoreChain) (a : HaarPathProfiles.Color d) :86    (P.coreChainProfile c).val.count a=(c.val.map color).count a := by87  obtain ⟨q,l,he,hq⟩ := c.property.288  simp [Path.coreChainProfile,he,HaarPathProfiles.wordProfile]8990lemma coreChainProfile_first (c : P.CoreChain) :91    (P.coreChainProfile c).val.first=color (c.val.head (P.toCore_nonempty c.property.1)) := rfl9293lemma coreChainProfile_last (c : P.CoreChain) :94    (P.coreChainProfile c).val.last=color (c.val.getLast (P.toCore_nonempty c.property.1)) := by95  obtain ⟨q,l,he,hq⟩ := c.property.296  simp only [Path.coreChainProfile,he,HaarPathProfiles.wordProfile,List.head_cons,List.tail_cons]97  exact List.getLast_map (l := q::l) (f := color) (by simp)9899/-- Equal profiles give a permutation of edge positions preserving colors100and fixing the first and last positions, including chains of length one. -/101theorem exists_coreChain_positionPerm (h : RefinedPattern P Q) (c : P.CoreChain) :102    ∃ σ : Equiv.Perm (Fin c.val.length),103      (∀ i, color (h.samePattern.dartPerm (c.val.get (σ i)))=color (c.val.get i)) ∧104      ∀ i, (i.val=0 ∨ i.val+1=c.val.length) → σ i=i := by105  classical106  let f : Fin c.val.length → HaarPathProfiles.Color d := fun i => color (c.val.get i)107  let g : Fin c.val.length → HaarPathProfiles.Color d :=108    fun i => color (h.samePattern.dartPerm (c.val.get i))109  let S := Finset.univ.filter (fun i : Fin c.val.length => i.val=0 ∨ i.val+1=c.val.length)110  have hprofile := h.profile_eq c111  have hcount : ∀ a, Fintype.card {i // f i=a}=Fintype.card {i // g i=a} := by112    intro a113    have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.count a) hprofile114    dsimp only at he115    rw [coreChainProfile_count,coreChainProfile_count] at he116    simp only [SamePattern.coreChainEquiv_apply,SamePattern.coreChainMap_val,List.map_map] at he117    rw [Fintype.card_subtype,Fintype.card_subtype,118      ←HaarMatchingCount.count_ofFn_eq_card,←HaarMatchingCount.count_ofFn_eq_card]119    simpa only [f,g,List.ofFn_comp',List.ofFn_get,List.map_map] using he120  have hfirst : color (c.val.head (P.toCore_nonempty c.property.1)) =121      color (h.samePattern.dartPerm (c.val.head (P.toCore_nonempty c.property.1))) := by122    have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.first) hprofile123    simpa only [coreChainProfile_first,SamePattern.coreChainEquiv_apply,124      SamePattern.coreChainMap_val,List.head_map] using he125  have hlast : color (c.val.getLast (P.toCore_nonempty c.property.1)) =126      color (h.samePattern.dartPerm (c.val.getLast (P.toCore_nonempty c.property.1))) := by127    have he := congrArg (fun p : HaarPathProfiles.BoundedProfile (HaarPathProfiles.Color d) m => p.val.last) hprofile128    simpa only [coreChainProfile_last,SamePattern.coreChainEquiv_apply,129      SamePattern.coreChainMap_val,List.getLast_map] using he130  have hfix : ∀ i ∈ S, f i=g i := by131    intro i hi132    have hi' := (Finset.mem_filter.mp hi).2133    change color (c.val.get i)=color (h.samePattern.dartPerm (c.val.get i))134    rcases hi' with hi | hi135    · have he : c.val.get i=c.val.head (P.toCore_nonempty c.property.1) := by136        simp only [List.get_eq_getElem,List.head_eq_getElem,hi]137      simpa only [he] using hfirst138    · have he : c.val.get i=c.val.getLast (P.toCore_nonempty c.property.1) := by139        simp only [List.get_eq_getElem,List.getLast_eq_getElem]140        congr 1141        omega142      simpa only [he] using hlast143  obtain ⟨σ,hσ,hS⟩ := exists_perm_labels_fix f g S hcount hfix144  exact ⟨σ,hσ,fun i hi => hS i (by simp [S,hi])⟩145146end Chains147end Nonadditivity.HaarProfilePermutations