AFTD Auto-Formalizing Theoretical Domains

hunger_firing_state

def

Given a positive natural number n, a linearly ordered type α, and a vector h : Fin n → α, hunger_firing_state h is the smallest index i : Fin n in the standard order on Fin n maximizing h i.

Statement

def hunger_firing_state {n : ℕ} [NeZero n] {α : Type*} [LinearOrder α] (h : Fin n → α) : Fin n
Defined in
arXiv:2610.08949 Section 2
Verified
26 Oct 2026
Axioms
none listed
Built on 2
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
Used by 2
  • hunger_stepFor n : ℕ with [NeZero n], a type K with a linear order, additive group structure, and one, a matrix P : Matrix (Fin n) (Fin n) K, and a…
  • hunger3_firing_cellFor a real 3-by-3 matrix Q and a permutation e, hunger3_firing_cell Q e is the topological closure (in Fin 3 → ℝ) of the set of zero-sum…

Read back from the Lean

Given a natural number $n$ with $n \neq 0$ (provided by [NeZero n]), a linearly ordered type $\alpha$, and a function $h : \mathrm{Fin}\ n \to \alpha$, hunger_firing_state defines an element of $\mathrm{Fin}\ n$ by taking the value of (List.finRange n).argmax h (extracted via Option.get, with a proof that the option is some since $n > 0$). Concretely, this is the index $i \in \mathrm{Fin}\ n$ that maximizes $h(i)$, breaking ties by choosing the smallest such index.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The firing state in a hunger game: the least index among states of maximal hunger. -/
def hunger_firing_state {n : ℕ} [NeZero n] {α : Type*} [LinearOrder α] (h : Fin n → α) : Fin n := ((List.finRange n).argmax h).get (by rw [Option.isSome_iff_ne_none, Ne, List.argmax_eq_none]; intro heq; have hlen : (List.finRange n).length = n := List.length_finRange; rw [heq] at hlen; dsimp at hlen; have : 0 < n := NeZero.pos n; omega)
See it in the graphDiscuss this resultChallenge it