AFTD Auto-Formalizing Theoretical Domains

spider_blocked_optionvals_lt_mem

theoremverified

For r ≥ 2 and β inward or outward, every k below spider_blocked_val β r occurs in the explicit options list of (in;{(r,β),(1,free)}).

Statement

theorem spider_blocked_optionvals_lt_mem (r : ℕ) (hr : 2 ≤ r) (beta : SpiderLegEnd)
    (hβ : beta = SpiderLegEnd.inward ∨ beta = SpiderLegEnd.outward) :
    ∀ k < spider_blocked_val beta r, k ∈ spider_blocked_optionvals r beta
Source
step towards spider_two_leg_blocked_incoming_val
Verified
20 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • spider_blocked_optionvals_low_memFor r ≥ 2, β inward or outward, and k + 2 ≤ r, the number k occurs in the explicit options list of (in;{(r,β),(1,free)}).
  • spider_blocked_optionvals_top_memFor r ≥ 1 and β inward or outward, r is in the explicit options list; moreover r-1 is in it when β = inward and r % 4 ≠ 3, and when β =…
  • spider_blocked_valThe conjectured closed form of the blocked two-leg family at incoming centre: for end condition inward it is m - 1 when m % 4 = 3 and m +…
  • 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_blocked_optionvalsThe explicit options list of the state (in;{(r,β),(1,free)}) at fuel r + 2 after substituting the inductive closed forms: for each cut j =…

The proof, explained

The proof proceeds by case analysis on whether β is inward or outward, and then on the residue of r modulo 4 based on the definition of spider_blocked_val β r. In the exceptional residue classes (r % 4 = 3 for inward, r % 4 = 1 for outward), the cutoff value is r - 1, and every k < r - 1 is covered by spider_blocked_optionvals_low_mem. In the non-exceptional residue classes, the cutoff is r + 1, and any k < r + 1 is either below r - 1 (covered again by spider_blocked_optionvals_low_mem), equal to r - 1, or equal to r, with the latter two top values provided by spider_blocked_optionvals_top_mem.

  1. Let k be an arbitrary natural number with k < spider_blocked_val β r; it suffices to show k ∈ spider_blocked_optionvals r β in the two cases β = inward and β = outward.

    We introduce k and the bound hk : k < spider_blocked_val β r, then case-split on the hypothesis hβ that β is either inward or outward.

    lines 5–6

      intro k hk
      rcases hβ with rfl | rfl
  2. When β = inward and r % 4 = 3, k ∈ spider_blocked_optionvals r inward.

    By definition, spider_blocked_val inward r simplifies to r - 1 when r % 4 = 3, so hk becomes k < r - 1, which implies k + 2 ≤ r by linear arithmetic. Applying spider_blocked_optionvals_low_mem shows k is in the options list.

    lines 7–9

    uses spider_blocked_optionvals_low_mem

      · by_cases h : r % 4 = 3
        · simp only [spider_blocked_val, h, if_true] at hk
          exact spider_blocked_optionvals_low_mem r k hr _ (Or.inl rfl) (by omega)
  3. When β = inward, r % 4 ≠ 3, and k < r - 1, k ∈ spider_blocked_optionvals r inward.

    When r % 4 ≠ 3, spider_blocked_val inward r simplifies to r + 1, so k < r + 1. Case-splitting with Nat.lt_or_ge first on k < r and then on k < r - 1 leads to the subcase k < r - 1. Then k + 2 ≤ r holds, and spider_blocked_optionvals_low_mem establishes membership.

    lines 10–13

    uses Nat.lt_or_ge, spider_blocked_optionvals_low_mem

        · simp only [spider_blocked_val, h, if_false] at hk
          rcases Nat.lt_or_ge k r with hklt | hkge
          · rcases Nat.lt_or_ge k (r - 1) with h1 | h1
            · exact spider_blocked_optionvals_low_mem r k hr _ (Or.inl rfl) (by omega)
  4. When β = inward, r % 4 ≠ 3, and r - 1 ≤ k < r, k ∈ spider_blocked_optionvals r inward.

    Linear arithmetic forces k = r - 1. Since r % 4 ≠ 3, the inward clause of spider_blocked_optionvals_top_mem guarantees that r - 1 ∈ spider_blocked_optionvals r inward.

    lines 14–16

    uses spider_blocked_optionvals_top_mem

            · have hk_eq : k = r - 1 := by omega
              rw [hk_eq]
              exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inl rfl)).2.1 rfl h
  5. When β = inward, r % 4 ≠ 3, and k ≥ r, k ∈ spider_blocked_optionvals r inward.

    Since k < r + 1 and k ≥ r, linear arithmetic forces k = r. The unconditional first clause of spider_blocked_optionvals_top_mem guarantees that r ∈ spider_blocked_optionvals r inward.

    lines 17–19

    uses spider_blocked_optionvals_top_mem

          · have hk_eq : k = r := by omega
            rw [hk_eq]
            exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inl rfl)).1
  6. When β = outward and r % 4 = 1, k ∈ spider_blocked_optionvals r outward.

    By definition, spider_blocked_val outward r simplifies to r - 1 when r % 4 = 1, so k < r - 1 and thus k + 2 ≤ r. Applying spider_blocked_optionvals_low_mem establishes membership.

    lines 20–22

    uses spider_blocked_optionvals_low_mem

      · by_cases h : r % 4 = 1
        · simp only [spider_blocked_val, h, if_true] at hk
          exact spider_blocked_optionvals_low_mem r k hr _ (Or.inr rfl) (by omega)
  7. When β = outward, r % 4 ≠ 1, and k < r - 1, k ∈ spider_blocked_optionvals r outward.

    When r % 4 ≠ 1, spider_blocked_val outward r is r + 1, so k < r + 1. Splitting with Nat.lt_or_ge into k < r and then k < r - 1 yields k + 2 ≤ r in this subcase, so spider_blocked_optionvals_low_mem applies.

    lines 23–26

    uses Nat.lt_or_ge, spider_blocked_optionvals_low_mem

        · simp only [spider_blocked_val, h, if_false] at hk
          rcases Nat.lt_or_ge k r with hklt | hkge
          · rcases Nat.lt_or_ge k (r - 1) with h1 | h1
            · exact spider_blocked_optionvals_low_mem r k hr _ (Or.inr rfl) (by omega)
  8. When β = outward, r % 4 ≠ 1, and r - 1 ≤ k < r, k ∈ spider_blocked_optionvals r outward.

    Linear arithmetic forces k = r - 1. Because r % 4 ≠ 1, the outward clause of spider_blocked_optionvals_top_mem guarantees that r - 1 ∈ spider_blocked_optionvals r outward.

    lines 27–29

    uses spider_blocked_optionvals_top_mem

            · have hk_eq : k = r - 1 := by omega
              rw [hk_eq]
              exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inr rfl)).2.2 rfl h
  9. When β = outward, r % 4 ≠ 1, and k ≥ r, k ∈ spider_blocked_optionvals r outward.

    From r ≤ k < r + 1, linear arithmetic forces k = r. The unconditional first clause of spider_blocked_optionvals_top_mem shows that r ∈ spider_blocked_optionvals r outward.

    lines 30–32

    uses spider_blocked_optionvals_top_mem

          · have hk_eq : k = r := by omega
            rw [hk_eq]
            exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inr rfl)).1
