remoteness_eq_of_verification_criterion
Consider an impartial game whose positions form a type V, each position x having a finite set of options opt x, such that every sequence of moves terminates (the option relation is well-founded); a position is terminal when it has no options. Let R : V → ℕ be the remoteness function, given by the recursion: R(x) = 0 at terminal x; if some option y of x has R(y) even, then R(x) = 1 + the minimum of R(y) over options with R(y) even; otherwise (x nonterminal, no even option) R(x) = 1 + the maximum of R(y) over all options. Let F : V → ℕ vanish at terminal positions and satisfy, at every nonterminal x: (1) if F(x) is even, every option y has F(y) odd and F(y) ≤ F(x) − 1, and some option has F(y) = F(x) − 1; (2) if F(x) is odd, some option has F(y) = F(x) − 1, and every option y with F(y) even has F(y) ≥ F(x) − 1. Then F = R. (Here F(y) ≤ F(x) − 1 and F(y) = F(x) − 1 are read in the integers, as F(y) + 1 ≤ F(x) and F(y) + 1 = F(x); minimum and maximum are expressed as attained bounds.)
Statement
theorem remoteness_eq_of_verification_criterion {V : Type*} (opt : V → Finset V) (hwf : WellFounded fun y x => y ∈ opt x) (R F : V → ℕ) (hR0 : ∀ x, opt x = ∅ → R x = 0) (hReven : ∀ x, (∃ y ∈ opt x, Even (R y)) → (∃ y ∈ opt x, Even (R y) ∧ R x = R y + 1) ∧ ∀ y ∈ opt x, Even (R y) → R x ≤ R y + 1) (hRodd : ∀ x, opt x ≠ ∅ → (∀ y ∈ opt x, ¬ Even (R y)) → (∃ y ∈ opt x, R x = R y + 1) ∧ ∀ y ∈ opt x, R y + 1 ≤ R x) (hF0 : ∀ x, opt x = ∅ → F x = 0) (hFeven : ∀ x, opt x ≠ ∅ → Even (F x) → (∀ y ∈ opt x, Odd (F y) ∧ F y + 1 ≤ F x) ∧ ∃ y ∈ opt x, F y + 1 = F x) (hFodd : ∀ x, opt x ≠ ∅ → Odd (F x) → (∃ y ∈ opt x, F y + 1 = F x) ∧ ∀ y ∈ opt x, Even (F y) → F x ≤ F y + 1) : F = R
- Formalizes
- arXiv:2611.27343 (A general reduction and explicit remoteness formulas for exact slow 2-Nim), Lemma 2.1 (verification criterion); remoteness is taken as any function satisfying the recursion (2.1), which determines it uniquely on a well-founded game.
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext
Read back from the Lean
Let V be any type, and let opt : V → Finset V be a function assigning to each state x : V a finite set of next states (options). Assume that the relation fun y x => y ∈ opt x is well-founded.
Let R, F : V → ℕ be two functions satisfying:
1. hR0: For all x : V, if opt x = ∅, then R x = 0.
2. hReven: For all x : V, if there exists y ∈ opt x such that R y is even, then:
- there exists y ∈ opt x such that R y is even and R x = R y + 1, and
- for all y ∈ opt x, if R y is even, then R x ≤ R y + 1.
(i.e., R x is 1 plus the minimum of R y over all options y with R y even).
3. hRodd: For all x : V, if opt x ≠ ∅ and for all y ∈ opt x, R y is not even, then:
- there exists y ∈ opt x such that R x = R y + 1, and
- for all y ∈ opt x, R y + 1 ≤ R x.
(i.e., R x is 1 plus the maximum of R y over all options y).
4. hF0: For all x : V, if opt x = ∅, then F x = 0.
5. hFeven: For all x : V, if opt x ≠ ∅ and F x is even, then:
- for all y ∈ opt x, F y is odd and F y + 1 ≤ F x, and
- there exists y ∈ opt x such that F y + 1 = F x.
6. hFodd: For all x : V, if opt x ≠ ∅ and F x is odd, then:
- there exists y ∈ opt x such that F y + 1 = F x, and
- for all y ∈ opt x, if F y is even, then F x ≤ F y + 1.
Then F = R (that is, F x = R x for all x : V).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The theorem is proved by well-founded induction on game positions using the termination of moves. Terminal positions have F(x) = R(x) = 0 by definition. For a non-terminal position x, the argument splits on whether F(x) is even or odd. If F(x) is even, all options have odd remoteness by induction, so the maximum-remoteness rule applies to R(x), and the mutual upper and lower bounds force F(x) = R(x). If F(x) is odd, the optimal transition achieving F(y) = F(x) − 1 must lead to an even position, triggering the minimum-remoteness rule for positions with even options, and the corresponding bounds again sandwich F(x) = R(x).
It suffices to show F(x) = R(x) for every game position x, assuming by induction that F(y) = R(y) holds for all options y of x.
By functional extensionality (`funext`), equality of functions F = R reduces to pointwise equality F(x) = R(x) for all positions x. Since the option relation is well-founded (`hwf`), we proceed by well-founded induction (`hwf.induction`), obtaining the induction hypothesis ih: F(y) = R(y) for every y ∈ opt(x).
funext x induction x using hwf.induction with | _ x ih =>
If x is a terminal position, then F(x) = R(x).
We split on whether x has any options (`by_cases hx : opt x = ∅`). When x is terminal, both F(x) = 0 and R(x) = 0 by the terminal base cases hF0 and hR0, so F(x) = R(x).
by_cases hx : opt x = ∅ · rw [hF0 x hx, hR0 x hx]
If F(x) is even, then no option of x has even remoteness.
We divide non-terminal positions by the parity of F(x) using `Nat.even_or_odd`. In the even branch, the verification criterion hFeven ensures that every option y ∈ opt(x) has odd F(y). By the induction hypothesis, R(y) = F(y) is odd, which by `Nat.not_even_iff_odd.2` means no option y has even remoteness R(y).
uses
Nat.even_or_odd,Nat.not_even_iff_odd.2rcases Nat.even_or_odd (F x) with he | ho · obtain ⟨hall, y', hy', hy'F⟩ := hFeven x hx he have hnoeven : ∀ y ∈ opt x, ¬ Even (R y) := by intro y hy hev rw [← ih y hy] at hev exact Nat.not_even_iff_odd.2 (hall y hy).1 hev
If F(x) is even, then F(x) = R(x).
Because x has no option with even remoteness, the remoteness definition for odd-only options (hRodd) applies: there is an option y with R(x) = R(y) + 1, and every option satisfies R(z) + 1 ≤ R(x). From hFeven, every option satisfies F(z) + 1 ≤ F(x), and some option y' achieves F(y') + 1 = F(x). Rewriting via the induction hypothesis F(y) = R(y) and F(y') = R(y') yields R(x) ≤ F(x) and F(x) ≤ R(x). Linear arithmetic (`omega`) deduces F(x) = R(x).
obtain ⟨⟨y, hy, hRy⟩, hRall⟩ := hRodd x hx hnoeven have h1 := (hall y hy).2 have h2 := hRall y' hy' rw [← ih y hy] at hRy rw [← ih y' hy'] at h2 omega
If F(x) is odd, then there exists an option y of x such that F(y) + 1 = F(x) and R(y) is even.
When F(x) is odd, the verification criterion hFodd provides an option y with F(y) + 1 = F(x). The parity of F(y) must be even: if it were odd, F(y) + 1 would be even, contradicting that F(x) is odd (`Nat.not_even_iff_odd.2`). By the induction hypothesis, R(y) = F(y) is also even.
uses
Nat.even_or_odd,Nat.not_even_iff_odd.2· obtain ⟨⟨y, hy, hyF⟩, hFall⟩ := hFodd x hx ho have hyev : Even (F y) := by rcases Nat.even_or_odd (F y) with h | h · exact h · exfalso rw [← hyF] at ho exact Nat.not_even_iff_odd.2 ho (h.add_one) have hRyev : Even (R y) := by rw [← ih y hy]; exact hyev
If F(x) is odd, then F(x) = R(x).
Since x has an option y with even remoteness, the definition of remoteness for positions with even options (hReven) applies: there is an even option y₁ with R(x) = R(y₁) + 1, and every even option z satisfies R(x) ≤ R(z) + 1. Applying this to y gives R(x) ≤ R(y) + 1. Conversely, since R(y₁) is even, the induction hypothesis implies F(y₁) is even, so the second clause of hFodd gives F(x) ≤ F(y₁) + 1. Substituting the induction hypothesis identities F(y) = R(y) and F(y₁) = R(y₁) gives R(x) ≤ F(y) + 1 = F(x) and F(x) ≤ R(y₁) + 1 = R(x). Linear arithmetic (`omega`) concludes F(x) = R(x).
obtain ⟨⟨y1, hy1, hy1ev, hRx⟩, hRall⟩ := hReven x ⟨y, hy, hRyev⟩ have h1 := hRall y hy hRyev have h2 := hFall y1 hy1 (by rw [ih y1 hy1]; exact hy1ev) rw [← ih y hy] at h1 rw [ih y1 hy1] at h2 omega
Nat.even_or_odd- Every natural number is either even or odd.
Nat.not_even_iff_odd.2- If a natural number is odd, then it is not even.
- The Presburger arithmetic tactic omega is used at lines 31 and 45 to deduce equality from the sandwiching inequalities R(x) ≤ F(x) and F(x) ≤ R(x).
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem remoteness_eq_of_verification_criterion {V : Type*} (opt : V → Finset V) (hwf : WellFounded fun y x => y ∈ opt x) (R F : V → ℕ) (hR0 : ∀ x, opt x = ∅ → R x = 0) (hReven : ∀ x, (∃ y ∈ opt x, Even (R y)) → (∃ y ∈ opt x, Even (R y) ∧ R x = R y + 1) ∧ ∀ y ∈ opt x, Even (R y) → R x ≤ R y + 1) (hRodd : ∀ x, opt x ≠ ∅ → (∀ y ∈ opt x, ¬ Even (R y)) → (∃ y ∈ opt x, R x = R y + 1) ∧ ∀ y ∈ opt x, R y + 1 ≤ R x) (hF0 : ∀ x, opt x = ∅ → F x = 0) (hFeven : ∀ x, opt x ≠ ∅ → Even (F x) → (∀ y ∈ opt x, Odd (F y) ∧ F y + 1 ≤ F x) ∧ ∃ y ∈ opt x, F y + 1 = F x) (hFodd : ∀ x, opt x ≠ ∅ → Odd (F x) → (∃ y ∈ opt x, F y + 1 = F x) ∧ ∀ y ∈ opt x, Even (F y) → F x ≤ F y + 1) : F = R := by funext x induction x using hwf.induction with | _ x ih => by_cases hx : opt x = ∅ · rw [hF0 x hx, hR0 x hx] rcases Nat.even_or_odd (F x) with he | ho · obtain ⟨hall, y', hy', hy'F⟩ := hFeven x hx he have hnoeven : ∀ y ∈ opt x, ¬ Even (R y) := by intro y hy hev rw [← ih y hy] at hev exact Nat.not_even_iff_odd.2 (hall y hy).1 hev obtain ⟨⟨y, hy, hRy⟩, hRall⟩ := hRodd x hx hnoeven have h1 := (hall y hy).2 have h2 := hRall y' hy' rw [← ih y hy] at hRy rw [← ih y' hy'] at h2 omega · obtain ⟨⟨y, hy, hyF⟩, hFall⟩ := hFodd x hx ho have hyev : Even (F y) := by rcases Nat.even_or_odd (F y) with h | h · exact h · exfalso rw [← hyF] at ho exact Nat.not_even_iff_odd.2 ho (h.add_one) have hRyev : Even (R y) := by rw [← ih y hy]; exact hyev obtain ⟨⟨y1, hy1, hy1ev, hRx⟩, hRall⟩ := hReven x ⟨y, hy, hRyev⟩ have h1 := hRall y hy hRyev have h2 := hFall y1 hy1 (by rw [ih y1 hy1]; exact hy1ev) rw [← ih y hy] at h1 rw [ih y1 hy1] at h2 omega