Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarPathVertexNames

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

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

31 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathClassData7import Nonadditivity.HaarPathColorNormalization89/-! # Canonical vertex names by first appearance1011Names are positions in the original length-m path, so they lie in `Fin m`.12A newly discovered vertex is named by its first arrival time. This gives a13fixed alphabet for sparse exploration marks without final-graph indexing.14-/15noncomputable section16namespace Nonadditivity.HaarPathGraph.Path17open HaarPathGraph HaarPathProfiles HaarPathClasses18variable {V : Type*} [DecidableEq V] {d m : ℕ}1920variable (P : Path V d m) (hm : 0 < m)21include hm2223/-- All visited vertices, including the terminal vertex, occur before time m. -/24lemma earlier_occurrence (j : Fin (m+1)) :25    ∃ i : Fin m, P.vertex i.castSucc=P.vertex j := by26  by_cases hj : j.val < m27  · exact ⟨⟨j.val,hj⟩,congrArg P.vertex (Fin.ext rfl)⟩28  · have he : j=Fin.last m := Fin.ext (by simp; omega)29    refine ⟨⟨0,hm⟩,?_⟩30    simpa only [he,Fin.castSucc_mk,Fin.mk_zero,P.closed]3132def occurrenceSet (j : Fin (m+1)) : Finset (Fin m) :=33  Finset.univ.filter fun i => P.vertex i.castSucc=P.vertex j3435lemma occurrenceSet_nonempty (j : Fin (m+1)) : (P.occurrenceSet j).Nonempty := by36  obtain ⟨i,hi⟩ := P.earlier_occurrence hm j37  exact ⟨i,by simp [occurrenceSet,hi]⟩3839/-- The least actual occurrence is the vertex's canonical name. -/40def vertexName (j : Fin (m+1)) : Fin m :=41  (P.occurrenceSet j).min' (P.occurrenceSet_nonempty hm j)4243lemma vertexName_spec (j : Fin (m+1)) :44    P.vertex (P.vertexName hm j).castSucc=P.vertex j := by45  exact (Finset.mem_filter.mp ((P.occurrenceSet j).min'_mem46    (P.occurrenceSet_nonempty hm j))).24748lemma vertexName_le (j : Fin (m+1)) (i : Fin m)49    (hi : P.vertex i.castSucc=P.vertex j) : P.vertexName hm j ≤ i := by50  exact (P.occurrenceSet j).min'_le i (by simp [occurrenceSet,hi])5152/-- Names retain exactly the equality pattern of the vertices. -/53theorem vertexName_eq_iff (i j : Fin (m+1)) :54    P.vertexName hm i=P.vertexName hm j ↔ P.vertex i=P.vertex j := by55  constructor56  · intro h57    exact (P.vertexName_spec hm i).symm.trans58      ((congrArg (fun x : Fin m => P.vertex x.castSucc) h).trans (P.vertexName_spec hm j))59  · intro h60    apply le_antisymm61    · exact P.vertexName_le hm i _ ((P.vertexName_spec hm j).trans h.symm)62    · exact P.vertexName_le hm j _ ((P.vertexName_spec hm i).trans h)6364@[simp] theorem vertexName_root : P.vertexName hm 0=⟨0,hm⟩ := by65  have h := P.vertexName_le hm 0 ⟨0,hm⟩ rfl66  apply Fin.ext67  change (P.vertexName hm 0).val=068  have hv : (P.vertexName hm 0).val ≤ 0 := h69  omega7071theorem vertexName_le_time (i : Fin m) : (P.vertexName hm i.castSucc).val ≤ i.val :=72  P.vertexName_le hm i.castSucc i rfl7374/-- The new name is the current arrival time, with no choice or relabelling75of previously decoded vertices. -/76theorem vertexName_of_firstVisit {i : Fin m} (hi : P.FirstVisit i) :77    (P.vertexName hm i.succ).val=i.val+1 := by78  let j : Fin m := ⟨i.val+1,P.firstVisit_not_last hi⟩79  have hj : j.castSucc=i.succ := Fin.ext rfl80  have hle := P.vertexName_le hm i.succ j (congrArg P.vertex hj)81  have hvle : (P.vertexName hm i.succ).val ≤ i.val+1 := hle82  have hgt : i.val < (P.vertexName hm i.succ).val := by83    by_contra h84    exact hi (P.vertexName hm i.succ).castSucc (by simp; omega)85      (P.vertexName_spec hm i.succ)86  omega8788/-- Renaming the vertices produces another genuine literal path. Its color89word is unchanged; independent endpoint color labels are tracked separately. -/90def namedPath : Path (Fin m) d m where91  vertex := P.vertexName hm92  colors := P.colors93  closed := (P.vertexName_eq_iff hm _ _).mpr P.closed94  reduced := P.reduced9596theorem namedPath_firstVisit_iff (i : Fin m) :97    (P.namedPath hm).FirstVisit i ↔ P.FirstVisit i := by98  simp only [Path.FirstVisit,namedPath]99  constructor100  · intro h j hj he101    exact h j hj ((P.vertexName_eq_iff hm j i.succ).mpr he)102  · intro h j hj he103    exact h j hj ((P.vertexName_eq_iff hm j i.succ).mp he)104105theorem namedPath_firstTimes : (P.namedPath hm).firstTimes=P.firstTimes := by106  ext i107  simp only [Path.mem_firstTimes,P.namedPath_firstVisit_iff hm]108109theorem namedPath_edgeAt_eq_iff (i j : Fin m) :110    (P.namedPath hm).edgeAt i=(P.namedPath hm).edgeAt j ↔ P.edgeAt i=P.edgeAt j := by111  simp only [Path.edgeAt,namedPath,edge_eq_iff,P.vertexName_eq_iff hm]112113theorem namedPath_importantTimes : (P.namedPath hm).importantTimes=P.importantTimes := by114  ext i115  simp only [Path.importantTimes,Finset.mem_filter,Finset.mem_univ,true_and,116    Path.treeEdges,Finset.mem_image,P.namedPath_firstTimes hm,P.namedPath_edgeAt_eq_iff hm]117118end Nonadditivity.HaarPathGraph.Path119120namespace Nonadditivity.HaarPathClasses121open HaarPathGraph HaarPathProfiles122variable {V : Type*} [DecidableEq V] {d m : ℕ}123124/-- Matching vertex names and independently normalized incidence colors125reconstructs the complete actual path equivalence class. The normal form126need not itself obey a global inverse-color convention. -/127theorem samePattern_of_named_data {P Q : Path V d m} (hm : 0 < m)128    (β γ : V → Equiv.Perm (Color d))129    (hv : ∀ j, P.vertexName hm j=Q.vertexName hm j)130    (hc : ∀ a, β (incidenceVertex P a) (incidenceColor P a)=131      γ (incidenceVertex Q a) (incidenceColor Q a)) : SamePattern P Q := by132  have hv' (i j : Fin (m+1)) : P.vertex i=P.vertex j ↔ Q.vertex i=Q.vertex j := by133    rw [←P.vertexName_eq_iff hm i j,←Q.vertexName_eq_iff hm i j,hv i,hv j]134  refine ⟨hv',fun a b hab => ?_⟩135  have hab' : incidenceVertex Q a=incidenceVertex Q b := by136    simpa only [incidenceVertex_eq] using137      (hv' (incidenceIndex a) (incidenceIndex b)).mp138        (by simpa only [incidenceVertex_eq] using hab)139  rw [←(β (incidenceVertex P b)).injective.eq_iff,←hab,140    hc a,hab,hc b,hab']141  exact (γ (incidenceVertex Q b)).injective.eq_iff142143end Nonadditivity.HaarPathClasses