Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formal Definition Definition. A Turing machine is a 5-tuple (S, , , s, H), where: S is a set of states  is an alphabet It must contain  and . It cannot.

Similar presentations


Presentation on theme: "Formal Definition Definition. A Turing machine is a 5-tuple (S, , , s, H), where: S is a set of states  is an alphabet It must contain  and . It cannot."— Presentation transcript:

1 Formal Definition Definition. A Turing machine is a 5-tuple (S, , , s, H), where: S is a set of states  is an alphabet It must contain  and . It cannot contain  or  s  S is the initial state H  S is the set of halting states

2 Formal Definition (II)
 is a collection of transitions defined by the function:  maps ((S-H)  ) into (S  (  (, })) such that: For any q  S – H, then for some p  S 1.1 (q, ) = (p,), or 1.2 (q, ) = (p, ) There cannot be any p, q  S and α   – {} such that (p, α) = (q, ) Very simple definition but very useful precisely because of its simplicity!

3 The “Eraser” TM Construct a Turing machine that receives as input a substring of a’s and replace each a for a blank space,  a (S, , , s, H) S = {s,q,h} ={a, , } H = {h}

4 Another Example = { ((s, ),(s,)), ((s,a),(q, )), ((q, ),(s, )),
((s, ),(h, )), ((q,a),(q,a)), ((q, ), (q, a)) } ((s, ),(q,)) What does this Turing machine do?

5 The Turing Machines M1 and M0
The Turing Machine M1 ? 1 The Turing Machine M0 ?

6 The Turing Machine Mx ? 1 ?

7 Configuration for Previous Machines
Explanation (q,w) q: state, w: word Finite automata (q,w,) q: state, w: word : stack Pushdown automata

8 Configuration for Turing Machines
The current state, q The symbol pointed by the head, h The string left of the head, LS The string right of the head, RS (q,h,LS,RS)

9 Configuration for Turing Machines (2)
Instead of writing: (q,h,LS,RS), we write: (q,LShRS) If q  H, then (q,LShRS) is called a halting configuration Examples: - Initial configuration with 3 a’s for the eraser TM: (s,eaaa) - Final configuration starting with (s,eaaa): (s,) - Final configuration of M1with (s,aab): (s,1ab)

10 Computation in Turing Machines
A configuration C1 = (q1,LS1h1RS1) yields a configuration C2 = (q2,LS2h2RS2) in one step, written C1 C2, if: There is a transition ((q1, h1),(q2,A)) in  C2 is obtained after applying ((q, h1),(q2,A)) to C1 (there are 3 cases for A: a in ∑, , or ) C yields C’, written C * C’: There is a sequence of configurations: C C C1 … C’

11 Example of Computation
(s,eaaa) yields (h,e) written (s,eaaa) * (h,e)

12 Example of Computation (2)
Consider the following Turing machine: ((s, ),(h, )) ((s,a),(q,b)) ((s,b),(q,a)) ((q,a),(s,)) ((q,b),(s,)) ((q, ),(q, )) ((s, ),(s,)) ((q, ),(s,)) - Trace the machine when starting with configuration (s,abbabba) - Describe what this machine does

13 Another Turing Machine
The (ab)* Turing Machine: 1 ? a b a b a b a a

14 Homework Please provide a secret nickname so we can post your grades on the course’s web site 4.1 a), b) 4.2 Construct a Turing machine that “reads” the character in the current cell and copies it into the contiguous cell immediately to the right of the current one (if the character in the current cell is , the machine does not terminate). For example if the starting configuration is: (s, abaa), then the halting configuration is: (h, abba), where h is a halting state Construct the Turing machine that recognizes (ab)* (See Slide # 13)


Download ppt "Formal Definition Definition. A Turing machine is a 5-tuple (S, , , s, H), where: S is a set of states  is an alphabet It must contain  and . It cannot."

Similar presentations


Ads by Google