languages and finite automata - florida institute of...
TRANSCRIPT
![Page 1: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/1.jpg)
1
Reducibility
![Page 2: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/2.jpg)
There are two main techniques for showing that problems are undecidable:
diagonalization and reduction
2
![Page 3: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/3.jpg)
We say that a problem A is reduced to a problem B if the decidability of A follows from the decidability of B.
Linz, 6th, page 315
3
![Page 4: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/4.jpg)
4
Problem is reduced to problemA B
If we can solve problem then
we can solve problem
B
A
B
A
![Page 5: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/5.jpg)
A is reducible to B if we can use B as a subroutine to solve A.
Use a halting TM for B in the construction of a halting TM which decides problem A.
5
![Page 6: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/6.jpg)
6
If is undecidable then is undecidable
If is decidable then is decidableB A
A B
Problem is reduced to problemA B
![Page 7: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/7.jpg)
7
Example: the halting problem
is reduced to
the state-entry problem
So, if the halting problem is undecidable, then the state-entry problem is undecidable.
![Page 8: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/8.jpg)
8
The state-entry problem
Inputs: M•Turing Machine
•State q
Question: Does M
•String w
enter state q
on input ?w
![Page 9: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/9.jpg)
9
Theorem:
The state-entry problem is undecidable
Proof: Reduce the halting problem to the
state-entry problem.
![Page 10: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/10.jpg)
10
Suppose we have an algorithm
(Turing Machine) that solves the
state-entry problem
We will construct an algorithm
that solves the halting problem
![Page 11: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/11.jpg)
11
Algorithm for
state-entry
problem
M
w
q
YES
NO
entersM q
doesn’t
enterM q
Assume we have the state-entry algorithm:
![Page 12: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/12.jpg)
12
Algorithm for
Halting problem
M
w
YES
NO
halts onM w
doesn’t
halt onM w
We want to design the halting algorithm:
![Page 13: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/13.jpg)
13
Modify any machine to construct :M
•Add new state q
•From any halting state add transitions to q
M q
halting statesSingle
halt state
M
M
![Page 14: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/14.jpg)
14
M halts
M halts on state q
if and only if
![Page 15: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/15.jpg)
15
machine and string
Algorithm for halting problem:
Inputs: M w
1. Construct machine with state M q
2. Run algorithm for state-entry problem
with inputs: M wq, ,
![Page 16: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/16.jpg)
16
Generate
M M
w
M
q
w
State-entry
algorithm
Halting problem algorithm
YES
NO
YES
NO
![Page 17: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/17.jpg)
17
Since the halting problem is undecidable,
it must be that the state-entry problem
is also undecidable
END OF PROOF
We reduced the halting problem
to the state-entry problem
![Page 18: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/18.jpg)
18
Another example:
the halting problem
is reduced to
the blank-tape halting problem
![Page 19: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/19.jpg)
19
The blank-tape halting problem
Input: MTuring Machine
Question: Does M halt when started with
a blank tape?
![Page 20: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/20.jpg)
20
Theorem:
Proof: Reduce the halting problem to the
blank-tape halting problem
The blank-tape halting problem is undecidable
![Page 21: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/21.jpg)
21
Suppose we have an algorithm
for the blank-tape halting problem
We will construct an algorithm
for the halting problem
![Page 22: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/22.jpg)
22
Algorithm for
blank-tape
halting problem
M
YES
NO
halts on
blank tape
M
doesn’t halt
on blank tape
M
Assume we have the blank-tape halting algorithm/machine. It looks
like this:
![Page 23: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/23.jpg)
23
Algorithm for
halting problem
M
w
YES
NO
halts onM w
doesn’t
halt onM w
We want to design a machine that decides
the halting problem. The machine looks
like this:
![Page 24: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/24.jpg)
24
wMConstruct a new machine
• On blank tape writes w
• Then continues execution like M
wM
M
then write w
step 1 step2
if blank tape execute
with input w
![Page 25: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/25.jpg)
25
M halts on input string
wM halts when started with blank tape
if and only if
w
![Page 26: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/26.jpg)
26
Algorithm for halting problem:
1. Construct wM
2. Run algorithm for
blank-tape halting problem
with input
,
wM
machine and stringInputs: M w
![Page 27: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/27.jpg)
27
Generate
wM
M
w
blank-tape
halting
algorithm
Halting problem algorithm
YES
NOwM
YES
NO
![Page 28: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/28.jpg)
28
Since the halting problem is undecidable,
the blank-tape halting problem is
also undecidable
END OF PROOF
We reduced the halting problem
to the blank-tape halting problem
![Page 29: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/29.jpg)
29
Does machine halt on input ?
Summary of Undecidable Problems
Halting Problem:
M w
Membership problem:
Is a string member of a
recursively enumerable language ?L
w
Does machine accept string ?M w
In other words:
![Page 30: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/30.jpg)
30
Does machine enter state
on input ?
Does machine halt when starting
on blank tape?
Blank-tape halting problem:
M
State-entry Problem:
M
w
q
![Page 31: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/31.jpg)
31
Uncomputable Functions
![Page 32: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/32.jpg)
32
Uncomputable Functions
A function is uncomputable if it cannot
be computed for all of its domain
Domain Values
region
f
![Page 33: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/33.jpg)
33
An uncomputable function:
)(nf
maximum number of moves until
any Turing machine with states
halts when started with the blank tape
n
![Page 34: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/34.jpg)
34
Theorem: Function is uncomputable)(nf
Proof:
Then the blank-tape halting problem
is decidable
Assume for contradiction that
is computable)(nf
![Page 35: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/35.jpg)
35
Algorithm for blank-tape halting problem:
Input: machine M
1. Count states of : M m
2. Compute )(mf
3. Simulate for steps
starting with empty tape
M )(mf
If halts then return YES
otherwise return NO M
![Page 36: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/36.jpg)
36
Therefore, the blank-tape halting
problem is decidable
However, the blank-tape halting
problem is undecidable
Contradiction!!!
![Page 37: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/37.jpg)
37
Therefore, function in uncomputable)(nf
END OF PROOF
![Page 38: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/38.jpg)
38
Rice’s Theorem
![Page 39: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/39.jpg)
39
Non-trivial properties of
recursively enumerable languages:
any property possessed by some (not all)
recursively enumerable languages
Definition:
![Page 40: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/40.jpg)
40
Some non-trivial properties of
recursively enumerable languages:
• is emptyL
L• is finite
L• contains two different strings
of the same length
![Page 41: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/41.jpg)
41
Rice’s Theorem:
Any non-trivial property of
a recursively enumerable language
is undecidable
![Page 42: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/42.jpg)
Rice’s Theorem
In exactly the same manner, we can substitute other questions such as “Does L(M) contain any string of length five?” or “Is L(M) regular?” without affecting the argument essentially. These questions, as well as similar questions, are all undecidable. A general result fromalizngthis is known as Rice’s theorem.
42
![Page 43: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/43.jpg)
Rice’s Theorem
This theorem states that any nontrivial property of a recursively enumerable language is undecidable. The adject“nontrivial” refers to a property possed by some but not all recursively enumerable languages. A precide statement and a proof of Rice’s theory can be found in Hopcroft and Ullman (1979).
Linz, 6th, pages 321-322
43
![Page 44: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/44.jpg)
A property of the RE languages is simply a set of RE languages. Thus, the property of being context-free is formally the set of all CFL’s. The property of being empty is the set {∅} consisting of only the empty language.
Theorem 9.11: (Rice’s Theorem) Every nontrivial property of the RE languages is undecidable.
Hopcroft, Motwani, Ullman, 3rd, pages 397-39844
![Page 45: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/45.jpg)
45
We will prove some non-trivial properties
without using Rice’s theorem
![Page 46: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/46.jpg)
46
Theorem:
For any recursively enumerable language Lit is undecidable to determine whether
is empty L
Proof:
We will reduce the membership problem
to this problem
![Page 47: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/47.jpg)
47
Algorithm for
empty language
problem
M
YES
NO
Assume we have the empty language algorithm:
Let be the machine that accepts M L
)(ML
)(ML
empty
not empty
LML )(
![Page 48: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/48.jpg)
48
Algorithm for
membership
problem
M
w
YES
NO
acceptsM w
rejectsM w
We will design the membership algorithm:
![Page 49: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/49.jpg)
49
First construct machine : wM
When enters a final state,
compare original input string with w
M
Accept if original input is
the same with w
![Page 50: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/50.jpg)
50
Lw
)( wML is not empty
if and only if
}{)( wML w
![Page 51: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/51.jpg)
51
Algorithm for membership problem:
Inputs: machine and string M w
1. Construct wM
2. Determine if is empty )( wML
YES: then )(MLw
NO: then )(MLw
![Page 52: Languages and Finite Automata - Florida Institute of …cs.fit.edu/~ryan/cse4083/busch/class21.pdfUse a halting TM for B in the construction of a halting TM which decides problem A](https://reader031.vdocument.in/reader031/viewer/2022022517/5b08579f7f8b9a51508bbde0/html5/thumbnails/52.jpg)
52
construct
wM
Check if
)( wML
is empty
YES
NO
M
w
NO
YES
Membership algorithm
wM
END OF PROOF