0% found this document useful (0 votes)
29 views61 pages

21 Universal Turing

The document discusses the concept of a Universal Turing Machine, which can simulate any other Turing Machine and is reprogrammable, unlike standard Turing Machines that are hardwired to execute a single program. It also explores the countability of sets, demonstrating that while Turing Machines are countable, the set of all languages (powerset) is uncountable, leading to the conclusion that there exist languages not accepted by any Turing Machine. The document concludes that there are languages that cannot be described by any algorithm, highlighting the limitations of Turing Machines.

Uploaded by

Kshitij Vasule
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views61 pages

21 Universal Turing

The document discusses the concept of a Universal Turing Machine, which can simulate any other Turing Machine and is reprogrammable, unlike standard Turing Machines that are hardwired to execute a single program. It also explores the countability of sets, demonstrating that while Turing Machines are countable, the set of all languages (powerset) is uncountable, leading to the conclusion that there exist languages not accepted by any Turing Machine. The document concludes that there are languages that cannot be described by any algorithm, highlighting the limitations of Turing Machines.

Uploaded by

Kshitij Vasule
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

A Universal Turing Machine

A limitation of Turing Machines:

Turing Machines are “hardwired”

they execute
only one program

Real Computers are re-programmable


Solution: Universal Turing Machine

Attributes:

• Reprogrammable machine

• Simulates any other Turing Machine


Universal Turing Machine
simulates any Turing Machine M

Input of Universal Turing Machine:

Description of transitions of M

Input string of M
Tape 1
Three tapes

Description of M

Universal
Tape 2
Turing
Machine
Tape Contents of M

Tape 3

State of M
Tape 1

Description of M

We describe Turing machine M


as a string of symbols:

We encode M as a string of symbols


Alphabet Encoding

Symbols: a b c d 

Encoding: 1 11 111 1111


State Encoding

States: q1 q2 q3 q4 

Encoding: 1 11 111 1111

Head Move Encoding

Move: L R

Encoding: 1 11
Transition Encoding

Transition:  ( q1 , a )  ( q2 , b, L )

Encoding: 1 0 1 0 11 0 11 0 1

separator
Turing 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 1 10 111 0 111 0 11

separator
Tape 1 contents of Universal Turing Machine:

binary encoding
of the simulated machine M

Tape 1
1 0 1 0 11 0 11 0 10011 0 1 10 111 0 111 0 1100 
A Turing Machine is described
with a binary string of 0’s and 1’s

Therefore:
The set of Turing machines
forms a language:

each string of this language is


the binary encoding of a Turing Machine
Language of Turing Machines

L = { 010100101, (Turing Machine 1)

00100100101111, (Turing Machine 2)

111010011110010101, ……

…… }
Countable Sets
Infinite sets are either: Countable

or

Uncountable
Countable set:
There is a one to one correspondence
of
elements of the set
to
Natural numbers (Positive Integers)

(every element of the set is mapped to a number


such that no two elements are mapped to same number)
Example: The set of even integers
is countable

Even integers: 0, 2, 4, 6, 
(positive)

Correspondence:

Positive integers: 1, 2, 3, 4, 

2 n corresponds to n  1
Example: The set of rational numbers
is countable

1 3 7
Rational numbers: , , , 
2 4 8
Naïve Approach Nominator 1
1 1 1
Rational numbers: , , ,
1 2 3
Correspondence:

Positive integers: 1, 2, 3, 

Doesn’t work:
we will never count 2 2 2
, , ,
numbers with nominator 2: 1 2 3
Better Approach
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 1 1

1 2 3 4

2 2 2

1 2 3

3 3

1 2
4

1
1 1 2 1 2
Rational Numbers: , , , , , 
1 2 1 3 2

Correspondence:

Positive Integers: 1, 2, 3, 4, 5, 
We proved:

the set of rational numbers is countable


by describing an enumeration procedure
(enumerator)
for the correspondence to natural numbers
Definition

Let S be a set of strings (Language)

An enumerator for S is a Turing Machine


that generates (prints on tape)
all the strings of S one by one

and
each string is generated in finite time
strings s1 , s2 , s3 ,   S

Enumerator output s1 , s2 , s3 , 
Machine for S (on tape)

Finite time: t1 , t 2 , t3 ,
Enumerator Machine
Configuration

Time 0  

q0

prints s1
Time t1 x1 # s1

qs
prints s2
Time t 2 x2 # s2

qs

prints s3
Time t3 x3 # s3

qs
Observation:
If for a set S there is an enumerator,
then the set is countable

The enumerator describes the


correspondence of S to natural numbers
Example: The set of strings S  {a , b , c } 
is countable

Approach:
We will describe an enumerator for S
Naive enumerator:
Produce the strings in lexicographic order:
s1  a
s2  aa
 aaa
aaaa
......
Doesn’t work:
strings starting with b
will never be produced
Better procedure: Proper Order
(Canonical Order)
1. Produce all strings of length 1

