SocialChoice.Voting.zKey
defimported Lean
The rank function used by zBallot: first separate alternatives by membership in R, then use the relevant source ballot's rank.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {N A : Type*} in noncomputable def SocialChoice.Voting.zKey [Fintype A] (P Q : LinearOrder A) (R : Set A) [∀ a : A, Decidable (a ∈ R)] (a : A) : Nat
- Defined in
- EconCSLib, `SocialChoice.Voting.zKey`
- Lean proof
- By xbei (from the file's git history), from github.com/gametheoryinlean/EconCSLib at
1a88f809b538(Copyright (c) 2026 EconCSLib contributors. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.30.0.SocialChoice.Voting.zKey← SocialChoice.Voting.zKey (EconCSLib/SocialChoice/Voting/ProfileSurgery.lean:25): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 2
- SocialChoice.Voting.BallotPrefers_ballotFromInjectiveSocialChoice.Voting.BallotPrefers_ballotFromInjective
- SocialChoice.Voting.rank
rank r ais the number of alternatives strictly aboveain ballotr.
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {N A : Type*} in /-- The rank function used by `zBallot`: first separate alternatives by membership in `R`, then use the relevant source ballot's rank. -/ noncomputable def SocialChoice.Voting.zKey [Fintype A] (P Q : LinearOrder A) (R : Set A) [∀ a : A, Decidable (a ∈ R)] (a : A) : Nat := let base := Fintype.card A + 1 let block := if a ∈ R then 0 else 1 let localRank := if a ∈ R then rank P a else rank Q a block * base + localRank