AFTD Auto-Formalizing Theoretical Domains

serial_dictatorship_first_excess_match_prob

def

The real-valued match probability p_n(d) in ℝ of student n+1 in serial dictatorship with n unit-capacity schools and preference lists of length d drawn without replacement, defined by the occupancy birth chain. It returns a real number in ℝ computed as the sum over k ∈ Finset.range (n + 1) of dist n k * (1 - (Nat.choose k d : ℝ) / (Nat.choose n d : ℝ)), where dist 0 k = if k = 0 then 1 else 0, and dist (m + 1) k = dist m k * ((Nat.choose k d : ℝ) / (Nat.choose n d : ℝ)) + (if k = 0 then 0 else dist m (k - 1) * (1 - (Nat.choose (k - 1) d : ℝ) / (Nat.choose n d : ℝ))), where division by zero when Nat.choose n d = 0 evaluates to 0 in ℝ.

Statement

noncomputable def serial_dictatorship_first_excess_match_prob (n d : ℕ) : ℝ
Defined in
arXiv:2506.06217, Section 2.1 (Longer Lists Yield Better Matchings)
Verified
18 Nov 2026
Axioms
none listed
Used by 4

Read back from the Lean

A definition of a function serial_dictatorship_first_excess_match_prob taking two natural numbers $n$ and $d$ and returning the real number computed as follows: Define an auxiliary recursive function $\text{dist} : \mathbb{N} \to \mathbb{N} \to \mathbb{R}$ by: - $\text{dist}(0, k) = \begin{cases} 1 & \text{if } k = 0 \\ 0 & \text{if } k \ne 0 \end{cases}$ - $\text{dist}(m + 1, k) = \text{dist}(m, k) \cdot \frac{\binom{k}{d}}{\binom{n}{d}} + \begin{cases} 0 & \text{if } k = 0 \\ \text{dist}(m, k - 1) \cdot \left(1 - \frac{\binom{k-1}{d}}{\binom{n}{d}}\right) & \text{if } k \ne 0 \end{cases}$ The function returns the sum: $$\sum_{k=0}^{n} \text{dist}(n, k) \cdot \left(1 - \frac{\binom{k}{d}}{\binom{n}{d}}\right)$$ where binomial coefficients are coerced to $\mathbb{R}$ and division is in $\mathbb{R}$.

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

/-- Match probability p_n(d) of student n+1 in serial dictatorship, computed via the occupancy birth chain. -/
noncomputable def serial_dictatorship_first_excess_match_prob (n d : ℕ) : ℝ := let rec dist : ℕ → ℕ → ℝ
    | 0 => fun k => if k = 0 then 1 else 0
    | m + 1 => fun k =>
      dist m k * ((Nat.choose k d : ℝ) / (Nat.choose n d : ℝ)) +
        if k = 0 then 0
        else dist m (k - 1) * (1 - (Nat.choose (k - 1) d : ℝ) / (Nat.choose n d : ℝ))
  ∑ k ∈ Finset.range (n + 1),
    dist n k * (1 - (Nat.choose k d : ℝ) / (Nat.choose n d : ℝ))
See it in the graphDiscuss this resultChallenge it