The scan of rewindInput (phase p1): from position q to position 0
ProvedMIPRE.TM.Interp.scan_rewindInputA statement of the module MIPRE.TM.Interp.Routines of the MIP* = RE formalization (commit 70cbf1c of vidick/MIPRE-formalization). The routines: specifications of the instructions. Each instruction's specification is a reachability statement: from a configuration at the instruction's first phase, with the tapes it reads in a stated shape, a bounded number of steps leads to the configuration at the next instruction, with the stated effect on the tapes it touches and none on the others (Untouched).
The scan of rewindInput (phase p1): from position q to position 0.
Formal statement. In Lean, with the scope shown:
open MIPRE
open MIPRE.TM
open MIPRE.TM.Interp
open Turing MultiInputTM Phase
open MultiTapeTM (moveInputPos)
variable {input : Fin 7 → List Sym}
theorem MIPRE.TM.Interp.scan_rewindInput {k : ProgId} {pc : Fin maxPc} {j : IT}
(hins : instrAt k pc = .rewindInput j) (hpc : pc.val + 1 < maxPc) (q : ℕ) :
∀ (c : Cfg input), c.state = some ⟨k, pc, p1⟩ → (c.inputPos j : ℕ) = q →
q ≤ (input j).length →
∃ c', Reach c (q + 1) c' [] ∧ c'.state = next_ k pc hpc ∧ Untouched c c' [j] [] ∧
(c'.inputPos j : ℕ) = 0
Formalization Note MIPRE.TM.Interp.scan_rewindInput is declared in MIPRE/TM/Interp/Routines.lean, lines 995–1030. The binders, hypotheses and conclusion are exactly those of the Lean statement above; the uploaded statement elaborates to the same type as the declaration in the repository. The definitions it mentions are those of the published definition bundles of the module's import closure.
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Computability.Language
import Mathlib.Data.Finset.Max
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Fintype.Option
import Mathlib.Data.Fintype.Prod
import Mathlib.Data.Fintype.Sigma
import Mathlib.Data.Fintype.Sum
import Mathlib.Data.Int.Interval
import Mathlib.Data.Nat.Notation
import Mathlib.Data.Sign.Defs
import Mathlib.Logic.Relation
import Mathlib.Tactic
import Mathlib.Tactic.DeriveFintype
import Definitions.Def_MIPRE_Cslib_Foundations_Data_RelatesInSteps
import Definitions.Def_MIPRE_Cslib_Computability_Machines_Turing_MultiTape_Deterministic
import Definitions.Def_MIPRE_TM_MultiInput_Deterministic
import Definitions.Def_MIPRE_TM_Interp_Instr
import Definitions.Def_MIPRE_TM_Interp_Machine
import Definitions.Def_MIPRE_TM_Interp_Tape
import Definitions.Def_MIPRE_TM_Interp_Reach
import Definitions.Def_MIPRE_TM_Interp_Routines
open MIPRE
open MIPRE.TM
open MIPRE.TM.Interp
open Turing MultiInputTM Phase
open MultiTapeTM (moveInputPos)
variable {input : Fin 7 → List Sym}theorem MIPRE.TM.Interp.scan_rewindInput {k : ProgId} {pc : Fin maxPc} {j : IT}
(hins : instrAt k pc = .rewindInput j) (hpc : pc.val + 1 < maxPc) (q : ℕ) :
∀ (c : Cfg input), c.state = some ⟨k, pc, p1⟩ → (c.inputPos j : ℕ) = q →
q ≤ (input j).length →
∃ c', Reach c (q + 1) c' [] ∧ c'.state = next_ k pc hpc ∧ Untouched c c' [j] [] ∧
(c'.inputPos j : ℕ) = 0 := by sorry