AFTD Auto-Formalizing Theoretical Domains

catch_up_value_aux_singleton

theoremverifiedformalization

In a Catch-Up position with a single remaining piece x, current score s_me, and opponent score s_opp, the game value for the mover is win if s_me + x > s_opp, loss if s_me + x < s_opp, and draw if s_me + x = s_opp, independently of the isFirstMove flag.

Statement

theorem catch_up_value_aux_singleton (x : ℕ) (s_me s_opp : ℕ) (isFirstMove : Bool) :
    catch_up_value_aux {x} s_me s_opp isFirstMove =
      if s_me + x > s_opp then CatchUpOutcome.win
      else if s_me + x < s_opp then CatchUpOutcome.loss
      else CatchUpOutcome.draw
Formalizes
Analysis of All the End Game Possibilities in Catch-up When There Are 3 or 4 Pieces Remaining (2024)
Verified
01 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • catch_up_value_auxThe game value of a Catch-Up position for the player about to move. If nothing remains, compare scores. If even all remaining numbers…
  • CatchUpOutcomeThe three possible outcomes of a game of Catch-Up, from the point of view of a fixed player: win, loss, draw.
  • CatchUpOutcome.bestGiven a list of outcomes, the best one for the player who chooses, under the order win > draw > loss (and loss if the list is empty).
Used by 5

Read back from the Lean

For all natural numbers $x$, $s_{\text{me}}$, and $s_{\text{opp}}$, and every boolean value $\text{isFirstMove}$, the value of $\text{catch\_up\_value\_aux}(\{x\}, s_{\text{me}}, s_{\text{opp}}, \text{isFirstMove})$ is equal to: - CatchUpOutcome.win, if $s_{\text{me}} + x > s_{\text{opp}}$; - CatchUpOutcome.loss, if $s_{\text{me}} + x < s_{\text{opp}}$; - CatchUpOutcome.draw, if $s_{\text{me}} + x = s_{\text{opp}}$ (the remaining case).

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

lemma catch_up_value_aux_singleton_best (o : CatchUpOutcome) :    CatchUpOutcome.best [o] = o := by  cases o <;> rfllemma catch_up_value_aux_singleton_attach_toList (x : ℕ) :    ({x} : Finset ℕ).attach.toList = [⟨x, Finset.mem_singleton_self x⟩] := by  have h : ({x} : Finset ℕ).attach = {⟨x, Finset.mem_singleton_self x⟩} := by    ext ⟨y, hy⟩    simp [Finset.mem_singleton.mp hy]  rw [h]  simplemma catch_up_value_aux_singleton_empty_eval (s1 s2 : ℕ) (b : Bool) :    catch_up_value_aux ∅ s1 s2 b =      if s1 > s2 then CatchUpOutcome.win      else if s2 > s1 then CatchUpOutcome.loss      else CatchUpOutcome.draw := by  rw [catch_up_value_aux.eq_def]  simp/-- Endgame valuation of Catch-Up with one remaining piece. -/theorem catch_up_value_aux_singleton (x : ℕ) (s_me s_opp : ℕ) (isFirstMove : Bool) :    catch_up_value_aux {x} s_me s_opp isFirstMove =      if s_me + x > s_opp then CatchUpOutcome.win      else if s_me + x < s_opp then CatchUpOutcome.loss      else CatchUpOutcome.draw := by  rw [catch_up_value_aux.eq_def]  simp only [Finset.singleton_ne_empty, ↓reduceIte, Finset.sum_singleton]  rw [catch_up_value_aux_singleton_attach_toList]  simp only [List.map_cons, List.map_nil, catch_up_value_aux_singleton_best, Finset.erase_singleton]  rw [catch_up_value_aux_singleton_empty_eval, catch_up_value_aux_singleton_empty_eval]  split_ifs <;> first | rfl | omega
See it in the graphDiscuss this resultChallenge it