Turing Machines Part One

Size: px
Start display at page:

Download "Turing Machines Part One"

Transcription

1 Turing Machines Part One

2 What problems can we solve with a computer?

3 Regular Languages CFLs Languages recognizable by any feasible computing machine All Languages

4 That same drawing, to scale. All Languages

5 The Problem Finite automata accept precisely the regular languages. We may need unbounded memory to recognize context-free languages. e.g. { an b n n N } requires unbounded counting. How do we build an automaton with fnitely many states but unbounded memory?

6 A Brief History Lesson

7 <ahem> Technology has solved all of mankind s problems! No more wars or sad ever!

8 Hilbert s Vision 1900: International Congress of Mathematicians meeting in Paris Proposes 23 unsolved problems as the agenda for the coming years An important theme is not simply proving more theorems, but achieving automation of theoremproving, even theorem generation. Humanity lives in leisure while all Truth fows efortlessly into our hands on a ticker tape! No one shall expel us from the Paradise that Cantor has created! -David Hilbert

9 Hi there, Reality! Hilbert s agenda is both a spectacular success and a spectacular failure Inspires some of the most impactful theoretical work in mathematical history, human history Brings us heroes like Alan Turing and Kurt Gödel! These incredible results consist of utterly demolishing all the pillars of Hilbert s vision of automated knowledge creation, within just a few years No one shall expel us from the Paradise that Cantor has created! -David Hilbert

10 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R This This is is the the Turing Turing machine s machine s finiteisttiteiconntont. finiteisttiteiconntont. It It issues issues commands commands that that drive drive the the operation operation of of the the machine. machine. q rej

11 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R This This is is the the TM s TM s infiniteitipe. infiniteitipe. Each Each tape tape cell cell holds holds a a tipei tipei stymbnt. stymbnt. Initially, Initially, all all (infnitely (infnitely many) many) tape tape symbols symbols are are blank. blank. q rej

12 A Simple Turing Machine q acc, R a, R q 0 q 1 The The machine machine is is ed ed with with the the inputisttoing inputisttoing written written somewhere somewhere on on the the tape. tape. The The tipeiheid tipeiheid initially initially points points to to the the frst frst symbol symbol of of the the input input string. string. a, R q rej, R a a a a

13 A Simple Turing Machine q acc, R a, R q 0 q 1 Like Like DFAs DFAs and and NFAs, NFAs, TMs TMs begin begin execution execution in in their their sttiotisttite. sttiotisttite. a, R q rej, R a a a a

14 A Simple Turing Machine q acc, R a, R q 0 q 1 At At each each step, step, the the TM TM only only looks looks at at the the symbol symbol immediately immediately under under the the tipeiheid. tipeiheid. a, R q rej, R a a a a

15 A Simple Turing Machine q acc, R a, R q 0 q 1 These These two two transitions transitions originate originate at at the the current current state. state. We re We re going going to to choose choose one one of of them them to to follow. follow. a, R q rej, R a a a a

16 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R Each Each transition transition has has the the form form oeidiiwoite,idio oeidiiwoite,idio and and means means if if symbol symbol oeid oeid is is under under the the tape tape head, head, q replace rej replace it it with with woite woite and and move move the the tape tape head head in in direction direction dio dio (L (L or or R). R). The The symbol symbol denotes denotes a a blank blank cell. cell. a a a a

17 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R Each Each transition transition has has the the form form oeidiiwoite,idio oeidiiwoite,idio and and means means if if symbol symbol oeid oeid is is under under the the tape tape head, head, q replace rej replace it it with with woite woite and and move move the the tape tape head head in in direction direction dio dio (L (L or or R). R). The The symbol symbol denotes denotes a a blank blank cell. cell. a a a a

18 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R Each Each transition transition has has the the form form oeidiiwoite,idio oeidiiwoite,idio and and means means if if symbol symbol oeid oeid is is under under the the tape tape head, head, q replace rej replace it it with with woite woite and and move move the the tape tape head head in in direction direction dio dio (L (L or or R). R). The The symbol symbol denotes denotes a a blank blank cell. cell. a a a

19 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R Each Each transition transition has has the the form form oeidiiwoite,idio oeidiiwoite,idio and and means means if if symbol symbol oeid oeid is is under under the the tape tape head, head, q replace rej replace it it with with woite woite and and move move the the tape tape head head in in direction direction dio dio (L (L or or R). R). The The symbol symbol denotes denotes a a blank blank cell. cell. a a a

20 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R Each Each transition transition has has the the form form oeidiiwoite,idio oeidiiwoite,idio and and means means if if symbol symbol oeid oeid is is under under the the tape tape head, head, q replace rej replace it it with with woite woite and and move move the the tape tape head head in in direction direction dio dio (L (L or or R). R). The The symbol symbol denotes denotes a a blank blank cell. cell. a a a

21 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a

22 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a

23 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a

24 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a

25 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

26 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

27 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

28 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

29 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

30 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a

31 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a

32 A Simple Turing Machine q acc, R a, R q 0 q 1 Unlike Unlike a a DFA DFA or or NFA, NFA, a a TM TM doesn t doesn t stop stop after after reading reading all all the the input input characters. characters. We We keep keep running running until until the the machine machine explicitly explicitly says says to to stop. stop. a, R q rej, R

33 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej

34 A Simple Turing Machine q acc, R a, R q 0 q 1 This This special special state state is is an an icocoeptingisttite. icocoeptingisttite. When When a a TM TM enters enters an an accepting accepting state, state, it it immediately immediately stops stops running running and and accepts accepts whatever whatever the the original original input input string string was was (in (in this this case, case, aaaa). aaaa). a, R q rej, R

