AFTD Auto-Formalizing Theoretical Domains

spider_rho_pair_values

theoremverified

For every h ≥ 1 and φ ≠ free, the pair of rho values (spider_rho h inward φ, spider_rho h outward φ) is either (0, 1) or (1, 0).

Statement

theorem spider_rho_pair_values (h : ℕ) (hh : 1 ≤ h) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free) :
    (spider_rho h SpiderLegEnd.inward φ = 0 ∧ spider_rho h SpiderLegEnd.outward φ = 1) ∨
    (spider_rho h SpiderLegEnd.inward φ = 1 ∧ spider_rho h SpiderLegEnd.outward φ = 0)
Source
step towards spider_mex_incoming_one_outward
Verified
19 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • 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_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 5

The proof, explained

The proof argues by case analysis on the spider leg end φ. The case φ = free is ruled out by assumption. For the remaining cases φ = inward and φ = outward, evaluating the definition of spider_rho reduces the claim to the parity of h: because h ≥ 1, even h implies h ≥ 2, making the pair of values (0, 1) or (1, 0) according to which direction matches the leg end.

  1. The case φ = free is ruled out by the hypothesis that φ ≠ free.

    We perform case analysis on the spider leg end φ. The constructor φ = free directly contradicts the hypothesis hφ : φ ≠ free, so contradiction finishes this case.

    lines 5–6

      cases φ with
      | free => contradiction
  2. When φ = inward, the pair of rho values is (0, 1) if h is even and (1, 0) if h is odd, satisfying the theorem.

    Unfolding the definition of spider_rho, the inward value is h % 2, while the outward value evaluates to 1 if 2 ≤ h and h % 2 = 0, and 0 otherwise. By Nat.mod_two_eq_zero_or_one, either h % 2 = 0 or h % 2 = 1. If h is even, the assumption 1 ≤ h implies 2 ≤ h by linear arithmetic (omega), so the pair is (0, 1). If h is odd, the outward condition fails and the inward value is 1, so the pair is (1, 0).

    lines 7–14

    uses Nat.mod_two_eq_zero_or_one

      | inward =>
        simp [spider_rho]
        rcases Nat.mod_two_eq_zero_or_one h with h0 | h1
        · left
          have : 2 ≤ h := by omega
          simp [h0, this]
        · right
          simp [h1]
  3. When φ = outward, the pair of rho values is (1, 0) if h is even and (0, 1) if h is odd, satisfying the theorem.

    Similarly, unfolding spider_rho shows that the inward value evaluates the conditional (yielding 1 if 2 ≤ h and h % 2 = 0, and 0 otherwise) while the outward value is h % 2. By Nat.mod_two_eq_zero_or_one, if h is even then 2 ≤ h (via omega), producing the pair (1, 0); if h is odd, we obtain (0, 1).

    lines 15–22

    uses Nat.mod_two_eq_zero_or_one

      | outward =>
        simp [spider_rho]
        rcases Nat.mod_two_eq_zero_or_one h with h0 | h1
        · right
          have : 2 ≤ h := by omega
          simp [h0, this]
        · left
          simp [h1]
Nat.mod_two_eq_zero_or_one
Every natural number has remainder 0 or 1 when divided by 2.

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

/-- For any leg length h ≥ 1 and non-free spider leg end φ, one of spider_rho h inward φ and spider_rho h outward φ equals 0 and the other equals 1. -/theorem spider_rho_pair_values (h : ℕ) (hh : 1 ≤ h) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free) :    (spider_rho h SpiderLegEnd.inward φ = 0 ∧ spider_rho h SpiderLegEnd.outward φ = 1) ∨    (spider_rho h SpiderLegEnd.inward φ = 1 ∧ spider_rho h SpiderLegEnd.outward φ = 0) := by  cases φ with  | free => contradiction  | inward =>    simp [spider_rho]    rcases Nat.mod_two_eq_zero_or_one h with h0 | h1    · left      have : 2 ≤ h := by omega      simp [h0, this]    · right      simp [h1]  | outward =>    simp [spider_rho]    rcases Nat.mod_two_eq_zero_or_one h with h0 | h1    · right      have : 2 ≤ h := by omega      simp [h0, this]    · left      simp [h1]
See it in the graphDiscuss this resultChallenge it