Skip to content

refactor(MultiTape): simulate machines through adapters - #1151

Open
barni120400 wants to merge 2 commits into
leanprover:mainfrom
barni120400:refactor/multitape-shared-simulations
Open

barni120400 wants to merge 2 commits into
leanprover:mainfrom
barni120400:refactor/multitape-shared-simulations

Conversation

@barni120400

@barni120400 barni120400 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Lets a machine follow another: it performs each transition of the inner machine through an adapter, which computes what the inner machine reads from the symbols under the outer heads (HeadSymbols) and gives the outer action performing each inner action. Follows.runningStepHom and Follows.stepHom turn a configuration map that agrees with the adapter into a homomorphism of step relations, so it maps run paths.

Defines extendTapes, outputToTape and inputFromTape as the machine run through an adapter (MultiTapeTM.adapt), so their homomorphisms come from follows_adapt. seq and repeatUntilBlank relabel the actions of their inner machines with Action.mapState and follow them by definition, and prependOutputHom follows the machine itself. This replaces the step lemmas of each simulation and the deterministic stepHom and runningStepHom, and shortens the proofs that use them.

Depends on #1122: its commit is included temporarily and will leave this diff when it merges.

Composed with Claude Code.

Space is counted only on run and computation paths. The visitation and
displacement lemmas hold for the run paths of nondeterministic
machines, and the configuration bounds take `RunsInSpace` and count the
storages and cores at the ends of computation paths: the computation
paths of a deterministic machine are prefixes of one another, so the
one visiting the most cells contains the windows of every other. The
deterministic `visitedByTapeHead`, `spaceUsedByTape` and `space` go,
with their lemmas and the unused `core_step_eq_of_core_eq`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@barni120400
barni120400 force-pushed the refactor/multitape-shared-simulations branch from f33ed1b to 7c214a5 Compare October 21, 2026 08:09
A machine follows another when it performs each of its transitions
through an adapter: what the inner machine reads, computed from the
symbols under the heads of the outer machine (`HeadSymbols`), and the
outer action performing each inner action. `adapt` runs a machine
through an adapter, and `Follows.runningStepHom` and `Follows.stepHom`
turn a configuration map that agrees with the adapter into a
homomorphism of step relations.

`extendTapes`, `outputToTape` and `inputFromTape` run `tm` through their
adapters, so their homomorphisms come from `follows_adapt`. `seq` and
`repeatUntilBlank` relabel the actions of their inner machines with
`Action.mapState` and follow them by definition, and `prependOutputHom`
follows the machine itself. This replaces the step lemmas of each
simulation and the deterministic `stepHom` and `runningStepHom`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@barni120400
barni120400 force-pushed the refactor/multitape-shared-simulations branch from 7c214a5 to 192855e Compare October 24, 2026 20:50
@barni120400 barni120400 changed the title refactor(MultiTape): share tape simulations with nondeterministic machines refactor(MultiTape): simulate machines through adapters Oct 24, 2026
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.

2 participants