35 A Simple Turing Machine q acc, R a, R q 0 q 1 This This special special state state is is an an icocoeptingisttite. icocoeptingisttite. When When a a TM TM enters enters an an accepting accepting state, state, it it immediately immediately stops stops running running and and accepts accepts whatever whatever the the original original input input string string was was (in (in this this case, case, aaaa). aaaa). a, R q rej, R

36 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a a a

37 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a a

38 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a a

39 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a a

40 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej a

41 A Simple Turing Machine q acc, R a, R q 0 q 1 a, R, R q rej

42 A Simple Turing Machine q acc, R a, R q 0 q 1 This This special special state state is is ai ai oejecotingisttite. oejecotingisttite. When When a a TM TM enters enters a a rejecting rejecting state, state, it it immediately immediately stops stops running running and and rejects rejects whatever whatever the the original original input input string string was was (in (in this this case, case, aaaaa). aaaaa). a, R q rej, R

43 A Simple Turing Machine q acc, R a, R q 0 q 1 This This special special state state is is ai ai oejecotingisttite. oejecotingisttite. When When a a TM TM enters enters a a rejecting rejecting state, state, it it immediately immediately stops stops running running and and rejects rejects whatever whatever the the original original input input string string was was (in (in this this case, case, aaaaa). aaaaa). a, R q rej, R

44 A Simple Turing Machine q acc, R a, R q 0 q 1 If If the the TM TM is is ed ed on on the the empty empty string string ε, ε, the the entire entire tape tape is is blank blank and and the the tape tape head head is is positioned positioned at at some some arbitrary arbitrary location location on on the the tape. tape. a, R q rej, R

45 A Simple Turing Machine q acc, R a, R q 0 q 1 If If the the TM TM is is ed ed on on the the empty empty string string ε, ε, the the entire entire tape tape is is blank blank and and the the tape tape head head is is positioned positioned at at some some arbitrary arbitrary location location on on the the tape. tape. a, R q rej, R

46 A Simple Turing Machine q acc, R a, R q 0 q 1 If If the the TM TM is is ed ed on on the the empty empty string string ε, ε, the the entire entire tape tape is is blank blank and and the the tape tape head head is is positioned positioned at at some some arbitrary arbitrary location location on on the the tape. tape. a, R q rej, R

47 The Turing Machine A Turing machine consists of three parts: A finite-sttiteiconntont that issues commands, an infiniteitipe for input and scratch space, and a tipeiheid that can read and write a single tape cell. At each step, the Turing machine writes a symbol to the tape cell under the tape head, changes state, and moves the tape head to the left or to the right.

48 Input and Tape Alphabets A Turing machine has two alphabets: An inputiitphibet Σ. All input strings are written in the input alphabet. A tipeiitphibet Γ, where Σ Γ. The tape alphabet contains all symbols that can be written onto the tape. The tape alphabet Γ can contain any number of symbols, but always contains at least one btinki stymbnt, denoted. You are guaranteed Σ. At up, the Turing machine begins with an infnite tape of symbols with the input written at some location. The tape head is positioned at the of the input.

49 Accepting and Rejecting States Unlike DFAs, Turing machines do not stop processing the input when they fnish reading it. Turing machines decide when (and if!) they will accept or reject their input. Turing machines can enter infnite loops and never accept or reject; more on that later...

50 Determinism Turing machines are deteoministtico: for every combination of a (non-accepting, non-rejecting) state q and a tape symbol a Γ, there must be exactly one transition defned for that combination of q and a. Any transitions that are missing implicitly go straight to a rejecting state. We ll use this later to simplify our designs. q acc, R a, R q 0 q 1 a, R, R q rej

51 Determinism Turing machines are deteoministtico: for every combination of a (non-accepting, non-rejecting) state q and a tape symbol a Γ, there must be exactly one transition defned for that combination of q and a. Any transitions that are missing implicitly go straight to a rejecting state. We ll use this later to simplify our designs. q acc, R a, R q 0 q 1 a, R This This machine machine is is exactly exactly the the same same as as the the previous previous one. one.

52 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej Run Run the the TM TM shown shown above above on on the the input input string string bba. bba. What What will will the the tape tape look look like like when when the the TM TM fnishes fnishes running? running? A. b b a B. a a b C. b b a D. a a b E. None of these, or two or more of these. Answer Answer at at PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to once once to to join, join, then then A, A, B, B, C, C, D, D, or or E. E.

53 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a

54 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a b a

55 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a a

56 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a b

57 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a b

58 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a b

59 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a b

60 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej If If M is is a a Turing Turing machine machine with with input input alphabet alphabet Σ, Σ, then then the the tinguigeinfim, tinguigeinfim, denoted denoted L(M), L(M), is is the the set set L(M) L(M) = { { w Σ* Σ* M accepts accepts w } }

61 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej If If M is is a a Turing Turing machine machine with with input input alphabet alphabet Σ, Σ, then then the the tinguigeinfim, tinguigeinfim, denoted denoted L(M), L(M), is is the the set set L(M) L(M) = { { w Σ* Σ* M accepts accepts w } } Let Let M be be the the above above TM, TM, and and assume assume its its input input alphabet alphabet is is {a, {a, b}. b}. What What is is L (( M)? M)? A. A. { w {a, {a, b}* b}* w ends ends in in a a } B. B. { w {a, {a, b}* b}* w ends ends in in b b } C. C. Ø D. D. None None of of these, these, or or two two or or more more of of these. these. Answer Answer at at PollEv.com/cs103 PollEv.com/cs103 or or text text CS103 CS103 to to once once to to join, join, then then A, A, B, B, C, C, or or D. D.

