Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarPaletteDecoder

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

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

22 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarChainColoringPalettes7import Nonadditivity.HaarProfileAssignmentBound8import Mathlib.Data.List.GetD910/-! # Literal block decoding of the common word palette1112Each block reads its chosen profile words in its actual orientations. The13decoder reverses the block order to match the coefficient-factor convention.14Its singleton restriction agrees exactly with the padded endpoint families.15-/16noncomputable section17set_option backward.isDefEq.respectTransparency false18set_option maxHeartbeats 100000019namespace Nonadditivity.HaarPaletteDecoder20open HaarPathGraph HaarPathProfiles HaarProfileCoefficient HaarProfilePadding21  HaarProfileAssignmentBound2223def paletteGroupWord {d M : ℕ} (w : Palette d M) : FreeGroup (Fin d) :=24  FreeGroup.mk (List.ofFn w.2)2526@[simp] theorem paletteGroupWord_embedWords {d k M : ℕ} {p : Profile (Color d)}27    (hk : k≤M) (w : Words d k p) : paletteGroupWord (embedWords hk w)=word w := rfl2829def orientedPalette {d M : ℕ} (forward : Bool) (w : Palette d M) : FreeGroup (Fin d) :=30  if forward then paletteGroupWord w else (paletteGroupWord w)⁻¹3132@[simp] theorem orientedPalette_embedWords {d k M : ℕ} {p : Profile (Color d)}33    (hk : k≤M) (forward : Bool) (w : Words d k p) :34    orientedPalette forward (embedWords hk w)=orientedWord forward w := rfl3536def decode {I : Type*} {d M : ℕ} (directions : ℕ → ℕ → Bool)37    (k : ℕ) (_labels : List I) (choices : List (Palette d M)) : FreeGroup (Fin d) :=38  ((choices.mapIdx (fun j w => orientedPalette (directions k j) w)).reverse).prod3940def forward {I : Type*} (directions : ℕ → ℕ → Bool) (k : ℕ) (_i : I) : Bool :=41  directions k 04243@[simp] theorem decode_singleton {I : Type*} {d n M : ℕ} {p : Profile (Color d)}44    (directions : ℕ → ℕ → Bool) (k : ℕ) (i : I) (hn : n≤M) (w : Words d n p) :45    decode directions k [i] [embedWords hn w]=orientedWord (directions k 0) w := by46  simp [decode]4748theorem decode_embedAssignment {I : Type*} {d M : ℕ}49    (directions : ℕ → ℕ → Bool) (size : I → ℕ) (profile : I → Profile (Color d))50    (hsize : ∀ i, size i≤M) (σ : ∀ i, Words d (size i) (profile i)) (k : ℕ) (i : I) :51    decode directions k [i] [embedAssignment size profile hsize σ i]=52      orientedWord (forward directions k i) (σ i) := by53  exact decode_singleton directions k i (hsize i) (σ i)5455variable {V : Type*} [DecidableEq V] {d m : ℕ} (P : Path V d m)5657def chainForward (c : P.CoreChain) : Bool := decide (c=P.representative (P.chainLabel c))5859def chainEmbed (σ : P.ChainPalette) (e : P.unorientedChains) : Palette d m :=60  embedWords (P.coreChain_length_le (P.representative e)) (σ e)6162theorem orientedPalette_chainEmbed (σ : P.ChainPalette) (c : P.CoreChain) :63    orientedPalette (chainForward P c) (chainEmbed P σ (P.chainLabel c))=64      word (P.paletteWord σ c) := by65  rw [P.paletteWord_word]66  simp only [chainEmbed,orientedPalette_embedWords,orientedWord,chainForward,decide_eq_true_eq]6768/-- Exact decoding of one actual core-chain block, including repeated labels69and arbitrary mixtures of the two orientations. -/70theorem decode_chain_block (σ : P.ChainPalette) (directions : ℕ → ℕ → Bool)71    (k : ℕ) (cs : List P.CoreChain)72    (hdir : ∀ j (hj : j<cs.length), directions k j=chainForward P cs[j]) :73    decode directions k (cs.map P.chainLabel)74        (cs.map (fun c => chainEmbed P σ (P.chainLabel c))) =75      (cs.reverse.map (fun c => word (P.paletteWord σ c))).prod := by76  have he : (cs.map (fun c => chainEmbed P σ (P.chainLabel c))).mapIdx77      (fun j w => orientedPalette (directions k j) w) =78      cs.map (fun c => word (P.paletteWord σ c)) := by79    apply List.ext_getElem80    · simp81    · intro j hj hk82      have hj' : j<cs.length := by simpa using hj83      simp only [List.getElem_mapIdx,List.getElem_map]84      rw [hdir j hj',orientedPalette_chainEmbed P]85  unfold decode86  rw [he,List.map_reverse]8788/-- Directions are read from the literal occurrence blocks. Out-of-range89entries are irrelevant to decoding and receive a fixed default. -/90def blockDirections (blocks : List (List P.CoreChain)) (k j : ℕ) : Bool :=91  match (blocks.getD k [])[j]? with92  | some c => chainForward P c93  | none => true9495theorem blockDirections_get (blocks : List (List P.CoreChain)) (k : ℕ)96    (hk : k<blocks.length) (j : ℕ) (hj : j<blocks[k].length) :97    blockDirections P blocks k j=chainForward P blocks[k][j] := by98  simp only [blockDirections,List.getD_eq_getElem blocks [] hk,List.getElem?_eq_getElem hj]99100theorem decode_actual_block (σ : P.ChainPalette) (blocks : List (List P.CoreChain))101    (k : ℕ) (hk : k<blocks.length) :102    decode (blockDirections P blocks) k (blocks[k].map P.chainLabel)103        (blocks[k].map (fun c => chainEmbed P σ (P.chainLabel c))) =104      (blocks[k].reverse.map (fun c => word (P.paletteWord σ c))).prod :=105  decode_chain_block P σ _ _ _ (blockDirections_get P blocks k hk)106107end Nonadditivity.HaarPaletteDecoder