Turing Machine
Turing Machine
Announcements
High-level specifications
R and RE languages.
Encodings.
Universal machines.
High-Level Descriptions
High-Level Descriptions
Example:
M = On input x:
Repeat the following:
If |x| 1, accept.
If the first and last symbols of x aren't
the same, reject.
Remove the first and last characters of x.
High-Level Descriptions
Example:
M = On input x:
Construct y, the reverse of x.
If x = y, accept.
Otherwise, reject.
High-Level Descriptions
Example:
M = On input x:
If x is a palindrome, accept.
Otherwise, reject.
High-Level Descriptions
Example:
M = On input x:
Check that x has the form 0n1m2p.
If not, reject.
If nm = p, accept.
Otherwise, reject.
High-Level Descriptions
Example:
M = On input x:
Check that x has the form p?t,
where p, t {0, 1}*.
If not, reject.
If so, if p is a substring of t, accept.
Otherwise, reject.
Formatted Input
Formatted Input
What's Allowed?
R and RE Languages
Accept
Loop
Reject
halts
Recall: Language of a TM
Why Recognizable?
Deciders
Reject
Decidable Languages
Run M on w.
Although it make take a staggeringly long time, M
will eventually accept or reject w.
Why R Matters
R RE
Thus R RE.
Is R = RE?
Encodings
An Interesting Observation
A Better Encoding
X2
0 1 0
1 0
0 0 1 1 0 0 0 1 1 0
X1, X2
Universal Machines
> 0 1 x 0 0 A 0 <
...
> 0 :
M o v e
l e f t . 1 :
G o
...
Letter
Recognizer
for L1
for L2
M2
M1
M' = On input w:
Run M1 on w.
If M1 accepts:
Run M2 on w.
If M2 accepts w, accept.
Same
Same
If M2 rejects w, reject.
here.
here.
If M1 rejects w, reject.
If
If MM1 1 loops
loops on
on w,
w, we
we will
will
never
never get
get past
past this
this line.
line.
When
When running
running aa TM
TM as
as aa
subroutine,
subroutine, make
make sure
sure you
you
remember
remember to
to account
account for
for
this!
this!
Decider
for L
M
M' = On input w:
Run M on w.
If M accepts w, reject.
If M rejects w, accept.
Will
Will this
this work
work if
if MM isis
aa recognizer,
recognizer, rather
rather
than
than aa decider?
decider?
An Important Result
0 1 2 x
Simulate M
A B x 1
Simulate M
M'
M' is
is aa
decider!
decider!
Nondeterminisic TMs
Nondeterministic Algorithms
Deterministically check if qr = n.
If so, accept.
Otherwise, reject
Applications of NTMs
Equivalently:
Given a TM M, is (M)?
As a language question:
LNE = {M | M is a TM and (M) }
0, R
1, R
start
, R
0, R
1, R
start
, R
0, R
1, R
start
, R
0, R
1, R
start
, R
0, R
1, R
start
, R
0, R
1, R
start
, R
Proofs on NTMs
Turing-Recognizable
Languages
Instantaneous Descriptions
An ID for WB Programs
Simulated tape of the program being executed.
> 0 1 1 0 0 0 0 <
...
> 0 :
M o v e
> 0 1 1
l e f t . 1 :
G o
...
0 0 0 0 < 1
This
This means
means the
the tape
tape head
head
isis under
under the
the next
next symbol.
symbol.
We
We write
write the
the line
line
number
number at
at the
the end
end
of
of the
the ID.
ID.
Manipulating IDs
Simulating an NTM
Reject.
> 0 1 0 0 0 1 0 <
...
> 0 :
M o v e
l e f t . 1 :
G o
...
Stored IDs
...
Letter
Next Time
Unsolvable Problems