Skip to content

feat(Machines): Single-Tape Nondeterministic Turing Machines (NTMs)#683

Open
fmontesi wants to merge 5 commits into
mainfrom
fmontesi/ntm-single
Open

feat(Machines): Single-Tape Nondeterministic Turing Machines (NTMs)#683
fmontesi wants to merge 5 commits into
mainfrom
fmontesi/ntm-single

Conversation

@fmontesi

Copy link
Copy Markdown
Collaborator
  • Adds NTMs, defined as nondeterministic automata over TrLabel and the usual derived 'yields' relation (Red).
  • Instantiates Acceptor and Transducer for NTM.
  • Proves characterisation theorems that connect reductions on configurations to single- and multistep transitions of the underlying machine.

Comment thread Cslib/Computability/Machines/Turing/SingleTape/Defs.lean
Comment thread Cslib/Computability/Machines/Turing/SingleTape/NonDeterministic.lean Outdated

@Shreyas4991 Shreyas4991 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Design comments

/-- The transition labels used by a single-tape Turing Machine. -/
inductive TrLabel (Symbol : Type*)
/-- Read `x` from the tape. -/
| read (x : Symbol)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does read need a parameter. Shouldn't read just return whatever symbol is on the thread?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This codifies the transition where the machine needs to read the symbol x to change states according to its transition relation. It's the usual thing in textbooks on TMs and automata, as well as labelled transition systems with 'observable actions'.

(otape : Option (Turing.BiTape Symbol)) (μ : TrLabel Symbol) :
Option (Turing.BiTape Symbol) :=
match μ, otape with
| read x, some tape => if x = tape.head then some tape else none

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is the tape an option type? We always operate on the tape don't we?

@fmontesi fmontesi Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because I need to use this with List.foldl in the NTM defs, but if you have a better suggestion I'm happy to hear it.

@fmontesi fmontesi enabled auto-merge July 5, 2026 18:54
@fmontesi fmontesi disabled auto-merge July 5, 2026 18:54
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