Capacitated coreset size, metric dimension, and the two analytic inputs
DefinitionPriceCapacities_UpperBound_Foundationsclusteringcoresetsmetric-geometry
Weighted data are finitely supported real functions. A capacitated coreset preserves total mass and all optimal assignment costs for fixed centers and loads. The file defines support size, Euclidean spaces, doubling dimension, distance pseudodimension, and the precise statements of the terminal embedding and dyadic Rademacher chaining results used in the upper bounds.
Definition code
import Mathlib
namespace CapCoreset
open Finset
variable {X : Type*} {ι : Type*} [Fintype ι]
/-- A weighted point set: finitely supported weights. -/
abbrev WSet (X : Type*) := X →₀ ℝ
/-- Nonnegativity of the weights. -/
def IsNonneg (W : WSet X) : Prop := ∀ x, 0 ≤ W x
/-- Weighted sum `f(W) = ∑_{x ∈ supp W} W(x) f(x)`. -/
noncomputable def wsum (W : WSet X) (f : X → ℝ) : ℝ :=
∑ x ∈ W.support, W x * f x
/-- Total weight `1(W)`. -/
noncomputable def mass (W : WSet X) : ℝ := wsum W fun _ => 1
/-- A fractional assignment of the weight of `W` to the centres with loads `h`. -/
structure IsAssignment (W : WSet X) (h : ι → ℝ) (a : X → ι → ℝ) : Prop where
nonneg : ∀ x i, 0 ≤ a x i
row : ∀ x, ∑ i, a x i = W x
col : ∀ i, ∑ x ∈ W.support, a x i = h i
/-- Cost of an assignment. -/
noncomputable def assignCost (W : WSet X) (D : X → ι → ℝ) (a : X → ι → ℝ) : ℝ :=
∑ x ∈ W.support, ∑ i, a x i * D x i
/-- The capacitated cost `cost_W(C, h)`: the infimum of the assignment costs. -/
noncomputable def capCost (W : WSet X) (D : X → ι → ℝ) (h : ι → ℝ) : ℝ :=
sInf (assignCost W D '' {a | IsAssignment W h a})
/-- Feasible load vectors `H = {h ≥ 0, ∑ h = n}`. -/
def IsLoad (W : WSet X) (h : ι → ℝ) : Prop := (∀ i, 0 ≤ h i) ∧ ∑ i, h i = mass W
/-! ### Clustering costs and coresets -/
/-- The power-`z` distance cost matrix of a centre tuple `C`. -/
noncomputable def powCost {X : Type*} [PseudoMetricSpace X] (z : ℕ) (C : ι → X) :
X → ι → ℝ :=
fun x i => dist x (C i) ^ z
/-- **Definition 2.2** (capacitated coreset). `Q` is a capacitated `ε`-coreset of `P`
for capacitated `(k, z)`-clustering if it has nonnegative weights, the same total
weight, and preserves the capacitated cost of every centre tuple and every feasible
load vector up to a factor `1 ± ε`. -/
def IsCapCoreset {X : Type*} [PseudoMetricSpace X] (k z : ℕ) (ε : ℝ) (P Q : WSet X) :
Prop :=
IsNonneg Q ∧ mass Q = mass P ∧
∀ (C : Fin k → X) (h : Fin k → ℝ), IsLoad P h →
|capCost Q (powCost z C) h - capCost P (powCost z C) h| ≤
ε * capCost P (powCost z C) h
/-- Size of a weighted point set: number of points of nonzero weight. -/
noncomputable def size (W : WSet X) : ℕ := W.support.card
end CapCoreset
namespace CapCoreset
open Finset
def sgn (b : Bool) : ℝ := if b then 1 else -1
/-- Euclidean space `ℝ^d`. -/
abbrev Euc (d : ℕ) := EuclideanSpace ℝ (Fin d)
/-- **Lemma 2.3** (terminal embeddings, Narayanan–Nelson [NN19]): every set of
`n ≥ 2` points of `ℝ^d` admits a terminal embedding with distortion `1 + α` into
`ℝ^m`, `m = O(α⁻² log n)`, for every `0 < α < 1/2`. -/
def TerminalEmbeddingLemma : Prop :=
∃ C : ℝ, 0 < C ∧ ∀ (d : ℕ) (S : Finset (Euc d)), 2 ≤ S.card → ∀ α : ℝ, 0 < α → α < 1 / 2 →
∃ m : ℕ, (m : ℝ) ≤ C * α⁻¹ ^ 2 * Real.log S.card ∧
∃ ψ : Euc d → Euc m, ∀ x ∈ S, ∀ y : Euc d,
‖x - y‖ ≤ ‖ψ x - ψ y‖ ∧ ‖ψ x - ψ y‖ ≤ (1 + α) * ‖x - y‖
/-- Euclidean `α`-net of a set of vectors (Definition 5.4). -/
def IsNet {J : Type*} [Fintype J] (V : Set (J → ℝ)) (α : ℝ) (N : Finset (J → ℝ)) : Prop :=
∀ v ∈ V, ∃ u ∈ N, ∑ s, (v s - u s) ^ 2 ≤ α ^ 2
/-- `E_σ sup_{v ∈ V} |⟨σ, v⟩|²` for independent uniform signs. -/
noncomputable def radSupSq {J : Type*} [Fintype J] [DecidableEq J] (V : Set (J → ℝ)) : ℝ :=
(∑ σ : J → Bool, sSup ((fun v => (∑ s, sgn (σ s) * v s) ^ 2) '' V)) /
(Fintype.card (J → Bool) : ℝ)
/-- **Proposition 5.7** (Dudley's inequality, [Ver18, §8.1]), in its standard dyadic
(chaining-sum) form: if `‖v‖ ≤ R` on `V` and `nets j` is an `R 2^{-j}`-net of `V`,
then for every cut-off level `L`
`E_σ sup_V |⟨σ,v⟩|² ≲ N (R 2^{-L})² + (∑_{j ≤ L} R 2^{-j} √(log 2|nets j|))²`. -/
def DudleyInequality : Prop :=
∃ C : ℝ, 0 < C ∧ ∀ (N : ℕ) (V : Set (Fin N → ℝ)) (R : ℝ), 0 < R →
(∀ v ∈ V, ∑ s, v s ^ 2 ≤ R ^ 2) →
∀ nets : ℕ → Finset (Fin N → ℝ), (∀ j, IsNet V (R / 2 ^ j) (nets j)) →
∀ L : ℕ, radSupSq V ≤ C * (N * (R / 2 ^ L) ^ 2 +
(∑ j ∈ Finset.range (L + 1),
R / 2 ^ j * Real.sqrt (Real.log (2 * (nets j).card))) ^ 2)
/-- Doubling dimension at most `q`: every ball is covered by `2^q` balls of half the
radius. -/
def HasDoublingDim (X : Type*) [PseudoMetricSpace X] (q : ℕ) : Prop :=
∀ (x : X) (r : ℝ), ∃ S : Finset X, S.card ≤ 2 ^ q ∧
Metric.closedBall x r ⊆ ⋃ y ∈ S, Metric.closedBall y (r / 2)
/-- **Definition 8.1.** Distance pseudodimension at most `q`: no `m > q` points with
thresholds admit all `2^m` truth patterns of `d(x_i, c) ≤ t_i` as `c` varies. -/
def HasDistPseudoDim (X : Type*) [PseudoMetricSpace X] (q : ℕ) : Prop :=
∀ (m : ℕ) (xs : Fin m → X) (ts : Fin m → ℝ),
(∀ pat : Fin m → Bool, ∃ c : X, ∀ i, (dist (xs i) c ≤ ts i ↔ pat i = true)) → m ≤ q
/-- Polylogarithmic factor `log(2 + x)`, used to express `Õ(·)`. -/
noncomputable def plog (x : ℝ) : ℝ := Real.log (2 + x)
end CapCoreset
Source
Prabhu, Schwiegelshohn and Shyam, The Price of Capacities for Clustering Coresets, Definition 2.2, Lemma 2.3, Proposition 5.7 and Definition 8.1. https://github.com/sudarshanshy/capacitated-coresets-upper-bounds/blob/8b06a8828641f2f764dd8476ae5be2dea3b0a3be/CapacitatedCoresetsUpperBounds/Defs.lean