Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
What do we know?
29.10.2009
148
29.10.2009
149
1110101001010011010010000100100 111
( q 0 , 0 ) ( q1 , 0 , R )
( q0 , 1) ( q3 ,1, R )
29.10.2009
150
0 }:
0 / 0, R
q0
/
,L
(q2)
Department of Software Systems
0 / 0, R
1 / 1, R
q1
/ ,L
1 / 1, R
(q3)
OHJ-2306 Introduction to Theoretical Computer Science, Fall 2009
29.10.2009
151
29.10.2009
152
29.10.2009
153
29.10.2009
154
4 Decidability
29.10.2009
155
29.10.2009
156
29.10.2009
157
L (C )
( L ( A) \ L( B ))
( L( A) L( B ))
( L ( B ) \ L( A))
( L ( A) L ( B ))
29.10.2009
158
29.10.2009
159
= { 0, 1, 2, } and
= { 1, 2, 3, } have the
29.10.2009
160
f(a1) f(a2)
We have also examined the equal size of two sets |A| = |B|
through a bijective f: A B mapping
Bijection (correspondence) = one-to-one + onto
Onto (surjection): f(A) = B or b B: a A: b = f(a)
A bijection uniquely pairs the elements of the sets A and B
| | = | +|
An infinite set that has the same size as
is countable
29.10.2009
161
| | = | |
2|
0 -1
-2
-3
=| |
2|
=| |
| | = | 2|
| 2| = | 2| (relatively easy)
Follows by transitivity
29.10.2009
162
| | | |
| |=| |
29.10.2009
163
| |<| |
Let us assume that the interval [0, 1[ is countable and apply
Cantors diagonalization to the numbers x1, x2, x3, in [0, 1[
Let the decimal representations of the numbers within the
interval be (excluding infinite sequences of 9s)
xi = j + dij 10-j
Let us construct a new real number
x=
dj 10-j
such that
dj
0, if d jj
1, if d jj
29.10.2009
164
29.10.2009
165
29.10.2009
166
29.10.2009
10
167
29.10.2009
168
3. When tape 1 does not contain any code for the simulated
state qi, M has reached a final state. Now i = k+1 or i = k+2,
where qk is the last encoded state. The TM MU transitions to
final state accept or reject.
Clearly the TM MU accepts the binary string M, w if and only if
w L(M).
29.10.2009
11
169
29.10.2009
170
29.10.2009
12
171
cc
MOK
MDUP
MUT
29.10.2009
172
Corollary H
Proof.
=
ERR, where ERR is the easy to decide language:
ERR = { x { 0, 1 }* | x does not have a prefix that is
a valid code for a Turing machine }.
Counter-assumption: is Turing-recognizable
Then by Theorem B,
ERR = is Turing-recognizable.
U is known to be Turing-recognizable (Th. F) and now also is
Turing-recognizable. Hence, by Theorem C, U is decidable.
This is a contradiction with Theorem G and the counter-assumption
does not hold. I.e., is not Turing-recognizable.
29.10.2009
13
173
29.10.2009
174
29.10.2009
14
175
M, w
MU
MHALT
29.10.2009
176
Chomsky hierarchy
29.10.2009
15
177
D, , , D, , ,
0: Turing-recognizable languages
Decidable languages
U, HALTTM,
1: Context-sensitive languages
2: Context-free languages
3: Regular languages
Finite lang.
ADFA, EDFA,
e.g. { akbkck | k 0 }
e.g. {akbk | k 0 }
e.g. { ak | k 0 }
29.10.2009
178
29.10.2009
16
179
Let us assume that there exists a total Java method h that returns
true if the method represented by string m halts on input w and
false otherwise:
boolean h(String m, String w)
Now we can program the method hHat
boolean hHat( String m )
{ if (h(m,m))
while (true) ;}
Let H be the string representation of hHat. hHat works as follows:
hHat(H) halts
Department of Software Systems
h(H,H) = false
29.10.2009
17