AFTD Auto-Formalizing Theoretical Domains

run_options_val

def

In the Game of Arrows, the list of nim-sums of values of sub-runs resulting from all legal moves on a run of length k with boundaries α and β, computed under the valuation run_val.

Statement

def run_options_val (k : ℕ) (α β : RunBoundary) : List ℕ
Source
step towards run_grundy_values
Verified
21 Oct 2026
Axioms
none listed
Built on 3
  • RunBoundaryThe boundary condition at an end of a path segment in the Game of Arrows is either free (denoted *), blocked inward (denoted →), or…
  • run_valThe closed-form evaluation of the Grundy value for a run of length k with boundaries α and β: k mod 2 for free-free and…
  • run_move_legalIn a run of length k with boundary conditions α and β, orienting edge j in direction δ is legal if and only if (j ≠ 1 or α ∈ {free, δ})…

Lean source view module on GitHub

/-- The list of option nim-sums for a run of length k with boundaries α and β, evaluated using the closed-form valuation run_val. -/
def run_options_val (k : ℕ) (α β : RunBoundary) : List ℕ :=
  (List.range k).flatMap fun idx =>
    let j := idx + 1
    [RunBoundary.blocked_in, RunBoundary.blocked_out].filterMap fun δ =>
      if run_move_legal k α β j δ then
        some (run_val (j - 1) α δ ^^^ run_val (k - j) δ β)
      else
        none
See it in the graphDiscuss this resultChallenge it