CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Section 3.1, 3.2, and 3.3
https://web.cs.ucdavis.edu/~gusfield/
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Convert the following grammar into a PDA
A→0A1∣B
B→1B∣ϵ
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Convert the following grammar into a PDA
A→0A1∣B
B→1B∣ϵ
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Show that if L1∪L2 is not context-free, then either L1 is not context-free or L2 is not context free.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Show that if L1∪L2 is not context-free, then either L1 is not context-free or L2 is not context free.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
We know that L2={w∣w=anbncn∨∣w∣ is even} is not context free.
Show that L3={anbncn∣n≥0} is not context-free without using the Pumping Lemma for CF or the Theorem of non-CF from Lecture 11.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
We know that L2={w∣w=anbncn∨∣w∣ is even} is not context free.
Show that L3={anbncn∣n≥0} is not context-free without using the Pumping Lemma for CF or the Theorem of non-CF from Lecture 11.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
We know that L2={w∣w=anbncn∨∣w∣ is even} is not context free.
Show that L3={anbncn∣n≥0} is not context-free without using the Pumping Lemma for CF or the Theorem of non-CF from Lecture 11.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
We know that L2={w∣w=anbncn∨∣w∣ is even} is not context free.
Show that L3={anbncn∣n≥0} is not context-free without using the Pumping Lemma for CF or the Theorem of non-CF from Lecture 11.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
We know that L2={w∣w=anbncn∨∣w∣ is even} is not context free.
Show that L3={anbncn∣n≥0} is not context-free without using the Pumping Lemma for CF or the Theorem of non-CF from Lecture 11.
Proof.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
A Turing machine is a 7-tuple (Q,Σ,Γ,δ,q0,qaccept,qreject)
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
A configuration is a snapshot of a computation. That is, it contains all information necessary to resume (or replay) a computation from any point in time.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
State | Tape |
---|---|
S | 0011 |
B | X011 |
B | X011 |
C | X0Y1 |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
State | Tape |
---|---|
S | 0011 |
B | X011 |
B | X011 |
C | X0Y1 |
State | Tape |
---|---|
C | X0Y1 |
S | X0Y1 |
B | XXY1 |
B | XXY1 |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
State | Tape |
---|---|
S | 0011 |
B | X011 |
B | X011 |
C | X0Y1 |
State | Tape |
---|---|
C | X0Y1 |
S | X0Y1 |
B | XXY1 |
B | XXY1 |
State | Tape |
---|---|
C | XXYY |
C | XXYY |
S | XXYY |
D | XXYY |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
State | Tape |
---|---|
S | 0011 |
B | X011 |
B | X011 |
C | X0Y1 |
State | Tape |
---|---|
C | X0Y1 |
S | X0Y1 |
B | XXY1 |
B | XXY1 |
State | Tape |
---|---|
C | XXYY |
C | XXYY |
S | XXYY |
D | XXYY |
State | Tape |
---|---|
D | XXYY␣ |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
State | Tape | Configuration |
---|---|---|
S | 0 1110 |
S 01110 |
B | x 1 110 |
x B 1110 |
B | xy 1 10 |
xy B 110 |
B | xyy 1 0 |
xyy B 10 |
B | xyyy 0 |
xyyy B 0 |
B | xyyyx_ |
xyyyx B |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
The configuration history (sequence of configurations), describes all configurations from the initial state until a current state.
We say that C1 yields C2
Configuration history |
---|
S 01110 |
x B 1110 |
xy B 110 |
xyy B 10 |
xyyy B 0 |
xyyyx B |
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
accept
state.reject
state.accept
or reject
statesaccept
or reject
stateCS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Give a Turing Machine that recognizes words of an even length.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
What language does this TM recognize? (online)
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Section 3.3
†: Devise an algorithm that tests whether a polynomial has an integral root.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Any algorithm can be represented by an equivalent Turing machine
A problem is computable if, and only if, there exists a Turing Machine that recognizes it.
Turing Machines are equivalent to λ-terms
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
A Turing Machine that is capable of simulating any other Turing Machine
Note that the Universal TM is a regular TM. This computability model is expressive enough to simulate itself.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
TM are used to reflect on the limits and potentials of general-purpose computers by engineers, mathematicians and logicians (Module 3)
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
turingmachine.io
, the tape actually grows both waysCS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
(⇐) Multitape Turing Machines trivially recognize the same language as Turing Machine
(let the number of tapes be 1)
(⇒) How can a single tape encode multitape?
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
To move the i-th head, read the tape from the beginning until you read ♯ a total of i times and then seek until you find the marked character
If the virtual head i hits the end of the tape ♯,
then shift the rest of the tape to the right and insert a blank character ␣
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
A machine can follow more than one transitions for the same input:
δ:Q×Γ→P(Q×Γ×{L,R})Deterministic can only have one outgoing edge per character read, a nondeterministic machine can have multiple edges
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
In a deterministic TM, a configuration history is linear
abc q1 aac -> abcx q2 ac -> abcxa q2 c -> abcx q2 ay
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
In a nondeterministic TM, a configuration history is a tree!
https://youtu.be/eMchSJaJJVU?t=340
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Accept: when any branch reaches qstart
Reject: when all branches reach qreject
To find a single acceptance state we need to search the computation tree
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Simulate all branches of the computation; search for any node with an accept state.
Question: If we are searching a search tree, and there may exist infinite branches (due to loops), how should we search the tree: DFS or BFS?
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Simulate all branches of the computation; search for any node with an accept state.
Question: If we are searching a search tree, and there may exist infinite branches (due to loops), how should we search the tree: DFS or BFS?
Bread-First Search will ensure our search is not caught in a never-ending branch.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
https://youtu.be/eMchSJaJJVU?t=897
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
†: Recall that the alphabet must always be a finite set, if the number of choices was unbounded, then we would not be able to encode as a value being stored in the tape.
CS420 ☽ Turing Machines ☽ Lecture 19 ☽ Tiago Cogumbreiro
Section 3.1, 3.2, and 3.3
https://web.cs.ucdavis.edu/~gusfield/
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |