Skip to content

feat(MultiTapeTM): Nondeterministic multi-tape Turing machines - #820

Open
barni120400 wants to merge 4 commits into
leanprover:mainfrom
barni120400:multitape/ntm
Open

feat(MultiTapeTM): Nondeterministic multi-tape Turing machines#820
barni120400 wants to merge 4 commits into
leanprover:mainfrom
barni120400:multitape/ntm

Conversation

@barni120400

Copy link
Copy Markdown

Builds on #819 — only the last commit is new here, the first three are that PR.

Adds nondeterministic multi-tape Turing machines: the transition function is replaced by a transition relation, and a computation is a RelSeries of the step relation starting at the initial configuration, so its length, the configurations it visits and the one it halts in all come from Mathlib. MultiTapeTM.toNTM embeds the deterministic machine and preserves computation in bounded time and space.

Configurations and the effect of a transition move to a shared MultiTape/Basic.lean. No existing statement changes meaning.

NB: claude was used heavily throughout.

/-- `ntm` has a computation on `input` that starts at the initial configuration, halts, emits
`output` and satisfies `P`. The notions below are its instances, so their constraints all refer to
a single computation. -/
def ComputesSuchThat (ntm : MultiTapeNTM k Symbol State) (input output : List Symbol)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of hides the fact that P only has to hold for some computation path. Maybe this should be a bit more visible in the name?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it on purpose, because by definition a computation of a non-deterministic machine is existance of a computation path.
So I didn't want to carry this existence in the name outside the "ComputesSuchThat".
I think the alternative is "ExistComputationPathSuchThat" but I think "ComputesSuchThat" is better

Comment thread Cslib/Computability/Machines/Turing/MultiTape/Deterministic.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/Nondeterministic.lean
Comment thread Cslib/Computability/Machines/Turing/MultiTape/NonDeterministic.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/NonDeterministic.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/NonDeterministic.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/NonDeterministic.lean Outdated
Comment thread Cslib/Computability/Machines/Turing/MultiTape/Configuration.lean
avivbarnatan-air and others added 4 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>
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