62 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej a a b

63 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b a b

64 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b b

65 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a

66 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a

67 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a

68 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a

69 q acc a b, R b a, R a a, L, L q 0 q 1 b b, L, L q rej b b a Although Although the the tape tape ends ends with with bba bba written written on on it, it, the the original original input input string string was was aab. aab. This This shows shows that that the the TM TM accepts accepts aab, aab, not not bba. bba. So So L ( M) ( M) = { { w {a, {a, b}* b}* w ends ends in in b b } }

70 Designing Turing Machines Despite their simplicity, Turing machines are very powerful computing devices. Today's lecture explores how to design Turing machines for various languages.

71 Designing Turing Machines Let Σ = {0, 1} and consider the language L = {0 n 1 n n N }. We know that L is context-free. How might we build a Turing machine for it?

72 L = {0 n 1 n n N }

73 A Recursive Approach The string ε is in L. The string 0w1 is in L if w is in L. Any string ing with 1 is not in L. Any string ending with 0 is not in L.

74 A Sketch of the TM

75 A Sketch of the TM

76 A Sketch of the TM

77 A Sketch of the TM

78 A Sketch of the TM

79 A Sketch of the TM

80 A Sketch of the TM

81 A Sketch of the TM

82 A Sketch of the TM

83 A Sketch of the TM

84 A Sketch of the TM

85 A Sketch of the TM

86 A Sketch of the TM

87 A Sketch of the TM

88 A Sketch of the TM 0 1 1

89 A Sketch of the TM 0 1 1

90 A Sketch of the TM 0 1 1

91 A Sketch of the TM 0 1 1

92 A Sketch of the TM 0 1 1

93 A Sketch of the TM 0 1

94 A Sketch of the TM 0 1

95 A Sketch of the TM 0 1

96 A Sketch of the TM 0 1

97 A Sketch of the TM 1

98 A Sketch of the TM 1

99 A Sketch of the TM 1

100 A Sketch of the TM

101 A Sketch of the TM

102

103

104

105 Check for

106 Check for 0 0, R

107 Check for 0 0, R

108 Check for 0 0, R Go to end

109 Check for 0 0, R Go to end 0 0, R 1 1, R

110 Check for 0 0, R Go to end 0 0, R 1 1, R

111 Check for 0 0, R Go to end 0 0, R 1 1, R

112 Check for 0 0, R Go to end 0 0, R 1 1, R

113 Check for 0 0, R Go to end 0 0, R 1 1, R

114 Check for 0 0, R Go to end 0 0, R 1 1, R

115 , L Check for 0 0, R Go to end 0 0, R 1 1, R

116 , L Check for 0 0, R Go to end 0 0, R 1 1, R

117 Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

118 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

119 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

120 Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

121 0 0, L 1 1, L Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

122 0 0, L 1 1, L Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

123 0 0, L 1 1, L Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

124 0 0, L 1 1, L Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

125 0 0, L 1 1, L Go to 1, L Clear a 1, L Check for 0 0, R Go to end 0 0, R 1 1, R

126 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R

127 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R

128 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1 1

129 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1 1

130 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1 1

131 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1 1

132 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1 1

133 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1

134 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1

135 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1

136 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 0 1

137 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 1

138 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 1

139 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R 1

140 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R

141 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R

142 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

143 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

144 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

145 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

146 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

147 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

148 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

149 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

150 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

151 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

152 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

153 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

154 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 1

155 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 1

156 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 1

157 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 1

158 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 1

159 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 1

160 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 1

161 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 1

162 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 1

163 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1

164 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1

165 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1

166 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1

167 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

168 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

169 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

170 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 0 1

171 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 0 1

172 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1

173 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1

174 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1

175 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1

176 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0

177 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0

178 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0

179 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

180 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

181 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

182 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

183 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

184 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

185 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 0

186 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 0 1 0

187 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

188 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

189 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

190 , R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

191 , R 0 0, R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

192 , R 0 0, R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

193 , R 0 0, R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc 1 0

194 , R 0 0, R 0 0, L 1 1, L Go to 1, L Clear a 1, R, L 1, R q acc rej Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

195 0 0, L 1 1, L Go to 1, L Clear a 1, R, L Check for 0 0, R Go to end 0 0, R 1 1, R, R q acc

196 Another TM Design We've designed a TM for {0 n1 n n N}. Consider this language over Σ = {0, 1}: L = { w Σ* w has the same number of 0s and 1s } This language is also not regular, but it is context-free. How might we design a TM for it?

197 A Caveat

198 A Caveat

199 A Caveat

200 A Caveat

201 A Caveat

202 A Caveat

203 A Caveat

204 A Caveat

205 A Caveat

206 A Caveat

207 A Caveat How do we know that this blank isn't one of of the infnitely many blanks after our input string?

208 A Caveat

209 A Caveat

210 A Caveat

211 A Caveat

212 A Caveat

213 A Caveat 1 1 0

214 A Caveat How do we know that this blank isn't one of of the infnitely many blanks after our input string?

215 A Caveat 1 1 0

216 A Caveat How do we know that this blank isn't one of of the infnitely many blanks after our input string?

217 One Solution

218 One Solution

219 One Solution

220 One Solution

221 One Solution

222 One Solution

223 One Solution

224 One Solution

225 One Solution

226 One Solution

227 One Solution

228 One Solution

229 One Solution

230 One Solution

231 One Solution

232 One Solution

233 One Solution

234 One Solution

235 One Solution

236 One Solution

237 One Solution

238 One Solution 1 1 0

239 One Solution 1 1 0

240 One Solution 1 1 0

241 One Solution 1 0

242 One Solution 1 0

243

244

245 Find 0/

246 Find 0/1 0, R

247 Find 0/1 0, R

248 Find 0/1 0, R Find

249 Find 0/1 0, R Find 1 0 0, R

250 Find 0/1 0, R Find 1 0 0, R

251 Find 0/1 0, R Find 1 1, L 0 0, R

252 Find 0/1 0, R Find 1 1, L 0 0, R

253 Find 0/1 Go home 0, R Find 1 1, L 0 0, R

254 Find 0/1 Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

255 Find 0/1 Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

256 Find 0/1 Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

257 Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

258 Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

259 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

260 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

261 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R

262 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

263 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

264 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

265 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

266 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

267 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

268 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

269 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

270 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

271 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

272 , R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

273 1, R, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

274 1, R, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0 0

275 1, R Find 0, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0 0

276 1 1, R, R 1, R Find 0, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0 0

277 1 1, R, R 1, R Find 0, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0 0

278 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0 0

279 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

280 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

281 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

282 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

283 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

284 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

285 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

286 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

287 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

288 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

289 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

290 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

291 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 1 0

292 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 0

293 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R 0

294 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

295 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

296 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

297 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

298 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

299 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

300 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

301 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

302 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

303 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

304 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

305 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

306 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

307 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

308 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

309 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

310 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L 0, R Find 1 1, L 0 0, R, R

311 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R

312 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R

313 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R

314 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R

315 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R Remember that all all missing transitions implicitly reject.

316 1 1, R, R 1, R Find 0 0, L, R Find 0/1, R Go Go home 0 0, L 1 1, L, L, R 0, R Find 1 1, L Accept! 0 0, R, R

317 Constant Storage Sometimes, a TM needs to remember some additional information that can't be put on the tape. In this case, you can use similar techniques from DFAs and introduce extra states into the TM's fnite-state control. The fnite-state control can only remember one of fnitely many things, but that might be all that you need!

318 Time-Out for Announcements!

319 Problem Set Seven Problem Set Seven is due this Friday at 2:30PM. As always, if you have questions, feel free to stop by ofice hours or ask on Piazza! Problem Set Eight will go out on Friday.

320 Back to CS103!

321 Another TM Design We just designed a TM for this language over Σ = {0, 1}: L = { w Σ* w has the same number of 0s and 1s } Let's do a quick review of how it worked.

322 A Leap of Faith

323 A Leap of Faith

324 A Leap of Faith

325 A Leap of Faith

326 A Leap of Faith

327 A Leap of Faith

328 A Leap of Faith

329 A Leap of Faith

330 A Leap of Faith

331 A Leap of Faith

332 A Leap of Faith How do we know that this blank isn't one of of the infnitely many blanks after our input string?

333 The Solution

334 The Solution

335 The Solution

336 The Solution

337 The Solution

338 The Solution

339 The Solution

340 The Solution

341 The Solution

342 The Solution

343 The Solution

344 The Solution

345 The Solution

346 The Solution

347 The Solution

348 The Solution

349 The Solution

350 The Solution

351 The Solution

352 A Diferent Idea

353 A Diferent Strategy

354 A Diferent Strategy Could we we sort sort the the characters of of this this string?

355 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

356 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

357 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

358 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

359 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

360 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

361 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

362 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

363 A Diferent Strategy Observation 1: 1: A string of of 0s 0s and and 1s 1s is is sorted if if it it matches the the regex 0 * * 11 * *.

364 A Diferent Strategy Observation 2: 2: A string of of 0s 0s and and 1s 1s is is not not sorted if if it it contains as as a substring.

365 A Diferent Strategy Observation 2: 2: A string of of 0s 0s and and 1s 1s is is not not sorted if if it it contains as as a substring.

366 A Diferent Strategy Observation 2: 2: A string of of 0s 0s and and 1s 1s is is not not sorted if if it it contains as as a substring.

367 A Diferent Strategy Observation 2: 2: A string of of 0s 0s and and 1s 1s is is not not sorted if if it it contains as as a substring.

368 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

369 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

370 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

371 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

372 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

373 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

374 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

375 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

376 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

377 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

378 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

379 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

380 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

381 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

382 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

383 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

384 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

385 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

386 A Diferent Strategy Idea: Repeatedly fnd fnd a copy of of and and replace it it with with

387 Let's Build It!

388

389

390 0*

391 0*

392 0 0, R 0*

393 0 0, R 0*

394 0 0, R 0*

395 0 0, R 0* 1 1, R

396 0 0, R 0* 1 1, R

397 1 1, R 0 0, R 0* 0*1*

398 1 1, R 0 0, R 0* 0*1* 1 1, R

399 1 1, R 0 0, R 0* 0*1* 1 1, R

400 1 1, R 0 0, R 0* 0*1* 1 1, R 0?,?

401 1 1, R 0 0, R 0* 0*1* 1 1, R Based on on what what we re trying to to do, do, what what should this this transition say? say? 0?,?

402 1 1, R 0 0, R 0* 0*1* 1 1, R 0?,?

403 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L

404 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L

405 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L Fix

406 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 1 0, L Fix

407 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 1 0, L Fix

408 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 1 0, L Fix