Nat.lt_or_ge
For any two natural numbers n and m, either n < m or n ≥ m.
spider_blocked_optionvals_low_mem
For r ≥ 2 and β ∈ {inward, outward}, any value k with k + 2 ≤ r belongs to spider_blocked_optionvals r β.
spider_blocked_optionvals_top_mem
For r ≥ 1 and β ∈ {inward, outward}, r belongs to spider_blocked_optionvals r β; moreover, r - 1 belongs to it if either β = inward and r % 4 ≠ 3, or β = outward and r % 4 ≠ 1.

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

/-- Gluing lemma: coverage of every k below the closed-form value, from the initial segment plus the two top values. -/theorem spider_blocked_optionvals_lt_mem (r : ℕ) (hr : 2 ≤ r) (beta : SpiderLegEnd)    (hβ : beta = SpiderLegEnd.inward ∨ beta = SpiderLegEnd.outward) :    ∀ k < spider_blocked_val beta r, k ∈ spider_blocked_optionvals r beta := by  intro k hk  rcases hβ with rfl | rfl  · by_cases h : r % 4 = 3    · simp only [spider_blocked_val, h, if_true] at hk      exact spider_blocked_optionvals_low_mem r k hr _ (Or.inl rfl) (by omega)    · simp only [spider_blocked_val, h, if_false] at hk      rcases Nat.lt_or_ge k r with hklt | hkge      · rcases Nat.lt_or_ge k (r - 1) with h1 | h1        · exact spider_blocked_optionvals_low_mem r k hr _ (Or.inl rfl) (by omega)        · have hk_eq : k = r - 1 := by omega          rw [hk_eq]          exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inl rfl)).2.1 rfl h      · have hk_eq : k = r := by omega        rw [hk_eq]        exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inl rfl)).1  · by_cases h : r % 4 = 1    · simp only [spider_blocked_val, h, if_true] at hk      exact spider_blocked_optionvals_low_mem r k hr _ (Or.inr rfl) (by omega)    · simp only [spider_blocked_val, h, if_false] at hk      rcases Nat.lt_or_ge k r with hklt | hkge      · rcases Nat.lt_or_ge k (r - 1) with h1 | h1        · exact spider_blocked_optionvals_low_mem r k hr _ (Or.inr rfl) (by omega)        · have hk_eq : k = r - 1 := by omega          rw [hk_eq]          exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inr rfl)).2.2 rfl h      · have hk_eq : k = r := by omega        rw [hk_eq]        exact (spider_blocked_optionvals_top_mem r (by omega) _ (Or.inr rfl)).1
See it in the graphDiscuss this resultChallenge it