Reciprocal-density diversity index
DefinitionCosDensity_Supplement_diversityIndexcomplexity-theorycosine-similarityfrequency-momentsp2o-gran-per-chapterp2o-plan-paperp2o-v1streaming-algorithms
For a stream , normalize each nonzero input as and define its cosine density by
The diversity index is
In the nonnegative-cosine regime every , so every reciprocal is defined and positive. This is a separate definition from the natural-exponent density moment.
Definition code
import Definitions.Def_CosDensity_Stream
namespace CosDensity.Supplement
set_option autoImplicit false
/-!
# The reciprocal-density diversity index
Q. Zhang, *Frequency Moments Beyond Equality: Streaming Cosine Density Moments*,
arXiv:2609.06925 (held version, sha256 f4d4df22…), §5, pp.15–19 (PDF pp.16–20).
**Formalization Note.** This is the paper's `M_{-1}`, not `CosDensity.moment`, whose exponent is a
natural number. Lean makes `0⁻¹ = 0`; all theorems using this definition retain the paper's
nonzero-vector and nonnegative-cosine hypotheses, under which every final density is at least one.
-/
/-- The diversity index `M_{-1}(P) = Σ_i 1 / D_i`. -/
noncomputable def diversityIndex {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
(P : List E) : ℝ :=
∑ i : Fin P.length, (CosDensity.density P i)⁻¹
end CosDensity.Supplement
Source
Q. Zhang, Frequency Moments Beyond Equality: Streaming Cosine Density Moments, arXiv:2609.06925 (held version, sha256 f4d4df22…), §5, pp.15–19 (PDF pp.16–20)