409 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L Go Home 1 0, L Fix

410 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

411 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

412 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

413 1 1, R 0 0, R 0* 0*1* 1 1, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

414 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

415 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

416 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

417 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

418 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

419 1 1, R 0 0, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

420 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

421 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

422 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

423 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

424 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

425 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

426 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

427 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

428 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

429 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

430 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

431 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

432 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

433 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

434 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

435 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

436 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

437 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

438 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

439 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

440 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

441 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

442 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

443 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

444 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

445 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

446 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

447 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

448 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

449 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

450 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

451 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

452 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

453 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

454 Our Our ultimate goal goal here here was was to to sort sort everything so so we we could hand it it of of to to the the machine to to check for for 0 n n 11 n n. Let's rewind the the tape head back back to to the the. 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

455 To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

456 To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

457 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

458 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

459 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

460 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

461 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

462 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

463 0 0, L 1 1, L To Start, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

464 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

465 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

466 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix 01

467 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 1 1, R 0 0, R 0* 0*1*, R 0 1, L This This is is just just a placeholder. Imagine snapping in in the the entire TM TM for for 0 n n 11 n n into into this this diagram, putting the the state in in the the dashed area. 1 1, R 0 0, L 1 1, L Go Home 1 0, L Fix 01

468 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

469 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

470 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

471 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

472 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

473 0 0, L 1 1, L To Start, R Start 0 n 1 n, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

474 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

475 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

476 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

477 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

478 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

479 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

480 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix

481 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix 01

482 0 0, L 1 1, L To Start, R Start 0 n 1 n, L, L 0 0, R 1 1, R 0* 0*1* 1 1, R, R 0 1, L 0 0, L 1 1, L Go Home 1 0, L Fix 01 This This TM TM will will sort sort any any sequence of of 0s 0s and and 1s, 1s, but but it it might take take a while. Fun Fun problem: design a TM TM that that sorts a string of of 0s 0s and and 1s, 1s, but but does so so while taking way way fewer steps than than this this machine.

483 TM Subroutines A TM subroutine is a Turing machine that, instead of accepting or rejecting an input, does some sort of processing job. TM subroutines let us compose larger TMs out of smaller TMs, just as you'd write a larger program using lots of smaller helper functions. Here, we saw a TM subroutine that sorts a sequence of 0s and 1s into ascending order.

484 TM Subroutines Typically, when a subroutine is done running, you have it enter a state marked done with a dashed line around it. When we're composing multiple subroutines together which we'll do in a bit the idea is that we'll snap in some real state for the done state.

485 What other subroutines can we make?

486 Next Time Arithmetic Subroutines What else can we do with TMs? The Church-Turing Thesis A scientifc hypothesis about computation. R and RE Languages What does it mean to solve a problem?

Turing Machines Part Two

Turing Machines Part Two Turing Machines Part Two Recap from Last Time Our First Turing Machine q acc a start q 0 q 1 a This This is is the the Turing Turing machine s machine s finiteisttiteiconntont. finiteisttiteiconntont.

More information

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture. Turing Machines Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing machine

More information

A Note on Turing Machine Design

A Note on Turing Machine Design CS103 Handout 17 Fall 2013 November 11, 2013 Problem Set 7 This problem explores Turing machines, nondeterministic computation, properties of the RE and R languages, and the limits of RE and R languages.

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II Hello Hello Condensed Slide Slide Readers! Readers! This This lecture lecture is is almost almost entirely entirely animations that that show show how how each each Turing Turing

More information

Turing Machines Part III

Turing Machines Part III Turing Machines Part III Announcements Problem Set 6 due now. Problem Set 7 out, due Monday, March 4. Play around with Turing machines, their powers, and their limits. Some problems require Wednesday's

More information

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM)? Proposed by Alan Turing in 936 finite-state control + infinitely long tape A

More information

Finite Automata Part One

Finite Automata Part One Finite Automata Part One Computability Theory What problems can we solve with a computer? What kind of computer? Computers are Messy http://en.wikipedia.org/wiki/file:eniac.jpg Computers are Messy That

More information

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM) Proposed by Alan Turing in 936 finite-state control + infinitely long tape A stronger

More information

Turing Machines Part II

Turing Machines Part II Turing Machines Part II Problem Set Set Five Five due due in in the the box box up up front front using using a late late day. day. Hello Hello Condensed Slide Slide Readers! Readers! This This lecture

More information

Turing Machines Part One

Turing Machines Part One Turing Mchines Prt One Wht problems cn we solve with computer? Regulr Lnguges CFLs Lnguges recognizble by ny fesible computing mchine All Lnguges Tht sme drwing, to scle. All Lnguges The Problem Finite

More information

CSCE 551: Chin-Tser Huang. University of South Carolina

CSCE 551: Chin-Tser Huang. University of South Carolina CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Church-Turing Thesis The definition of the algorithm came in the 1936 papers of Alonzo Church h and Alan

More information

Finite Automata Part Two

Finite Automata Part Two Finite Automata Part Two Recap from Last Time Old MacDonald Had a Symbol, Σ-eye-ε-ey, Oh! You may have noticed that we have several letter- E-ish symbols in CS103, which can get confusing! Here s a quick

More information

Most General computer?

Most General computer? Turing Machines Most General computer? DFAs are simple model of computation. Accept only the regular languages. Is there a kind of computer that can accept any language, or compute any function? Recall

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.   ETH Zürich (D-ITET) October, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) October, 19 2017 Part 5 out of 5 Last week was all about Context-Free Languages Context-Free

