AFTD Auto-Formalizing Theoretical Domains

SocialChoice.Voting.ballotFromInjective

defimported Lean

Pull a linear order back along an injective map, using the supplied codomain order explicitly rather than relying on ambient typeclass search. This is the safe constructor for ballots on types such as Fin n, which already carry a default order.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Finset in
variable {N A : Type*} in
noncomputable def SocialChoice.Voting.ballotFromInjective {B : Type*} (rB : LinearOrder B)
    (f : A → B) (hf : Function.Injective f) : LinearOrder A
Defined in
EconCSLib, `SocialChoice.Voting.ballotFromInjective`
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.
Verified
08 Oct 2026
Axioms
none listed
Built on 2
Used by 12

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Finset in
variable {N A : Type*} in
/-- Pull a linear order back along an injective map, using the supplied codomain order explicitly rather than relying on ambient typeclass search. This is the safe constructor for ballots on types such as `Fin n`, which already carry a default order. -/
noncomputable def SocialChoice.Voting.ballotFromInjective {B : Type*} (rB : LinearOrder B)
    (f : A → B) (hf : Function.Injective f) : LinearOrder A where
  toPartialOrder :=
    { toPreorder :=
        { toLE := ⟨fun a b => @LE.le B (ballotLE rB) (f a) (f b)⟩
          toLT := ⟨fun a b => @LT.lt B (ballotLT rB) (f a) (f b)⟩
          le_refl := fun a => rB.le_refl (f a)
          le_trans := fun a b c hab hbc => rB.le_trans (f a) (f b) (f c) hab hbc
          lt_iff_le_not_ge := fun a b => rB.lt_iff_le_not_ge (f a) (f b) }
      le_antisymm := fun a b hab hba => hf (rB.le_antisymm (f a) (f b) hab hba) }
  toMin := ⟨fun a b =>
    if @LE.le B (ballotLE rB) (f a) (f b) then a else b⟩
  toMax := ⟨fun a b =>
    if @LE.le B (ballotLE rB) (f a) (f b) then b else a⟩
  le_total := fun a b => rB.le_total (f a) (f b)
  toDecidableLE := fun a b =>
    @LinearOrder.toDecidableLE B rB (f a) (f b)
  toDecidableEq := Classical.decEq A
  toDecidableLT := fun a b =>
    @LinearOrder.toDecidableLT B rB (f a) (f b)
  min_def := by
    intro a b
    rfl
  max_def := by
    intro a b
    rfl
See it in the graphDiscuss this resultChallenge it