Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarPathChains

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

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

57 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathGraph7import Mathlib.Data.List.Induction8import Mathlib.Data.List.Chain910/-! # Deterministic chains between core vertices1112A reduced chain cannot choose a branch before reaching a core vertex: at13an internal vertex of degree two the incoming dart excludes one incidence14and forces the next dart. This file formalizes that uniqueness for actual15colored graph darts, rather than assuming a chain reconstruction oracle.16-/17noncomputable section18namespace Nonadditivity.HaarPathGraph19open HaarPathProfiles20variable {V : Type*} {d m : ℕ}2122@[simp] theorem reverse_reverse (q : Dart V d) : reverse (reverse q) = q := by23  simp [reverse]2425theorem reverse_ne_self (q : Dart V d) : reverse q ≠ q := by26  obtain ⟨e,b⟩ := q27  cases b <;> simp [reverse]2829/-- A nonempty reduced dart word cannot equal its reverse with all30orientations reversed. The middle dart or middle pair would backtrack. -/31theorem reduced_ne_reverse (l : List (Dart V d)) (hne : l ≠ [])32    (hred : l.IsChain fun a b => b ≠ reverse a) : l.reverse.map reverse ≠ l := by33  induction l using List.bidirectionalRecOn with34  | H0 => exact (hne rfl).elim35  | H1 a =>36      simpa using reverse_ne_self a37  | Hn a l b ih =>38      intro he39      have hba : reverse b=a := by40        simpa using congrArg List.head? he41      have hab : reverse a=b := by rw [←hba,reverse_reverse]42      have he' : l.reverse.map reverse=l := by43        simp only [List.reverse_cons,List.reverse_append,44          List.map_append,List.map_cons,List.map_nil,45          hba,hab] at he46        exact List.append_cancel_right (List.cons.inj he).247      by_cases hl : l=[]48      · subst l49        have hr : b ≠ reverse a := by simpa using hred50        exact hr hab.symm51      · exact ih hl hred.tail.left_of_append he'5253namespace Path54variable [DecidableEq V] (P : Path V d m)5556lemma reverse_mem {q : Dart V d} (hq : q ∈ P.darts) : reverse q ∈ P.darts := by57  simpa only [darts, Finset.mem_product, Finset.mem_univ, and_true, reverse] using hq5859/-- The degree-two condition uniquely determines the continuation away from60an incoming incidence. -/61theorem next_dart_unique {a b c : Dart V d}62    (ha : a ∈ P.darts) (hb : b ∈ P.darts) (hc : c ∈ P.darts)63    (hcore : source a ∉ P.coreVertices)64    (hab : source a=source b) (hac : source a=source c)65    (hba : b ≠ a) (hca : c ≠ a) : b=c := by66  have hv := P.source_mem ha67  have hdeg : P.degree (source a)=2 := by68    by_contra h69    exact hcore (Finset.mem_filter.mpr ⟨hv,Or.inr h⟩)70  let S := P.darts.filter fun q => source q=source a71  have hsub : {a,b} ⊆ S := by72    intro q hq73    rcases Finset.mem_insert.mp hq with rfl | hq74    · exact Finset.mem_filter.mpr ⟨ha,rfl⟩75    · rw [Finset.mem_singleton] at hq76      subst q77      exact Finset.mem_filter.mpr ⟨hb,hab.symm⟩78  have heq : {a,b}=S := Finset.eq_of_subset_of_card_le hsub (by79    change P.degree (source a) ≤ _80    simp [hdeg,Ne.symm hba])81  have hcm : c ∈ ({a,b} : Finset (Dart V d)) := by82    rw [heq]83    exact Finset.mem_filter.mpr ⟨hc,hac.symm⟩84  exact (by simpa [hca] using hcm : c=b).symm8586/-- A chain stopped on first arrival at a core vertex. Its initial vertex may87be arbitrary; the complete chains later require a core initial vertex too. -/88inductive ToCore : List (Dart V d) → Prop89  | last (a : Dart V d) (ha : a ∈ P.darts)90      (hcore : source (reverse a) ∈ P.coreVertices) : ToCore [a]91  | cons (a b : Dart V d) (l : List (Dart V d))92      (ha : a ∈ P.darts) (hcore : source (reverse a) ∉ P.coreVertices)93      (hjoin : source (reverse a)=source b) (hred : b ≠ reverse a)94      (htail : ToCore (b::l)) : ToCore (a::b::l)9596lemma toCore_nonempty {l : List (Dart V d)} (h : P.ToCore l) : l ≠ [] := by97  cases h <;> simp9899lemma toCore_head_mem {a : Dart V d} {l : List (Dart V d)} (h : P.ToCore (a::l)) :100    a ∈ P.darts := by cases h <;> assumption101102/-- Exact deterministic reconstruction from the initial dart. -/103theorem toCore_unique {l : List (Dart V d)} (h : P.ToCore l) :104    ∀ {l' : List (Dart V d)}, P.ToCore l' → l.head?=l'.head? → l=l' := by105  induction h with106  | last a ha hcore =>107      intro l' h' hhead108      cases h' with109      | last b hb hbcore => simpa using hhead110      | cons b c l hb hbcore hjoin hred htail =>111          have hab : a=b := by simpa using hhead112          subst b113          exact (hbcore hcore).elim114  | cons a b l ha hcore hjoin hred htail ih =>115      intro l' h' hhead116      cases h' with117      | last c hc hccore =>118          have hac : a=c := by simpa using hhead119          subst c120          exact (hcore hccore).elim121      | cons c e s hc hccore hcjoin hcred hctail =>122          have hac : a=c := by simpa using hhead123          subst c124          have hbe : b=e := P.next_dart_unique (P.reverse_mem ha)125            (P.toCore_head_mem htail) (P.toCore_head_mem hctail) hcore hjoin hcjoin hred hcred126          subst e127          exact congrArg (List.cons a) (ih hctail rfl)128129/-- The same reduced chains before specifying their terminal vertex. -/130inductive InternalChain : List (Dart V d) → Prop131  | single (a : Dart V d) (ha : a ∈ P.darts) : InternalChain [a]132  | cons (a b : Dart V d) (l : List (Dart V d))133      (ha : a ∈ P.darts) (hcore : source (reverse a) ∉ P.coreVertices)134      (hjoin : source (reverse a)=source b) (hred : b ≠ reverse a)135      (htail : InternalChain (b::l)) : InternalChain (a::b::l)136137lemma internalChain_nonempty {l : List (Dart V d)} (h : P.InternalChain l) : l ≠ [] := by138  cases h <;> simp139140lemma ToCore.internalChain {l : List (Dart V d)} (h : P.ToCore l) : P.InternalChain l := by141  induction h with142  | last a ha hc => exact InternalChain.single a ha143  | cons a b l ha hc hj hr ht ih => exact InternalChain.cons a b l ha hc hj hr ih144145lemma toCore_last_core {l : List (Dart V d)} (h : P.ToCore l) :146    source (reverse (l.getLast (P.toCore_nonempty h))) ∈ P.coreVertices := by147  induction h with148  | last a ha hc => simpa using hc149  | cons a b l ha hc hj hr ht ih => simpa using ih150151lemma internalChain_toCore {l : List (Dart V d)} (h : P.InternalChain l)152    (hc : source (reverse (l.getLast (P.internalChain_nonempty h))) ∈ P.coreVertices) :153    P.ToCore l := by154  induction h with155  | single a ha => exact ToCore.last a ha (by simpa using hc)156  | cons a b l ha hcore hj hr ht ih =>157      exact ToCore.cons a b l ha hcore hj hr (ih (by simpa using hc))158159/-- Appending one edge checks only the old final incidence. -/160theorem internalChain_append {l : List (Dart V d)} (h : P.InternalChain l)161    (b : Dart V d) (hb : b ∈ P.darts)162    (hcore : source (reverse (l.getLast (P.internalChain_nonempty h))) ∉ P.coreVertices)163    (hjoin : source (reverse (l.getLast (P.internalChain_nonempty h)))=source b)164    (hred : b ≠ reverse (l.getLast (P.internalChain_nonempty h))) :165    P.InternalChain (l++[b]) := by166  induction h with167  | single a ha =>168      exact InternalChain.cons a b [] ha (by simpa using hcore)169        (by simpa using hjoin) (by simpa using hred) (InternalChain.single b hb)170  | cons a c l ha hc hj hr ht ih =>171      exact InternalChain.cons a c (l++[b]) ha hc hj hr172        (ih (by simpa using hcore) (by simpa using hjoin) (by simpa using hred))173174/-- A reversed internal chain is still reduced and has the same internal175vertices. This proves reversal compatibility for actual graph chains. -/176theorem internalChain_reverse {l : List (Dart V d)} (h : P.InternalChain l) :177    P.InternalChain (l.reverse.map reverse) := by178  induction h with179  | single a ha =>180      exact InternalChain.single (reverse a) (P.reverse_mem ha)181  | cons a b l ha hc hj hr ht ih =>182      rw [List.reverse_cons, List.map_append, List.map_singleton]183      apply P.internalChain_append ih (reverse a) (P.reverse_mem ha)184      · simpa [List.getLast_map, List.getLast_reverse, reverse_reverse, ←hj] using hc185      · simpa [List.getLast_map, List.getLast_reverse, reverse_reverse] using hj.symm186      · simpa [List.getLast_map, List.getLast_reverse, reverse_reverse] using Ne.symm hr187188/-- Chains that both start and end at core vertices. -/189def CoreChain := {l : List (Dart V d) // P.ToCore l ∧190  ∃ a t, l=a::t ∧ source a ∈ P.coreVertices}191192/-- Literal incidences at core vertices. -/193def coreDarts : Finset (Dart V d) := P.darts.filter fun q => source q ∈ P.coreVertices194195/-- Encoding by the first incidence proves finiteness without assuming any196bound on the length of a chain. -/197def coreChainEncode (c : P.CoreChain) : {q // q ∈ P.coreDarts} := by198  let a := c.val.head (P.toCore_nonempty c.property.1)199  refine ⟨a,Finset.mem_filter.mpr ⟨?_,?_⟩⟩200  · obtain ⟨b,t,he,hcore⟩ := c.property.2201    simpa [a,he] using P.toCore_head_mem (he ▸ c.property.1)202  · obtain ⟨b,t,he,hcore⟩ := c.property.2203    simpa [a,he] using hcore204205theorem coreChainEncode_injective : Function.Injective P.coreChainEncode := by206  intro c c' h207  apply Subtype.ext208  apply P.toCore_unique c.property.1 c'.property.1209  have hh := congrArg Subtype.val h210  change c.val.head (P.toCore_nonempty c.property.1) =211    c'.val.head (P.toCore_nonempty c'.property.1) at hh212  rw [List.head?_eq_some_head (P.toCore_nonempty c.property.1),213    List.head?_eq_some_head (P.toCore_nonempty c'.property.1), hh]214215instance coreChainFintype : Fintype P.CoreChain :=216  Fintype.ofInjective P.coreChainEncode P.coreChainEncode_injective217218lemma internalChain_isChain {l : List (Dart V d)} (h : P.InternalChain l) :219    l.IsChain fun a b => b ≠ reverse a := by220  induction h with221  | single a ha => simp222  | cons a b l ha hc hj hr ht ih => exact List.isChain_cons_cons.mpr ⟨hr,ih⟩223224/-- Actual reversal of a complete core chain. -/225def coreChainReverse (c : P.CoreChain) : P.CoreChain := by226  let l := c.val.reverse.map reverse227  have hi : P.InternalChain l := P.internalChain_reverse c.property.1.internalChain228  have hstart : source (c.val.head (P.toCore_nonempty c.property.1)) ∈ P.coreVertices := by229    obtain ⟨a,t,he,hc⟩ := c.property.2230    simpa [he] using hc231  have ht : P.ToCore l := P.internalChain_toCore hi (by232    simpa [l,List.getLast_map,List.getLast_reverse] using hstart)233  refine ⟨l,ht,⟨l.head (P.toCore_nonempty ht),l.tail,234    (List.cons_head_tail (P.toCore_nonempty ht)).symm,?_⟩⟩235  simpa [l,List.head_map,List.head_reverse] using P.toCore_last_core c.property.1236237@[simp] theorem coreChainReverse_involutive (c : P.CoreChain) :238    P.coreChainReverse (P.coreChainReverse c)=c := by239  apply Subtype.ext240  change (c.val.reverse.map reverse).reverse.map reverse=c.val241  simp [List.map_reverse,List.map_map,Function.comp_def]242243theorem coreChainReverse_ne_self (c : P.CoreChain) : P.coreChainReverse c ≠ c := by244  intro h245  have he := congrArg Subtype.val h246  exact reduced_ne_reverse c.val (P.toCore_nonempty c.property.1)247    (P.internalChain_isChain c.property.1.internalChain) he248249/-- Every actual chain has a different initial core incidence. -/250theorem card_coreChain_le_coreDarts : Fintype.card P.CoreChain ≤ P.coreDarts.card := by251  simpa using Fintype.card_le_of_injective P.coreChainEncode P.coreChainEncode_injective252253end Path254end Nonadditivity.HaarPathGraph