More information

Announcements. Using a 72-hour extension, due Monday at 11:30AM.

Announcements. Using a 72-hour extension, due Monday at 11:30AM. The Big Picture Announcements Problem Set 9 due right now. Using a 72-hour extension, due Monday at 11:30AM. On-time Problem Set 8's graded, should be returned at the end of lecture. Final exam review

More information

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement: Decidability 2017/10/31 Chapter 4.1 in Sipser Ø Announcement: q q q Slides for this lecture are here: http://www.public.asu.edu/~yzhan442/teaching/cse355/lectures/decidability.pdf Happy Hollaween! Delayed

More information

The Turing machine model of computation

The Turing machine model of computation The Turing machine model of computation For most of the remainder of the course we will study the Turing machine model of computation, named after Alan Turing (1912 1954) who proposed the model in 1936.

More information

Complexity Theory Part I

Complexity Theory Part I Complexity Theory Part I Outline for Today Recap from Last Time Reviewing Verifiers Nondeterministic Turing Machines What does nondeterminism mean in the context of TMs? And just how powerful are NTMs?

More information

Announcements. Final exam review session tomorrow in Gates 104 from 2:15PM 4:15PM Final Friday Four Square of the quarter!

Announcements. Final exam review session tomorrow in Gates 104 from 2:15PM 4:15PM Final Friday Four Square of the quarter! The Big Picture Problem Problem Set Set 99 due due in in the the box box up up front. front. Congrats Congrats on on finishing finishing the the last last problem problem set set of of the the quarter!

More information

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

More Turing Machines. CS154 Chris Pollett Mar 15, 2006. More Turing Machines CS154 Chris Pollett Mar 15, 2006. Outline Multitape Turing Machines Nondeterministic Turing Machines Enumerators Introduction There have been many different proposals for what it means

More information

Introduction to Turing Machines

Introduction to Turing Machines Introduction to Turing Machines Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 12 November 2015 Outline 1 Turing Machines 2 Formal definitions 3 Computability

More information

Turing Machine Variants

Turing Machine Variants CS311 Computational Structures Turing Machine Variants Lecture 12 Andrew Black Andrew Tolmach 1 The Church-Turing Thesis The problems that can be decided by an algorithm are exactly those that can be decided

More information

Turing Machines. Lecture 8

Turing Machines. Lecture 8 Turing Machines Lecture 8 1 Course Trajectory We will see algorithms, what can be done. But what cannot be done? 2 Computation Problem: To compute a function F that maps each input (a string) to an output

More information

Decidability and Undecidability

Decidability and Undecidability Decidability and Undecidability Major Ideas from Last Time Every TM can be converted into a string representation of itself. The encoding of M is denoted M. The universal Turing machine U TM accepts an

More information

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

More information

Decidable Languages - relationship with other classes.

Decidable Languages - relationship with other classes. CSE2001, Fall 2006 1 Last time we saw some examples of decidable languages (or, solvable problems). Today we will start by looking at the relationship between the decidable languages, and the regular and

More information

Computability Theory. CS215, Lecture 6,

Computability Theory. CS215, Lecture 6, Computability Theory CS215, Lecture 6, 2000 1 The Birth of Turing Machines At the end of the 19th century, Gottlob Frege conjectured that mathematics could be built from fundamental logic In 1900 David

More information

Chapter 7 Turing Machines

Chapter 7 Turing Machines Chapter 7 Turing Machines Copyright 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 A General Model of Computation Both finite automata and pushdown automata are

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Church s thesis The computable functions are the same as the partial recursive

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Today's learning goals Sipser Ch 3 Trace the computation of a Turing machine using its transition function and configurations.

More information

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

Computation Histories

Computation Histories 208 Computation Histories The computation history for a Turing machine on an input is simply the sequence of configurations that the machine goes through as it processes the input. An accepting computation

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 5 Reductions Undecidable problems from language theory Linear bounded automata given by Jiri Srba Lecture 5 Computability and Complexity 1/14 Reduction Informal Definition

More information

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand

More information

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG) CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG) Objectives Recall that decidable languages are languages that can be decided by TM (that means,

More information

Reducability. Sipser, pages

Reducability. Sipser, pages Reducability Sipser, pages 187-214 Reduction Reduction encodes (transforms) one problem as a second problem. A solution to the second, can be transformed into a solution to the first. We expect both transformations

More information

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY RYAN DOUGHERTY If we want to talk about a program running on a real computer, consider the following: when a program reads an instruction,

More information

Finite Automata Part One

Finite Automata Part One Finite Automata Part One Computability Theory What problems can we solve with a computer? What problems can we solve with a computer? What kind of computer? Computers are Messy http://www.intel.com/design/intarch/prodbref/27273.htm

More information

Finite Automata Part One

Finite Automata Part One Finite Automata Part One Computability Theory What problems can we solve with a computer? What kind of computer? Computers are Messy http://www.intel.com/design/intarch/prodbref/27273.htm We need a simpler

More information

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement: Mapping Reducibility 2017/11/16 Chapter 5.3 in Sipser Ø Announcement: q Slides for this lecture are here: http://www.public.asu.edu/~yzhan442/teaching/cse355/lectures/mapping.pdf 1 Last time Reducibility

More information

Exam Computability and Complexity

Exam Computability and Complexity Total number of points:... Number of extra sheets of paper:... Exam Computability and Complexity by Jiri Srba, January 2009 Student s full name CPR number Study number Before you start, fill in the three

More information

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018 CS 301 Lecture 17 Church Turing thesis Stephen Checkoway March 19, 2018 1 / 17 An abridged modern history of formalizing algorithms An algorithm is a finite, unambiguous sequence of steps for solving a

More information

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman Equivalence of TMs and Multitape TMs Theorem 3.13 and Corollary 3.15 By: Joseph Lauman Turing Machines First proposed by Alan Turing in 1936 Similar to finite automaton, but with an unlimited and unrestricted

More information

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Turing Machines Review An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Varieties of TMs Multi-Tape TMs Nondeterministic TMs String Enumerators

More information

Turing Machines, diagonalization, the halting problem, reducibility

Turing Machines, diagonalization, the halting problem, reducibility Notes on Computer Theory Last updated: September, 015 Turing Machines, diagonalization, the halting problem, reducibility 1 Turing Machines A Turing machine is a state machine, similar to the ones we have

More information

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) 1 Deterministic Turing Machine (DTM).. B B 0 1 1 0 0 B B.. Finite Control Two-way, infinite tape, broken into

