Uncountable Sets
continued...
1
Theorem:
Let S be an infinite countable set.
The powerset 2S of S is uncountable
2
Application: Languages
Example Alphabet : {a, b}
Set of Strings:
S {a, b} { , a, b, aa, ab, ba, bb, aaa, aab,}
*
infinite and countable
Powerset: all languages
2 {{},{a},{a, b}{aa, ab, aab},}
L1 L2 L3
L4
S
uncountable
3
Languages: Uncountable
L1
L2
L3
M1
M2
M3
Lk
?
Turing machines: Countable
There are infinitely many more languages
than Turing Machines
4
There are some languages not accepted
by Turing Machines
These languages cannot be described
by algorithms
5
Recursively Enumerable Languages
and
Recursive Languages
6
Definition:
A language is recursively enumerable
if some Turing machine accepts it
7
Let L be a recursively enumerable language
and M be the Turing Machine that accepts it
For string w :
if w L
then M halts in a final state
if w L
then M halts in some state
or loops forever
8
Definition:
A language is recursive
if some Turing machine accepts it
and halts on any input string
In other words:
A language is recursive if there is
a membership algorithm for it
9
Let L be a recursive language
and M be the Turing Machine that accepts it
For string w :
if w L
then M halts in a final state
if w L
then M halts in a non-final state
10
We will prove:
1. There is a specific language
which is not recursively enumerable
2. There is a specific language
which is recursively enumerable
but not recursive
11
Non Recursively Enumerable
Recursively Enumerable
Recursive
12
First we prove:
• If a language is recursive then
there is an enumeration procedure for it
• A language is recursively enumerable
if and only if
there is an enumeration procedure for it
13
Theorem:
if a language L is recursive then
there is an enumeration procedure for it
14
Proof:
Enumeration Machine
~
M
Enumerates all
strings of input alphabet
M
Accepts L
15
Enumeration procedure
Repeat:
~ generates a string w
M
M
checks if w L
YES: print w to output
NO:
ignore w
End of proof
16
Theorem:
if language L is recursively enumerable then
there is an enumeration procedure for it
17
Proof:
Enumeration Machine
~
M
Enumerates all
strings of input alphabet
M
Accepts L
18
NAIVE APPROACH
Enumeration procedure
Repeat:
~ generates a string w
M
M
checks if w L
YES: print w to output
NO:
ignore w
Problem: If w L
machine M may loop forever
19
BETTER APPROACH
~ Generates first string w
M
1
M
executes first step on w1
~ Generates second string w
M
2
M
executes first step on w2
second step on w1
20
~ Generates third string w
M
3
M
executes first step on w3
second step on w2
third step on
w1
And so on............
21
w1
w2
w3
w4
1
2
3
Move
22
If for string w
machine M halts in a final state
then it prints w on the output
End of proof
23
Theorem:
If for language L
there is an enumeration procedure
then L is recursively enumerable
24
Proof:
Input Tape
w
Machine that
accepts L
Enumerator
for L
Compare
25
Turing machine that accepts
L
For input string w
Repeat:
• Using the enumerator,
generate the next string of L
• Compare generated string with w
If same, accept and exit loop
End of proof
26
Question:
This is not a membership algorithm.
Why?
Answer:
The enumeration procedure
may not produce strings in proper order
27
We have proven:
A language is recursively enumerable
if and only if
there is an enumeration procedure for it
28
A Language which
is not
Recursively Enumerable
29
We want to find a language that
is not Recursively Enumerable
This language is not accepted by any
Turing Machine
30
Consider alphabet {a}
Strings:
a, aa, aaa, aaaa,
1
a
a
2
a
3
a
4
31
Consider Turing Machines
that accept languages over alphabet {a}
They are countable:
M1, M 2 , M 3 , M 4 ,
32
Example language accepted by M i
L( M i ) {aa, aaaa, aaaaaa}
2
4
6
L( M i ) {a , a , a }
Alternative representation
1
a
a
L( M i ) 0
1
2
a
3
0
4
a
1
0
a
5
a
6
1
a
7
0
33
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
34
Consider the language
i
i
L {a : a L( M i )}
L
consists from the 1’s in the diagonal
35
1
2
3
4
a
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
a
3
a
4
L {a , a ,}
36
Consider the language
i
i
i
i
L
L {a : a L( M i )}
L {a : a L( M i )}
L
consists from the 0’s in the diagonal
37
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
1
3
a
4
2
L {a , a ,}
38
Theorem:
Language L is not recursively enumerable
39
Proof:
Assume for contradiction that
L is recursively enumerable
There must exist some machine M k
that accepts L
L( M k ) L
40
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
Question: M k M1 ?
41
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
1
Answer:
M k M1
a L( M k )
1
a L ( M1 )
42
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
Question: M k M 2 ?
43
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
2
Answer:
Mk M2
a L( M k )
2
a L( M 2 )
44
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
Question: M k M 3 ?
45
1
a
a
2
a
L( M1)
0
1
0
1
L( M 2 )
1
0
0
1
L( M 3 )
0
1
1
1
L( M 4 )
0
0
0
1
3
a
4
3
Answer:
M k M3
a L( M k )
3
a L( M 3 )
46
Similarly:
M k Mi
for any
i
Because either:
i
a L( M k )
i
a L( M i )
or
i
a L( M k )
i
a L( M i )
47
Therefore the machine
M k cannot exist
CONTRADICTION!!!
Therefore the language L
is not recursively enumerable
End of proof
48
Observation:
There is no algorithm that
describes L
(otherwise it would be accepted by
a Turing Machine)
49
A Language
which is Recursively Enumerable
and not Recursive
50
We want to find a language which
Is recursively
enumerable
There is a
Turing Machine
that accepts
the language
But not
recursive
The machine
doesn’t
necessarily halt
on any input
51
We will prove that the language
i
i
L {a : a L( M i )}
Is recursively enumerable
but not recursive
52
Theorem:
The language
i
i
L {a : a L( M i )}
is recursively enumerable
53
Proof:
We will give a Turing Machine that
accepts L
54
Turing Machine that accepts L
For any input string w
• Write w a
i
• Find Turing machine M i
(using the enumeration procedure
for Turing Machines)
• Simulate M i on input a
i
• If M i accepts, then accept w
End of proof
55
Observation:
Recursively enumerable
i
i
L {a : a L( M i )}
Not recursively enumerable
i
i
L {a : a L( M i )}
(Thus, not recursive)
56
Theorem:
The language
i
i
L {a : a L( M i )}
is not recursive
57
Proof:
Assume for contradiction that L is recursive
Then
L
is recursive:
Take the Turing Machine M that accepts L
M
halts on any input
If M accepts then reject
If M rejects then accept
58
Therefore:
L recursive
But we know:
L not recursively enumerable
thus, not recursive
CONTRADICTION!!!!
59
Therefore,
L
is not recursive
End of proof
60
Non Recursively Enumerable
L
Recursively Enumerable
L
Recursive
61
© Copyright 2026 Paperzz