Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarPathExploration

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

Catalog entries: Corrected important-exploration-time count

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

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

41 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.Fintype.Fin89/-! # First-visit exploration of literal closed reduced paths1011The discovery tree is formed by edges whose terminal vertex has not appeared12before. This file proves its cardinality and the corrected important-time13bound, including the case where the last traversal is a tree edge.14-/15noncomputable section16namespace Nonadditivity.HaarPathGraph17open scoped BigOperators18variable {V : Type*} {d m : ℕ}1920lemma edge_endpoints {x y x' y' : V} {c c' : HaarPathProfiles.Color d}21    (h : edge x c y = edge x' c' y') :22    (x=x' ∧ y=y') ∨ (x=y' ∧ y=x') := by23  obtain ⟨g,b⟩ := c24  obtain ⟨g',b'⟩ := c'25  cases b <;> cases b' <;> simp only [edge, Bool.false_eq_true,26    ite_false, ite_true, Prod.mk.injEq] at h27  all_goals tauto2829namespace Path30variable [DecidableEq V] (P : Path V d m)31local instance : BEq (Edge V d) := instBEqOfDecidableEq3233/-- A position that discovers a vertex for the first time. -/34def FirstVisit (i : Fin m) : Prop :=35  ∀ j : Fin (m+1), j.val ≤ i.val → P.vertex j ≠ P.vertex i.succ3637instance (i : Fin m) : Decidable (P.FirstVisit i) := inferInstanceAs38  (Decidable (∀ j : Fin (m+1), j.val ≤ i.val → P.vertex j ≠ P.vertex i.succ))3940def firstTimes : Finset (Fin m) := Finset.univ.filter P.FirstVisit4142def edgeAt (i : Fin m) : Edge V d :=43  edge (P.vertex i.castSucc) (P.colors i) (P.vertex i.succ)4445/-- The literal discovery-tree edges, without a supplied spanning-tree oracle. -/46def treeEdges : Finset (Edge V d) := P.firstTimes.image P.edgeAt4748/-- Important positions are the traversals of a non-tree edge. We include49all positions here; excluding the final position cannot increase the count. -/50def importantTimes : Finset (Fin m) :=51  Finset.univ.filter fun i => P.edgeAt i ∉ P.treeEdges5253@[simp] theorem mem_firstTimes (i : Fin m) : i ∈ P.firstTimes ↔ P.FirstVisit i := by54  simp [firstTimes]5556lemma firstVisit_terminal_ne_root {i : Fin m} (hi : P.FirstVisit i) :57    P.vertex i.succ ≠ P.vertex 0 := Ne.symm (hi 0 (by simp))5859lemma firstVisit_not_last {i : Fin m} (hi : P.FirstVisit i) : i.val+1<m := by60  by_contra hn61  have he : i.succ=Fin.last m := Fin.ext (by simp; omega)62  exact P.firstVisit_terminal_ne_root hi (by rw [he,P.closed])6364lemma firstVisit_terminal_injective :65    Set.InjOn (fun i : Fin m => P.vertex i.succ) P.firstTimes := by66  intro i hi j hj he67  have hfi := (P.mem_firstTimes i).mp hi68  have hfj := (P.mem_firstTimes j).mp hj69  apply Fin.ext70  by_contra hn71  rcases lt_or_gt_of_ne hn with hij | hji72  · exact hfj i.succ (by simpa using hij) he73  · exact hfi j.succ (by simpa using hji) he.symm7475/-- Every non-root visited vertex has a unique discovery time. -/76theorem firstTimes_terminal_image :77    P.firstTimes.image (fun i => P.vertex i.succ) = P.vertices.erase (P.vertex 0) := by78  ext v79  constructor80  · intro hv81    obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hv82    exact Finset.mem_erase.mpr ⟨P.firstVisit_terminal_ne_root83      ((P.mem_firstTimes i).mp hi),P.end_mem i⟩84  · intro hv85    obtain ⟨hne,hv⟩ := Finset.mem_erase.mp hv86    let S : Finset (Fin (m+1)) := Finset.univ.filter fun j => P.vertex j=v87    obtain ⟨k,hk,hkv⟩ := Finset.mem_image.mp hv88    have hS : S.Nonempty := ⟨k.castSucc,by simp [S,hkv]⟩89    let j := S.min' hS90    have hjv : P.vertex j=v := (Finset.mem_filter.mp (S.min'_mem hS)).291    have hjpos : 0<j.val := by92      by_contra h93      have hj0 : j=0 := Fin.ext (by change j.val=0; omega)94      exact hne (by rw [←hjv,hj0])95    let i : Fin m := ⟨j.val-1,by have := j.isLt; omega⟩96    have hji : i.succ=j := Fin.ext (by change j.val-1+1=j.val; omega)97    refine Finset.mem_image.mpr ⟨i,?_,by rw [hji,hjv]⟩98    apply (P.mem_firstTimes i).mpr99    intro q hq he100    have hqS : q∈S := by simp [S,he,hji,hjv]101    have hmin : j≤q := S.min'_le _ hqS102    have hmin' : j.val≤q.val := hmin103    dsimp [i] at hq104    omega105106lemma root_mem_vertices (hm : 0<m) : P.vertex 0∈P.vertices := by107  simpa using P.start_mem ⟨0,hm⟩108109/-- Exactly one new vertex is added at each discovery time. -/110theorem card_firstTimes (hm : 0<m) : P.firstTimes.card+1=P.vertices.card := by111  have hc := Finset.card_image_of_injOn P.firstVisit_terminal_injective112  rw [P.firstTimes_terminal_image] at hc113  have he := Finset.card_erase_add_one (P.root_mem_vertices hm)114  omega115116/-- An edge that first discovers a vertex was not traversed earlier. This117also handles negative colors and loops in the original colored multigraph. -/118theorem firstVisit_edge_not_earlier {j : Fin m} (hj : P.FirstVisit j)119    {i : Fin m} (hij : i.val<j.val) : P.edgeAt i ≠ P.edgeAt j := by120  intro he121  rcases edge_endpoints he with ⟨hx,hy⟩ | ⟨hx,hy⟩122  · exact hj i.succ (by simpa using hij) hy123  · exact hj i.castSucc (by simp; omega) hx124125theorem firstVisit_edge_injective : Set.InjOn P.edgeAt P.firstTimes := by126  intro i hi j hj he127  apply Fin.ext128  by_contra hn129  rcases lt_or_gt_of_ne hn with hij | hji130  · exact P.firstVisit_edge_not_earlier ((P.mem_firstTimes j).mp hj) hij he131  · exact P.firstVisit_edge_not_earlier ((P.mem_firstTimes i).mp hi) hji he.symm132133theorem card_treeEdges (hm : 0<m) : P.treeEdges.card+1=P.vertices.card := by134  rw [treeEdges,Finset.card_image_of_injOn P.firstVisit_edge_injective]135  exact P.card_firstTimes hm136137lemma edgeAt_mem_edges (i : Fin m) : P.edgeAt i∈P.edges := by138  apply List.mem_toFinset.mpr139  exact List.mem_ofFn.mpr ⟨i,rfl⟩140141lemma treeEdges_subset_edges : P.treeEdges⊆P.edges := by142  intro e he143  obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp he144  exact P.edgeAt_mem_edges i145146/-- The complement of important positions consists of the actual visits of147the discovery tree; no assumption about the final traversal is made. -/148theorem important_add_tree_visits :149    P.importantTimes.card + ∑ e∈P.treeEdges, P.edgeList.count e = m := by150  have hsum := Finset.sum_fiberwise_of_maps_to151    (s := Finset.univ.filter fun i : Fin m => P.edgeAt i∈P.treeEdges)152    (t := P.treeEdges) (g := P.edgeAt) (f := fun _ => (1 : ℕ))153    (by intro i hi; exact (Finset.mem_filter.mp hi).2)154  have hcount (e : Edge V d) (he : e∈P.treeEdges) :155      ((Finset.univ.filter fun i : Fin m => P.edgeAt i∈P.treeEdges).filter156        fun i => P.edgeAt i=e).card = P.edgeList.count e := by157    simp only [Finset.filter_filter]158    have hf : (Finset.univ.filter fun i : Fin m =>159        P.edgeAt i∈P.treeEdges ∧ P.edgeAt i=e) =160        Finset.univ.filter fun i : Fin m => P.edgeAt i=e := by161      ext i162      simp only [Finset.mem_filter,Finset.mem_univ,true_and]163      constructor164      · exact And.right165      · intro h; exact ⟨h ▸ he,h⟩166    rw [hf]167    simpa [edgeList,edgeAt] using168      (Fin.card_filter_univ_eq_vector_get_eq_count e (List.Vector.ofFn P.edgeAt))169  have htree : (Finset.univ.filter fun i : Fin m => P.edgeAt i∈P.treeEdges).card =170      ∑ e∈P.treeEdges, P.edgeList.count e := by171    calc172      _ = ∑ e∈P.treeEdges, ((Finset.univ.filter fun i : Fin m =>173          P.edgeAt i∈P.treeEdges).filter fun i => P.edgeAt i=e).card := by174        simpa using hsum.symm175      _ = _ := Finset.sum_congr rfl hcount176  have hpart := Finset.card_filter_add_card_filter_not177    (s := Finset.univ) (p := fun i : Fin m => P.edgeAt i∈P.treeEdges)178  rw [htree] at hpart179  simpa [importantTimes,add_comm] using hpart180181/-- At least two visits per tree edge, except for genuine singleton edges. -/182theorem twice_treeEdges_le_visits_add_singletons :183    2*P.treeEdges.card ≤ (∑ e∈P.treeEdges, P.edgeList.count e) +184      (HaarPathMultiplicity.singletonEdges P.edgeList).card := by185  have hpoint (e : Edge V d) (he : e∈P.treeEdges) :186      2 ≤ P.edgeList.count e + (if P.edgeList.count e=1 then 1 else 0) := by187    have hp : 0<P.edgeList.count e := List.count_pos_iff.mpr188      (List.mem_toFinset.mp (P.treeEdges_subset_edges he))189    split_ifs <;> omega190  have hs := Finset.sum_le_sum hpoint191  have hsub : (P.treeEdges.filter fun e => P.edgeList.count e=1) ⊆192      HaarPathMultiplicity.singletonEdges P.edgeList := by193    intro e he194    obtain ⟨he,hc⟩ := Finset.mem_filter.mp he195    exact Finset.mem_filter.mpr ⟨P.treeEdges_subset_edges he,hc⟩196  have hc := Finset.card_le_card hsub197  simp only [Finset.sum_const,smul_eq_mul,Finset.sum_add_distrib,198    Finset.sum_ite,Nat.mul_one] at hs199  omega200201/-- Corrected BC important-time estimate. The `+2` is essential: the last202traversal may be a tree edge, so it cannot always be deducted from this count. -/203theorem card_importantTimes_le (hm : 0<m) :204    P.importantTimes.card ≤ P.defectTwice+2 := by205  have ht := P.card_treeEdges hm206  have hv := P.important_add_tree_visits207  have hs := P.twice_treeEdges_le_visits_add_singletons208  have hd := P.twice_vertices_le_length_add_singletons209  dsimp [defectTwice]210  omega211212end Path213end Nonadditivity.HaarPathGraph