Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarPathClasses

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

Direct imports

Imported by project modules

4 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

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

33 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathTree7import Mathlib.Logic.Equiv.Fintype89/-! # Literal vertex-and-local-color path equivalence1011BC's first path equivalence simultaneously preserves repeated vertices and12repeated colors at each vertex. Both directions of every traversal are part13of the incidence data. This file constructs the relabelling permutations14from equality patterns; they are not supplied as an assumption.15-/16noncomputable section17namespace Nonadditivity.HaarPathClasses18open HaarPathGraph HaarPathProfiles19variable {A E : Type*}2021/-- Equality of two labeling kernels gives an actual bijection of their ranges. -/22def rangeEquivOfKernel (f g : A → E)23    (h : ∀ a b, f a=f b ↔ g a=g b) : Set.range f ≃ Set.range g where24  toFun x := ⟨g (Classical.choose x.property),⟨_,rfl⟩⟩25  invFun y := ⟨f (Classical.choose y.property),⟨_,rfl⟩⟩26  left_inv x := by27    apply Subtype.ext28    have he := Classical.choose_spec x.property29    have he' := Classical.choose_spec30      (show g (Classical.choose x.property) ∈ Set.range g from ⟨_,rfl⟩)31    exact ((h _ _).mpr he').trans he32  right_inv y := by33    apply Subtype.ext34    have he := Classical.choose_spec y.property35    have he' := Classical.choose_spec36      (show f (Classical.choose y.property) ∈ Set.range f from ⟨_,rfl⟩)37    exact ((h _ _).mp he').trans he3839theorem rangeEquivOfKernel_apply (f g : A → E)40    (h : ∀ a b, f a=f b ↔ g a=g b) (a : A) :41    (rangeEquivOfKernel f g h ⟨f a,⟨a,rfl⟩⟩).val=g a := by42  exact (h _ _).mp (Classical.choose_spec (show f a∈Set.range f from ⟨a,rfl⟩))4344/-- For a finite label alphabet, the range bijection extends to a genuine45permutation of the whole alphabet. -/46theorem exists_perm_of_kernel_eq [Fintype E] (f g : A → E)47    (h : ∀ a b, f a=f b ↔ g a=g b) :48    ∃ σ : Equiv.Perm E, ∀ a, σ (f a)=g a := by49  classical50  let e := rangeEquivOfKernel f g h51  refine ⟨e.extendSubtype,fun a => ?_⟩52  rw [Equiv.extendSubtype_apply_of_mem e (f a) ⟨a,rfl⟩]53  exact rangeEquivOfKernel_apply f g h a5455variable {V : Type*} {d m : ℕ}5657abbrev Incidence (m : ℕ) := Fin m × Bool5859def incidenceVertex (P : Path V d m) (a : Incidence m) : V :=60  if a.2 then P.vertex a.1.castSucc else P.vertex a.1.succ6162def incidenceColor (P : Path V d m) (a : Incidence m) : Color d :=63  if a.2 then P.colors a.1 else flipColor (P.colors a.1)6465def incidenceIndex (a : Incidence m) : Fin (m+1) :=66  if a.2 then a.1.castSucc else a.1.succ6768@[simp] theorem incidenceVertex_eq (P : Path V d m) (a : Incidence m) :69    incidenceVertex P a=P.vertex (incidenceIndex a) := by70  obtain ⟨i,b⟩ := a71  cases b <;> rfl7273/-- The exact local-color relabelling relation on actual paths. Requiring74both incidences of each edge is BC's compatibility at its two endpoints. -/75def Relabeled (P Q : Path V d m) : Prop :=76  ∃ τ : Equiv.Perm V, ∃ β : V → Equiv.Perm (Color d),77    (∀ j, τ (P.vertex j)=Q.vertex j) ∧78    ∀ a, β (incidenceVertex P a) (incidenceColor P a)=incidenceColor Q a7980/-- Finite observable equality patterns of vertices and local colors. -/81def SamePattern (P Q : Path V d m) : Prop :=82  (∀ i j, P.vertex i=P.vertex j ↔ Q.vertex i=Q.vertex j) ∧83  ∀ a b, incidenceVertex P a=incidenceVertex P b →84    (incidenceColor P a=incidenceColor P b ↔ incidenceColor Q a=incidenceColor Q b)8586theorem relabeled_samePattern {P Q : Path V d m} (h : Relabeled P Q) :87    SamePattern P Q := by88  obtain ⟨τ,β,hv,hc⟩ := h89  constructor90  · intro i j91    rw [←hv i,←hv j]92    exact τ.injective.eq_iff.symm93  · intro a b hab94    rw [←hc a,←hc b,hab]95    exact (β (incidenceVertex P b)).injective.eq_iff.symm9697/-- Actual construction of all global and local permutations from patterns. -/98theorem samePattern_relabeled [Fintype V] {P Q : Path V d m}99    (h : SamePattern P Q) : Relabeled P Q := by100  classical101  obtain ⟨τ,hτ⟩ := exists_perm_of_kernel_eq P.vertex Q.vertex h.1102  have hlocal (v : V) : ∃ β : Equiv.Perm (Color d),103      ∀ a : {a : Incidence m // incidenceVertex P a=v},104        β (incidenceColor P a.val)=incidenceColor Q a.val := by105    apply exists_perm_of_kernel_eq106    intro a b107    exact h.2 a.val b.val (a.property.trans b.property.symm)108  choose β hβ using hlocal109  refine ⟨τ,β,hτ,fun a => ?_⟩110  exact hβ (incidenceVertex P a) ⟨a,rfl⟩111112theorem relabeled_iff_samePattern [Fintype V] (P Q : Path V d m) :113    Relabeled P Q ↔ SamePattern P Q :=114  ⟨relabeled_samePattern,samePattern_relabeled⟩115116/-- Coarse path equivalence is an actual equivalence relation. -/117theorem samePattern_equivalence : Equivalence (@SamePattern V d m) := by118  constructor119  · intro P120    exact ⟨fun _ _ => Iff.rfl,fun _ _ _ => Iff.rfl⟩121  · intro P Q h122    refine ⟨fun i j => (h.1 i j).symm,fun a b hab => ?_⟩123    have hbase : incidenceVertex P a=incidenceVertex P b := by124      simp only [incidenceVertex_eq]125      apply (h.1 (incidenceIndex a) (incidenceIndex b)).mpr126      simpa only [incidenceVertex_eq] using hab127    exact (h.2 a b hbase).symm128  · intro P Q R hp hq129    refine ⟨fun i j => (hp.1 i j).trans (hq.1 i j),fun a b hab => ?_⟩130    have hbase : incidenceVertex Q a=incidenceVertex Q b := by131      simp only [incidenceVertex_eq]132      apply (hp.1 (incidenceIndex a) (incidenceIndex b)).mp133      simpa only [incidenceVertex_eq] using hab134    exact (hp.2 a b hab).trans (hq.2 a b hbase)135136def pathSetoid : Setoid (Path V d m) := ⟨SamePattern,samePattern_equivalence⟩137138/-- The quotient in the path counting problem, with the paper's genuine139relabeling relation characterized above. -/140abbrev PathClass (V : Type*) (d m : ℕ) := Quotient (@pathSetoid V d m)141142/-- A finite Boolean code for the entire incidence pattern. This initial143normal form is exact; its later sparse encoding uses exploration marks. -/144def patternCode [DecidableEq V] (P : Path V d m) :145    ((Fin (m+1) × Fin (m+1)) → Bool) × ((Incidence m × Incidence m) → Bool) :=146  (fun p => decide (P.vertex p.1=P.vertex p.2),147   fun p => decide (incidenceVertex P p.1=incidenceVertex P p.2 ∧148     incidenceColor P p.1=incidenceColor P p.2))149150theorem patternCode_eq_iff [DecidableEq V] (P Q : Path V d m) :151    patternCode P=patternCode Q ↔ SamePattern P Q := by152  constructor153  · intro h154    have hv : ∀ i j, P.vertex i=P.vertex j ↔ Q.vertex i=Q.vertex j := by155      intro i j156      have he := congrFun (congrArg Prod.fst h) (i,j)157      simpa only [patternCode,decide_eq_decide] using he158    refine ⟨hv,fun a b hab => ?_⟩159    have hab' : incidenceVertex Q a=incidenceVertex Q b := by160      simp only [incidenceVertex_eq]161      apply (hv (incidenceIndex a) (incidenceIndex b)).mp162      simpa only [incidenceVertex_eq] using hab163    have he := congrFun (congrArg Prod.snd h) (a,b)164    simpa only [patternCode,hab,hab',true_and,decide_eq_decide] using he165  · intro h166    apply Prod.ext167    · funext p168      exact decide_eq_decide.mpr (h.1 p.1 p.2)169    · funext p170      apply decide_eq_decide.mpr171      have hv : incidenceVertex P p.1=incidenceVertex P p.2 ↔172          incidenceVertex Q p.1=incidenceVertex Q p.2 := by173        simpa only [incidenceVertex_eq] using h.1 (incidenceIndex p.1) (incidenceIndex p.2)174      constructor175      · rintro ⟨hb,hc⟩176        exact ⟨hv.mp hb,(h.2 p.1 p.2 hb).mp hc⟩177      · rintro ⟨hb,hc⟩178        exact ⟨hv.mpr hb,(h.2 p.1 p.2 (hv.mpr hb)).mpr hc⟩179180/-- An injective, actual finite representation of the path quotient. -/181def classPatternCode [DecidableEq V] (C : PathClass V d m) :=182  Quotient.lift patternCode183    (fun _ _ h => (patternCode_eq_iff _ _).mpr h) C184185theorem classPatternCode_injective [DecidableEq V] :186    Function.Injective (@classPatternCode V d m _) := by187  intro a b188  induction a using Quotient.inductionOn with189  | h P =>190    induction b using Quotient.inductionOn with191    | h Q =>192      intro he193      apply Quotient.sound194      exact (patternCode_eq_iff P Q).mp he195196instance [DecidableEq V] : Fintype (PathClass V d m) :=197  Fintype.ofInjective classPatternCode classPatternCode_injective198199end Nonadditivity.HaarPathClasses