Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions of Tape: Tape contents `Holds τ p l`: the tape `τ` holds the list `l` from cell `p`

Definition
MIPRE_TM_Interp_Tape

by thomasvidick · Oct 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

computabilitymip-remipre-formalizationturing-machines

The definitions of the module MIPRE.TM.Interp.Tape of the MIP* = RE formalization (commit 70cbf1c of vidick/MIPRE-formalization). Tape contents. Holds τ p l: the tape τ holds the list l from cell p. The lemmas relate it to appending, to writing a cell (Function.update) and to reading the cell under a head.

Definitions (6): MIPRE.TM.Interp.BlankBefore (The tape is blank before p.); MIPRE.TM.Interp.BlankBeyond (The tape is blank from p on.); MIPRE.TM.Interp.BlankFrom (The cells of [p, p + n) are blank.); MIPRE.TM.Interp.Holds (The tape holds l from cell p.); MIPRE.TM.Interp.Tape (A work tape.); MIPRE.TM.Interp.bits (The bits of a bit string as symbols.).

Embedded lemmas (5): the small results the bodies of these definitions need (proof fields, simp rules, decidability and finiteness instances), proved inside the bundle so that it imports no unproved statement: nil, bits_append, bits_cons, bits_nil, length_bits.

Formalization Note The bundle is the module MIPRE.TM.Interp.Tape (MIPRE/TM/Interp/Tape.lean) with every declaration not listed removed, imports rewritten to the bundles of the module's import closure; the declarations keep their names, statements and bodies; the source module is split over 1 imported bundle(s).

Definition code
/-
Copyright (c) 2026 Thomas Vidick. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Thomas Vidick
-/
/- Generated for Prove2Me from vidick/MIPRE-formalization@70cbf1c, MIPRE/TM/Interp/Tape.lean (definition bundle: declarations the uploaded statements rest on);
   produced mechanically by prove2me/tools/gen.py, never edited by hand. -/
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Fintype.Option
import Mathlib.Data.Fintype.Prod
import Mathlib.Data.Fintype.Sum
import Mathlib.Data.Sign.Defs
import Mathlib.Tactic
import Mathlib.Tactic.DeriveFintype
import Definitions.Def_MIPRE_TM_Interp_Instr

/-!
# Tape contents

`Holds τ p l`: the tape `τ` holds the list `l` from cell `p`. The lemmas relate it to
appending, to writing a cell (`Function.update`) and to reading the cell under a head.
-/

namespace MIPRE.TM.Interp

/-- A work tape. -/
abbrev Tape := ℤ → Option Sym

/-- The tape holds `l` from cell `p`. -/
def Holds (τ : Tape) (p : ℤ) (l : List Sym) : Prop :=
  ∀ k : ℕ, (hk : k < l.length) → τ (p + k) = some l[k]

namespace Holds

variable {τ : Tape} {p : ℤ}

@[simp] theorem nil : Holds τ p [] := fun k hk => by simp at hk

end Holds

/-- The cells of `[p, p + n)` are blank. -/
def BlankFrom (τ : Tape) (p : ℤ) (n : ℕ) : Prop := ∀ q, p ≤ q → q < p + n → τ q = none

/-- The tape is blank from `p` on. -/
def BlankBeyond (τ : Tape) (p : ℤ) : Prop := ∀ q, p ≤ q → τ q = none

/-- The tape is blank before `p`. -/
def BlankBefore (τ : Tape) (p : ℤ) : Prop := ∀ q, q < p → τ q = none

/-- The bits of a bit string as symbols. -/
def bits : List Bool → List Sym := List.map fun b => if b then Sym.one else Sym.zero

@[simp] theorem bits_nil : bits [] = [] := rfl
@[simp] theorem bits_cons (b : Bool) (l : List Bool) :
    bits (b :: l) = (if b then Sym.one else Sym.zero) :: bits l := rfl
@[simp] theorem bits_append (l₁ l₂ : List Bool) : bits (l₁ ++ l₂) = bits l₁ ++ bits l₂ :=
  List.map_append ..
@[simp] theorem length_bits (l : List Bool) : (bits l).length = l.length := List.length_map ..

end MIPRE.TM.Interp
Source
https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/TM/Interp/Tape.lean

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