import Mathlib.Computability.TuringMachine.Computable /-! # Stack configuration API for bundled machines The initial and halted configurations select exactly one designated stack. These lemmas expose their label, state and stacks without requiring a client to unfold their dependent conditional definitions. They use only Mathlib's machine model; their proposed upstream home is `Mathlib/Computability/TuringMachine/Computable.lean`. -/ namespace Turing /-- The initial configuration starts at the machine's main label. -/ @[simp] theorem initList_l (tm : FinTM2) (s : List (tm.Γ tm.k₀)) : (initList tm s).l = some tm.main := rfl /-- The initial configuration uses the machine's initial state. -/ @[simp] theorem initList_var (tm : FinTM2) (s : List (tm.Γ tm.k₀)) : (initList tm s).var = tm.initialState := rfl /-- The input stack of the initial configuration contains the input list. -/ @[simp] theorem initList_stk_self (tm : FinTM2) (s : List (tm.Γ tm.k₀)) : (initList tm s).stk tm.k₀ = s := by simp [initList] /-- Every stack other than the input stack is initially empty. -/ @[simp] theorem initList_stk_ne (tm : FinTM2) (s : List (tm.Γ tm.k₀)) {k : tm.K} (h : k ≠ tm.k₀) : (initList tm s).stk k = [] := by simp [initList, h] /-- The halted configuration has no current label. -/ @[simp] theorem haltList_l (tm : FinTM2) (s : List (tm.Γ tm.k₁)) : (haltList tm s).l = none := rfl /-- The halted configuration resets to the machine's initial state. -/ @[simp] theorem haltList_var (tm : FinTM2) (s : List (tm.Γ tm.k₁)) : (haltList tm s).var = tm.initialState := rfl /-- The output stack of the halted configuration contains the output list. -/ @[simp] theorem haltList_stk_self (tm : FinTM2) (s : List (tm.Γ tm.k₁)) : (haltList tm s).stk tm.k₁ = s := by simp [haltList] /-- Every stack other than the output stack is empty in the halted configuration. -/ @[simp] theorem haltList_stk_ne (tm : FinTM2) (s : List (tm.Γ tm.k₁)) {k : tm.K} (h : k ≠ tm.k₁) : (haltList tm s).stk k = [] := by simp [haltList, h] end Turing