More information

Nonregular Languages

Nonregular Languages Nonregular Languages Recap from Last Time Theorem: The following are all equivalent: L is a regular language. There is a DFA D such that L( D) = L. There is an NFA N such that L( N) = L. There is a regular

More information

Turing Machines (TM) The Turing machine is the ultimate model of computation.

Turing Machines (TM) The Turing machine is the ultimate model of computation. TURING MACHINES Turing Machines (TM) The Turing machine is the ultimate model of computation. Alan Turing (92 954), British mathematician/engineer and one of the most influential scientists of the last

More information

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory The Chinese University of Hong Kong Fall 2011 CSCI 3130: Formal languages and automata theory Turing Machines Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130 Turing Machines control head a

More information

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm).

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm). Finite Automata Announcements Problem Set Four due Thursday at 7:PM (right before the midterm). Stop by OH with questions! Email cs3@cs.stanford.edu with questions! Review session tonight, 7PM until whenever

More information

Turing Machines Part Three

Turing Machines Part Three Turing Machines Part Three What problems can we solve with a computer? What kind of computer? Very Important Terminology Let M be a Turing machine. M accepts a string w if it enters an accept state when

More information

Finite Automata Part One

Finite Automata Part One Finite Automata Part One Computability Theory What problems can we solve with a computer? What problems can we solve with a computer? What kind of computer? Computers are Messy http://www.intel.com/design/intarch/prodbref/27273.htm

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s Agenda Quick Review of CFG s and PDA s Introduction to Turing Machines and their Languages Reminders and

More information

ECS 120 Lesson 15 Turing Machines, Pt. 1

ECS 120 Lesson 15 Turing Machines, Pt. 1 ECS 120 Lesson 15 Turing Machines, Pt. 1 Oliver Kreylos Wednesday, May 2nd, 2001 Before we can start investigating the really interesting problems in theoretical computer science, we have to introduce

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 14 Last time Turing Machine Variants Church-Turing Thesis Today Universal TM Decidable languages Designing deciders Sofya Raskhodnikova 3/1/2016 Sofya Raskhodnikova;

More information

CS4026 Formal Models of Computation

CS4026 Formal Models of Computation CS4026 Formal Models of Computation Turing Machines Turing Machines Abstract but accurate model of computers Proposed by Alan Turing in 1936 There weren t computers back then! Turing s motivation: find

More information

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex SE 3310b Theoretical Foundations of Software Engineering Turing Machines Aleksander Essex 1 / 1 Turing Machines 2 / 1 Introduction We ve finally arrived at a complete model of computation: Turing machines.

More information

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite The Church-Turing Thesis CS60001: Foundations of Computing Science Professor, Dept. of Computer Sc. & Engg., Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q 0, q accept, q reject ), where

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

More information

Complexity Theory Part I

Complexity Theory Part I Complexity Theory Part I Problem Problem Set Set 77 due due right right now now using using a late late period period The Limits of Computability EQ TM EQ TM co-re R RE L D ADD L D HALT A TM HALT A TM

More information

1 Showing Recognizability

1 Showing Recognizability CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove

More information

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction) CS5371 Theory of Computation Lecture 14: Computability V (Prove by Reduction) Objectives This lecture shows more undecidable languages Our proof is not based on diagonalization Instead, we reduce the problem

More information

CSCE 551: Chin-Tser Huang. University of South Carolina

CSCE 551: Chin-Tser Huang. University of South Carolina CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Computation History A computation history of a TM M is a sequence of its configurations C 1, C 2,, C l such

More information

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CS154, Lecture 10: Rice s Theorem, Oracle Machines CS154, Lecture 10: Rice s Theorem, Oracle Machines Moral: Analyzing Programs is Really, Really Hard But can we more easily tell when some program analysis problem is undecidable? Problem 1 Undecidable

More information

Turing Machine Recap

Turing Machine Recap Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every

More information

CpSc 421 Homework 9 Solution

CpSc 421 Homework 9 Solution CpSc 421 Homework 9 Solution Attempt any three of the six problems below. The homework is graded on a scale of 100 points, even though you can attempt fewer or more points than that. Your recorded grade

More information

TURING MAHINES

TURING MAHINES 15-453 TURING MAHINES TURING MACHINE FINITE STATE q 10 CONTROL AI N P U T INFINITE TAPE read write move 0 0, R, R q accept, R q reject 0 0, R 0 0, R, L read write move 0 0, R, R q accept, R 0 0, R 0 0,

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

More information

Decidability (intro.)

