Exact Lean source
Nonadditivity.HaarSharpCounting
Download original .lean · View on GitHub · Jump to source
Catalog entries: Corrected important-exploration-time count
Direct imports
Nonadditivity.HaarPathClassStatsMathlib.Algebra.BigOperators.Ring.Finsetdependency
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
14 project constants, including generated, internal and private declarations.
14 declarations
Nonadditivity.HaarPathClasses.card_defectClass_weighted_leNonadditivity.HaarPathClasses.card_explorationMarkNonadditivity.HaarPathClasses.card_refinedDefectClass_le_coarse_mulNonadditivity.HaarPathClasses.card_refinedDefectClass_weighted_leNonadditivity.HaarPathClasses.card_refined_subfamily_weighted_leNonadditivity.HaarPathClasses.classSparseCodeNonadditivity.HaarPathClasses.classSparseCode_injectiveNonadditivity.HaarPathClasses.eventList_eq_of_sparseCode_eqNonadditivity.HaarPathClasses.sparseCodeWeightNonadditivity.HaarPathClasses.sparseCodeWeight_nonnegNonadditivity.HaarPathClasses.sparseExplorationCodeNonadditivity.HaarPathClasses.sparseExplorationCode.eq_1internal/detail/privateNonadditivity.HaarPathClasses.sparseExplorationCode_weightNonadditivity.HaarPathClasses.sum_sparseCodeWeight
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.HaarPathClassStats7import Mathlib.Algebra.BigOperators.Ring.Finset89/-! # Weighted chronological encoding of genuine path classes1011The time coordinate is stored as the position of an optional mark rather12than counted again in every event. Weighted enumeration preserves the13important-event budget and avoids the exponential padding overhead.14-/1516noncomputable section1718namespace Nonadditivity.HaarPathClasses1920open HaarPathGraph HaarPathProfiles21open scoped BigOperators2223variable {V : Type*} [DecidableEq V] {m : ℕ}2425/-- A chronological sparse code: each actual time carries at most one mark. -/26def sparseExplorationCode (P : Path V 2 m) (hm : 0 < m) :27Fin m → Option (ExplorationMark m) :=28fun i => if i ∈ P.importantTimes then some (explorationMark P hm i) else none2930theorem eventList_eq_of_sparseCode_eq {P Q : Path V 2 m} (hm : 0 < m)31(hcode : sparseExplorationCode P hm = sparseExplorationCode Q hm) :32explorationEventList P hm = explorationEventList Q hm := by33have htimes : P.importantTimes = Q.importantTimes := by34ext i35have hi := congrFun hcode i36by_cases hP : i ∈ P.importantTimes <;> by_cases hQ : i ∈ Q.importantTimes <;>37simp [sparseExplorationCode, hP, hQ] at hi ⊢38unfold explorationEventList39rw [← htimes]40apply List.map_congr_left41intro i hi42have hP : i ∈ P.importantTimes := by simpa using hi43have hQ : i ∈ Q.importantTimes := by simpa only [← htimes] using hP44have hm := congrFun hcode i45simp only [sparseExplorationCode, if_pos hP, if_pos hQ, Option.some.injEq] at hm46exact congrArg (fun x => (i, x)) hm4748def classSparseCode [Fintype V] {δ : ℕ} (hm : 0 < m)49(C : DefectClass V m δ hm) : Fin m → Option (ExplorationMark m) :=50sparseExplorationCode (classRepresentative hm C) hm5152theorem classSparseCode_injective [Fintype V] (hm : 0 < m) (δ : ℕ) :53Function.Injective (@classSparseCode V _ m _ δ hm) := by54intro C D h55apply classExplorationCode_injective hm δ56apply Subtype.ext57exact eventList_eq_of_sparseCode_eq hm h5859def sparseCodeWeight {A I : Type*} [Fintype I] (z : ℝ) (c : I → Option A) : ℝ :=60∏ i, (c i).elim 1 (fun _ => z)6162theorem sparseCodeWeight_nonneg {A I : Type*} [Fintype I] {z : ℝ} (hz : 0 ≤ z)63(c : I → Option A) : 0 ≤ sparseCodeWeight z c := by64apply Finset.prod_nonneg65intro i _66cases c i with67| none => norm_num68| some a => exact hz6970theorem sum_sparseCodeWeight {A I : Type*} [Fintype I] [DecidableEq I] [Fintype A]71(z : ℝ) :72(∑ c : I → Option A, sparseCodeWeight z c) =73(1 + (Fintype.card A : ℝ) * z) ^ Fintype.card I := by74unfold sparseCodeWeight75rw [← Fintype.prod_sum (fun (_ : I) (a : Option A) => a.elim 1 (fun _ => z))]76simp [Fintype.sum_option, add_comm]7778theorem sparseExplorationCode_weight (P : Path V 2 m) (hm : 0 < m) (z : ℝ) :79sparseCodeWeight z (sparseExplorationCode P hm) = z ^ P.importantTimes.card := by80have he : sparseCodeWeight z (sparseExplorationCode P hm) =81∏ i : Fin m, if i ∈ P.importantTimes then z else 1 := by82apply Finset.prod_congr rfl83intro i _84by_cases hi : i ∈ P.importantTimes <;> simp [sparseExplorationCode, hi]85rw [he, Fintype.prod_ite_mem]86simp8788@[simp] theorem card_explorationMark (m : ℕ) :89Fintype.card (ExplorationMark m) = 64 * m ^ 2 := by90simp only [ExplorationMark, Color, Fintype.card_prod, Fintype.card_fin,91Fintype.card_bool]92ring9394/-- Exact weighted code bound on the actual defect classes. Unlike the95unweighted padded-list estimate, this retains the chronological positions. -/96theorem card_defectClass_weighted_le [Fintype V] (hm : 0 < m) (δ : ℕ)97{z : ℝ} (hz : 0 ≤ z) (hz1 : z ≤ 1) :98(Fintype.card (DefectClass V m δ hm) : ℝ) * z ^ (δ + 2) ≤99(1 + 64 * (m : ℝ) ^ 2 * z) ^ m := by100classical101let f := @classSparseCode V _ m _ δ hm102have hf : Function.Injective f := classSparseCode_injective hm δ103calc104_ = ∑ C : DefectClass V m δ hm, z ^ (δ + 2) := by simp105_ ≤ ∑ C : DefectClass V m δ hm, sparseCodeWeight z (f C) := by106apply Finset.sum_le_sum107intro C _108rw [show f C = sparseExplorationCode (classRepresentative hm C) hm from rfl,109sparseExplorationCode_weight]110have hc := (classRepresentative hm C).card_importantTimes_le hm111rw [classRepresentative_defect] at hc112exact pow_le_pow_of_le_one hz hz1 hc113_ = ∑ c ∈ Finset.univ.image f, sparseCodeWeight z c := by114rw [Finset.sum_image]115intro C _ D _ h116exact hf h117_ ≤ ∑ c : Fin m → Option (ExplorationMark m), sparseCodeWeight z c := by118exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _)119(fun c _ _ => sparseCodeWeight_nonneg hz c)120_ = _ := by simp only [sum_sparseCodeWeight, card_explorationMark,121Nat.cast_mul, Nat.cast_ofNat, Nat.cast_pow, Fintype.card_fin]122123theorem card_refinedDefectClass_le_coarse_mul [Fintype V] (hm : 0 < m) (δ : ℕ) :124Fintype.card (RefinedDefectClass V m δ hm) ≤125Fintype.card (DefectClass V m δ hm) * (4 * m ^ 2) ^ (3 * δ + 4) := by126classical127rw [Fintype.card_congr (refinedDefectEquiv hm δ), Fintype.card_sigma]128calc129_ ≤ ∑ C : DefectClass V m δ hm, (4 * m ^ 2) ^ (3 * δ + 4) := by130apply Finset.sum_le_sum131intro C _132have h := card_refinedOver_le C.val hm (by decide : 0 < 2)133have hd := classRepresentative_defect hm C134change (Quotient.out C.val).defectTwice = δ at hd135simpa only [hd, show 2 * 2 = 4 from rfl] using h136_ = _ := by simp137138theorem card_refinedDefectClass_weighted_le [Fintype V] (hm : 0 < m) (δ : ℕ)139{z : ℝ} (hz : 0 ≤ z) (hz1 : z ≤ 1) :140(Fintype.card (RefinedDefectClass V m δ hm) : ℝ) * z ^ (δ + 2) ≤141(1 + 64 * (m : ℝ) ^ 2 * z) ^ m * (4 * (m : ℝ) ^ 2) ^ (3 * δ + 4) := by142have hc : (Fintype.card (RefinedDefectClass V m δ hm) : ℝ) ≤143(Fintype.card (DefectClass V m δ hm) : ℝ) * (4 * (m : ℝ) ^ 2) ^ (3 * δ + 4) := by144exact_mod_cast card_refinedDefectClass_le_coarse_mul (V := V) hm δ145calc146_ ≤ ((Fintype.card (DefectClass V m δ hm) : ℝ) *147(4 * (m : ℝ) ^ 2) ^ (3 * δ + 4)) * z ^ (δ + 2) :=148mul_le_mul_of_nonneg_right hc (pow_nonneg hz _)149_ = ((Fintype.card (DefectClass V m δ hm) : ℝ) * z ^ (δ + 2)) *150(4 * (m : ℝ) ^ 2) ^ (3 * δ + 4) := by ring151_ ≤ _ := mul_le_mul_of_nonneg_right152(card_defectClass_weighted_le (V := V) hm δ hz hz1) (by positivity)153154theorem card_refined_subfamily_weighted_le [Fintype V] (hm : 0 < m) (δ : ℕ)155(s : Finset (RefinedClass V 2 m))156(hs : ∀ C ∈ s, classDefectTwice hm (refinedToCoarse C) = δ)157{z : ℝ} (hz : 0 ≤ z) (hz1 : z ≤ 1) :158(s.card : ℝ) * z ^ (δ + 2) ≤159(1 + 64 * (m : ℝ) ^ 2 * z) ^ m * (4 * (m : ℝ) ^ 2) ^ (3 * δ + 4) := by160classical161let f : s → RefinedDefectClass V m δ hm := fun C => ⟨C.val, hs C.val C.property⟩162have hf : Function.Injective f := by163intro C D h164exact Subtype.ext (congrArg (fun x : RefinedDefectClass V m δ hm => x.val) h)165have hc := Fintype.card_le_of_injective f hf166simp only [Fintype.card_coe] at hc167have hreal : (s.card : ℝ) ≤ Fintype.card (RefinedDefectClass V m δ hm) := by168exact_mod_cast hc169exact (mul_le_mul_of_nonneg_right hreal (pow_nonneg hz _)).trans170(card_refinedDefectClass_weighted_le hm δ hz hz1)171172end Nonadditivity.HaarPathClasses