AFTD Auto-Formalizing Theoretical Domains

kmeans_cost_two

def

The 2-means clustering cost of a finite set of points X in a normed group with respect to two centers c₁ and c₂ is the sum over x in X of min(||x - c₁||², ||x - c₂||²).

Statement

noncomputable def kmeans_cost_two {E : Type*} [NormedAddCommGroup E] (X : Finset E) (c₁ c₂ : E) : ℝ
Defined in
arXiv:2611.14573 Section 2
Verified
13 Nov 2026
Axioms
none listed
Used by 2
  • kmeans_plus_plus_two_expected_costThe expected cost E[Phi₂] of two centers chosen by k-means++ on a finite set X is the average over uniformly chosen first center c₁ in X…
  • kmeans_opt_twoThe optimal 2-means cost OPT₂(X) of a finite set of points X is the infimum over all pairs of centers c₁, c₂ of the 2-means cost of X with…

Read back from the Lean

A definition kmeans_cost_two which, given a normed additive commutative group E, a finite subset X of E, and two points c₁ and c₂ in E, computes the real number given by the sum over all x ∈ X of the minimum of the squared distance ‖x - c₁‖^2 and the squared distance ‖x - c₂‖^2.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The 2-means cost of a finite point set X with respect to two centers c₁ and c₂. -/
noncomputable def kmeans_cost_two {E : Type*} [NormedAddCommGroup E] (X : Finset E) (c₁ c₂ : E) : ℝ := ∑ x ∈ X, min (‖x - c₁‖^2) (‖x - c₂‖^2)
See it in the graphDiscuss this resultChallenge it