Layer-cake counting for families of natural numbers #
For a family k of natural numbers indexed by a finite set s, slice the values at every level
j and count the indices above it, Nⱼ = #{i ∈ s | j < kᵢ}. Each index is counted once at every
level below its value, so ∑ⱼ Nⱼ = ∑ᵢ kᵢ, and each pair of indices is counted together at every
level below both values, so ∑ⱼ Nⱼ² = ∑_{i, i'} min kᵢ k_{i'}.
Combining the two gives the exponent identity behind the Conway–Sloane form of the local density
of a diagonal Jordan form diag(uᵢ pᵏⁱ) at an odd prime: the exponent
∑ⱼ binom(Nⱼ + 1, 2) of the density, doubled, plus the exponent ∑_{i, i'} (k_{i'} - kᵢ)⁺ of the
cross terms of the p-mass, is (n + 1) ∑ kᵢ.
Main results #
Finset.sum_range_card_filter_lt:∑_{j < K} #{i ∈ s | j < kᵢ} = ∑_{i ∈ s} kᵢwhen everykᵢis at mostK.Finset.sum_range_card_filter_lt_mul_self:∑_{j < K} #{i ∈ s | j < kᵢ}² = ∑_{i, i' ∈ s} min kᵢ k_{i'}under the same bound.Finset.two_mul_sum_range_choose_add_sum_sum_tsub:2 ∑_{j < max k} binom(Nⱼ + 1, 2) + ∑_{i, i'} (k_{i'} - kᵢ) = (#s + 1) ∑ kᵢ.
Layer-cake counting for pairs. If every kᵢ with i ∈ s is at most K, then the sum
over the levels j < K of the squared number of indices with j < kᵢ is
∑_{i, i' ∈ s} min kᵢ k_{i'}.
The Conway–Sloane exponent identity. Twice ∑_{j < max k} binom(Nⱼ + 1, 2), where
Nⱼ = #{i ∈ s | j < kᵢ}, plus ∑_{i, i' ∈ s} (k_{i'} - kᵢ) (truncated subtraction) is
(#s + 1) ∑_{i ∈ s} kᵢ. The first sum is the exponent of p in the local density of the
diagonal Jordan form diag(uᵢ pᵏⁱ) at an odd prime, the second is the exponent of √p in the
cross terms of its Conway–Sloane p-mass.