candidate_rank
def
Given a finite candidate type C with decidable equality, a linear order ord on C, and a candidate c in C, candidate_rank ord c is the 0-based index of c in Fin (Fintype.card C), defined as the number of candidates strictly greater than c under ord.
Statement
def candidate_rank {C : Type*} [Fintype C] [DecidableEq C] (ord : LinearOrder C) (c : C) : Fin (Fintype.card C)
- Defined in
- arXiv:2610.26535 Definition 2
- Verified
- 24 Oct 2026
- Axioms
- none listed
- Built on 2
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder.
- TotalPreorderA total preorder: a preorder where
- Used by 3
- rank_score_candidate_weightGiven a nonempty finite type of voters V, a finite type of candidates C with decidable equality, a scoring function s : Fin (Fintype.card…
- rank_score_candidate_weight_pos_of_last_posIf s is a positional scoring vector whose last-place score is positive then every candidate has strictly positive rank-score weight.
- not_rank_score_veto_core_side_count_boundThe statement
rank_score_veto_core_side_count_boundis false: The conclusion has its two cardinalities swapped with respect to the…
Read back from the Lean
Given a finite type C with decidable equality, a linear order ord on C, and an element c : C, candidate_rank is defined as the element of Fin (Fintype.card C) whose underlying value is the number of elements c' : C strictly greater than c with respect to ord (i.e., #{c' : C | c < c'}). (Consequently, the maximum element has rank 0 and the minimum element has rank Fintype.card C - 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
/-- The 0-based rank of candidate c in a linear order on candidates C, given by the number of candidates strictly preferred to c. -/ def candidate_rank {C : Type*} [Fintype C] [DecidableEq C] (ord : LinearOrder C) (c : C) : Fin (Fintype.card C) := letI := ord have h_not : c ∉ Finset.filter (fun c' => c < c') Finset.univ := by simp have h_ssubset : Finset.filter (fun c' => c < c') Finset.univ ⊂ Finset.univ := by rw [Finset.ssubset_univ_iff] intro h_all have : c ∈ Finset.filter (fun c' => c < c') Finset.univ := by rw [h_all]; exact Finset.mem_univ c exact h_not this ⟨(Finset.filter (fun c' => c < c') Finset.univ).card, Finset.card_lt_card h_ssubset⟩