Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Finite-game viability and history-based counterstrategies

Definition
AngelDevil_FiniteGame

by Yuxuan Xu · Oct 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

angel-problemcombinatoricsgame-theory

Finite viability is defined recursively: zero further rounds are always viable; one more round is viable when every optional Devil selection admits a safe Angel landing with a viable remaining state. The finite Angel selects such a landing when one exists. A bad Devil move makes every safe landing nonviable when such a move exists. Burn-history reconstruction turns these state-based choices into a total history-only Devil strategy. Off-path choices and exhausted horizons have explicitly defined defaults.

Definition code
import Definitions.Def_AngelDevil_FiniteHorizon

namespace AngelDevil

def advance (s : State) (d : Option Point) (v : Point) : State :=
  ⟨s.visited ++ [v], s.burned ++ [d]⟩

def Viable (p : Nat) : Nat → State → Prop
  | 0, _ => True
  | n+1, s => ∀ d : Option Point, ∃ v : Point,
      Jump p (current s) v ∧ some v ∉ s.burned ++ [d] ∧
      Viable p n (advance s d v)

noncomputable def finiteAngel (p T : Nat) : AngelStrategy := by
  classical
  intro h b
  exact if hv : ∃ v, Jump p (h.getLastD origin) v ∧ some v ∉ b ∧
      Viable p (T-h.length) ⟨h ++ [v], b⟩ then Classical.choose hv else origin

noncomputable def badMove (p n : Nat) (s : State) : Option Point := by
  classical
  exact if hd : ∃ d : Option Point, ∀ v,
      Jump p (current s) v → some v ∉ s.burned ++ [d] →
      ¬ Viable p n (advance s d v) then Classical.choose hd else none

/- Reconstruct a state-dependent Devil's own earlier selections from the
visited history. This preserves the mission's history-only Devil interface. -/
def simulatedBurns (choose : State → Option Point) (h : List Point) :
    List (Option Point) :=
  if _hnil : h = [] then [] else
  let prior := h.dropLast
  if prior = [] then [] else
  let b := simulatedBurns choose prior
  b ++ [choose ⟨prior, b⟩]
termination_by h.length
decreasing_by
  have hp := List.length_pos_iff.mpr _hnil
  simp only [List.length_dropLast]
  omega

def historyDevil (choose : State → Option Point) : DevilStrategy :=
  fun h => choose ⟨h, simulatedBurns choose h⟩

noncomputable def finiteDevil (p T : Nat) : DevilStrategy :=
  historyDevil (fun s => badMove p (T-s.visited.length) s)

end AngelDevil
Source
Mathe, The Angel of power 2 wins (2007), https://doi.org/10.1017/S0963548306008303, author manuscript pp. 1-2: determinacy observation and Claim 2.1; auxiliary formalization definitions.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me