AFTD Auto-Formalizing Theoretical Domains

run_move_legal

def

In a run of length k with boundary conditions α and β, orienting edge j in direction δ is legal if and only if (j ≠ 1 or α ∈ {free, δ}) and (j ≠ k or β ∈ {free, δ}).

Statement

def run_move_legal (k : ℕ) (α β : RunBoundary) (j : ℕ) (δ : RunBoundary) : Bool
Defined in
scout/2610-15145-nim-heaps-in-the-game-of-cycles-the-parity-conjecture-fails.md:417
Verified
21 Oct 2026
Axioms
none listed
Built on 1
  • RunBoundaryThe boundary condition at an end of a path segment in the Game of Arrows is either free (denoted *), blocked inward (denoted →), or…
Used by 5
  • run_options_valIn 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 α…
  • run_grundy_stepFor every k > 0 and boundary conditions α and β, the Grundy value run_grundy k α β is the minimum excluded value of the nim-sums of the…
  • run_grundy_aux_eq_run_grundyFor any natural numbers n and k with k + 1 ≤ n, and any boundary conditions α and β, run_grundy_aux n k α β equals run_grundy k α β.
  • run_grundy_auxThe auxiliary Grundy value function for a run of length k with boundary conditions α and β in the Game of Arrows, computed by recursion up…
  • run_grundy_zeroFor any boundary conditions α and β, a run of length 0 in the Game of Arrows has Grundy value 0.

Read back from the Lean

The function run_move_legal takes natural numbers k and j, and values α, β, and δ of type RunBoundary, returning a Bool. It evaluates to true if and only if both of the following conditions are satisfied: 1. j ≠ 1, or α = RunBoundary.free, or α = δ; and 2. j ≠ k, or β = RunBoundary.free, or β = δ. (Equivalently: if j = 1, then α must be RunBoundary.free or δ; and if j = k, then β must be RunBoundary.free or δ.)

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

/-- Predicate deciding whether orienting edge j in direction δ is a legal move on a run of length k with boundary conditions α and β. -/
def run_move_legal (k : ℕ) (α β : RunBoundary) (j : ℕ) (δ : RunBoundary) : Bool :=
  (j ≠ 1 || α = .free || α = δ) && (j ≠ k || β = .free || β = δ)
See it in the graphDiscuss this resultChallenge it