Decidability (intro.) CHAPTER 4 Decidability Contents Decidable Languages decidable problems concerning regular languages decidable problems concerning context-free languages The Halting Problem The diagonalization method The

More information

Turing machines and linear bounded automata

Turing machines and linear bounded automata and linear bounded automata Informatics 2A: Lecture 29 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 27 November 2015 1 / 15 The Chomsky hierarchy: summary Level Language

More information

Decidable and undecidable languages

Decidable and undecidable languages The Chinese University of Hong Kong Fall 2011 CSCI 3130: Formal languages and automata theory Decidable and undecidable languages Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130 Problems about

More information

CpSc 421 Final Exam December 15, 2006

CpSc 421 Final Exam December 15, 2006 CpSc 421 Final Exam December 15, 2006 Do problem zero and six of problems 1 through 9. If you write down solutions for more that six problems, clearly indicate those that you want graded. Note that problems

More information

Undecidable Problems and Reducibility

Undecidable Problems and Reducibility University of Georgia Fall 2014 Reducibility We show a problem decidable/undecidable by reducing it to another problem. One type of reduction: mapping reduction. Definition Let A, B be languages over Σ.

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Handicapped machines DFA limitations Tape head moves only one direction 2-way DFA

More information

CS 21 Decidability and Tractability Winter Solution Set 3

CS 21 Decidability and Tractability Winter Solution Set 3 CS 21 Decidability and Tractability Winter 2018 Posted: January 31 Solution Set 3 If you have not yet turned in the Problem Set, you should not consult these solutions. 1. (a) A 2-NPDA is a 7-tuple (Q,,

More information

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm Testing Emptiness of a CFL As for regular languages, we really take a representation of some language and ask whether it represents φ Can use either CFG or PDA Our choice, since there are algorithms to

More information

Chapter 3: The Church-Turing Thesis

Chapter 3: The Church-Turing Thesis Chapter 3: The Church-Turing Thesis 1 Turing Machine (TM) Control... Bi-direction Read/Write Turing machine is a much more powerful model, proposed by Alan Turing in 1936. 2 Church/Turing Thesis Anything

More information

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages COMP/MATH 300 Topics for Spring 2017 June 5, 2017 Review and Regular Languages Exam I I. Introductory and review information from Chapter 0 II. Problems and Languages A. Computable problems can be expressed

More information

ACS2: Decidability Decidability

ACS2: Decidability Decidability Decidability Bernhard Nebel and Christian Becker-Asano 1 Overview An investigation into the solvable/decidable Decidable languages The halting problem (undecidable) 2 Decidable problems? Acceptance problem

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 4.1 Explain what it means for a problem to be decidable. Justify the use

More information

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 CS 373: Theory of Computation Sariel Har-Peled and Madhusudan Parthasarathy Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 This lecture covers Rice s theorem, as well as

More information

Recap from Last Time

Recap from Last Time Regular Expressions Recap from Last Time Regular Languages A language L is a regular language if there is a DFA D such that L( D) = L. Theorem: The following are equivalent: L is a regular language. There

More information

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand

More information

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Turing Machines Review An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Varieties of TMs Multi-Tape TMs Nondeterministic TMs String Enumerators

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 5.1, 5.3 Define and explain core examples of computational problems, including

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Languages Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable Languages We

More information

1 Unrestricted Computation

1 Unrestricted Computation 1 Unrestricted Computation General Computing Machines Machines so far: DFAs, NFAs, PDAs Limitations on how much memory they can use: fixed amount of memory plus (for PDAs) a stack Limitations on what they

More information

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK COMS11700 Turing machines Department of Computer Science, University of Bristol Bristol, UK 21 March 2014 COMS11700: Turing machines Slide 1/15 Introduction We have seen two models of computation: finite

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 15 Ana Bove May 17th 2018 Recap: Context-free Languages Chomsky hierarchy: Regular languages are also context-free; Pumping lemma

More information

Non-emptiness Testing for TMs

Non-emptiness Testing for TMs 180 5. Reducibility The proof of unsolvability of the halting problem is an example of a reduction: a way of converting problem A to problem B in such a way that a solution to problem B can be used to

More information

CS 361 Meeting 26 11/10/17

CS 361 Meeting 26 11/10/17 CS 361 Meeting 26 11/10/17 1. Homework 8 due Announcements A Recognizable, but Undecidable Language 1. Last class, I presented a brief, somewhat inscrutable proof that the language A BT M = { M w M is

More information

Theory of Computation

Theory of Computation Theory of Computation Lecture #2 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 1 Lecture 2: Overview Recall some basic definitions from Automata Theory.

More information

Introduction to Languages and Computation

Introduction to Languages and Computation Introduction to Languages and Computation George Voutsadakis 1 1 Mathematics and Computer Science Lake Superior State University LSSU Math 400 George Voutsadakis (LSSU) Languages and Computation July 2014

More information

Turing machines and linear bounded automata

Turing machines and linear bounded automata and linear bounded automata Informatics 2A: Lecture 30 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 25 November 2016 1 / 17 The Chomsky hierarchy: summary Level Language

More information

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess!

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess! The Big Picture Announcements Problem Set 9 due right now. We'll release solutions right after lecture. Congratulations you're done with CS103 problem sets! Practice final exam is Monday, December 8 from

More information

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable SD & Turing Lecture 33: Reductions and Undecidability CSCI 81 Spring, 2012 Kim Bruce Theorem: A language is SD iff it is Turing enumerable. Proof: Spose L is Turing enumerable. Show L is SD. Let w be input.

More information