Recursively Enumerable and Recursive Languages: Fall 2005 Costas Busch - RPI 1
Recursively Enumerable and Recursive Languages: Fall 2005 Costas Busch - RPI 1
and
Recursive Languages
L
Recursive
M1, M 2 , M 3 , M 4 ,
L( M1), L( M 2 ), L( M 3 ), L( M 4 ),
Binary representation
1 2 3 4 5 6 7
a a a a a a a
L( M i ) 0 1 0 1 0 1 0
Fall 2005 Costas Busch - RPI 12
Example of binary representations
1 2 3 4
a a 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
i i
L {a : a L( M i )}
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 4
L {a , a ,}
Fall 2005 Costas Busch - RPI 15
Consider the language L
i i
L {a : a L( M i )}
i i
L {a : a L( M i )}
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 2
L {a , a ,}
Fall 2005 Costas Busch - RPI 17
Theorem:
Language L is not recursively enumerable
Proof:
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
Question: M k M1 ? L( M k ) L
Fall 2005 Costas Busch - RPI 19
1 2 3 4
a a 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
1
a L( M k )
Answer: M k M1
1
Fall 2005 Costas Busch - RPI
a L ( M1 ) 20
1 2 3 4
a a 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
Question: M k M 2 ? L( M k ) L
Fall 2005 Costas Busch - RPI 21
1 2 3 4
a a 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
2
a L( M k )
Answer: Mk M2
2
Fall 2005 Costas Busch - RPI
a L( M 2 ) 22
1 2 3 4
a a 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
Question: M k M 3 ? L( M k ) L
Fall 2005 Costas Busch - RPI 23
1 2 3 4
a a 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
3
a L( M k )
Answer: M k M3
3
Fall 2005 Costas Busch - RPI
a L( M 3 ) 24
Similarly: Mk Mi for any i
Because either:
i i
a L( M k ) a L( M k )
or
i i
a L( M i ) a L( M i )
L
Recursively Enumerable
Recursive
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 4
L {a , a ,}
Fall 2005 Costas Busch - RPI 29
Theorem: The language
i i
L {a : a L( M i )}
is recursively enumerable
Recursively enumerable
i i
L {a : a L( M i )}
Proof:
Build a Turing machine M that
accepts X and halts on every input
qi qi x x, R
qj qj
Transform M to M
END OF PROOF
Fall 2005 Costas Busch - RPI 35
i i
Theorem: L {a : a L( M i )}
is not a recursive language
Proof: If L is recursive
The complement
of a recursive language
is recursive
Then L is recursive
However, L is not Turing acceptable!
Contradiction!!!!
Fall 2005 Costas Busch - RPI 36
Non Recursively Enumerable
L
Recursively Enumerable
L
Recursive
(strong result)
• A language is recursively enumerable
if and only if
there is an enumeration procedure for it
Proof:
a
b
aa
Example:
ab
alphabet is {a, b} ba (proper order)
bb
aaa
aab
......
Fall 2005 Costas Busch - RPI 41
Enumeration procedure for L
Repeat:
~ generates a string w
M
M checks if w L
YES: print w to output
NO: ignore w
This part terminates,
because L is recursive
Fall 2005 Costas Busch - RPI 42
Enumeration Machine for L
~ M
M Give me
Enumerates all next string
If M accepts wi output
strings of
then print wi to
input alphabet string wi All strings
output
of L
bb accept bb
aaa accept aaa
aab reject
Proof:
~ M
M
Enumerates all
Accepts L
strings of input alphabet
in proper order
Fall 2005 Costas Busch - RPI 46
NAIVE APPROACH
Enumeration procedure for L
Repeat:
~ generates a string w
M
M checks if w L
YES: printw to output
NO: ignore w
Problem: If w L
machine M may loop forever
Fall 2005 Costas Busch - RPI 47
BETTER APPROACH
~ Generates first string w
M 1
And so on............
1 1 1 1
Step in
2 2 2 2
computation
of string
3 3 3 3
4 4 4 4
End of Proof
Fall 2005 Costas Busch - RPI 51
Theorem:
If for language L
there is an enumeration procedure
then L is recursively enumerable
Proof:
End of Proof
Fall 2005 Costas Busch - RPI 54
By Combining the last two theorems,
we have proven: