AFTD Auto-Formalizing Theoretical Domains

spider_blocked_raw_opts

def

The raw option list of the state (in;{(r,β),(1,free)}) after exactly one unfolding step of spider_gamma at fuel r+2, with the *sub-state Grundy values left unevaluated*: the zipIdx.flatMap over the two legs, each cut j = 1,…,h, both directions δ, skipping the prohibited end cut, and dispatching j ≥ 2 to the two-leg sub-state ((j-1,δ) :: rest) and j = 1 to the one-leg rest.

Statement

def spider_blocked_raw_opts (r : ℕ) (beta : SpiderLegEnd) : List ℕ
Source
step towards op211_three_legged_spider_eventual_parity
Verified
08 Nov 2026
Axioms
none listed
Built on 5
  • spider_gammaThe function spider_gamma computes a natural number from a fuel parameter fuel : ℕ, a centre status s : CentreStatus, and a list of spider…
  • SpiderLegEndThe end condition of an attached leg in a spider state is either free (no arc on the leg), inward (pointing towards the centre), or…
  • spider_update_centreThe function spider_update_centre updates centre status s given leg transition delta: if delta is inward, none maps to incoming, incoming…
  • CentreStatusThe status of the central vertex in a spider state: none (no marked arcs incident), incoming (at least one incoming arc), outgoing (at…
  • spider_rhoThe function spider_rho takes h : ℕ and delta, phi : SpiderLegEnd, returning h if phi = free; if phi = inward, it returns h % 2 when delta…
Used by 1
  • spider_blocked_raw_opts_splitThe raw option list of (in;{(r,β),(1,free)}) decomposes as spider_blocked_leg0_opts r β ++ spider_blocked_free_leg_opts r β: the zipIdx…

Lean source view module on GitHub

/-- The one-unfolding option list of (in;{(r,β),(1,free)}) at fuel r+2, with sub-state values kept unevaluated. -/
def spider_blocked_raw_opts (r : ℕ) (beta : SpiderLegEnd) : List ℕ := ([(r, beta), (1, SpiderLegEnd.free)] : List (ℕ × SpiderLegEnd)).zipIdx.flatMap
    (fun ⟨⟨h, phi⟩, idx⟩ =>
      let rest := ([(r, beta), (1, SpiderLegEnd.free)] : List (ℕ × SpiderLegEnd)).eraseIdx idx
      (List.range h).flatMap (fun j_zero =>
        let j := j_zero + 1
        [SpiderLegEnd.inward, SpiderLegEnd.outward].filterMap (fun delta =>
          if j == h ∧ phi ≠ SpiderLegEnd.free ∧ delta ≠ phi then none
          else
            let d := spider_rho (h - j) delta phi
            if j ≥ 2 then
              some (d ^^^ spider_gamma (r + 1) CentreStatus.incoming ((j - 1, delta) :: rest))
            else
              some (d ^^^ spider_gamma (r + 1)
                (spider_update_centre CentreStatus.incoming delta) rest))))
See it in the graphDiscuss this resultChallenge it