Download presentation
Presentation is loading. Please wait.
Published byAllan Woods Modified over 9 years ago
1
CSCI 2670 Introduction to Theory of Computing October 7, 2004
2
2 Agenda Yesterday –Test Today –Continue Turing Machines
3
October 7, 20043 Announcements Homework due Wednesday –3.2 b,d 3.5 all, 3.7, 3.8 a,c (high-level descriptions) Reminder: tutorial sessions are suspended until further notice –Extended office hours while tutorials are suspended Monday 11:00 – 12:00 Tuesday 3:00 – 4:00 Wednesday 3:00 – 5:00
4
October 7, 20044 Formal definition of a TM Definition: A Turing machine is a 7- tuple (Q, , , ,q 0,q accept,q reject ), where Q, , and are finite sets and 1.Q is the set of states, 2. is the input alphabet not containing the special blank symbol ~ 3. is the tape alphabet, where ~ and , 4. : Q Q {L,R} is the transition function,
5
October 7, 20045 Formal definition of a TM Definition: A Turing machine is a 7- tuple (Q, , , ,q 0,q accept,q reject ), where Q, , and are finite sets and 5.q 0 Q is the start state, 6.q accept Q is the accept state, and 7.q reject Q is the reject state, where q reject q accept
6
October 7, 20046 Computing with a TM M receives input w = w 1 w 2 …w n * on leftmost n squares of tape –Rest of tape is blank (all ~ symbols) Head position begins at leftmost square of tape Computation follows rules of Head never moves left of leftmost square of the tape –If says to move L, head stays put!
7
October 7, 20047 Completing computation Continue following transition rules until M reaches q accept or q reject –Halt at these states May never halt if the machine never transitions to one of these states!
8
October 7, 20048 TM configurations The configuration of a Turing machine is the current setting –Current state –Current tape contents –Current tape location Notation uqv –Current state = q –Current tape contents = uv Only ~ symbols after last symbol of v –Current tape location = first symbol of v
9
October 7, 20049 Configuration C 1 yields C 2 C 1 yields C 2 if the TM can legally go from C 1 to C 2 in one step –Assume a, b and u, v * –uaq i bv yields uq k acv if (q i,b)=(q k,c,L) –uaq i bv yields uacq k v if (q i,b)=(q k,c,R)
10
October 7, 200410 Configuration C 1 yields C 2 Special cases if head is at beginning or end of tape –q i bv yields q k cv if (q i,b)=(q k,c,L) –q i bv yields cq k v if (q i,b)=(q k,c,R) –uaq i is the same as uaq i ~ “handle this case as before” uaq i ~ yields uq k ac~ if (q i,b)=(q k,c,L) uaq i ~ yields uacq k ~ if (q i,b)=(q k,c,R)
11
October 7, 200411 Special configurations Start configuration –q0w–q0w Halting configurations –Accepting configuration: uq accept v –Rejecting configuration: uq reject v u, v *
12
October 7, 200412 Strings accepted by a TM A Turing machine M accepts input sequence w if a sequence of configurations C 1, C 2, …, C k exist, where 1.C 1 is the start configuration of M on input w 2.each C i yields C i+1 for i = 1, 2, …, k-1 3.C k is an accepting configuration
13
October 7, 200413 Language of a TM The language of M, denoted L(M), is –L(M) = {w | M accepts w} A language is called Turing- recognizable if some Turing machine recognizes it
14
October 7, 200414 Deciders A Turing machine is called a decider if every string in * is either accepted or rejected A language is called Turing-decidable if some Turing machine decides it –These languages are often just called decidable
15
October 7, 200415 Turing machine notation (q i,b)=(q k,c,D), where D = L or R, is represented by the following transition qiqi qkqk b c, D In the special case where (q i,b)=(q k,b,D), i.e., the tape is unchanged, the right-hand side will just display the direction
16
October 7, 200416 Example Write a TM that accepts all strings of the form 101001000100001 … –Start with a 1 –End with a 1 –Progressively more 0’s between consecutive 1’s
17
October 7, 200417 Design Check first symbol is a 1 –If not reject Move right and check if second symbol is a 0 –If not reject –If so, replace with X and begin recursion
18
October 7, 200418 Recursion (high level) Go back and forth on either side of each 1 –Replace 0’s on right side of 1 with an X –Replace X’s on left side of 1 with a Y After all X’s on left side of 1 are replaced with Y’s, there should be exactly one on the right side that has not been X’ed –If not, reject –If so, repeat process (recursion step)
19
October 7, 200419 Exit condition If you begin to look for the next group of 0’s and reach a ~ then accept
20
October 7, 200420
21
October 7, 200421 Group project 1 Design a Turing machine to accept any string in {a,b} * after making a copy of it on the tape –The tape will start with w –After TM processes the string, the tape should read ww
22
October 7, 200422 Group project 2 Write a Turing machine that accepts the language {w {a,b} * | |w| is even}
23
October 7, 200423 Group project 3 Write a Turing machine that accepts the language {a n b m | n m and n m}
24
October 7, 200424 Group project 4 Write a Turing machine that accepts the language {a n b m a n+m | n 0 and m 1}
25
October 7, 200425 Group project 5 Write a Turing machine that accepts the language {ww R | w {a,b} * }
26
October 7, 200426 Group project 6 Design a Turing machine that accepts the language {w {a,b} * | w has more a’s than b’s}
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.