AFTD Auto-Formalizing Theoretical Domains

online_wus_winner

def

Given a finite type of voters V, candidate type C with decidable equality, preference profile prof : V → LinearOrder C, and a sequence of candidates c : ℕ → C, online_wus_winner prof c : ℕ → C is defined recursively: at round 0 the winner is c 0; at round s + 1, with candidate finset Ct1 = (Finset.range (s + 2)).image c and phi = (Real.sqrt 5 - 1) / 2, if the previous winner online_wus_winner prof c s satisfies is_weighted_uncovered prof phi Ct1 then the winner is online_wus_winner prof c s, otherwise the winner is c (s + 1).

Statement

noncomputable def online_wus_winner {V C : Type*} [Fintype V] [DecidableEq C]
    (prof : V → LinearOrder C) (c : ℕ → C) : ℕ → C
Defined in
arXiv:2611.30683, Section 4, Algorithm 3
Verified
29 Nov 2026
Axioms
none listed
Built on 1
  • is_weighted_uncoveredGiven a finite type of voters V, a type of candidates C, a preference profile prof : V → LinearOrder C assigning each voter a linear order…

Read back from the Lean

Given types V (with [Fintype V]) and C (with [DecidableEq C]), a voting profile prof : V → LinearOrder C assigning a linear order on C to each voter in V, and a sequence of candidates c : ℕ → C, online_wus_winner prof c is the sequence of candidates in C defined recursively for t : ℕ by: - At t = 0, the winner is c 0. - At t = s + 1, letting ih be the winner at step s, Ct1 be the set of candidates {c 0, c 1, ..., c (s + 1)} (the image of {0, ..., s + 1} under c), and phi = (Real.sqrt 5 - 1) / 2: - If ih is weighted uncovered (is_weighted_uncovered prof phi Ct1 ih), the winner at step s + 1 remains ih. - Otherwise, the winner at step s + 1 is the newly introduced candidate c (s + 1).

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

/-- Algorithm 3: online weighted uncovered set rule keeping the incumbent if still phi-weighted uncovered, else switching to the challenger. -/
noncomputable def online_wus_winner {V C : Type*} [Fintype V] [DecidableEq C]
    (prof : V → LinearOrder C) (c : ℕ → C) : ℕ → C := fun t =>
  @Nat.rec (fun _ => C)
    (c 0)
    (fun s ih =>
      let Ct1 := (Finset.range (s + 2)).image c
      let phi := (Real.sqrt 5 - 1) / 2
      @ite C (is_weighted_uncovered prof phi Ct1 ih) (Classical.propDecidable _)
        ih
        (c (s + 1)))
    t
See it in the graphDiscuss this resultChallenge it