Holevo Additivity Gap in Lean 4

Lean explorer

Exact Lean source

Nonadditivity.HaarSkeletonSegmentation

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

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

24 declarations

Full module

1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarProfileDecodedCoefficients7import Nonadditivity.HaarProfileCompositionBound8import Nonadditivity.NoncommutativeCSBlocks9import Nonadditivity.HaarNonbacktrackingSegmentation10import Nonadditivity.HaarTimeCompositionReverse1112/-! # The actual register factors are the last-return segmented product1314The skeleton scans occurrences from right to left. Its first block therefore15uses the ordinary polynomial, and each subsequent block uses the killed-return16polynomial. Reversing the scan durations recovers the exact ordered segmented17product, with no commutativity assumption on the operator coefficients.18-/1920noncomputable section21set_option backward.isDefEq.respectTransparency false22namespace Nonadditivity.HaarSkeletonSegmentation23open scoped BigOperators24open HaarOperatorPolynomial HaarProfileBlockCoefficients HaarNonbacktracking25  NoncommutativeCS HaarProfileCompositionBound HaarProfileDecodedCoefficients26  HaarProfilePatternBound HaarProfileAssignmentBound HaarProfilePadding27  HaarProfileCoefficient HaarPathProfiles HaarTimeCompositions2829section Algebra30variable {G R : Type*} [Group G] [Ring R]3132def pairCoefficient (A : MonoidAlgebra R G) (ordinary : Bool) (x : G × ℕ) : R :=33  if ordinary then (A ^ x.2) x.1 else killedPolynomial A 1 x.2 x.13435def reverseFactors (A : MonoidAlgebra R G) : Bool → List (G × ℕ) → List R36  | _, [] => []37  | ordinary, x :: xs => reverseFactors A false xs ++ [pairCoefficient A ordinary x]3839theorem reverseFactors_snoc (A : MonoidAlgebra R G) (ordinary : Bool)40    (xs : List (G × ℕ)) (x : G × ℕ) :41    reverseFactors A ordinary (xs ++ [x]) =42      [pairCoefficient A (ordinary && xs.isEmpty) x] ++ reverseFactors A ordinary xs := by43  induction xs generalizing ordinary with44  | nil => simp [reverseFactors]45  | cons y ys ih => simp [reverseFactors, ih, List.append_assoc]4647theorem reverseFactors_segmentedProduct (A : MonoidAlgebra R G)48    (g : G) (gs : List G) (ts : List ℕ) (ht : ts.length = (g :: gs).length) :49    (reverseFactors A true (((g :: gs).zip ts).reverse)).prod =50      segmentedProduct A g gs ts := by51  induction gs generalizing g ts with52  | nil =>53      cases ts with54      | nil => simp at ht55      | cons n ns =>56          have hn : ns = [] := List.length_eq_zero_iff.mp (by simpa using ht)57          subst ns58          simp [reverseFactors, pairCoefficient]59  | cons h hs ih =>60      cases ts with61      | nil => simp at ht62      | cons n ns =>63          have hn : ns.length = (h :: hs).length := by simpa using ht64          have hne : ((h :: hs).zip ns).reverse ≠ [] := by65            have hl : ((h :: hs).zip ns).reverse.length = (h :: hs).length := by66              simp [List.length_zip, hn]67            intro he68            simp [he] at hl69          simp only [List.zip_cons_cons, List.reverse_cons, reverseFactors_snoc]70          simp only [List.isEmpty_eq_false_iff.mpr hne, Bool.and_false,71            List.singleton_append, List.prod_cons, pairCoefficient, Bool.false_eq_true,72            if_false, ih h ns hn, segmentedProduct_cons]7374theorem reverseFactors_mapIdx {X : Type*} (A : MonoidAlgebra R G)75    (xs : List X) (word : ℕ → X → G) (duration : ℕ → ℕ) (k : ℕ) :76    reverseFactors A (decide (k = 0))77        (xs.mapIdx (fun i x => (word (k + i) x, duration (k + i)))) =78      (xs.mapIdx (fun i x =>79        pairCoefficient A (decide (k + i = 0)) (word (k + i) x, duration (k + i)))).reverse := by80  induction xs generalizing k with81  | nil => rfl82  | cons x xs ih =>83      simp only [List.mapIdx_cons, Nat.add_zero, List.reverse_cons, reverseFactors]84      have hi := ih (k + 1)85      simpa only [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm, Nat.add_eq_zero_iff,86        Nat.one_ne_zero, and_false, decide_false] using87        congrArg (fun l => l ++ [pairCoefficient A (decide (k = 0)) (word k x, duration k)]) hi8889end Algebra9091variable {I J E : Type*}92variable [NormedAddCommGroup E] [InnerProductSpace ℂ E] [CompleteSpace E]93variable {d : ℕ}9495/-- Decoded whole-block words in the chronological register-scan order. -/96def scanWords {m n : ℕ} {a : Fin m → I} {b : Fin n → I}97    (P : EndpointSkeleton I a b)98    (decode : ℕ → List I → List J → FreeGroup (Fin d)) (σ : I → J) :99    List (FreeGroup (Fin d)) :=100  P.blocks.mapIdx (fun k labels => decode k labels (labels.map σ))101102@[simp] theorem length_scanWords {m n : ℕ} {a : Fin m → I} {b : Fin n → I}103    (P : EndpointSkeleton I a b)104    (decode : ℕ → List I → List J → FreeGroup (Fin d)) (σ : I → J) :105    (scanWords P decode σ).length = P.markedFlags.length := by106  simp [scanWords]107108private theorem mapIdx_zip {X Y Z : Type*} (xs : List X)109    (f : ℕ → X → Y) (g : ℕ → X → Z) :110    (xs.mapIdx f).zip (xs.mapIdx g) = xs.mapIdx (fun i x => (f i x, g i x)) := by111  induction xs generalizing f g with112  | nil => rfl113  | cons x xs ih => simp only [List.mapIdx_cons, List.zip_cons_cons, ih]114115private theorem mapIdx_duration_eq_times {m n : ℕ} {a : Fin m → I} {b : Fin n → I}116    (P : EndpointSkeleton I a b) (duration : ℕ → ℕ) (k : ℕ) :117    P.blocks.mapIdx (fun j _ => duration (k + j)) = P.times duration k := by118  induction P generalizing k with119  | done => rfl120  | first i P ih =>121      simp only [EndpointSkeleton.blocks, EndpointSkeleton.times, List.mapIdx_cons, Nat.add_zero]122      congr 1123      convert ih (k + 1) using 1124      congr 1125      funext j x126      congr 1127      omega128  | last p P ih =>129      simp only [EndpointSkeleton.blocks, EndpointSkeleton.times, List.mapIdx_cons, Nat.add_zero]130      congr 1131      convert ih (k + 1) using 1132      congr 1133      funext j x134      congr 1135      omega136  | middle visits P ih =>137      simp only [EndpointSkeleton.blocks, EndpointSkeleton.times, List.mapIdx_cons, Nat.add_zero]138      congr 1139      convert ih (k + 1) using 1140      congr 1141      funext j x142      congr 1143      omega144  | singleton i P ih =>145      simp only [EndpointSkeleton.blocks, EndpointSkeleton.times, List.mapIdx_cons, Nat.add_zero]146      congr 1147      convert ih (k + 1) using 1148      congr 1149      funext j x150      congr 1151      omega152153/-- The literal unpadded register product is exactly the last-return product154on the decoded blocks in their original left-to-right order. -/155theorem raw_blockFactors_segmentedProduct [Fintype J] [DecidableEq J]156    {m n : ℕ} {a : Fin m → I} {b : Fin n → I}157    (P : EndpointSkeleton I a b) (B : Polynomial (FreeGroup (Fin d)) E)158    (duration : ℕ → ℕ)159    (decode : ℕ → List I → List J → FreeGroup (Fin d)) (σ : I → J)160    (g : FreeGroup (Fin d)) (gs : List (FreeGroup (Fin d)))161    (hgs : (scanWords P decode σ).reverse = g :: gs) :162    (P.blockFactors (fun k labels choices =>163      blockPolynomial B (decide (k = 0)) (duration k) (decode k labels choices)) 0 σ).prod =164      segmentedProduct B g gs (P.times duration 0).reverse := by165  rw [P.blockFactors_eq_reverse_mapIdx]166  simp only [Nat.zero_add]167  have hr := reverseFactors_mapIdx B P.blocks168    (fun k labels => decode k labels (labels.map σ)) duration 0169  simp only [Nat.zero_add, decide_true] at hr170  have he : (scanWords P decode σ).zip (P.times duration 0) =171      P.blocks.mapIdx (fun k labels => (decode k labels (labels.map σ), duration k)) := by172    rw [← mapIdx_duration_eq_times P duration 0]173    simpa only [scanWords, Nat.zero_add] using mapIdx_zip P.blocks174      (fun k labels => decode k labels (labels.map σ)) (fun k _ => duration k)175  have hlen : (P.times duration 0).reverse.length = (g :: gs).length := by176    rw [← hgs, List.length_reverse, List.length_reverse, length_scanWords]177    simp [times_eq_ofFn]178  have hz : ((g :: gs).zip (P.times duration 0).reverse).reverse =179      (scanWords P decode σ).zip (P.times duration 0) := by180    have heql : (scanWords P decode σ).length = (P.times duration 0).length := by181      simp [times_eq_ofFn]182    rw [← hgs]183    have hz := List.reverse_zipWith (f := Prod.mk) heql184    exact congrArg List.reverse hz.symm |>.trans (List.reverse_reverse _)185  have h := reverseFactors_segmentedProduct B g gs (P.times duration 0).reverse hlen186  rw [hz, he, hr] at h187  have hc : ∀ k labels,188      pairCoefficient B (decide (k = 0)) (decode k labels (labels.map σ), duration k) =189        blockPolynomial B (decide (k = 0)) (duration k) (decode k labels (labels.map σ)) := by190    intro k labels191    by_cases hk : k = 0 <;> simp [pairCoefficient, blockPolynomial, hk]192  simpa only [hc] using h193194end Nonadditivity.HaarSkeletonSegmentation