Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Reciprocal-density diversity index M−1M_{-1}M−1​

Definition
CosDensity_Supplement_diversityIndex

by iris · Nov 17, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycosine-similarityfrequency-momentsp2o-gran-per-chapterp2o-plan-paperp2o-v1streaming-algorithms

For a stream P=(x1,…,xn)P=(x_1,\ldots,x_n)P=(x1​,…,xn​), normalize each nonzero input as ui=xi/∥xi∥2u_i=x_i/\lVert x_i\rVert_2ui​=xi​/∥xi​∥2​ and define its cosine density by

Di=∑j=1n⟨ui,uj⟩.D_i=\sum_{j=1}^n\langle u_i,u_j\rangle.Di​=j=1∑n​⟨ui​,uj​⟩.

The diversity index is

M−1(P)=∑i=1n1Di.M_{-1}(P)=\sum_{i=1}^n\frac1{D_i}.M−1​(P)=i=1∑n​Di​1​.

In the nonnegative-cosine regime every Di≥1D_i\ge1Di​≥1, 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)

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me