AFTD Auto-Formalizing Theoretical Domains

spider_rho

def

The function spider_rho takes h : ℕ and delta, phi : SpiderLegEnd, returning h if phi = free; if phi = inward, it returns h % 2 when delta = inward, and (if h ≥ 2 ∧ h % 2 = 0 then 1 else 0) otherwise; if phi = outward, it returns h % 2 when delta = outward, and (if h ≥ 2 ∧ h % 2 = 0 then 1 else 0) otherwise.

Statement

def spider_rho (h : ℕ) (delta : SpiderLegEnd) (phi : SpiderLegEnd) : ℕ
Defined in
scout/2610-15145-nim-heaps-in-the-game-of-cycles-the-parity-conjecture-fails.md, Theorem 4.3 and Section 6.1
Verified
18 Oct 2026
Axioms
none listed
Built on 1
  • 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…
Used by 31

Read back from the Lean

The function spider_rho takes a natural number h : ℕ and two values delta, phi : SpiderLegEnd (an inductive type with three constructors: free, inward, and outward), and returns a natural number defined by cases on phi: - If phi = .free, it returns h. - If phi = .inward: - If delta = .inward, it returns h % 2. - Otherwise (if delta ≠ .inward), it returns 1 if h ≥ 2 and h % 2 = 0 (i.e., h is an even number at least 2), and 0 otherwise. - If phi = .outward: - If delta = .outward, it returns h % 2. - Otherwise (if delta ≠ .outward), it returns 1 if h ≥ 2 and h % 2 = 0, and 0 otherwise.

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

/-- Value of a detached run of h edges with given near and far end conditions. -/
def spider_rho (h : ℕ) (delta : SpiderLegEnd) (phi : SpiderLegEnd) : ℕ :=
  match phi with
  | .free => h
  | .inward => if delta == .inward then h % 2 else (if h ≥ 2 ∧ h % 2 == 0 then 1 else 0)
  | .outward => if delta == .outward then h % 2 else (if h ≥ 2 ∧ h % 2 == 0 then 1 else 0)
See it in the graphDiscuss this resultChallenge it