Exact Lean source
Nonadditivity.HaarPathMultiplicity
Download original .lean · View on GitHub · Jump to source
Direct imports
Nonadditivity.HaarPathProfilesMathlib.Algebra.BigOperators.Group.Finset.Basicdependency
Imported by project modules
3 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
20 project constants, including generated, internal and private declarations.
20 declarations
Nonadditivity.HaarPathMultiplicity.excessOccurrencesNonadditivity.HaarPathMultiplicity.excessOccurrences.eq_1internal/detail/privateNonadditivity.HaarPathMultiplicity.excessOccurrences_eqNonadditivity.HaarPathMultiplicity.excessOccurrences_eq._proof_1_1internal/detail/privateNonadditivity.HaarPathMultiplicity.excess_add_twice_edgesNonadditivity.HaarPathMultiplicity.excess_add_twice_edges._proof_1_1internal/detail/privateNonadditivity.HaarPathMultiplicity.excess_add_twice_edges._proof_1_2internal/detail/privateNonadditivity.HaarPathMultiplicity.highMultiplicityOccurrencesNonadditivity.HaarPathMultiplicity.highMultiplicityOccurrences.eq_1internal/detail/privateNonadditivity.HaarPathMultiplicity.highMultiplicityOccurrences_le_twice_excessNonadditivity.HaarPathMultiplicity.highMultiplicityOccurrences_le_twice_excess._proof_1_3internal/detail/privateNonadditivity.HaarPathMultiplicity.highMultiplicityOccurrences_le_twice_excess._proof_1_4internal/detail/privateNonadditivity.HaarPathMultiplicity.length_le_twice_edges_add_excessNonadditivity.HaarPathMultiplicity.length_le_twice_edges_add_excess._proof_1_1internal/detail/privateNonadditivity.HaarPathMultiplicity.singletonEdgesNonadditivity.HaarPathMultiplicity.singletonEdges.eq_1internal/detail/privateNonadditivity.HaarPathMultiplicity.sum_multiplicitiesNonadditivity.HaarPathMultiplicity.sum_occurrence_weightsNonadditivity.HaarPathMultiplicity.twice_edges_le_length_add_singletonsNonadditivity.HaarPathMultiplicity.twice_edges_le_length_add_singletons._proof_1_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 Nonadditivity.HaarPathProfiles7import Mathlib.Algebra.BigOperators.Group.Finset.Basic89/-! # Literal edge-multiplicity identities for the Haar path expansion1011The list may be the colored edges of an original path or the successive12compressed-edge visits. All cardinal and excess-occurrence estimates are13proved for its actual multiplicities, rather than supplied as hypotheses.14-/15noncomputable section16namespace Nonadditivity.HaarPathMultiplicity17open scoped BigOperators18variable {E : Type*} [DecidableEq E]1920/-- Edges that occur exactly once in the given path. -/21def singletonEdges (l : List E) : Finset E := l.toFinset.filter (fun e => l.count e = 1)2223/-- Occurrences beyond the first two visits of each edge. -/24def excessOccurrences (l : List E) : ℕ := ∑ e ∈ l.toFinset, (l.count e - 2)2526theorem sum_multiplicities (l : List E) :27∑ e ∈ l.toFinset, l.count e = l.length := List.sum_toFinset_count_eq_length l2829/-- BC equation (30), stated without truncated subtraction on either side. -/30theorem excess_add_twice_edges (l : List E) :31excessOccurrences l + 2*l.toFinset.card = l.length + (singletonEdges l).card := by32have hpoint (e : E) (he : e ∈ l.toFinset) :33(l.count e - 2) + 2 = l.count e + (if l.count e = 1 then 1 else 0) := by34have hp : 0 < l.count e := List.count_pos_iff.mpr (List.mem_toFinset.mp he)35split_ifs <;> omega36have hs := Finset.sum_congr rfl hpoint37simpa [excessOccurrences, singletonEdges, Finset.sum_add_distrib,38Finset.sum_ite, sum_multiplicities, mul_comm] using hs3940/-- The number of distinct edges is at most `(length + singletons)/2`. -/41theorem twice_edges_le_length_add_singletons (l : List E) :422*l.toFinset.card ≤ l.length + (singletonEdges l).card := by43have h := excess_add_twice_edges l44omega4546/-- Total visits to edges of multiplicity at least four. -/47def highMultiplicityOccurrences (l : List E) : ℕ :=48∑ e ∈ l.toFinset, if 4 ≤ l.count e then l.count e else 04950/-- The fourth-and-higher multiplicity cost is controlled by twice the exact51excess. This is the counting step in the BC probabilistic weight estimate. -/52theorem highMultiplicityOccurrences_le_twice_excess (l : List E) :53highMultiplicityOccurrences l ≤ 2*excessOccurrences l := by54rw [highMultiplicityOccurrences, excessOccurrences, Finset.mul_sum]55apply Finset.sum_le_sum56intro e he57split_ifs <;> omega5859/-- First/last visits contribute at most two per distinct compressed edge;60all other visits are precisely the excess counted above. -/61theorem length_le_twice_edges_add_excess (l : List E) :62l.length ≤ 2*l.toFinset.card + excessOccurrences l := by63have h := excess_add_twice_edges l64omega6566/-- A second, useful form of BC equation (30). -/67theorem excessOccurrences_eq (l : List E) :68excessOccurrences l = l.length + (singletonEdges l).card - 2*l.toFinset.card := by69have h := excess_add_twice_edges l70omega7172/-- Summing a statistic over distinct edges equals its occurrence sum when73weighted by the actual edge multiplicity. -/74theorem sum_occurrence_weights {M : Type*} [AddCommMonoid M]75(l : List E) (f : E → M) :76(l.map f).sum = ∑ e ∈ l.toFinset, l.count e • f e := by77exact Finset.sum_list_map_count l f7879end Nonadditivity.HaarPathMultiplicity