turing machines 1

3
FOUNDATIONS OF COMPUTATION 2009 LECTURE NOTES 12 ISSUED 23 NOVEMBER 2009 1. Turing machines A Turing machine consists of a control module, a tape infinite in one direction and a working head. The tape is divided into cells in each of which a letter can be written. The working head at each moment of time observes one cell on the tape. control b a a Figure 1. A scheme of a Turing machine Definition. Turing machine (TM) is a system (Q, Σ, s, δ, H) where Q is set of states; Σ is an alphabet containing t (blank), . (left end symbol), and not contain- ing and ; s is the initial state; H is the set of halting states; δ is the transition function, δ :(Q \ H) × Σ Q × ∪ {←, →}) such that (a) for all q Q \ H if δ(q,.)=(p, b) then b =; (b) for all q Q \ H and a Σ if δ(q,a)=(p, b) then b 6= .. How it works: 1 2014 28 NOVEMBER 2014

Upload: pravallika-reddy

Post on 22-Dec-2015

213 views

Category:

Documents


0 download

DESCRIPTION

iNTRO ABOUT TURING MACHINCE

TRANSCRIPT

Page 1: Turing Machines 1

FOUNDATIONS OF COMPUTATION 2009

LECTURE NOTES 12

ISSUED 23 NOVEMBER 2009

1. Turing machines

A Turing machine consists of a control module, a tape infinite in one directionand a working head. The tape is divided into cells in each of which a letter can bewritten. The working head at each moment of time observes one cell on the tape.

control

b a a

Figure 1. A scheme of a Turing machine

Definition. Turing machine (TM) is a system (Q, Σ, s, δ, H) where

• Q is set of states;• Σ is an alphabet containing t (blank), . (left end symbol), and not contain-

ing → and ←;• s is the initial state;• H is the set of halting states;• δ is the transition function,

δ : (Q \H)× Σ→ Q× (Σ ∪ {←,→})

such that(a) for all q ∈ Q \H if δ(q, .) = (p, b) then b =→;(b) for all q ∈ Q \H and a ∈ Σ if δ(q, a) = (p, b) then b 6= ..

How it works:1

201320132014

28 NOVEMBER 2014

Page 2: Turing Machines 1

2 ISSUED 23 NOVEMBER 2009

Let δ(q, a) = (p, b). Then TM, when in the state q and reading the letter a, willadopt the state p and

• if b ∈ Σ then will replace a by b;• if b ∈ {←,→} then will move the head in the direction b.

TM will stop only when it adopts a halting state. If TM observes ., it mustmove to the right (by (a)). In this way . is never erased, and TM never falls off itsleft end.

By (b) TM never writes . so this symbol is unique on the tape.

2. Examples

The following machine erases any input and then halts:

({s, q, h}, {a,t, .}, δ, s, {h}),

where δ is defined by the following table.

state letter δ(state, letter)s a (q,t)s t (h,t)s . (s,→)q a (s, a)q t (s,→)q . (q,→)

Note that some of the transitions in the table, e.g., the fourth, are not used in anycomputation, but the function δ is defined at every element of the set (Q \H)×Σ.

Another example, a Turing machine that does not halt on any input, but runsfrom it’s beginning to it’s end, then back to the beginning and so forth.:

state letter δ(state, letter)s a (s,→)s t (q,←)s . (s, .)q a (q,←)q . (s,→)q t (h,t)

3. Computations

Definition. A configuration of TM is an object of the kind (q, .w, a, v), where

• q ∈ Q,• .w is a word starting with . and w ∈ Σ∗,• a ∈ Σ,• v ∈ Σ∗.

The configuration is a “snapshot” of TM at a given moment of it’s work, indi-cating

(1) the state,(2) what is on the tape,

20 NOVEMBER 2013

Page 3: Turing Machines 1

LECTURE NOTES 12 3

(3) position of the head (the head it is observing the letter a between .w andv).

We will abbreviate the notation (q, .w, a, v) to just a pair (q, .wav).

Definition.

• A configuration (q, .wav) is called halting if q ∈ H.• A configuration (q1, w1a1v1) yields a configuration q2, w2a2v2) in one step

if the second is obtained from the thirst by “one application of the transitionfunction”.• A configuration C1 yields a configuration Cn if there is a sequence of con-

figurations C2, . . . , Cn−1 such that Ci yields Ci+1 for all i = 1, . . . , n− 1.

In what follows we assume that inputs of TM are words over an alphabet Σ0 ⊂Σ \ {t, .}. The initial configuration is (s, .tw) where w ∈ Σ∗

0 is an input word.TM halts on w ∈ Σ∗

0 if the initial configuration yields a halting configuration.

4. Semidecidable and decidable sets

Definition. Let L ⊂ Σ∗0. L is called semidecidable (or recursively enumerable) if

there is TM such that for every w ∈ Σ∗0 the following is true: w ∈ L if and only

if TM halts on w. L is called decidable (or recursive) if both L and Σ∗0 \ L are

semidecidable.

Here is another characterization of decidable sets.

Theorem. A language L is decidable if and only if there is a TM M with H ={y, n} such that w ∈ L is equivalent to the initial configuration yielding a haltingconfiguration with y, and w ∈ Σ∗

0\L is equivalent to the initial configuration yieldinga halting configuration with n.

A proof in one direction is simple: given M we obtain TM halting exactly on Lby making in M the state n non-halting, and extending the transition function bydefining δ(n, a) = (n, a) for every a ∈ Σ. In a similar way the machine halting onΣ∗

0 \L is defined. The proof of the existence of M if L is decidable is slightly morecomplex and is not considered in detail in this course.