AFTD Auto-Formalizing Theoretical Domains

sampfordRareGroupWeight

def

For integers m, r, k, ℓ with m + r = n, r ≥ 2, 1 ≤ k < m, the rare-group weight W_ℓ is defined as binom(m, k + 1 - ℓ) * binom(r, ℓ) * [k / (m - k)]^(k + 1 - ℓ) * [1 / (r - 1)]^ℓ * [(k + 1 - ℓ)(1 - k / m) + ℓ(1 - 1 / r)] for ℓ ≤ k + 1, and 0 for out-of-range indices.

Statement

noncomputable def sampfordRareGroupWeight (m r k ℓ : ℕ) : ℝ
Defined in
OP-1944
Verified
18 Nov 2026
Axioms
none listed
Used by 1
  • sampfordRareGroupRatioFor partition parameters m, r, k with m + r = n, r ≥ 2, 1 ≤ k < m, the rare-group coupling deficit ratio is the quotient of the sum of…

Read back from the Lean

The function sampfordRareGroupWeight takes four natural numbers $m, r, k, \ell$ and returns a real number defined as follows: If $\ell \le k + 1$, it returns: $$\binom{m}{k + 1 - \ell} \binom{r}{\ell} \left(\frac{k}{m - k}\right)^{k + 1 - \ell} \left(\frac{1}{r - 1}\right)^\ell \left((k + 1 - \ell)\left(1 - \frac{k}{m}\right) + \ell\left(1 - \frac{1}{r}\right)\right)$$ where $k + 1 - \ell$, $m - k$, and $r - 1$ are natural number subtractions before casting to $\mathbb{R}$, and division by zero is handled according to Lean's convention ($x / 0 = 0$). Otherwise (if $\ell > k + 1$), it returns $0$.

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 rare-group weight W_ℓ from the Sampford coupling obstruction frontier. -/
noncomputable def sampfordRareGroupWeight (m r k ℓ : ℕ) : ℝ :=
  if ℓ ≤ k + 1 then
    (Nat.choose m (k + 1 - ℓ) : ℝ) * (Nat.choose r ℓ : ℝ) *
    ((k : ℝ) / (m - k : ℝ)) ^ (k + 1 - ℓ) * ((1 : ℝ) / (r - 1 : ℝ)) ^ ℓ *
    ((k + 1 - ℓ : ℝ) * (1 - (k : ℝ) / m) + (ℓ : ℝ) * (1 - (1 : ℝ) / r))
  else 0
See it in the graphDiscuss this resultChallenge it