Skip to content

refactor(MultiTapeTM): Put the output tape into the configuration - #819

Open
barni120400 wants to merge 3 commits into
leanprover:mainfrom
barni120400:multitape/run-from
Open

refactor(MultiTapeTM): Put the output tape into the configuration#819
barni120400 wants to merge 3 commits into
leanprover:mainfrom
barni120400:multitape/run-from

Conversation

@barni120400

Copy link
Copy Markdown

Two independent changes to the multi-tape Turing machine, one per commit.

The first puts the output tape into the configuration: Cfg gains an output field, step appends the symbol the transition emits, and initCfg starts it empty. The output of a run is then whatever is on its final configuration's tape. That makes outputString unnecessary, so it and its lemmas are removed: outputString_succ becomes step_output, outputString_eq_of_halt is restated on configurations, and outputString_halt and outputString_add_eq_append were output-flavoured restatements of the existing configs_of_halts and configs_add. ComputesInTimeAndSpace now reads the output off the configuration it already mentions.

The second renames configs to runFrom. It returns the single configuration reached after t steps rather than a sequence, so the plural name did not match its type, and it depends on the machine only through its step function. Pure rename, no statement or proof changed.

This is step 1 of the plan discussed on Zulip: with the output in the configuration, a List of configurations determines the output string, so a computation can be such a list and reuse the machinery in RelatesInSteps.lean.

Note that the configuration space is now unbounded, so counting reachable configurations needs to happen on the storage configuration rather than on Cfg.

Supersedes #818.

NB: claude was used heavily throughout.

Comment on lines +32 to +33
The transition function can optionally output one symbol, which is appended to the output tape held
in the configuration, so the output of a run can be read off its final configuration.

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.

I think this can stay as it is. In this high-level design section we also don't mention how the other tapes are stored exactly.

Comment thread Cslib/Computability/Machines/Turing/MultiTape/Deterministic.lean

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.

Just noticed this - we don't use BiTape any more here:

Suggested change
is the blank tape symbol). Note that it is not required that `Symbol` or `State` are finite

avivbarnatan-air and others added 3 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>
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