Skip to content

refactor(MultiTapeTM): Make the deterministic machine a nondeterministic one - #821

Draft
barni120400 wants to merge 6 commits into
leanprover:mainfrom
barni120400:multitape/ntm-deterministic
Draft

refactor(MultiTapeTM): Make the deterministic machine a nondeterministic one#821
barni120400 wants to merge 6 commits into
leanprover:mainfrom
barni120400:multitape/ntm-deterministic

Conversation

@barni120400

Copy link
Copy Markdown

Builds on #820 — only the last commit is new here.

MultiTapeTM now extends MultiTapeNTM, permitting exactly the transition its transition function prescribes, with ofTr building one from a transition function. Everything defined for the nondeterministic machine therefore applies to it directly, and the separate embedding file is gone.

Determinism makes those notions concrete: a step is what step computes, every computation is the machine's own run, and computing is a statement about that run. Space is now defined once, on a computation.

NB: claude was used heavily throughout.

@barni120400
barni120400 marked this pull request as draft August 20, 2026 08:58
@barni120400
barni120400 force-pushed the multitape/ntm-deterministic branch 2 times, most recently from 98baaee to ca7bec3 Compare August 20, 2026 15:27
avivbarnatan-air and others added 6 commits August 20, 2026 18:41
The configuration gains an `output` field holding the symbols emitted so
far, `step` appends to it and `initCfg` starts it empty. The output of a
run can then be read off its final configuration, so `outputString` and
its lemmas are replaced by `step_output` and existing facts about
`configs`, and `ComputesInTimeAndSpace` reads the output from the
configuration it already mentions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`configs` returns the single configuration reached after `t` steps, not a
sequence of configurations, so the plural name did not match the type. It
also depends on `tm` only through its step function. Renamed to `runFrom`,
along with its five lemmas. Pure rename, no change to any statement or
proof.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Keep the design section free of storage details, list the output tape
among a configuration's components, and drop the stale `BiTape` mention.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A nondeterministic machine replaces the transition function by a
transition relation. Configurations and the effect of an action move to a
shared `MultiTape/Configuration.lean`; no existing statement changes
meaning.

A computation path is a `RelSeries` of the step relation starting at the
initial configuration, so Mathlib supplies its length, the configurations
it passes through, and the one it ends at. `MultiTapeTM.toNTM` embeds the
deterministic machine and `toNTM_computes` shows the embedding preserves
computation in bounded time and space.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tic one

`MultiTapeTM` now extends `MultiTapeNTM`, permitting exactly the
transition its transition function prescribes, with `ofTr` building one
from a transition function. Everything defined for the nondeterministic
machine therefore applies to it, and the separate embedding file is gone.

Determinism makes those notions concrete: a step is what `step` computes
(`ntmStep_iff`, replacing `TransitionRelation`), every computation is the
machine's own run (`computation_toFun`), and computing is a statement
about that run (`computesInTimeAndSpace_iff`). Space is now defined once,
on `Computation`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…e space measures

A `Run` is a series of steps from anywhere; a `Computation` is a run
starting at the initial configuration. `visited`, `spaceByTape` and
`space` are therefore defined for arbitrary runs, and the lemmas about
them live with the other tape lemmas. `spaceUsed_eq_run_space` relates
the deterministic measures to them from any configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@barni120400
barni120400 force-pushed the multitape/ntm-deterministic branch from ca7bec3 to a03c9d4 Compare August 20, 2026 15:44
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