Skip to content

feat(Automata, LTS, and Turing): saturated multistep transitions, mapLabel for LTS, and Nondeterministic Turing Machines (NTM)#615

Open
fmontesi wants to merge 11 commits into
mainfrom
fmontesi/ntm
Open

feat(Automata, LTS, and Turing): saturated multistep transitions, mapLabel for LTS, and Nondeterministic Turing Machines (NTM)#615
fmontesi wants to merge 11 commits into
mainfrom
fmontesi/ntm

Conversation

@fmontesi
Copy link
Copy Markdown
Collaborator

@fmontesi fmontesi commented Jun 4, 2026

This PR:

  1. Fixes a bug in the formulation of EpsilonNA by adopting a new saturated multistep transition LTS.SMTr for LTS, which correctly invokes tau-closure for empty strings.
  2. Adds nondeterministic Turing machines (NTM), as an example of how Turing machines can be formulated on top of our current library for transition systems.

Both changes have been discussed at the last CSLib General Meeting and are part of a larger discussion towards integrating machine models and transition systems (postponed to later work).

@fmontesi fmontesi requested a review from chenson2018 as a code owner June 4, 2026 12:32
instance : Acceptor (SingleTapeNTM State Symbol) Symbol where
Accepts (m : SingleTapeNTM State Symbol) (xs : List Symbol) :=
∃ s ∈ m.start, ∃ c', c'.state ∈ m.accept ∧ m.MRed (Cfg.mk₁ s xs) c'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In order to complete the definition at least for complexity theory, it would be nice to have a definition of the sort

def ComputesInTimeAndSpace (tm : SingleTapeNTM State Symbol) (input output : List Symbol) (t s : Nat) := ...

alternatively

def AcceptsInTimeAndSpace (tm : SingleTapeNTM State Symbol) (input : List Symbol) (t s : Nat) := ...

Copy link
Copy Markdown
Contributor

@Shreyas4991 Shreyas4991 left a comment

Choose a reason for hiding this comment

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

This PR seems fine to me. The only question is whether we shouldn't just define the basic operations as move, read, write, etc, as opposed to a single step transition.

Pro:

The TM can be programmed by a lean function that chains these operations

Possible Con:

We will have to count read, write, and move as separate operations. However this is a small constant factor blow up which has no meaningful consequences in complexity theory or computability theory.

Discussion Thread

Link

namespace Cslib.Computability.Turing.SingleTape

/-- The transition labels used by a single-tape Turing Machine. -/
structure TrLabel (State Symbol : Type*) where
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.

This could be an inductive type. We can replace the transition function with the basic operations on a TM. For more discussion see Zulip thread for this PR

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