computability decidability
DESCRIPTION
Computability Decidability. Unsolvable problems. Computer scientists usually deal with problems which are solvable. We are supposed to find an algorithm to solve a particular problem. Why do we need to know about problems which are unsolvable ? - PowerPoint PPT PresentationTRANSCRIPT
1
ComputabilityDecidability
2
Unsolvable problems
Computer scientists usually deal with problems which are solvable.
We are supposed to find an algorithm to solve a particular problem.
Why do we need to know about problems which are unsolvable ?we will not waste time in finding an non-existed algorithm.we will realize that the problem needs to be simplified or altered
before we can find an algorithmic solution.unsolvable problems can stimulate our imagination and help us
gain an important perspective on computation.
3
Decidable Languages
We have seen in the last chapter an undecidable problem, the 10th problem of Hilbert.
Now we will show some other problems and consider whether they are decidable by algorithm or not.
4
Decidable Problems Concerning Regular Languages
Acceptance problem
Whether a finite automata accepts a string ?
ADFA = {<B,w>| B is a DFA that accepts input string w}
Whether a nondeterministic finite automata accepts
a string ?
ANFA = {<B,w>| B is a NFA that accepts input string w}
Whether a regular expression generates a given string.
AREX = {<R,w>| R is a regular expression that generates string w}
5
Decidable Problems concerning Regular Lang.
Empty Language problemWhether a language of a finite automata is empty ?
EDFA = {<A>| A is a DFA and L(A) = }
Equivalence problemWhether two finite automata are equivalent ?
EQDFA = {<A,B>| A and B are DFAs and L(A) = L(B)}
6
Theorem 1
ADFA is a decidable language
ADFA = {<B,w>| B is a DFA that accepts input string w}
Show that the problem of testing whether a given finite automata accepts a given string is decidable
Proof idea: Present a TM M that decides ADFA.
7
Proof
M = “on input <B,w>, where B is a DFA and w is a string:Simulate B on input w.If the simulation ends in an accept state, accept. If it ends in a
non-accepting state, reject.”
Notes: input of M is an encoded string <B,w>B can be represented reasonably as a list of its five components,
Q, , , q0 and F.before M starts its computation, M first checks on whether it
properly represents a DFA B and a string w. If not, M rejects.
8
Proof:
wInput Tape
B
Machine M
accept
rejectM keeps track of B’s current state and B’s current position in the input w by writing this information down on its tape.
9
Theorem 2
ANFA is a decidable language
ANFA = {<B,w>| B is a NFA that accepts input string w}
Proof idea: Present a TM N that decides ANFA.N has M as a subroutine.Because M is designed to work with DFAs, N first converts
the NFA B it receives as input to a DFA before passing it to M.
10
Proof
N = “on input <B,w>, where B is a NFA and w is a string:Convert NFA B to an equivalent DFA C
Run TM M from Theorem 1 on input <C,w>.
If M accepts, accept; otherwise reject.”
11
Proof:
wInput Tape
C
Machine N
accept
reject
Machine M
12
Theorem 3
AREX is a decidable language
AREX = {<R,w>| R is a regular expression that generates string w}
Proof idea: Present a TM P that decides AREX.
13
Proof
P = “on input <R,w>, where R is a regular expression and w is a string:Convert regular expression R to an equivalent DFA A.
Run TM M on input <A,w>.
If M accepts, accept; if M rejects , reject.”
14
Theorem 4
EDFA is a decidable language
EDFA = {<A>| A is a DFA and L(A) = }
Show that the problem of testing whether a given finite automata accepts any strings at all is decidable.
Proof idea: A DFA accepts some string if and only if reaching an accept state
from the start state by traveling alone the arrows of the DFA is possible.
Present a TM T that uses a marking algorithm.
15
ProofT = “on input <A>, where A is a DFA:
Mark the start state of A.
Repeat until no new states get marked:
Mark any state that has a transition coming into it from any state that is already marked.
If no accept state is marked, accept; otherwise reject.”
A is empty
16
Theorem 5
EQDFA is a decidable language
EQDFA = {<A,B>| A and B are DFAs and L(A) = L(B)}
Show that the problem of testing whether 2 DFAs recognize the same language is decidable.
Proof idea: Construct a new DFA C from A and B, where C accepts only
those strings that are accepted by either A or B but not by both.If A and B recognize the same language, C will accept nothing.Test whether L(C) is empty by the theorem 4.4
17
L(C)
L(C) = (L(A) L(B)) (L(A) L(B))
L(A) L(B)
Symmetric difference of L(A) and L(B)
C is also a DFA as the class of regular language is closed undercomplementation, union and intersection
18
Proof
F = “on input <A,B>, where A and B are DFAs:Construct DFA C as described.
Run TM T from Theorem 4 on input <C>
If T accepts, accept. If T rejects, reject.”
19
Proof
Machine F
Machine T
C
accept
reject
accept
reject
20
Decidable Problems concerning to Context-Free Language
Acceptance problem
Whether a CFG accepts a string ?
ACFG = {<G,w>| G is a CFG that accepts input string w}
Emptiness problem
Whether a CFG generates any strings at all ?
ECFG = {<G>| G is a CFG and L(G) = }
Equivalent problem
Whether two CFGs generate the same language ?
EQCFG = {<G,H>| G and H are CFGs and L(G) = L(H)}
21
Theorem 6
ACFG is a decidable language
ACFG = {<G,w>| G is a CFG that generates string w}
Proof idea: Naïve idea :
Go through every derivations to determine whether any is a derivation of w.
But this algorithm will not halt if w is not a member of G.
Better approach:We need to ensure that the algorithm tries only finitely many
derivations, so use CNF form.
any derivation of w has 2n-1 steps, where n is the length of w.
22
Proof
S = “on input <G,w>, where G is a CFG and w is a string:Convert G to an equivalent grammar in Chomsky
Normal Form.
List all derivations with 2n-1 steps, where n is the length of w.
If any of these derivations generate w, accept; if not, reject.”
23
CFLs and PDAs
As we can convert back and forth between CFLs and PDAs.
Hence, everything we say about the decidability of problems concerning CFLs applies well to PDAs.
24
Theorem 7
ECFG is a decidable language
ECFG = {<G>| G is a CFG and L(G) = }
Proof idea: Naïve idea : to determine whether L(G) =
try going through all possible w’s, one by one.But there are infinitely many w’s to try, so this algorithm could end
up running forever.
Better approach:We need to test whether the start variable can generate a string of
terminals.Determine for each variable whether that variable is capable of
generating a string of terminals, the algorithm keeps track of this information by placing a mark on that variable.
25
ProofR = “on input <G>, where G is a CFG :
Mark all terminal symbols in G.
Repeat until no new variables get marked
Mark any variable A where G has a rule AU1 U2… Uk and each symbol U1 , …, Uk
has already been marked.
If the start symbol is not marked, accept; otherwise
reject. ”
G is empty
26
EQCFG
Consider the problem of testing whether 2 CFGs generate the same language.
ECFG = {<G,w>| G is a CFG that generates string w}
Proof idea: Naïve idea :
use the same method as theorem 4.5But CFL is not closed under complementation or
intersections.
In fact, ECFG is not decidable. We’ll prove it in the next chapter.
27
Theorem 8
“Every context-free language is decidable.”We show that every CFL is decidable.Proof idea:
Naïve (bad) idea : try to convert a PDA for A directly to a TM.the PDA for A may be nondeterministic, so we get an NTM
which we can convert into a deterministic TM.however, PDA can have some branches go on forever, reading
and writing the stack without coming to a halt. therefore our TM will not be a decider.
Better approach:We prove this theorem with the TM S in Theorem 6 to decide
ACFG.
28
Proof
Let G be a CFG for A and design a TM MG that decides A.
We build a copy of G into MG.
It works as follow.
MG = “on input w:
Run TM S on input <G,w>
If this machine accepts, accept; if it rejects, reject.”
29
Proof
Machine MG
Machine S
accept
reject
accept
reject
1. Convert G to CNF form.
2. List all derivations with 2n-1 steps, where n is the length of w.
3. If any of these derivations generate w, accept; if not, reject.
30
Relationship among classes of Language
Turing-recognizable
DecidableContext-freeRegular
31
Non Recursively Enumerator language
We want to find a language that is not Recursively Enumerable
This language is not accepted by any Turing MachineIt can’t be implemented on (contemporary) computer.Example:
Verify that the program we wrote performs as specified (that it is correct).
Halting problem : Testing whether a TM accepts a given input string (ATM)
32
Theorem 9
ATM = {<M,w>| M is a TM and M accepts w}.
ATM is undecidable.
Proof: observe that ATM is Turing-recognizable.
We try to find a TM (U) that recognizes ATM.
33
Halting Problem
U = “On input <M,w>, where M is a TM and w is a string:Simulate M on input w.
If M ever enters its accept state, accept; if M ever enters its reject state, reject.”
Note: U loops on input <M,w> if M loops on w, that’s why U doesn’t decide ATM.
34
Universal Turing Machineproposed by Turing.
a machine is called universal if it is capable to simulate any other Turing machine from the description of that machine.
played an important early role in stimulating the development of stored-program computers.
35
The Diagonalization method
discovered by Georg Cantor in 1873.is the proof of the undecidability of the halting
problem.using countable and uncountable set to prove.Idea is : we want to prove that
set of Turing-recognizable language is uncountablewhile set of Turing machine is countable.
36
Cantor’s problemConcerned with the problem of measuring the sizes
of infinite sets.
If we have 2 infinite sets, how can we tell whether one is larger than the other or whether they are of the same size ?
Naïve: try to count the elements of the infinite set, we will never finish!
37
Cantor’s problem
Better approach:
Observe that 2 finite sets are of the same size if the elements of the one set can be paired with the element of the other set.
We can extend this idea to infinite sets.
38
Definition: Correspondence
Consider 2 sets, A and B, and a function f from A to B.
Say that f is one-to-one if it never maps 2 different elements to the same place that is, f(a) f(b) whenever a b.
Say that A and B are the same size if there is a one-to-one, onto function f: AB.
one-to-one and onto is called CorrespondenceCorrespondence
39
Example
Let N be the set of Natural numbers {1,2,3,…}
be the set of even natural numbers {2,4,6,…}
Using cantor’s method, we can see that N and have the same size.
n f(n)
1 2
2 4
3 6... ...
40
Definition : Countable
A set A is countable if either it is finite or it has the same size as N.
41
ExampleLet
N be the set of Natural numbers {1,2,3,…} Q be the set of positive rational numbers
Q = {m/n |m,n N }
Q seems the be bigger than N but actually they have the same size.
Using cantor’s method, we list all the elements of Q and then pair each element with the element of N.
We have to ensure that every member of Q appears only once on the list.
42
Correspondence of N and Q
11
12
13
14
15
21
22
23
24
25
31
32
33
34
35
41
42
43
44
45
51
52
.
.
.
. . .
43
Trick
We pair the first element of Q on the list with the number 1 from N.
the second element of Q on the list with the number 2 from N.
…
After seeing the corresponding of N and Q, we can see that as each curve Q has finite number of elements which can be mapped with elements of N, thus both sets have same size.
44
Theorem 4.14R is uncountable
R is the set of real number.
Proof by the diagonalization method.
45
Proof
by contradiction : suppose that a correspondence f existed between N and R. means that we must pair all the members of N with all the members of R.
show that f fails to work as it should.
How to show ? finding an x in R that is not paired with anything in N.
46
ProofFinding x by constructing it.
choose each digit of x to make x different from one of the real numbers that is paired with an element of N
Sure that x is different from any real number that is paired.
47
Illustration of the idea
suppose we have a corresponding f:
we construct x by let the first digit of x be anything different from the first fractional digit of f(1). let the second digit of x be anything different from the second fractional digit of f(2).
…
thus we can construct x which is different from f(n) for any n.
n f(n)
1 0.123456
2 0.500000
3 0.759685... ...
n f(n)
1 0.423456
2 0.530000
3 0.756685... ...
48
Corollary 4.15
Some languages are not Turing-recognizable.
Proof idea: set of Turing-recognizable language is uncountable while set of
Turing machine is countable.
Because each Turing machine can recognize a single language and there are more languages than TMs, some languages are not recognized by any TM.
Thus, there exists some languages which are not Turing-recognizable.
49
set of all TMs is countable.Proof idea:
first of allwe have to observe that the set of all * is countable, for
any alphabet .
with only finitely many strings of each length, we may form a list of * by written down all strings of length 0, length 1, length 2 and so on.
50
set of all TMs is countable.Secondly
We can encode each TM into a string <M>
as the set of all strings is countable therefore the set of all TMs is countable.
51
set of all languages is uncountable
Proof idea:
first of allwe have to observe that the set of all infinite binary
sequence is uncountable
An infinite binary sequence is an unending sequence of 0s and 1s.
we can prove by the diagonalization method.
(imagine as the same way as R)
52
set of all languages is uncountableSecondly
Let B be the set of all infinite binary sequences.Let L be the set of all languages over alphabet .Show that L is uncountable by giving correspondence
with B.the idea is that “as B is uncountable thus L is also
uncountable.”
53
set of all languages is uncountable
Correspondence of L and BShow that both sets have the same size.
Let * = {s1,s2,…}.
Each language A L has a unique sequence of B. (one-to-one and onto)
Characteristic sequence of A, (A)The ith bit of that sequence is a 1 if si A and is a 0 if
si A.
54
set of all languages is uncountable
Example : Characteristic sequence
The function f: L B, where f(A) equals the Characteristic sequence of A, is one-to-one and onto and hence a correspondence. Therefore, as B is uncountable, L is uncountable as well.
* = { , 0 , 1 , 00 , 01 , 10 ,11
, 000 , 001 , … } ;
A = { 0 , 00 , 01 000 , 001 , … } ;
(A) = { 0 1 0 1 1 0 0 1 1 … } ;
55
The Halting Problem
We have proved that there are some languages which are not Turing-recognizable.
Now, we want to show that such a TM which can such a TM which can recognize the non Turing-recognizable recognize the non Turing-recognizable language doesn’t existlanguage doesn’t exist.
56
Proof of Theorem 9
ATM is undecidable.Proof:
Consider = {a}.
The set of all strings is * = {,a, aa, aaa, aaaa…}
= {,a1, a2, a3, a4…}
the set of all TMs is countable, thus we can order them as M1, M2, M3,…
to indicate which language is accepted by what machine, we can again use the characteristic sequence of that language.
57
Proof of Theorem 9
Example:assume a machine Mi accepts a language L(Mi)
L(Mi) = {a2, a4, a6}
we can write
* = { a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 ,,,
… } ;
L(Mi) = { 0 1 0 1 0 1 0 0 … } ;
58
1a 2a 3a 4a
)1(ML
0 1 10
)2(ML
)3(ML
01 0 1
0 1 11
)4(ML 0 10 0
Proof of Theorem 9
For each machine, we can write its characteristic sequence
59
Consider the language
)}(:{ iii MLaaL
L consists from the 1’s in the diagonal
Proof of Theorem 9
60
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
},,{ 43 aaL
)1(ML
)2(ML
)3(ML
)4(ML
61
)}(:{ iii MLaaL
L consists from the 0’s in the diagonal
)}(:{ iii MLaaL
Consider the language L
Proof of Theorem 9
Since L is a properly defined language, we can consider its complement
62
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
},,{ 21 aaL
)1(ML
)2(ML
)3(ML
)4(ML
63
Claim 1:
Language is not recursively enumerableL
Proof of Theorem 4.9
If we can prove that it is not recursively enumerable, we can now find a language which is not Turing recognizable.
If we can prove that it is not recursively enumerable, we can now find a language which is not Turing recognizable.
64
is recursively enumerable
LAssume for contradiction that
There must exist some machine
that accepts kM
L
LML k )(
Proof: Claim 1
65
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
Question: ?1MMk
)1(ML
)2(ML
)3(ML
)4(ML
66
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
)1(ML
)2(ML
)3(ML
)4(ML
Answer: 1MMk )(
)(
11
1
MLa
MLa k
)(
)(
11
1
MLa
MLa k
67
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
)1(ML
)2(ML
)3(ML
)4(ML
Question: ?2MMk Answer: 2MMk )(
)(
22
2
MLa
MLa k
)(
)(
22
2
MLa
MLa k
68
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
)1(ML
)2(ML
)3(ML
)4(ML
Question: ?3MMk Answer: 3MMk )(
)(
33
3
MLa
MLa k
)(
)(
33
3
MLa
MLa k
69
Similarly: ik MM for any i
Because either:
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
or
Proof: Claim 1
70
Therefore, the machine cannot exist kM
Therefore, the language
is not recursively enumerable
L
End of ProofEnd of Proof
Proof: Claim 1
71
There is no There is no algorithmalgorithm that describes that describes L
(otherwise would be accepted by
some Turing Machine)
L
Observation:
72
Recursive
Recursively Enumerable
Non Recursively Enumerable
L
73
Testing whether TM accepts a given string : ATM
Try to construct a TM (H) to decide whether another TM (M) accepts a string (w) or not.
H is decider on (M,w)
accept if M accepts w
H(M,w) =
reject if M rejects w
74
Testing whether TM accepts a given string : ATM
If w = the encoded string <M>
H is decider on (M,<M>)
accept if M accepts <M>
H(M,<M>) =
reject if M rejects <M>
75
Testing whether TM accepts a given string : ATM
Now we construct a new TM (D) with H as a subroutine.
D does opposite to what its subroutine does.D = “On input <M>, where M is a TM,
Run H on input <M,<M>)Output the opposite to what H outputs; that is, if H
accepts, reject and if H rejects, accept.”
76
Testing whether TM accepts a given string : ATM
accept if H rejects <M>
D(<M>) =
reject if H accepts <M>
accept if M rejects <M>
D(<M>) =
reject if M accepts <M>
77
Testing whether TM accepts a given string : ATM
D(<M>)
H (M,<M>)
M (<M>)if M accepts <M> then H acceptsif M rejects <M> then H rejects
accept
reject accept
reject
78
Testing whether TM accepts a given string : ATM
running M on <M>
1M
1 1
1
1
1
11
1
1M
2M
3M
4M
2M 3M 4M
1
79
output of H
Testing whether TM accepts a given string : ATM
1M
0
1
10
0
1
0
1
1
0
1
0
0
1M
2M
3M
4M
2M 3M 4M
1
1
1
80
Output of D
Testing whether TM accepts a given string : ATM
1M
0
1
10 0
1
0
1
1
0
1
0
0
1M
2M
3M
4M
2M 3M 4M
1
1
1
D 1 10 0
D
1
1
0
?
1
81
A Language which is Recursively Enumerable and not Recursive
82
We want to find a language which
There is a
Turing Machine
that accepts
the language
The machine
doesn’t halt
on some input
Is recursively
enumerable
But not
recursive
83
We will prove that the language
)}(:{ iii MLaaL
Is recursively enumerable
but not recursive
Proof
84
1a 2a 3a 4a
0 1 10
01 0 1
0 1 11
0 10 0
},,{ 43 aaL
)1(ML
)2(ML
)3(ML
)4(ML
85
Theorem:
The language )}(:{ iii MLaaL
is recursively enumerable
Proof:
We will give a Turing Machine that accepts L
86
Turing Machine that accepts L
For any input string w
• Find Turing machine iM
(using the enumeration procedure for Turing Machines)
• Simulate on inputiM ia
iM• If accepts, then accept w
• Compute for whichiaw i
End of Proof
87
)}(:{ iii MLaaL
Recursively enumerable
)}(:{ iii MLaaL
Not recursively enumerable
(Thus, also not recursive)
Observation:
88
The language )}(:{ iii MLaaL
is not recursive
Theorem:
Proof:
Assume for contradiction that
L is recursive
89
Proof
But we know:
L is not recursively enumerable
thus, not recursive
CONTRADICTION!
Therefore, is not recursiveL
End of Proof
Then is recursive L
90
L
Recursive
Recursively Enumerable
Non Recursively Enumerable
L
91
Theorem
A language is decidable (recursive) if and only if it is both Turing-recognizable and Co-Turing-recognizable.
Co-Turing-recognizable language is the the complement of a Turing-recognizable language.
92
Corollary
is not Turing-recognizable.
Proof:
ATM is Turing-recognizable.
if is Turing-recognizable,
ATM would be decidable.
But ATM is not decidable, thus
must not be Turing-recognizable.
ATM
ATM
ATM
93
Recursively Enumerable and
Recursive
Languages
94
Definition:
A language is recursively enumerable(rekursivt uppräknelig)
if some Turing machine accepts it
95
For string :
Let be a recursively enumerable languageL
and the Turing Machine that accepts itM
Lw
w
if then halts in a final state M
Lwif then halts in a non-final stateM
or loops forever
96
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
97
For string :
Let be a recursive languageL
and the Turing Machine that accepts itM
Lw
w
if then halts in a final state M
Lwif then halts in a non-final stateM
98
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
99
Recursive
Recursively Enumerable
Non Recursively Enumerable
100
We will first 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
101
Theorem:
if a language is recursive then
there is an enumeration procedure for it
L
102
Proof:
MM~
Enumeration Machine
Accepts LEnumerates all
strings of input alphabet
103
If the alphabet is then
can enumerate strings as follows:
},{ baM~
abaaabbabbaaaaab......
104
Enumeration procedure
Repeat:
M~ generates a string
M
w
checks if Lw
YES: print to output w
NO: ignore w
End of Proof
105
Example:
M~
abaaabbabbaaaaab......
)(ML
b
ab
bbaaa
......
,....},,,{ aaabbabbL Enumeration
Output
b
ab
bbaaa
......
106
Theorem:
if language is recursively enumerable then
there is an enumeration procedure for it
L
107
Proof:
MM~
Enumeration Machine
Accepts LEnumerates all
strings of input alphabet
108
If the alphabet is then
can enumerate strings as follows:
},{ baM~
abaaabbabbaaaaab
109
Enumeration procedure
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
110
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
111
M~ Generates third string 3w
M executes first step on 3w
second step on 2w
third step on 1w
And so on............
112
1w 2w 3w 4w
1
Step
in
string
1 1 1
2 2 2 2
3 3 3 3
113
If for any string
machine halts in a final state
then it prints on the output
Miw
iw
End of Proof
114
Theorem:
If for language
there is an enumeration procedure
then is recursively enumerable
L
L
115
Proof:
wInput Tape
Enumerator
for LCompare
Machine that
accepts L
116
Turing machine that accepts L
Repeat:
• Using the enumerator,
generate the next string of L
For input string w
• Compare generated string with w
If same, accept and exit loop
End of Proof
117
We have proven:
A language is recursively enumerable
if and only if
there is an enumeration procedure for it
118
A Language which is not
Recursively Enumerable
119
We want to find a language that
is not Recursively Enumerable
This language is not accepted by any
Turing Machine
120
Consider alphabet }{a
Strings: ,,,, aaaaaaaaaa
1a 2a 3a 4a
121
Consider Turing Machines
that accept languages over alphabet }{a
They are countable:
,,,, 4321 MMMM
122
Example language accepted by
},,{)( aaaaaaaaaaaaML i
},,{)( 642 aaaML i
iM
Alternative representation
)( iML
1a 2a 3a 4a 5a 6a 7a
0 1 1 10 0 0
123
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
124
Consider the language
)}(:{ iii MLaaL
L consists from the 1’s in the diagonal
125
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 43 aaL
126
Consider the language
)}(:{ iii MLaaL
L consists from the 0’s in the diagonal
)}(:{ iii MLaaL
L
127
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 21 aaL
128
Theorem:
Language is not recursively enumerableL
129
Proof:
is recursively enumerableL
Assume for contradiction that
There must exist some machine
that accepts kM
L
LML k )(
130
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?1MMk
131
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
132
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?2MMk
133
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
134
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?3MMk
135
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
136
Similarly: ik MM
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
for any i
Because either:
or
137
Thus the machine cannot exist kM
Therefore, the language
is not recursively enumerable
L
End of Proof
138
Observation:
There is no algorithm that describes L
(otherwise would be accepted by
some Turing Machine)
L
139
Recursive
Recursively Enumerable
Non Recursively Enumerable
L
140
A Language which is Recursively Enumerable
and not Recursive
141
We want to find a language which
There is a
Turing Machine
that accepts
the language
The machine
doesn’t halt
on some input
Is recursively
enumerable
But not
recursive
142
We will prove that the language
)}(:{ iii MLaaL
Is recursively enumerable
but not recursive
143
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 43 aaL
144
The language
Theorem:
)}(:{ iii MLaaL
is recursively enumerable
145
Proof:
We will give a Turing Machine that
accepts L
146
Turing Machine that accepts L
For any input string w
• Compute , for whichiaw
• Find Turing machine iM(using the enumeration procedure for Turing Machines)
• Simulate on inputiM ia
• If accepts, then accept iM w
i
End of Proof
147
Observation:
)}(:{ iii MLaaL
)}(:{ iii MLaaL
Recursively enumerable
Not recursively enumerable
(Thus, also not recursive)
148
Theorem:
The language )}(:{ iii MLaaL
is not recursive
149
Proof:
Assume for contradiction that is recursiveL
Then is recursive L
Take the Turing Machine that accepts M L
halts on any input:M
If accepts then reject
If rejects then accept
MM
150
L is recursive
But we know:
L is not recursively enumerable
thus, not recursive
CONTRADICTION!
Therefore, is not recursiveL
End of Proof
151
L
Recursive
Recursively Enumerable
Non Recursively Enumerable
L