Skip to content

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

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

feat(Machines): Single-Tape Nondeterministic Turing Machines (NTMs)#683
fmontesi wants to merge 3 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.

tape := Turing.BiTape.mk₁ xs

/-- The space used by a configuration is the space used by its tape. -/
def Cfg.spaceUsed (cfg : Cfg State Symbol) : ℕ := cfg.tape.spaceUsed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Moving my comment from the other PR:

I think this definition might be misleading because it implement a rather uncommon notion of space (although it might be equivalent in the end). This definition is mainly used to prove that the output length is bounded by the number of steps. So maybe we should rather rename it to "tapeSize" or something like that.
But we can also leave that for a later change when we introduce a notion of space.


/-- An NTM yields a small-step operational semantics on configurations, which codifies an execution
step. -/
def Red (m : SingleTapeNTM State Symbol)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you add a small comment that explains why it is called Red?

@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?

(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?

criterion as for deterministic TMs. We might want to revisit this in the future.
-/
c'.tape = Turing.BiTape.mk₁ ys

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you add another Prop that states that the NTM accepts an input in at most t steps?

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