Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The held-spin model as a typed use relation

Definition
APFReachKernel_TypedSpin

by FiniteUniverse · Sep 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

apfconditional-referencereachkernel

This interface interprets the supplied SpinHeld automaton as a context-indexed use relation and builds its closure-law instance. The output context is Unit. Later theorems compare its existential admission and results with the original SpinHeld presentation. The construction is for this particular example and does not assert a general physical-source equivalence.

Definition code
import Definitions.Def_APFReachKernel_SpinControl
import Definitions.Def_APFReachKernel_SpinHeld
import Definitions.Def_APFReachKernel_Typed
namespace ReachKernel.TypedSpin
end ReachKernel.TypedSpin
/-
ReachKernel/TypedSpin.lean

The supplied SpinHeld example as a typed use relation, with a UseLaws
instance and equality of the two result readings proved for this model.
The output context is Unit. No general context-changing correspondence or
full original-foundation model is claimed.
-/

set_option autoImplicit false

namespace ReachKernel.TypedSpin
open ReachKernel.Typed
open SpinHeld

abbrev Γ := Unit
abbrev Raw : Γ → Type := fun _ => St
abbrev Proc : Γ → Type := fun _ => SpinHeld.Q

def T : Typing Γ Proc := ⟨fun _ _ => ()⟩

/-- Lane B's use relation for the spin model: p (a start-tagged word) used
from x ends at b when p starts at x, fits the budget, and b is an outcome. -/
def U : UseRelation T Raw :=
  fun _ p x b => p.1 = x ∧ p.2.length ≤ B ∧ b ∈ outcomes x p.2

/-- Words always have at least one outcome. -/
theorem outcomes_nonempty (s : St) (w : List Op) : ∃ t, t ∈ outcomes s w := by
  induction w generalizing s with
  | nil => exact ⟨s, by simp [outcomes]⟩
  | cons o w ih =>
    have hs : ∃ u, u ∈ outs s o := by
      obtain ⟨a, h⟩ := s
      cases o with
      | Hold => exact ⟨(a, true), by simp [outs]⟩
      | Drop => exact ⟨(a, false), by simp [outs]⟩
      | R o' =>
        have hne : SpinControl.outs a o' ≠ [] := by cases a <;> cases o' <;> decide
        obtain ⟨u, hu⟩ := List.exists_mem_of_ne_nil _ hne
        exact ⟨(u, h), List.mem_map.2 ⟨u, hu, rfl⟩⟩
    obtain ⟨u, hu⟩ := hs
    obtain ⟨t, ht⟩ := ih u
    exact ⟨t, by simp only [outcomes, List.mem_flatMap]; exact ⟨u, hu, ht⟩⟩





/-- (C1)–(C3) hold for the spin model in lane B's form. -/
def laws : UseLaws T U SpinHeld.calib B where
  load _ c := c.2.length
  ident _ x := (x, [])
  out_ident _ _ := rfl
  concat _ c c' := (c.1, c.2 ++ c'.2)
  out_concat _ _ _ := rfl
  identity := by
    intro _ x
    exact ⟨rfl, Nat.zero_le _, by simp [outcomes]⟩
  concat_use := by
    intro _ c c' x b b' h h' hb
    obtain ⟨h1, _, hbo⟩ := h
    obtain ⟨h1', _, hbo'⟩ := h'
    refine ⟨h1, hb, ?_⟩
    show b' ∈ outcomes x (c.2 ++ c'.2)
    rw [outcomes_append]
    exact ⟨b, hbo, h1' ▸ hbo'⟩
  prefix_use := by
    intro _ c c' x b'' h
    obtain ⟨h1, h2, _⟩ := h
    obtain ⟨t, ht⟩ := outcomes_nonempty x c.2
    have h2' : (c.2 ++ c'.2).length ≤ B := h2
    rw [List.length_append] at h2'
    exact ⟨t, h1, by omega, ht⟩





end ReachKernel.TypedSpin
Source
APF ReachKernel; original archive f05a126714fe8d24a4377f87a7e460777555e19227087abb6c18dbe2ffae959e, ReachKernel/TypedSpin.lean; corrected compatible source manifest 2c8ccc43b416ba6e4f1b9eb02d4780b828e8dab689651eb567f7d159065cdfd2. Private conditional/reference model.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me