Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine...
Transcript of Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine...
![Page 1: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/1.jpg)
Automata TheoryCS411-2015F-11
Turing Machines
David Galles
Department of Computer Science
University of San Francisco
![Page 2: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/2.jpg)
11-0: Turing Machines
Machines so far (DFA, PDA) read input only once
Next: Turing Machines
Can back up over the input
Can overwrite the input
![Page 3: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/3.jpg)
11-1: Turing Machines
Input string is written on a tape:
a b b c b a ...Read/write head
input string infinite blank tape
Start of tape symbol
At each step, machine reads a symbol, and theneither
Writes a new symbol
Moves read/write head to right
Moves read/write head to left
![Page 4: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/4.jpg)
11-2: Turing Machines
A Turing Machine M = (K,Σ, δ, s,H)
K is a set of states
Σ is the tape alphabet
s ∈ K is the start state
H ⊂ K are “Halting states” – y for accept, andn for reject
δ : (K −H)× Σ 7→ K × (Σ ∪ {←,→})
![Page 5: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/5.jpg)
11-3: Turing Machines
TM for L = {0n1n : n > 0}
Idea:
Mark off first 0, go to end of string and mark offlast one (ensuring that the string starts with 0and ends with 1
Repeat until all characters have been morkedoff
Make sure # of 0s match the # if 1s.
![Page 6: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/6.jpg)
11-4: Turing Machines
TM for L = {0n1n : n > 0}
0 1 ⊔ X Z
q0 (q1, X) (n, 1) (n,⊔) (n,X) (y, Z)
q1 (q1,→) (q1,→) (q2,←) (q1,→) (q2,←)
q2 (n, 0) (q3, Z) (n,⊔) (n,X) (n,Z)
q3 (q3,←) (q3,←) (n,⊔) (q0,→) (q3,←)
![Page 7: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/7.jpg)
11-5: Turing Machines
TM for L = {0n1n : n > 0}
0 1 ⊔ X Z
q0 (q1, X) no no no yes
q1 (q1,→) (q1,→) (q2,←) (q1,→) (q2,←)
q2 no (q3, Z) no no no
q3 (q3,←) (q3,←) no (q0,→) (q3,←)
![Page 8: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/8.jpg)
11-6: Turing Machines
TM for L = {0n1n2n : n > 0}
![Page 9: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/9.jpg)
11-7: Turing Machines
TM for L = {0n1n2n : n > 0}
0 1 2 ⊔ X Y Z
q0 (q1, X) no no no no (q4,→) no
q1 (q1,→) (q2, Y ) no no (q1,→) (q1,→) no
q2 no (q2,→) (q3, Z) no no (q2,→) (q2,→)
q3 (q3,←) (q3,←) (q3,←) no (q0,→) (q3,←) (q3,←)
q4 no no no yes (q4,→) (q4,→) (q4,→)
![Page 10: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/10.jpg)
11-8: Turing Machines
TM for L = {wwR : w ∈ {a, b}∗}
![Page 11: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/11.jpg)
11-9: Turing Machines
TM for L = {wwR : w ∈ {a, b}∗}
a b ⊔ X Z
q0 (q1, X) (q4, X) yes no yes
q1 (q1,→) (q1,→) (q2,←) (q1,→) (q2,←)
q2 (q3, Z) no no no no
q3 (q3,←) (q3,←) no (q0,→) (q3,←)
q4 (q4,→) (q4,→) (q5,←) (q4,→) (q5,←)
q2 no (q3, Z) no no no
![Page 12: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/12.jpg)
11-10: Turing Machine Diagrams
“Table Notation” for Turing Machines can bedifficult to read
Define small machines, use them to build largermachines
Not changing the definition of a TM, just using amore convenient notation
![Page 13: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/13.jpg)
11-11: Turing Machine Diagrams
Writing machines: Ma = (K,Σ, δ, s,H)
K = {s, h}
s = s
H = {h}
δ = {((s, b), (h, a)) : ∀b ∈ Σ
Writes an ’a’ on the tape, and then halts.
![Page 14: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/14.jpg)
11-12: Turing Machine Diagrams
Moving Machines: M← = (K,Σ, δ, s,H)
K = {s, h}
s = s
H = {h}
δ = {((s, b), (h,←)) : ∀b ∈ Σ
Moves the head to the left, and then halts.
![Page 15: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/15.jpg)
11-13: Turing Machine Diagrams
Connecting Diagrams:
M
M
M
1
2
3
a
b
Run M1 until it halts, and then examine the symbolunder the read/write head
If the symbol is an ’a’, execute M2 until it halts
If the symbol is a ’b’, execute M3 until it halts
![Page 16: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/16.jpg)
11-14: Turing Machine Diagrams
Connecting Diagrams:
M M1 2
a,b,c
M M1 2M M1 2
Σ=
![Page 17: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/17.jpg)
11-15: Turing Machine Diagrams
Shorthand:
Ma = a
M← = L
M→ = R
R→ R→ a→= RRa = R2a
R Rx == = R
R Rx == = R
![Page 18: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/18.jpg)
11-16: Turing Machine Diagrams
Shift-right machine
Convert ⊲⊔w to ⊲ ⊔ ⊔w
![Page 19: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/19.jpg)
11-17: Turing Machine Diagrams
Shift-right machine
Convert ⊲⊔w to ⊲ ⊔ ⊔w
R Lx =
x =
RxLL
x =
R
![Page 20: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/20.jpg)
11-18: Turing Machine Diagrams
Copy machine
Convert ⊲⊔w to ⊲⊔w ⊔ w
![Page 21: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/21.jpg)
11-19: Turing Machine Diagrams
Copy machine
Convert ⊲⊔w to ⊲⊔w ⊔ w
Rx =
R R xL L x
L
![Page 22: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/22.jpg)
11-20: Turing Machine Diagrams
Shift-left machine
Convert ⊔w to w⊔
![Page 23: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/23.jpg)
11-21: Turing Machine Diagrams
Shift-left machine
Convert ⊔w to w⊔
Rx =
x =
LxRR
x =
L
x =
![Page 24: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/24.jpg)
11-22: Turing Machine Diagrams
Copy machine (part II)
Convert ⊲⊔w to ⊲⊔ww
(Using other machines .... )
![Page 25: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/25.jpg)
11-23: Turing Machine Diagrams
Copy machine (part II)
Convert ⊲⊔w to ⊲⊔ww
COPYM R
LEFT-SHIFTM L
![Page 26: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/26.jpg)
11-24: Turing Machine Diagrams
Successor
Convert ⊲⊔w (where w is the binaryrepresentation of an integer) to ⊲⊔v (where v is
the binary representation of (w + 1)⊲⊔11011⇒ ⊲⊔11100⊲⊔1111⇒ ⊲⊔10000
![Page 27: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/27.jpg)
11-25: Turing Machine Diagrams
Successor
Convert ⊲⊔w (where w is the binaryrepresentation of an integer) to ⊲⊔v (where v is
the binary representation of (w + 1)
R L
1
0
R1R 0L
0
1
L
![Page 28: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/28.jpg)
11-26: Turing Machine Diagrams
Predecessor
Convert ⊲⊔w (where w is the binaryrepresentation of an integer) to ⊲⊔v (where v is
the binary representation of (w − 1)⊲⊔11100⇒ ⊲⊔11011⊲⊔1111⇒ ⊲⊔10000
![Page 29: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/29.jpg)
11-27: Turing Machine Diagrams
Predecessor
Convert ⊲⊔w (where w is the binaryrepresentation of an integer) to ⊲⊔v (where v is
the binary representation of (w − 1)
R L
0
1
RL
1
0
L
(if subtract 1 from 0)
![Page 30: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/30.jpg)
11-28: Turing Machine Diagrams
Add
Convert ⊲⊔w; v to ⊲⊔w + v
(first, convert to ⊲⊔0 . . . 0;w + v)
![Page 31: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/31.jpg)
11-29: Turing Machine Diagrams
Add
Convert ⊲⊔w; v to ⊲⊔w + v
(first, convert to ⊲⊔0 . . . 0;w + v)
M MPRED
Result >= 0
Result < 0
SUCCR ; L
RL
(note – need to change MSUCC so that it expects a ;instead of a ⊔ at the beginning of the string)
![Page 32: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/32.jpg)
11-30: Turing Machine Diagrams
Add
Convert ⊲⊔w; v to ⊲⊔w + v
(first, convert to ⊲⊔0 . . . 0;w + v)
R L
1
0
R1R 0L
0
1
L
R L
0
1
RL
1
0
L
(end computation)
; ;
![Page 33: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/33.jpg)
11-31: Turing Machine Diagrams
Covert ⊲⊔0 . . . 0;w to ⊲⊔w, where w ∈ {0, 1}
![Page 34: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/34.jpg)
11-32: Turing Machine Diagrams
Covert ⊲⊔0 . . . 0;w to ⊲⊔w, where w ∈ {0, 1}
R0
;
;
Rx = ;L RxR ;
L(end computation)
;
![Page 35: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/35.jpg)
11-33: Turing Machine Diagrams
Add: Convert ⊲⊔w; v to ⊲⊔w + v
R L
1
0
R1R 0L
0
1
L
R L
0
1
1
0
L
; ;
R0
;
;
Rx = ;L RxR ;
L(end computation)
;
![Page 36: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/36.jpg)
11-34: Turing Machine Diagrams
We can add “yes” and “no” machines to ourdiagrams for machines that accept and rejectstrings
Diagram for a Turing Machine that accepts the
language L = {02n : n ≥ 0}
![Page 37: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/37.jpg)
11-35: Turing Machine Diagrams
We can add “yes” and “no” machines to ourdiagrams for machines that accept and rejectstrings
Diagram for a Turing Machine that accepts the
language L = {02n : n ≥ 0}
R0
R
0
noyes
0
,0
![Page 38: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/38.jpg)
11-36: Turing Machine Diagrams
Diagram for a Turing Machine that accepts the
language L = {a2n
: n ≥ 0}
![Page 39: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/39.jpg)
11-37: Turing Machine Diagrams
Diagram for a Turing Machine that accepts the
language L = {a2n
: n ≥ 0}
First: Write a TM that doubles a string of A’s
(converts w = An to w′ = A2n
(Can use other tape symbols if desired)
![Page 40: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/40.jpg)
11-38: Turing Machine Diagrams
Write a TM that doubles a string of A’s (converts
w = An to W = A2n
R
A
R L AL
A
C R BLC
R
B
B.Cdone
L
![Page 41: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/41.jpg)
11-39: Turing Machine Diagrams
Given a machine that converts w = An tow′ = A2n, how can we accept the language
L = {a2n
: n ≥ 0}?
![Page 42: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/42.jpg)
11-40: Turing Machine Diagrams
Given a machine that converts w = An tow′ = A2n, how can we accept the language
L = {a2n
: n ≥ 0}?
Check if the string is a. If so, accept.
Otherwise, overwrite the first a with an A.
Repeat:Doulble the # of A’s – if a ⊔ is overwritten inthis process, halt and rejectAfter doubling, check to see if the nextsymbol is a ⊔. If so, halt and accept
![Page 43: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/43.jpg)
11-41: Turing Machine Diagrams
Diagram for a Turing Machine that accepts the
language L = {a2n
: n ≥ 0}
Ra
A R
yes
a
LA
C R
A,B
no
a
BLC
R
A
R ,a yes
L AL
a
B
B,C
R
![Page 44: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/44.jpg)
11-42: Non-Halting TMs
It is possible to create a Turing Machine that doesnot halt
R
It is possible to create a Turing Machine that onlyhalts on some inputs
Ra yes
![Page 45: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/45.jpg)
11-43: Deciding TM
A Turing Machine M Decides a language L if:
M halts on all inputs
M accepts all strings w ∈ L
M rejects all strings w 6∈ L
We’ve already seen an example of Turing
machines that decide languages (a2n, a2n
)
![Page 46: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/46.jpg)
11-44: Semi-Deciding TM
A Turing Machine M Semi-Decides a language Lif:
M halts on all strings w ∈ L
M accepts all strings w ∈ L
M runs forever on all strings w 6∈ L
TM that semi-decides L = all strings over {a, b} thatcontain the substring aa
![Page 47: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/47.jpg)
11-45: Semi-Deciding TM
A Turing Machine M Semi-Decides a language Lif:
M halts on all strings w ∈ L
M accepts all strings w ∈ L
M runs forever on all strings w 6∈ L
TM that semi-decides L = all strings over {a, b} thatcontain the substring aa
Ra
yes
Ra
a
![Page 48: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/48.jpg)
11-46: Recursive Languages
The Recursive Languages is the set of alllanguages that are decided by some TuringMachine
LREC = {L : ∃ Turing machine M , M decides
L}
Is LREC closed under complementation?
That is, if L ∈ LREC , must L ∈ LREC?
![Page 49: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/49.jpg)
11-47: Recursive Languages
The Recursive Languages is the set of alllanguages that are decided by some TuringMachine
LREC = {L : ∃ Turing machine M , M decides
L}
LREC is closed under complementation?
L ∈ LREC =⇒ L ∈ LREC (flip yes/no states)
![Page 50: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/50.jpg)
11-48: r.e. Languages
The Recursively Enumerable (r.e.) Languages isthe set of all languages that are semi-decided bysome Turing Machine
Lre = {L : ∃ Turing machine M , M
semi-decides L}
Is LREC ⊆ Lre?
![Page 51: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/51.jpg)
11-49: r.e. Languages
The Recursively Enumerable (r.e.) Languages isthe set of all languages that are semi-decided bysome Turing Machine
Lre = {L : ∃ Turing machine M , M
semi-decides L}
Is LREC ⊆ Lre
Replace “no” states with non-halting machine
![Page 52: Automata Theory - USF Computer Sciencegalles/cs411/lecture/lecture11.pdf · 11-40: Turing Machine Diagrams Given a machine that converts w = An to w′= A2n, how can we accept the](https://reader034.fdocuments.us/reader034/viewer/2022042310/5ed7ebca17e4482306586dc4/html5/thumbnails/52.jpg)
11-50: r.e. Languages
The Recursively Enumerable (r.e.) Languages isthe set of all languages that are semi-decided bysome Turing Machine
Lre = {L : ∃ Turing machine M , M
semi-decides L}
Is Lre 6⊆ LREC
More on this later ...