Skip to content

feat(MultiTapeTM): add tape redirection plumbing - #936

Merged
SamuelSchlesinger merged 17 commits into
leanprover:mainfrom
crei:loop/07-step-lemmas
Sep 26, 2026
Merged

SamuelSchlesinger merged 17 commits into
leanprover:mainfrom
crei:loop/07-step-lemmas

Conversation

@crei

@crei crei commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

This adds TM modifiers to use work tapes instead of input or output tapes

crei and others added 9 commits September 22, 2026 08:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread Cslib/Computability/Machines/Turing/MultiTape/Plumbing/ExtendTapes.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/Plumbing/InputFromTape.lean Outdated
crei and others added 5 commits September 25, 2026 07:23
Replace `rw [show ... from Function.iterate_succ_apply' ..]` with a
direct `rw [runFrom, Function.iterate_succ_apply', ← runFrom]` in the
three proofs that previously relied on the removed `runFrom_succ_eq_step'`
wrapper lemma.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the concise case-split proof used on main before Action.apply
lost its blanket @[simp]: add Action.apply explicitly to the simp set
in the `some q` case instead of manually unfolding via Prod.ext/Storage.ext.
Verified this avoids the linter.flexible warning under --wfail --iofail.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt proofs to the new `Fin.append`/`Fin.natAdd`/`invOfMemRange`-based
definitions of `inCfg` (InputFromTape) and `partialInv` (ExtendTapes):

- Replace subtype literals `⟨k, by omega⟩`/`⟨k + 1, by omega⟩` with
  `Fin.natAdd k 0`/`Fin.natAdd k 1` throughout InputFromTape.lean to
  match the new definition's indexing.
- Fix `inCfg_workTapes_vip`/`_flag` and `inCfg_workTapePos_vip`/`_flag`,
  which no longer reduced by `simp [inCfg]` alone under the `Fin.append`
  encoding (removes a leftover `sorry`).
- Simplify `partialInv_isPartialInv` to use the dedicated
  `Function.Embedding.left_inv_of_invOfMemRange`/
  `right_inv_of_invOfMemRange` lemmas instead of manually re-deriving
  them via `Fintype.choose_spec`, matching the new `invOfMemRange`-based
  `partialInv` definition.

Verified with lake build --wfail --iofail, mk_all --check, lake test,
lake lint, lake exe lint-style.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@crei
crei marked this pull request as ready for review September 25, 2026 06:00
… modifiers

Add `runFrom_comm`, which lifts a step-semiconjugation to whole runs, and
`spaceUsed_le_of_workTapePos_embedding`, which bounds the space of a
simulation that tracks the original heads on embedded tapes. The run and
space lemmas of `extendTapes`, `inputFromTape` and `outputToTape` become
applications of these, and the step lemmas are shortened to a case split on
the tape index followed by `simp`.

`Action.apply` now derives its projection lemmas with `@[simps -fullyApplied]`,
unused lemmas are removed, and the `inputFromTape` reading lemmas are public
simp lemmas stated in terms of `inCfg`.
Restore `step_inputPos_of_state`, `step_workTapes_of_state`,
`step_workTapePos_of_state`, `inputPos_runFrom_le` and
`val_moveInputPos_le`, which later plumbing uses. Drop `runFrom_comm` in
favour of `Function.Semiconj.iterate_right`, as leanprover#942 did, passing only the
configuration map.

`inputFromTape` builds its tape actions with `Fin.append` like `inCfg`, the
space lemma takes its embedding as `e` with the hypothesis oriented like
`spaceUsed_eq_of_workTapePos`, and `val_moveInputPos_sub_one` is renamed to
`val_moveInputPos_sub_one_eq_clampMove`.
…pe-plumbing-refactor

refactor(MultiTapeTM): simplify the tape redirection plumbing
@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Sep 26, 2026
Merged via the queue into leanprover:main with commit d1ce5d4 Sep 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants