refactor(MultiTapeTM): read runFrom through Mathlib's iterate API - #878
Merged
Conversation
`runFrom cfg t` is by definition `tm.step^[t] cfg`, so the lemmas that lift a statement about one `step` to a whole run are instances of Mathlib's iterate API. This file already used it for `runFrom_add`, `runFrom_succ_eq_step` and `relatesInSteps_iff_runFrom_eq`; these are the remaining cases. * `runFrom_comm_of_step`: a map of configurations that commutes with the two step functions commutes with their runs, so a step-for-step simulation only has to be verified for a single step. This is `Function.Semiconj.iterate_right`, stated in the orientation the `step` lemma of a simulation naturally has, so that instances need no `symm`. * `runFrom_of_halt` is `Function.iterate_fixed` applied to `step_of_halt`. * The `hloop` inside `not_halts_of_repeat_nonhalt` is `Function.iterate_fixed` applied to the repeated configuration, via `Function.iterate_mul`. `runFrom_comm_of_step` has no caller yet on `main`. It is the shape that every machine transformation instantiates — each one proves a `step` lemma and then repeats the same three-line induction to obtain the corresponding `runFrom` lemma — so it is added here to be available to the machine-plumbing work in flight rather than duplicated in it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
SamuelSchlesinger
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a lemma that will be helpful in future simulations:
runFrom_comm_of_step: a map of configurations that commutes with the two TM step functions commutes with their runs, so a step-for-step simulation only has to be verified for a single step.Also changes two proofs to use the
Function.iterate_fixedAPI instead of manual induction proofs.