Professional Documents
Culture Documents
4 Decidability
Ch4 Decidability
It may seem “obvious” that every function can be computed/every problem can be
solved algorithmically, given sufficient time.
o However, this turns out to be false: there exist functions that cannot be
computed within any finite number of steps!!
o This chapter discusses algorithmic unsolvability.
Why study undecidability/unsolvability?
o To know which problems cannot be solved exactly and hence try to develop
algorithms that don’t give the exact solution, but a good-enough approximate
solution.
o This is also of deep philosophical interest (to some of us? ). Gives us a
perspective on computation. Insaan knows of the limits of his/her artifacts.
We begin by studying some problems solvable by algorithms, or in other words,
decidable languages.
o This order of studying helps us appreciate better the unsolvable problems.
o The decidable problems discussed here have practical applications.
First, we study decidable problems concerning regular languages
o What are regular languages? Languages accepted by finite automata.
o Applications of finite automata:
http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/fa-applications.html
Examples of systems that can be modeled by FA are: control circuits of computers,
computer network communication protocols, lexical analysers for compilers etc.
o We can decide whether
a finite automaton will accept a string
the language of a finite automaton is empty
two finite automata are equivalent
We choose to represent various computational problems by languages.
o Doing so is convenient because we have already set up terminology for dealing
with languages.
o For example, the acceptance problem for DFAs of testing whether a particular
DFA accepts a given string can be expressed as a language, ADFA. This
Page 1 of 18
Dr A. Alvi Ch.4 Decidability
language contains the encodings of all DFAs together with strings that the
DFAs accept. Let
o Proof:
The input <B,w> is a representation of a DFA B together with a
string w.
One reasonable representation of B is simply a list of its five
components, Q, ∑, , qo, and F.
When M receives its input, M first determines whether it properly
represents a DFA B and a string w. If not, M rejects.
Then M carries out the simulation directly. It keeps track of B's
current state and B's current position in the input w by writing this
information down on its tape.
Initially, B's current state is qo and B's current input position is the
leftmost symbol of w.
The states and position are updated according to the specified
transition function . When M finishes processing the last symbol
of w, M accepts the input if B is in an accepting state; M rejects the
input if B is in a nonaccepting state.
Page 2 of 18
Dr A. Alvi Ch.4 Decidability
Theorem 4.2: Now do the same for NFA’s: ANFA is a decidable language
o
Theorem 4.3: AREX is a decidable language
Page 3 of 18
Dr A. Alvi Ch.4 Decidability
Emptiness Testing: Now we test whether a finite automaton accepts any strings at all,
rather than a particular string (as in previous examples). Let
Proof: We use a TM T that uses a marking algorithm as in Ex. 3.23 (which students
were assigned to read; the one about graph)
Page 4 of 18
Dr A. Alvi Ch.4 Decidability
CFG = PDA as they can be inter-converted. So everything said about CFGs is also
true about PDAs.
Page 5 of 18
Dr A. Alvi Ch.4 Decidability
Theorem 4.8: Emptiness testing for the language of a CFG (i.e. is the language
generated by a CFG empty?)
o What’s a CFG?
o Let
Page 6 of 18
Dr A. Alvi Ch.4 Decidability
Page 7 of 18
Dr A. Alvi Ch.4 Decidability
Page 8 of 18
Dr A. Alvi Ch.4 Decidability
NO!
o Many such unsolvable problems
o Aim: For you to develop a feel for unsolvable problems and to be able to prove
their unsolvability.
The difficulty in the halting problem lies in the requirement that the decision
procedure must work for all programs and inputs.
There are programs (interpreters) that simulate the execution of whatever source code
they are given. Such programs can demonstrate that a program does halt if this is the
case: the interpreter itself will eventually halt its simulation, which shows that the
original program halted. However, an interpreter will not halt if its input program
does not halt, so this approach cannot solve the halting problem as stated. It does
not successfully answer "doesn't halt" for programs that do not halt.
While Turing's proof shows that there can be no general method or algorithm to
determine whether algorithms halt, individual instances of that problem may very
well be susceptible to attack.
o Given a specific algorithm, one can often show that it must halt for any input,
and in fact computer scientists often do just that as part of a correctness proof.
But each proof has to be developed specifically for the algorithm at hand;
there is no mechanical, general way to determine whether algorithms on a
Turing machine halt (think of the interpreter analogy).
o However, there are some heuristics that can be used in an automated fashion to
attempt to construct a proof, which succeed frequently on typical programs.
This field of research is known as automated termination analysis.
Page 9 of 18
Dr A. Alvi Ch.4 Decidability
Problem: Whether a given TM M accepts a given input string. Call this ATM, just as
we used ADFA and ACFG.
o While ADFA and ACFG are decidable, ATM is not!
o Let
U is the universal Turing machine proposed by Turing that can simulate any other
Turing machine from the description of that machine.
Diagonalization Method: Used to prove the Halting Problem.
o A technique discovered by mathematician Georg Cantor in 1873 to count
infinite sets.
o Sounds weird, but even infinite sets are classified as countable or uncountable,
depending on if we can find a way to enumerate/count the elements of an
infinite set.
o If we can pair the elements of one set with those of another, then we can
compare their sizes.
o Cantor thought of a nice way of doing this mapping/pairing using diagonals of a
matrix. Can be done for infinite sets.
o Good link:
http://platonicrealms.com/minitexts/Infinity-You-Cant-Get-There-From-Here/
o Hand-counting example.
Page 10 of 18
Dr A. Alvi Ch.4 Decidability
o Note that no element of set A can remain unmapped because a function maps
every element in the domain (set A) to an element in the range (set B).
o So the set of natural numbers is used to count the members of another set.
Page 11 of 18
Dr A. Alvi Ch.4 Decidability
Page 12 of 18
Dr A. Alvi Ch.4 Decidability
o You might think now that we can set up such correspondences with N for any
infinite set.
o This isn’t so. There are uncountable sets that are too big.
Page 13 of 18
Dr A. Alvi Ch.4 Decidability
o x can be any real number. We choose its integer part to be zero for no special
reason.
Page 14 of 18
Dr A. Alvi Ch.4 Decidability
Page 15 of 18
Dr A. Alvi Ch.4 Decidability
Page 16 of 18
Dr A. Alvi Ch.4 Decidability
Page 17 of 18
Dr A. Alvi Ch.4 Decidability
A Turing-unrecognizable language
o We showed that ATM is not decidable but Turing-recognizable at least.
o Some languages not even that!
o Complement of a language is all the strings not in the language.
o A language is called co-Turing-recognizable if it’s the complement of a
Turing-recognizable language.
o We need the following theorem:
o
Page 18 of 18