Docsity

Turing Machine Variants and Non-Deterministic TMs, Slides of Computer Science

Partial preview of the text

Download Turing Machine Variants and Non-Deterministic TMs and more Slides Computer Science in PDF only on Docsity!

1

Turing Machines Variants

2

Agenda

Turing Machine Variants

 Non-deterministic TM‟s  Multi-Tape

4

Input-Output Turing Machines

When fM crashes or goes into an infinite

loop for some contents, fM is a partial

function

If M always halts properly for any

possible input, its function f is total

(i.e. always defined).

5

TM Notations

There are three ways that Sipser uses to describe TM algorithms.

  1. High level – pseudocode which explains how algorithm works without the technical snafoos of TM notation

  2. Implementation level – describe how the TM operates on its tape. No need to mention states explicitly.

  3. Low-level description. One of:

Set of complete “goto” style instructions State diagram Formal description: spell out the 7-tuple

7

Implementation-Level TM

Example

The idea is to carry out the high level

description by copying each character

to the end. We also need to keep track

of which characters have already been

copied (or were copies themselves) by

distinguishing these characters. One

way is to use a different character, say

X.

EG: Let‟s see how 11111 is transformed.

8

Implementation-Level TM

Example

So round by round, tape transformed as

follows:

 X1111X

 XX111XX

 XXX11XXX

 XXXX1XXXX

 XXXXXXXXXX

10

Implementation-Level TM

Example

M = "On input w = 1^ n

  1. HALT if no input
  2. Write $ in left-most position
  3. Sweep right and write X in first blank
  4. Sweep left through X-streak and 1-streak
  5. Go right
  6. If read X, go right and goto 9. Else, replace 1 by X, move right.
  7. If read X [[finished original w]] goto 8 Else, goto 3
  8. Sweep to the right until reach blank, replace by X
  9. Sweep left replacing everything non-blank by 1
  10. HALT

11

Implementation-Level TM

Example

At the low level the Turing Machine is

completely described, usually using a

state diagram:

0

halt

• R

2

1 $,R

1|XR^ $|XR

3 1 L 4

1 X,R

• 1,L

• X,L

XL 1 L

6 5

8

1 R

XR

XR

9

X1,L

$1,L

$R 9

X1,L

13

Non-Deterministic TM‟s

Recognizers vs. Deciders

N is always called a non-deterministic

recognizer and is said to recognize

L(N); furthermore, if in addition for all

inputs and all computation branches, N

always halts, then N is called a non-

deterministic decider and is said to

decide L(N).

14

Non-Deterministic TM

Example

Consider the non-deterministic method:

void nonDeterministicCrossOut(char c)

while() if (read blank) go left else if (read c) cross out, go right, return OR go right // even when reading c OR go left // even when reading c

16

Non-Deterministic TM

Example

A: {x  {0,1,2}* | x has the same no.

of 0‟s as 1‟s as 2‟s }

Q: Suppose q is the state of the TM while running

inside nonDeterministicCrossOut(„1‟) and q‟ is

the state of the TM inside nonDeterministicCrossOut(„2‟). Suppose that current configuration is

u = 0XX1Xq12X

For which v do we have u  v?

17

Non-Deterministic TM

Example

A: 0XX1Xq12X2 

0XX1qX12X2 | 0XX1X1q2X2 | 0XX1XX q‟ 2X

These define 3 branches of computation

tree:

Q: Is this a non-deterministic TM decider?

0XX1XX q‟ 2X

0XX1Xq12X

0XX1qX12X2 0XX1X1q2X

19

NTM‟s

Konig‟s Infinity Lemma

For Problem 3.3 in Sipser the following fact is important:

If a NTM is a decider then given any input,

there is a number h such that all computation

branches involve at most h basic steps. I.e.,

computation tree has height h. Follows from:

Konig’s Infinity Lemma: An infinite tree with finite branching at each node must contain an infinitely long path from the root.

Or really, the contrapositive is used: A tree with no infinite paths, and with finite branching must itself be finite.

20

Konig‟s Infinity Lemma

Proof Idea

Idea is to “smell-out” where the infinite

part of the tree is and go in that

direction: