AFTD Auto-Formalizing Theoretical Domains

sampfordConsecutiveHouseCouplingLossDelta

def

The maximal consecutive-house coupling loss Delta_n for Sampford apportionment on n parties, defined as the supremum over all positive vote-share vectors p on n parties (with p_i > 0 and sum p_i = 1) and house sizes h >= 1, of the infimum over all valid couplings of the Sampford apportionment seat distributions at house sizes h and h + 1 of the probability that some party i receives strictly fewer seats at house h + 1 than at house h. At each house size h, party i receives its lower quota floor(h p_i) plus an indicator of whether i is in the subset S of size k = h - sum_j floor(h p_j) drawn according to Sampford's rejective sampling law on the fractional residues r_j = h p_j - floor(h p_j).

Statement

open Classical in
noncomputable def sampfordConsecutiveHouseCouplingLossDelta (n : ℕ) : ℝ
Defined in
Correa et al., arXiv:2405.03687, Section 3.3 and Appendix A
Verified
18 Nov 2026
Axioms
none listed
Used by 3

Read back from the Lean

sampfordConsecutiveHouseCouplingLossDelta (n : ℕ) : ℝ defines a real number for each natural number n. For a vector r : Fin n → ℝ and subset S ⊆ Fin n, its Sampford weight is defined by weight r S = (∑ i ∈ S, (1 - r i)) * (∏ i ∈ S, r i) * (∏ i ∈ (Finset.univ \ S), (1 - r i)), and totalWeight r k is the sum of weight r S over all subsets S ⊆ Fin n with cardinality k. The probability probSubset r k S of subset S is defined by: - if k = 0: 1 if S = ∅, else 0; - else if k = n: 1 if S = Finset.univ, else 0; - else if S.card = k and totalWeight r k ≠ 0: weight r S / totalWeight r k; - else: 0. Given a probability vector p : Fin n → ℝ and integer house size h : ℕ: - Let l i = ⌊h * p i⌋, r i = h * p i - l i, and k = h - ∑ i, l i (using ℕ subtraction). - Let l' i = ⌊(h + 1) * p i⌋, r' i = (h + 1) * p i - l' i, and k' = (h + 1) - ∑ i, l' i. - A function prob : Finset (Fin n) → Finset (Fin n) → ℝ is a coupling (isCoupling p h prob) if: 1. prob S T ≥ 0 for all subsets S, T ⊆ Fin n; 2. For all S ⊆ Fin n with |S| = k, the sum of prob S T over all T of size k' equals probSubset r k S; 3. For all T ⊆ Fin n with |T| = k', the sum of prob S T over all S of size k equals probSubset r' k' T. - The loss of a coupling prob is the sum over all S of size k and T of size k' of prob S T whenever there exists some index i : Fin n such that the allocation at house size h + 1 decreases strictly below the allocation at house size h (i.e., l' i + [i ∈ T] < l i + [i ∈ S]), and 0 otherwise. Finally, sampfordConsecutiveHouseCouplingLossDelta n is the supremum (sSup) over all v : ℝ such that there exist: - a strictly positive probability vector p : Fin n → ℝ (satisfying ∀ i, 0 < p i and ∑ i, p i = 1), and - a house size h : ℕ with 1 ≤ h, such that v is the infimum (sInf) of the coupling loss over all valid couplings prob for p and h.

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

open Classical in
/-- Maximal consecutive-house coupling loss Delta_n for Sampford apportionment on n parties. -/
noncomputable def sampfordConsecutiveHouseCouplingLossDelta (n : ℕ) : ℝ :=
  let weight (r : Fin n → ℝ) (S : Finset (Fin n)) : ℝ :=
    (∑ i ∈ S, (1 - r i)) * (∏ i ∈ S, r i) * (∏ i ∈ (Finset.univ \ S), (1 - r i))
  let totalWeight (r : Fin n → ℝ) (k : ℕ) : ℝ :=
    ∑ S ∈ Finset.powersetCard k Finset.univ, weight r S
  let probSubset (r : Fin n → ℝ) (k : ℕ) (S : Finset (Fin n)) : ℝ :=
    if k = 0 then (if S = ∅ then 1 else 0)
    else if k = n then (if S = Finset.univ then 1 else 0)
    else if S.card = k ∧ totalWeight r k ≠ 0 then weight r S / totalWeight r k
    else 0
  let isCoupling (p : Fin n → ℝ) (h : ℕ) (prob : Finset (Fin n) → Finset (Fin n) → ℝ) : Prop :=
    let l (i : Fin n) := Nat.floor (h * p i)
    let r (i : Fin n) := h * p i - l i
    let k := h - ∑ i, l i
    let l' (i : Fin n) := Nat.floor ((h + 1) * p i)
    let r' (i : Fin n) := (h + 1) * p i - l' i
    let k' := (h + 1) - ∑ i, l' i
    (∀ S T, 0 ≤ prob S T) ∧
    (∀ S ∈ Finset.powersetCard k Finset.univ,
      ∑ T ∈ Finset.powersetCard k' Finset.univ, prob S T = probSubset r k S) ∧
    (∀ T ∈ Finset.powersetCard k' Finset.univ,
      ∑ S ∈ Finset.powersetCard k Finset.univ, prob S T = probSubset r' k' T)
  let loss (p : Fin n → ℝ) (h : ℕ) (prob : Finset (Fin n) → Finset (Fin n) → ℝ) : ℝ :=
    let l (i : Fin n) := Nat.floor (h * p i)
    let k := h - ∑ i, l i
    let l' (i : Fin n) := Nat.floor ((h + 1) * p i)
    let k' := (h + 1) - ∑ i, l' i
    ∑ S ∈ Finset.powersetCard k Finset.univ,
      ∑ T ∈ Finset.powersetCard k' Finset.univ,
        if ∃ i : Fin n, l' i + (if i ∈ T then 1 else 0) < l i + (if i ∈ S then 1 else 0)
        then prob S T else 0
  sSup { v | ∃ (p : Fin n → ℝ) (h : ℕ),
    (∀ i, 0 < p i) ∧ ∑ i, p i = 1 ∧ 1 ≤ h ∧
    v = sInf { L | ∃ prob, isCoupling p h prob ∧ L = loss p h prob } }
See it in the graphDiscuss this resultChallenge it