View
226
Download
0
Tags:
Embed Size (px)
Citation preview
Fall 2005 Costas Busch - RPI 2
Definition:
A language is recursively enumerableif there is a Turing machine that accepts it
Also known as: Turing Recognizable languages orTuring Acceptable languages
Fall 2005 Costas Busch - RPI 3
For any string :
Let be a recursively enumerable languageL
and the Turing Machine that accepts itM
Lw
w
if then halts in an accept state M
Lwif then halts in a non-accept stateM
or loops forever
Fall 2005 Costas Busch - RPI 4
Definition:
A language is recursiveif there is a Turing machine accepts it and the machine halts on every input string
Also known as decidable languages
Fall 2005 Costas Busch - RPI 5
For any string :
Let be a recursive languageL
that accepts such that:
M
Lw
w
if then halts in an accept state M
Lwif then halts in a non-accept stateM
Then there is a Turing machine
L
Fall 2005 Costas Busch - RPI 6
We will prove:
1. There is a specific language which is not recursively enumerable (not accepted by any Turing Machine)
2. There is a specific language which is recursively enumerable but not recursive
L
L
Fall 2005 Costas Busch - RPI 10
Consider Turing Machinesthat accept languages over alphabet }{a
They are countable:
,,,, 4321 MMMM
(There is an enumeration procedure that generates them)
Fall 2005 Costas Busch - RPI 11
,,,, 4321 MMMM
Each machine accepts some language over }{a
),(),(),(),( 4321 MLMLMLML
Note that it is possible to have
)()( ji MLML ji Since, a language could be accepted by more than oneTuring machine
for
Fall 2005 Costas Busch - RPI 12
Example language accepted by
},,{)( aaaaaaaaaaaaML i
},,{)( 642 aaaML i
iM
Binary representation
1a 2a 3a 4a 5a 6a 7a
)( iML
0 1 1 10 0 0
Fall 2005 Costas Busch - RPI 13
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Example of binary representations
Fall 2005 Costas Busch - RPI 14
Consider the language
)}(:{ iii MLaaL
L consists of the 1’s in the diagonal
Fall 2005 Costas Busch - RPI 15
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 43 aaL
Fall 2005 Costas Busch - RPI 16
Consider the language
)}(:{ iii MLaaL
L consists of the 0’s in the diagonal
)}(:{ iii MLaaL
L
Fall 2005 Costas Busch - RPI 17
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 21 aaL
Fall 2005 Costas Busch - RPI 18
Proof:
is recursively enumerableL
Assume for contradiction that
There must exist some machinethat accepts :
kML LML k )(
Theorem:
Language is not recursively enumerableL
Fall 2005 Costas Busch - RPI 19
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?1MMk LML k )(
Fall 2005 Costas Busch - RPI 20
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 1MMk )(
)(
11
1
MLa
MLa k
Fall 2005 Costas Busch - RPI 21
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?2MMk LML k )(
Fall 2005 Costas Busch - RPI 22
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 2MMk )(
)(
22
2
MLa
MLa k
Fall 2005 Costas Busch - RPI 23
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?3MMk LML k )(
Fall 2005 Costas Busch - RPI 24
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 3MMk )(
)(
33
3
MLa
MLa k
Fall 2005 Costas Busch - RPI 25
Similarly: ik MM
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
for any i
Because either:
or
the machine cannot exist kM
is not recursively enumerable L
End of Proof
Fall 2005 Costas Busch - RPI 28
There is a Turing Machine that accepts
Every machinethat accepts doesn’t halt on some input string
Is recursively enumerable
But notrecursive
)}(:{ iii MLaaL
We will prove that the language
LL
Fall 2005 Costas Busch - RPI 29
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 43 aaL
Fall 2005 Costas Busch - RPI 30
The languageTheorem:
)}(:{ iii MLaaL
is recursively enumerable
Proof:We will give a Turing Machine thataccepts L
Fall 2005 Costas Busch - RPI 31
Turing Machine that accepts LFor any input string w
• Compute , for which iaw• Find Turing machine iM
(using the enumeration procedure for Turing Machines)
• Simulate on inputiMia
• If accepts, then accept iM w
i
End of Proof
Fall 2005 Costas Busch - RPI 32
Observation:
)}(:{ iii MLaaL
)}(:{ iii MLaaL
Recursively enumerable
Not recursively enumerable
(Thus, is not recursive either)L
Fall 2005 Costas Busch - RPI 33
Theorem:
If a language is recursive,then its complement is recursive too
XX
Proof:
Build a Turing machine that accepts and halts on every input X
M
Fall 2005 Costas Busch - RPI 34
(accepts and halts on every input string)
1. Let be the Turing machine that accepts M X
and halts on every input string
If accepts then rejectIf rejects then accept
MM
X
M Turing Machine
On any input string do: w
2. Run with input stringM w
Fall 2005 Costas Busch - RPI 35
M
iq iq
jq jq
Rxx ,
For all tape symbols not read in the other transitions of
x
iq
M
Transform toM M END OF PROOF
Fall 2005 Costas Busch - RPI 36
Theorem: )}(:{ iii MLaaL
is not a recursive language
Proof: If is recursive
Then is recursive
L
L
The complement of a recursive language
is recursive
Contradiction!!!!
However, is not Turing acceptable!L
Fall 2005 Costas Busch - RPI 39
We will 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
(weak result)
(strong result)
Fall 2005 Costas Busch - RPI 40
Theorem:
if a language is recursive then there is an enumeration procedure for it
L
Proof:
Let be the Turing machine that acceptsand halts on every input
M L
Use to build the enumeration procedure for
ML
Fall 2005 Costas Busch - RPI 41
Example: alphabet is },{ ba
abaaabbabbaaaaab......
(proper order)
Let be an enumerator that printsall strings from input alphabet in proper order
M~
Fall 2005 Costas Busch - RPI 42
Enumeration procedure for
Repeat:
M~ generates a string
M
w
checks if Lw
YES: print to output w
NO: ignore w
L
This part terminates,because is recursive L
Fall 2005 Costas Busch - RPI 43
MM~Enumeration Machine for
string
Give me next stringEnumerates all
strings of
input alphabet
Generates allStrings in alphabet
iwIf acceptsthen print tooutput
M iw
iw
Tests each stringif it is accepted by
L
M
output
All strings
of L
Fall 2005 Costas Busch - RPI 44
Example:
M~
abaaabbabbaaaaab
M
,....},,,{ aaabbabbL Enumeration
Output
b
ab
bbaaa
reject
reject
reject
accept
accept
accept
accept
reject
END OF PROOF
1w
2w3w
Fall 2005 Costas Busch - RPI 45
Theorem:
if language is recursively enumerable thenthere is an enumeration procedure for it
L
Proof:
Let be the Turing machine that accepts M L
Use to build the enumeration procedure for
ML
Fall 2005 Costas Busch - RPI 46
MM~
Enumeration Machine for
Accepts LEnumerates allstrings of input alphabetin proper order
L
Fall 2005 Costas Busch - RPI 47
Enumeration procedure for
Repeat: M~ generates a string
M
w
checks if Lw
YES: print to output w
NO: ignore w
NAIVE APPROACH
Problem:If machine may loop forever
LwM
L
Fall 2005 Costas Busch - RPI 48
M~
M
1w
executes first step on
BETTER APPROACH
1w
M~ Generates second string 2w
M executes first step on 2w
second step on 1w
Generates first string
Fall 2005 Costas Busch - RPI 49
M~ Generates third string 3w
M executes first step on 3w
second step on 2w
third step on 1w
And so on............
Fall 2005 Costas Busch - RPI 50
1w 2w 3w 4w
1
Step in computationof string
1 1 1
2 2 2 2
3 3 3 3
String:
4 4 4 4
Fall 2005 Costas Busch - RPI 51
If for any string machine halts in an accepting statethen it prints on the output
Miw
iw
End of Proof
Fall 2005 Costas Busch - RPI 52
Theorem:
If for language there is an enumeration procedurethen is recursively enumerable
L
L
Proof:
Using the enumerator forwe will build a Turing machine that accepts
L
L
Fall 2005 Costas Busch - RPI 53
wInput Tape
Enumeratorfor L
Compare
Turing Machine that accepts Lw
iwIf same, Accept and Halt
Give me thenext stringin the enumeration sequence
Fall 2005 Costas Busch - RPI 54
Turing machine that accepts L
Loop:• Using the enumerator of , generate the next string of L
For any input string w
• Compare generated string with w
If same, accept and exit loop
End of Proof
L