List.exists_argMax_on
theoremverifiedformalizationimported Lean
Existence of an argmax on a non-empty list under a total preorder. Since the preorder may lack antisymmetry, ties are allowed — we only claim existence of *some* maximizer, not uniqueness.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in variable {X Y : Type*} in theorem List.exists_argMax_on [TotalPreorder Y] (f : X → Y) (head : X) (tail : List X) : ∃ m, m ∈ head :: tail ∧ ∀ x ∈ head :: tail, f x ≤ f m
- Formalizes
- EconCSLib, `List.exists_argMax_on`
- 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.List.exists_argMax_on← List.exists_argMax_on (EconCSLib/Foundation/Argmax.lean:40): verbatim
- Verified
- 08 Oct 2026
- Axioms
propext- Built on 1
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or…
- TotalPreorderA total preorder: a preorder where
- Used by 1
- KnapsackAuction.exists_welfareMaximizerA welfare-maximizing feasible binary allocation, chosen using
List.argMaxOnon the finite space of feasible0/1allocations.
- KnapsackAuction.exists_welfareMaximizerA welfare-maximizing feasible binary allocation, chosen using
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true invariable {X Y : Type*} in/-- **Existence of an argmax** on a non-empty list under a total preorder. Since the preorder may lack antisymmetry, ties are allowed — we only claim existence of *some* maximizer, not uniqueness. -/theorem List.exists_argMax_on [TotalPreorder Y] (f : X → Y) (head : X) (tail : List X) : ∃ m, m ∈ head :: tail ∧ ∀ x ∈ head :: tail, f x ≤ f m := by induction tail generalizing head with | nil => refine ⟨head, List.mem_singleton.mpr rfl, ?_⟩ intro x hx rw [List.mem_singleton] at hx subst hx exact le_refl _ | cons y ys ih => obtain ⟨m', hm'_mem, hm'_max⟩ := ih y rcases TotalPreorder.le_total (f m') (f head) with hle | hle · refine ⟨head, List.mem_cons_self, ?_⟩ intro x hx rcases List.mem_cons.mp hx with rfl | hx_in · exact le_refl _ · exact le_trans (hm'_max x hx_in) hle · refine ⟨m', ?_, ?_⟩ · exact List.mem_cons.mpr (Or.inr hm'_mem) · intro x hx rcases List.mem_cons.mp hx with rfl | hx_in · exact hle · exact hm'_max x hx_in