Transcript powerpoint
Linear Bounded Automata
LBAs
1
Linear Bounded Automata
are like Turing Machines
with a restriction:
The working space of the tape
is the space of the input string
2
Input string
[ a b c d e ]
Left-end
marker
Working space
of tape
Right-end
marker
All computation is done between end markers
3
We define LBA’s to be NonDeterministic
Open Problem:
NonDeterministic LBA’s
have same power with
Deterministic LBA’s ?
4
Example languages accepted by LBAs:
n n n
L {a b c }
n!
L {a }
LBA’s have more power than NPDA’s
5
Later in class we will prove:
LBA’s have less power
than Turing Machines
6
A Universal Turing Machine
7
Limitation of Turing Machines:
Turing Machines are “hardwired”
They execute
only one program
Real Computers are reprogrammable
8
Solution:
Universal Turing Machine
• is a reprogrammable machine
• simulates any other Turing Machine
9
Universal Turing machine
simulates any Turing machine
M
Input of Universal Machine:
Description of transitions of M
Initial tape contents of
M
10
Description of M
Universal
Turing
Machine
Tape Contents of M
State of M
11
Alphabet Encoding
Symbols:
a
b
c
d
Encoding:
1
11
111
1111
12
State Encoding
States:
q1
q2
q3
q4
Encoding:
1
11
111
1111
Head Move Encoding
Move:
L
R
Encoding:
1
11
13
Transition Encoding
Transition:
Encoding:
(q1, a) (q2 , b, L)
1 0 1 0 11 0 11 0 1
separator
14
Machine Encoding
Transitions:
(q1, a) (q2 , b, L)
(q2 , b) (q3 , c, R)
Encoding:
1 0 1 0 11 0 11 0 1 00 11 0 110 111 0 111 0 11
separator
15
Input of Universal Turing Machine:
encoding of the simulated machine M
16
A Turing Machine is described
with a string of 0’s and 1’s
The set of Turing machines form a language:
each string of the language is
the encoding of a Turing Machine
17
Countable Sets
18
Infinite sets are either:
• Countable
• Uncountable
19
Countable set:
There is a one to one correspondence
between
elements of the set
and
positive integers
20
Example:
The set of even integers
is countable
Even integers:
0, 2, 4, 6,
Correspondence:
Positive integers:
2n
1, 2, 3, 4,
corresponds to
n 1
21
Example:
The set of rational numbers
is countable
Rational numbers:
1 3 7
, , ,
2 4 8
22
Naive Approach
Rational numbers:
1 1 1
, , ,
1 2 3
Correspondence:
Positive integers:
1, 2, 3,
Doesn’t work:
we will never count numbers with nominator 2
2 2 2
, , ,
1 2 3
23
Better Approach
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
24
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
25
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
26
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
27
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
28
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
4
1
1
4
29
Rational Numbers:
1 1 2 1 2
, , , , ,
1 2 1 3 2
Correspondence:
Positive Integers:
1, 2, 3, 4, 5,
30
We proved:
the set of rational numbers is countable
by giving
an enumeration procedure
31
Definition
Let S be a set of strings
An enumeration procedure for S is a
Turing Machine that generates
any string of S in finite number of steps
32
strings
s1, s2 , s3 , S
Enumeration
Machine for S
output
s1, s2 , s3 ,
Finite time: t1, t2 , t3 ,
33
Enumeration Machine
Time 0
Configuration
q0
Time t1
x1 # s1
qs
34
Time t2
x2 # s2
qs
Time t3
x3 # s3
qs
35
A set is countable if there is an
enumeration procedure for it
36
Example:
The set of all strings {a, b, c}
is countable
We will describe the enumeration procedure
37
Naive procedure:
Produce the strings in lexicographic order:
a
aa
aaa
...
Doesn’t work:
strings starting with b will never be produced
38
Better procedure:
Proper Order
Produce all strings of length 1
Produce all strings of length 2
Produce all strings of length 2
..........
39
Produce strings:
Proper Order
a , b, c
aa
ab
ac
ba
bb
bc
ca
cb
cc
aaa
aab
aac
......
Length 1
Length 2
Length 3
40
Theorem:
The set of all Turing Machines
is countable
41
Theorem:
The set of all Turing Machines
is countable
Proof:
Any Turing Machine is encoded
with a string of 0’s and 1’s
Find an enumeration procedure
for the set of Turing Machine strings
42
Enumeration Procedure:
Repeat
1. Generate the next string of 0’s and 1’s
in proper order
2. Check if the string defines a
Turing Machine
if YES: print string on output
if NO: ignore string
43
Uncountable Sets
44
Definition:
A set is uncountable if it is not countable
45
Theorem:
Let S be an infinite countable set.
S
The powerset 2 of S is uncountable
46
Proof:
Since S is countable, we can write
S {s1, s2 , s3 ,}
Element of
S
47
Elements of the powerset have the form:
{s1, s3}
{s5 , s7 , s9 , s10}
48
We encode each element of the power set
with a string of 0’s and 1’s
Powerset
element
Encoding
s1
s2
s3
s4
{s1}
1
0
0
0
{s2 , s3 }
0
1
1
0
{s1,s3, s4}
1
0
1
1
49
Let’s assume for contradiction that the
powerset is countable.
We can enumerate the elements of the
powerset
50
Powerset
element
Encoding
t1
1
0
0
0
0
t2
1
1
0
0
0
t3
1
1
0
1
0
t4
1
1
0
0
1
51
Take the powerset element
whose bits are the complements
if the diagonal
52
t1
1
0
0
0
0
t2
1
1
0
0
0
t3
1
1
0
1
0
t4
1
1
0
0
1
New element: 0011
(Diagonal complement)
53
The new element must be some
ti
This is impossible:
The i-th bit must be the complement
of itself
54
We have contradiction!
Therefore the powerset is uncountable
55