EconCSLib.Foundation.Argmax #
Argmax helpers for total preorders on non-empty lists.
Why a bespoke version #
Mathlib's List.argmax / Finset.argmax require [LinearOrder]
(antisymmetry). The backward-induction proof in
ExtensiveGame.BackwardInduction only needs [TotalPreorder] (no
antisymmetry). This file closes that gap with a computable argmax: a left
fold that keeps the running maximizer, needing only a decidable comparison
[DecidableLE] for the fold and [TotalPreorder] for correctness.
Main definitions #
List.exists_argMax_on— some element ofhead :: tailmaximizesf(pure existence,[TotalPreorder]only)List.argMaxOn— chosen such element, computed by a fold ([TotalPreorder]+[DecidableLE])List.argMaxOn_mem— the chosen element is in the listList.argMaxOn_ge— every element'sf-image is≤the chosen one's
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.
A chosen maximizer of f on the non-empty list head :: tail, computed
by a left fold that keeps the running maximizer (ties keep the later element).
Computable: the fold needs only a decidable comparison [DecidableLE Y];
correctness (argMaxOn_mem / argMaxOn_ge) needs the total preorder.
Equations
- List.argMaxOn f head tail = List.foldl (fun (a z : X) => if f a ≤ f z then z else a) head tail
Instances For
The chosen maximizer is a member of the list.
Soundness: every element's f-image is ≤ the chosen maximizer's.
The argmax achieves at least the head's value.