Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.NoncommutativeCSBlocks

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

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.NoncommutativeCSSkeletonDecoration7import Mathlib.Data.List.SplitLengths89/-! # Literal blocks and occurrence lifts of endpoint skeletons1011Each compressed middle run is a single block. Splitting an actual occurrence12list by these block lengths preserves every occurrence and hence all its13orientation data, while recovering precisely the skeleton's label blocks.14-/15noncomputable section16namespace Nonadditivity.NoncommutativeCS.EndpointSkeleton17variable {I C : Type*}1819def blocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I} :20    EndpointSkeleton I a b → List (List I)21  | .done _ => []22  | .first i P => [i] :: P.blocks23  | .last (a := a) p P => [a p] :: P.blocks24  | .middle (a := a) visits P => visits.map a :: P.blocks25  | .singleton i P => [i] :: P.blocks2627@[simp] theorem flatten_blocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}28    (P : EndpointSkeleton I a b) : P.blocks.flatten=P.word := by29  induction P <;> simp_all [blocks, word]3031@[simp] theorem length_blocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}32    (P : EndpointSkeleton I a b) : P.blocks.length=P.markedFlags.length := by33  induction P <;> simp_all [blocks, markedFlags]3435theorem blocks_nonempty {m n : ℕ} {a : Fin m → I} {b : Fin n → I}36    (P : EndpointSkeleton I a b) (hP : P.Compressed) :37    ∀ block ∈ P.blocks, block ≠ [] := by38  induction P with39  | done => simp [blocks]40  | first i P ih => simpa [blocks] using ih hP41  | last p P ih => simpa [blocks] using ih hP42  | middle visits P ih => simpa [blocks] using And.intro hP.1 (ih hP.2.2)43  | singleton i P ih => simpa [blocks] using ih hP4445private theorem map_splitLengths (f : C → I) (sizes : List ℕ) (cs : List C) :46    (sizes.splitLengths cs).map (List.map f)=sizes.splitLengths (cs.map f) := by47  induction sizes generalizing cs with48  | nil => simp49  | cons n ns ih => simp [List.splitLengths_cons, ih, List.map_take, List.map_drop]5051private theorem splitLengths_lengths_flatten (ls : List (List I)) :52    (ls.map List.length).splitLengths ls.flatten=ls := by53  induction ls with54  | nil => simp55  | cons l ls ih => simp [List.splitLengths_cons, ih]5657/-- Actual occurrences split according to the skeleton, retaining their58full values rather than replacing them by label names. -/59def occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}60    (P : EndpointSkeleton I a b) (cs : List C) : List (List C) :=61  (P.blocks.map List.length).splitLengths cs6263theorem map_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}64    (P : EndpointSkeleton I a b) (label : C → I) (cs : List C)65    (hcs : cs.map label=P.word) :66    (P.occurrenceBlocks cs).map (List.map label)=P.blocks := by67  unfold occurrenceBlocks68  rw [map_splitLengths, hcs, ← P.flatten_blocks, splitLengths_lengths_flatten]6970theorem flatten_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}71    (P : EndpointSkeleton I a b) (label : C → I) (cs : List C)72    (hcs : cs.map label=P.word) :73    (P.occurrenceBlocks cs).flatten=cs := by74  apply List.flatten_splitLengths75  have hlen := congrArg List.length hcs76  simpa only [List.length_map, ← P.flatten_blocks, List.length_flatten] using hlen.le7778theorem lengths_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}79    (P : EndpointSkeleton I a b) (label : C → I) (cs : List C)80    (hcs : cs.map label=P.word) :81    (P.occurrenceBlocks cs).map List.length=P.blocks.map List.length := by82  have h := congrArg (List.map List.length) (P.map_occurrenceBlocks label cs hcs)83  simpa only [List.map_map, List.length_map, Function.comp_def] using h8485@[simp] theorem length_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}86    (P : EndpointSkeleton I a b) (cs : List C) :87    (P.occurrenceBlocks cs).length=P.markedFlags.length := by88  simp [occurrenceBlocks]8990theorem occurrenceBlocks_nonempty {m n : ℕ} {a : Fin m → I} {b : Fin n → I}91    (P : EndpointSkeleton I a b) (hP : P.Compressed)92    (label : C → I) (cs : List C) (hcs : cs.map label=P.word) :93    ∀ block ∈ P.occurrenceBlocks cs, block ≠ [] := by94  intro block hb he95  have hm : block.map label ∈ P.blocks := by96    rw [← P.map_occurrenceBlocks label cs hcs]97    exact List.mem_map_of_mem hb98  exact P.blocks_nonempty hP _ hm (by simp [he])99100/-- Reading the compiler from right to left restores the actual original101occurrence order, including all repeated orientations. -/102theorem flatten_reversed_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}103    (P : EndpointSkeleton I a b) (label : C → I) (cs : List C)104    (hcs : cs.reverse.map label=P.word) :105    ((P.occurrenceBlocks cs.reverse).reverse.map List.reverse).flatten=cs := by106  have h := congrArg List.reverse (P.flatten_occurrenceBlocks label cs.reverse hcs)107  simpa only [List.reverse_flatten, List.reverse_reverse, List.map_reverse] using h108109theorem flatten_map_reversed_occurrenceBlocks {m n : ℕ} {a : Fin m → I} {b : Fin n → I}110    (P : EndpointSkeleton I a b) (label : C → I) (cs : List C)111    (hcs : cs.reverse.map label=P.word) :112    ((P.occurrenceBlocks cs.reverse).map List.reverse).reverse.flatten=cs := by113  have h := congrArg List.reverse (P.flatten_occurrenceBlocks label cs.reverse hcs)114  simpa only [List.reverse_flatten, List.reverse_reverse] using h115116/-- The register compiler multiplies the chronological blocks in reverse117order, with exactly their original absolute block indices. -/118theorem blockFactors_eq_reverse_mapIdx119    {𝕜 E J : Type*} [RCLike 𝕜] [NormedAddCommGroup E]120    [InnerProductSpace 𝕜 E] [CompleteSpace E] [Fintype J] [DecidableEq J]121    {m n : ℕ} {a : Fin m → I} {b : Fin n → I}122    (P : EndpointSkeleton I a b) (A : ℕ → List I → List J → E →L[𝕜] E)123    (k : ℕ) (σ : I → J) :124    P.blockFactors A k σ=125      (P.blocks.mapIdx (fun j ls => A (k+j) ls (ls.map σ))).reverse := by126  induction P generalizing k <;>127    simp_all [blocks, blockFactors, List.mapIdx_cons, Nat.add_assoc,128      Nat.add_left_comm, Nat.add_comm]129130end Nonadditivity.NoncommutativeCS.EndpointSkeleton