Exact Lean source
Nonadditivity.HaarPathProfiles
Download original .lean · View on GitHub · Jump to source
Direct imports
Mathlib.Data.Fintype.CarddependencyMathlib.Data.Fintype.PidependencyMathlib.Data.List.CountdependencyMathlib.Tacticdependency
Imported by project modules
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
35 project constants, including generated, internal and private declarations.
35 declarations
Nonadditivity.HaarPathProfiles.BoundedProfileNonadditivity.HaarPathProfiles.BoundedProfile.congr_simpNonadditivity.HaarPathProfiles.ColorNonadditivity.HaarPathProfiles.ProfileNonadditivity.HaarPathProfiles.Profile._sizeOf_1internal/detail/privateNonadditivity.HaarPathProfiles.Profile._sizeOf_instinternal/detail/privateNonadditivity.HaarPathProfiles.Profile.casesOnNonadditivity.HaarPathProfiles.Profile.countNonadditivity.HaarPathProfiles.Profile.ctorIdxNonadditivity.HaarPathProfiles.Profile.extNonadditivity.HaarPathProfiles.Profile.ext.match_1internal/detail/privateNonadditivity.HaarPathProfiles.Profile.ext_iffNonadditivity.HaarPathProfiles.Profile.firstNonadditivity.HaarPathProfiles.Profile.lastNonadditivity.HaarPathProfiles.Profile.mkNonadditivity.HaarPathProfiles.Profile.mk._flat_ctorinternal/detail/privateNonadditivity.HaarPathProfiles.Profile.mk.injNonadditivity.HaarPathProfiles.Profile.mk.injEqNonadditivity.HaarPathProfiles.Profile.mk.noConfusionNonadditivity.HaarPathProfiles.Profile.mk.sizeOf_specNonadditivity.HaarPathProfiles.Profile.noConfusionNonadditivity.HaarPathProfiles.Profile.noConfusionTypeNonadditivity.HaarPathProfiles.Profile.recNonadditivity.HaarPathProfiles.Profile.recOnNonadditivity.HaarPathProfiles.boundedProfileFintypeNonadditivity.HaarPathProfiles.card_boundedProfile_leNonadditivity.HaarPathProfiles.card_profileAssignments_leNonadditivity.HaarPathProfiles.card_signedProfile_leNonadditivity.HaarPathProfiles.card_twoGeneratorProfile_leNonadditivity.HaarPathProfiles.count_eq_residual_addNonadditivity.HaarPathProfiles.encodeNonadditivity.HaarPathProfiles.encode_injectiveNonadditivity.HaarPathProfiles.residual_count_ltNonadditivity.HaarPathProfiles.wordProfileNonadditivity.HaarPathProfiles.wordProfile._proof_1internal/detail/private
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Mathlib.Data.Fintype.Card7import Mathlib.Data.Fintype.Pi8import Mathlib.Data.List.Count9import Mathlib.Tactic1011/-! # Finite word-profile counts for the Haar path expansion1213A path segment is profiled by its first color, last color and the number14of occurrences of every color. The bound is the profile-count ingredient15of Bordenave--Collins, Lemma 5.8. Subtracting the first color before encoding16is essential: the remaining multiplicities lie in `Fin m`, not `Fin (m+1)`.17The statement here concerns actual profiles of nonempty words of length18at most `m`; no profile-count hypothesis is assumed.19-/20noncomputable section21namespace Nonadditivity.HaarPathProfiles2223variable {α : Type*} [DecidableEq α]2425/-- The data retained by the refined path equivalence relation. -/26@[ext] structure Profile (α : Type*) where27first : α28last : α29count : α → ℕ3031/-- Literal profile of the nonempty word `a :: l`. -/32def wordProfile (a : α) (l : List α) : Profile α where33first := a34last := (a :: l).getLast (by simp)35count := fun x => (a :: l).count x3637/-- Realizable profiles, with the full word length bounded by `m`. -/38def BoundedProfile (α : Type*) [DecidableEq α] (m : ℕ) :=39{p : Profile α // ∃ a l, l.length < m ∧ wordProfile a l = p}4041/-- Deleting the first letter leaves fewer than `m` occurrences of every color. -/42theorem residual_count_lt {m : ℕ} (p : BoundedProfile α m) (x : α) :43p.val.count x - (if x = p.val.first then 1 else 0) < m := by44obtain ⟨a, l, hl, hp⟩ := p.property45rw [← hp]46change (a :: l).count x - (if x = a then 1 else 0) < m47have hc := lt_of_le_of_lt (List.count_le_length (a := x) (l := l)) hl48by_cases h : x = a49· subst x; simpa using hc50· simpa [List.count_cons, h, Ne.symm h] using hc5152/-- The deleted first letter can be recovered without truncated-subtraction loss. -/53theorem count_eq_residual_add {m : ℕ} (p : BoundedProfile α m) (x : α) :54p.val.count x =55(p.val.count x - (if x = p.val.first then 1 else 0)) +56(if x = p.val.first then 1 else 0) := by57obtain ⟨a, l, hl, hp⟩ := p.property58rw [← hp]59change (a :: l).count x =60((a :: l).count x - (if x = a then 1 else 0)) + (if x = a then 1 else 0)61by_cases h : x = a62· subst x; simp63· simp [h]6465/-- Explicit bounded encoding, independent of the underlying graph vertices. -/66def encode {m : ℕ} (p : BoundedProfile α m) : α × α × (α → Fin m) :=67(p.val.first, p.val.last,68fun x => ⟨p.val.count x - (if x = p.val.first then 1 else 0),69residual_count_lt p x⟩)7071theorem encode_injective {m : ℕ} : Function.Injective (encode (α := α) (m := m)) := by72intro p q h73have hf : p.val.first = q.val.first := congrArg (fun z => z.1) h74have hl : p.val.last = q.val.last := congrArg (fun z => z.2.1) h75have hc : p.val.count = q.val.count := by76funext x77have hx := congrArg (fun z : α × α × (α → Fin m) => (z.2.2 x).val) h78change p.val.count x - (if x = p.val.first then 1 else 0) =79q.val.count x - (if x = q.val.first then 1 else 0) at hx80rw [count_eq_residual_add p x, count_eq_residual_add q x, hx, hf]81exact Subtype.ext (Profile.ext hf hl hc)8283instance boundedProfileFintype [Fintype α] (m : ℕ) : Fintype (BoundedProfile α m) :=84Fintype.ofInjective encode encode_injective8586/-- Profile-count bound for an arbitrary finite alphabet. -/87theorem card_boundedProfile_le [Fintype α] (m : ℕ) :88Fintype.card (BoundedProfile α m) ≤89Fintype.card α ^ 2 * m ^ Fintype.card α := by90calc91_ ≤ Fintype.card (α × α × (α → Fin m)) :=92Fintype.card_le_of_injective encode encode_injective93_ = _ := by simp [pow_two, mul_assoc]9495/-- Profiles chosen on each core edge have an exponential count only in the96number of core edges, rather than in the original path length. -/97theorem card_profileAssignments_le [Fintype α] {E : Type*} [Fintype E] [DecidableEq E] (m : ℕ) :98Fintype.card (E → BoundedProfile α m) ≤99(Fintype.card α ^ 2 * m ^ Fintype.card α) ^ Fintype.card E := by100rw [Fintype.card_fun]101exact Nat.pow_le_pow_left (card_boundedProfile_le (α := α) m) _102103/-- The signed `d`-generator alphabet used for unitary matrices and their adjoints. -/104abbrev Color (d : ℕ) := Fin d × Bool105106/-- Exact base in Bordenave--Collins Lemma 5.8, before the core-edge estimate. -/107theorem card_signedProfile_le (d m : ℕ) :108Fintype.card (BoundedProfile (Color d) m) ≤ (2*d*m^d)^2 := by109have h := card_boundedProfile_le (α := Color d) m110have he : Fintype.card (Color d)^2 * m^Fintype.card (Color d) =111(2*d*m^d)^2 := by112simp only [Color, Fintype.card_prod, Fintype.card_fin, Fintype.card_bool]113rw [pow_mul, mul_pow]114ring115exact he ▸ h116117/-- In particular, two independent Haar generators need at most `(4*m^2)^2`118profiles on each compressed edge. -/119theorem card_twoGeneratorProfile_le (m : ℕ) :120Fintype.card (BoundedProfile (Color 2) m) ≤ (4*m^2)^2 := by121simpa using card_signedProfile_le 2 m122123end Nonadditivity.HaarPathProfiles