Skip to content

feat(MultiTapeTM): halting-time, output-length, and visited-position lemmas for multi-tape TMs - #816

Open
SamuelSchlesinger wants to merge 1 commit into
leanprover:mainfrom
SamuelSchlesinger:samschles/multi-tape-tm-lemmas
Open

feat(MultiTapeTM): halting-time, output-length, and visited-position lemmas for multi-tape TMs#816
SamuelSchlesinger wants to merge 1 commit into
leanprover:mainfrom
SamuelSchlesinger:samschles/multi-tape-tm-lemmas

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

This is in advance of a PR for Turing machine composition.

  • exists_minimal_halting_config: a padded halting run has a least halting time reaching the same configuration
  • outputString_length_le / output_length_le_time: the output is no longer than the elapsed time
  • spaceUsedByTape_le_of_positions: space comparison between two machines via inclusion of visited head positions

…lti-tape TMs

General lemmas independent of any particular construction:
- exists_minimal_halting_config: a padded halting run has a least
  halting time reaching the same configuration
- outputString_length_le / output_length_le_time: the output is no
  longer than the elapsed time
- spaceUsedByTape_le_of_positions: space comparison between two
  machines via inclusion of visited head positions

/-- Every padded halting computation has a least halting time, and the configuration there is the
same as at the padded time. -/
lemma exists_minimal_halting_config (tm : MultiTapeTM k Symbol State)

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 lemma could be reworked a little. It seems to be related to haltsAtStep and halting_step_unique, so should maybe move there. Also the conjunction is rather complicated, maybe it should be split?

Maybe we could also prove Monotone fun t => (tm.configs cfg t).state.isNone?

Comment on lines +433 to +436
have hone : (tm.outputSymbol (tm.configs cfg t)).toList.length ≤ 1 := by
cases tm.outputSymbol (tm.configs cfg t) <;> simp
simp only [List.length_append]
omega

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.

There does not seem to be a lemma Option.toList_length (x : Option α) : x.toList.length ≤ 1 (which would he hone). But maybe this one suffices (I did not test it):

Suggested change
have hone : (tm.outputSymbol (tm.configs cfg t)).toList.length ≤ 1 := by
cases tm.outputSymbol (tm.configs cfg t) <;> simp
simp only [List.length_append]
omega
grind [Option.toList]

_ = k * t + k := by simp [Nat.mul_succ]

/--
The space used by one tape is monotone under inclusion of its visited head positions in the

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 lemma deserves a bit more explanation, in particular, I don't understand the meaning of hpos.

@crei

crei commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Heads up: This might conflict with #819

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