Documentation

EconCSLib.Foundation.Argmax

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 #

theorem List.exists_argMax_on {X : Type u_1} {Y : Type u_2} [TotalPreorder Y] (f : XY) (head : X) (tail : List X) :
(m : X), m head :: tail ∀ (x : X), x head :: tailf x f m

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.

def List.argMaxOn {X : Type u_1} {Y : Type u_2} [TotalPreorder Y] [DecidableLE Y] (f : XY) (head : X) (tail : List X) :
X

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
Instances For
    theorem List.argMaxOn_mem {X : Type u_1} {Y : Type u_2} [TotalPreorder Y] [DecidableLE Y] (f : XY) (head : X) (tail : List X) :
    argMaxOn f head tail head :: tail

    The chosen maximizer is a member of the list.

    theorem List.argMaxOn_ge {X : Type u_1} {Y : Type u_2} [TotalPreorder Y] [DecidableLE Y] (f : XY) (head : X) (tail : List X) (x : X) :
    x head :: tailf x f (argMaxOn f head tail)

    Soundness: every element's f-image is the chosen maximizer's.

    theorem List.le_argMaxOn_head {X : Type u_1} {Y : Type u_2} [TotalPreorder Y] [DecidableLE Y] (f : XY) (head : X) (tail : List X) :
    f head f (argMaxOn f head tail)

    The argmax achieves at least the head's value.