2. Produce all strings of length 2

3. Produce all strings of length 3

4. Produce all strings of length 4


..........
s1  a
s2  b length 1
 c
aa
ab
ac
Produce strings in ba
Proper Order: bb length 2
bc
ca
cb
cc
aaa
aab length 3
aac
......
Theorem: The set of all Turing Machines
is countable

Proof: Any Turing Machine can be encoded


with a binary string of 0’s and 1’s

Find an enumeration procedure


for the set of Turing Machine strings
Enumerator:
Repeat
1. Generate the next binary string
of 0’s and 1’s in proper order

2. Check if the string describes a


Turing Machine
if YES: print string on output tape
if NO: ignore string
Binary strings Turing Machines
0
1
00
01


1 0 1 0 11 0 11 0 0 s1
1 0 1 0 11 0 11 0 1 1 0 1 0 11 0 11 0 1

 s2
1 0 11 0 1010010101 101 1 0 11 0 1010010101 101


End of Proof
Uncountable Sets
We will prove that there is a language L 
which is not accepted by any Turing machine

Technique:
Turing machines are countable

Languages are uncountable

(there are more languages than Turing Machines)


Definition: A set is uncountable
if it is not countable

We will prove that there is a language


which is not accepted by any Turing machine
Theorem:

If S is an infinite countable set, then

S
the powerset 2 of S is uncountable.

(the powerset 2 S is the set whose elements


are all possible sets made from the elements of S )
Proof:

Since S is countable, we can write

S  {s1 , s2 , s3 ,}

Elements of S
Elements of the powerset 2 S have the form:


{s1 , s3 }

{s5 , s7 , s9 , s10 }

……
We encode each element of the powerset
with a binary string of 0’s and 1’s

Powerset
Binary encoding
element
(in arbitrary order)
s1 s2 s3 s4 

{s1} 1 0 0 0 

{s 2 , s 3 } 0 1 1 0 

{s1 , s 3 , s4 } 1 0 1 1 
Observation:
Every infinite binary string corresponds
to an element of the powerset:

Example: 1 0 0 111 0 

S
Corresponds to: {s1, s4 , s5 , s6 ,}  2
Let’s assume (for contradiction)
that the powerset 2 is countable
S

Then: we can enumerate


the elements of the powerset

S
2  {t1, t2 , t3 ,}
suppose that this is the respective
Powerset
Binary encoding
element
t1 1 0 0 0 0 

t2 1 1 0 0 0 

t3 1 1 0 1 0 

t4 1 1 0 0 1 
 
Take the binary string whose bits
are the complement of the diagonal

t1 1 0 0 0 0 

t2 1 1 0 0 0 
t3 1 1 0 1 0 

t4 1 1 0 0 1 

Binary string: t  0011 


(birary complement of diagonal)
The binary string t  0011 
corresponds
to an element of
the powerset 2 :S S
t  {s3 , s 4 , }  2
Thus, t must be equal to some ti

t  ti
However,
the i-th bit in the encoding of t is
the complement of the i-th bit of ti , thus:

t  ti
Contradiction!!!
Since we have a contradiction:

The powerset 2 S of
S is uncountable

End of proof
An Application: Languages

Consider Alphabet : A  {a , b}
The set of all Strings:

S  {a , b}  { , a , b, aa , ab , ba , bb , aaa , aab ,}


*

infinite and countable

(we can enumerate the strings


in proper order)
Consider Alphabet : A  {a , b}
The set of all Strings:

S  {a , b}  { , a , b, aa , ab , ba , bb , aaa , aab ,}


*

infinite and countable

Any language is a subset of S :

L  {aa , ab , aab}
Consider Alphabet : A  {a , b}
The set of all Strings:
* *
S  A  {a , b}  { , a , b, aa , ab , ba , bb , aaa , aab ,}
infinite and countable

The powerset of S contains all languages:


S
2  { ,{ }, {a}, {a , b}, {aa , b},..., {aa , ab , aab}, }
uncountable
Consider Alphabet : A  {a , b}

countable
Turing machines: M1 M2 M3 

accepts
Languages accepted
By Turing Machines: L1 L2 L3 
countable

Denote: X  { L1, L2 , L3 ,} Note: X 2 S


countable
S  {a , b } * 
Languages accepted
by Turing machines: X countable

S
All possible languages: 2 uncountable

S
Therefore: X 2

since X  2S , we have X  2S 
Conclusion:

There is a language L  not accepted


by any Turing Machine:

S L  2 S
and L  X
X 2

(Language L  cannot be described


by any algorithm)
Non Turing-Acceptable Languages

L

Turing-Acceptable
Languages
Note that: X  {L1, L2 , L3 ,}
is a multi-set (elements may repeat)
since a language may be accepted
by more than one Turing machine

However, if we remove the repeated elements,


the resulting set is again countable since every element
still corresponds to a positive integer

You might also like