0% found this document useful (0 votes)
11 views

RE Languages and Enumerator

Uploaded by

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

RE Languages and Enumerator

Uploaded by

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

RE languages

and
Enumerators

Fall 2006 Costas Busch - RPI 1


We will prove:
(weak result)
• If a language is recursive (or decidable)
then there is an enumerator for it

(strong result)
• A language is recursively enumerable (RE)
if and only if
there is an enumerator for it

Fall 2006 Costas Busch - RPI 2


Theorem:
if a language L is recursive then
there is an enumerator for it

Proof:
Let Turing machineM be the decider forL

Use M to build the enumerator for L

Fall 2006 Costas Busch - RPI 3


~
Let M be an enumerator that prints
all strings from input alphabet in proper order

a
b
aa
Example:
ab
alphabet is {a, b} ba (proper order)
bb
aaa
aab
......
Fall 2006 Costas Busch - RPI 4
Enumerator for L
Repeat:
~
1. M generates a string w

2. M checks if w L
YES: print w to output
NO: ignore w
This part terminates,
because L is recursive
Fall 2006 Costas Busch - RPI 5
Enumerator 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

Generates all Tests each string


Strings in alphabet if it is accepted by M

Fall 2006 Costas Busch - RPI 6


Example: L  {b, ab, bb, aaa,....}
~ Enumeration
M M Output
w1 a reject
w2 b accept b
w3 aa reject
ab accept ab
ba reject

bb accept bb
aaa accept aaa
aab reject

Fall 2006 Costas Busch - RPI END OF PROOF 7


Theorem:
if language L is RE then
there is an enumerator for it

Proof:

Let M be the Turing machine that accepts L

Use M to build the enumerator for L

Fall 2006 Costas Busch - RPI 8


Enumerator for L
Give me
next string
~ wi M
M string

Enumerates all
Accepts L
strings of input alphabet
in proper order
Fall 2006 Costas Busch - RPI 9
NAIVE APPROACH
Enumerator for L
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
Fall 2006 Costas Busch - RPI 10
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
Fall 2006 Costas Busch - RPI 11
~ Generates third string w
M 3

M executes first step on w3


second step on w2
third step on w1

And so on............

Fall 2006 Costas Busch - RPI 12


String: w1 w2 w3 w4 

1 1 1 1

Step in
2 2 2 2
computation
of string
3 3 3 3

4 4 4 4

Fall 2006 Costas Busch - RPI 13


If for any string wi
machine M halts in an accepting state
then print wi on the output

End of Proof
Fall 2006 Costas Busch - RPI 14
Theorem:
If for language L
there is an enumerator
then L is RE

Proof:

Using the enumerator for L


we will build a Turing machine
that accepts L

Fall 2006 Costas Busch - RPI 15


Input Tape
w

Turing Machine that accepts L


w
Enumerator wi Compare
for L Give me the
If same,
next string Accept and Halt
in the
enumeration
sequence

Fall 2006 Costas Busch - RPI 16


Turing machine that accepts L
For any input string w
Loop:
• Using the enumerator of L ,
generate the next string of L
• Compare generated string with w
If same, accept and exit loop

End of Proof
Fall 2006 Costas Busch - RPI 17
By combining the last two theorems,
we have proven:

A language is RE
if and only if
there is an enumerator for it

Fall 2006 Costas Busch - RPI 18

You might also like