Docsity

Computability and Undecidability: A Study of Computation, Decidability, and Enumerability, Study notes of Algorithms and Programming

Toggle sidebar
bg1
Computability Notes
Lecture 1
In this section of the course we will explore the notion of computation. Till
now we have seen problems which have been solvable, that is, for which
there exist procedures. One would like to ask whether there exist prob-
lems which cannot be solved? Are there problems that can be solved but
are ‘intractable’? What do we mean by ‘computation’ ? In answering these
questions we will present a standard model of computation which intuitively
corresponds to our notion of computation. We will also prove some basic
results about this model.
This area of mathematics was motivated by questions such as the problem
posed by David Hilbert, whether there exists a procedure to determine the
truth or falsity of any mathematical proposition. This question was resolved
by Kurt G¨odel who proved that no such procedure could exist by construct-
ing a formula whose very definition stated that it could not be proved or
disproved. Other related questions are about intelligence of machines. Alan
Turing gave a famous test to determine intelligence, which is based on a ma-
chine’s ability to imitate a human.
Definition. An alphabet is a non-empty, finite set of symbols. For example
A={0,1,2, a, b, c}is an alphabet. The set of symbols on a keyboard is also
an alphabet. A∗is the set of strings over the alphabet A.
Let A={a0,...,ar}be an alphabet; let W⊆A∗; and let Pbe a ‘procedure’.
For now we can consider a procedure to be a program or recipe with a finite
description. We will be more precise later.
Definitions:
1. Pis a decision procedure for Wiff ∀x∈A∗,P, given x, halts and
returns if x∈Wand a0otherwise.
2. Wis decidable if there exists a decision procedure for W.
1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Computability and Undecidability: A Study of Computation, Decidability, and Enumerability and more Study notes Algorithms and Programming in PDF only on Docsity!

Computability Notes

Lecture 1

In this section of the course we will explore the notion of computation. Till now we have seen problems which have been solvable, that is, for which there exist procedures. One would like to ask whether there exist prob- lems which cannot be solved? Are there problems that can be solved but are ‘intractable’? What do we mean by ‘computation’? In answering these questions we will present a standard model of computation which intuitively corresponds to our notion of computation. We will also prove some basic results about this model.

This area of mathematics was motivated by questions such as the problem posed by David Hilbert, whether there exists a procedure to determine the truth or falsity of any mathematical proposition. This question was resolved by Kurt G¨odel who proved that no such procedure could exist by construct- ing a formula whose very definition stated that it could not be proved or disproved. Other related questions are about intelligence of machines. Alan Turing gave a famous test to determine intelligence, which is based on a ma- chine’s ability to imitate a human.

Definition. An alphabet is a non-empty, finite set of symbols. For example A = { 0 , 1 , 2 , a, b, c} is an alphabet. The set of symbols on a keyboard is also an alphabet. A∗^ is the set of strings over the alphabet A.

Let A = {a 0 ,... , ar} be an alphabet; let W ⊆ A∗; and let P be a ‘procedure’. For now we can consider a procedure to be a program or recipe with a finite description. We will be more precise later.

Definitions:

  1. P is a decision procedure for W iff ∀x ∈ A∗, P , given x, halts and returns  if x ∈ W and a 0 otherwise.
  2. W is decidable if there exists a decision procedure for W.
  1. P is an enumeration procedure for W iff P outputs exactly the the elements of W (in any order with repetitions allowed).
  2. W is enumerable if there exists an enumeration procedure for W.

Example. A∗^ is enumerable. Proof. Let A = {a 0 , a 1 ,... , an}. Output the words of length 0, 1 , 2 ,.... We can do this in lexicographic order.

Example. PRIME?, SAT?, CYCLE? (in a graph), NEG-WT-CYCLE? etc. are all decidable. Proof. We gave algorithms for them and algorithms are ‘procedures’.

Theorem 1 Every decidable set is enumerable.

Proof. Let W ⊆ A∗^ be a decidable set with decision procedure P. Enumer- ate as follows: enumerate A∗^ separately and output x ∈ A∗^ iff x ∈ W , which can be checked using P.

Theorem 2 W ⊆ A∗^ is decidable iff W and A∗\W are enumerable.

Proof. (⇒) If W is decidable, say by procedure P , then we can decide A∗\W using P and inverting its output. By Theorem 1, W and A∗\W are enumerable. (⇐) Assume that P and P ′^ are enumeration procedures for W and A∗\W respectively. Given x ∈ A∗, start the enumerations P and P ′. At some point, one of P or P ′^ will output x, and x ∈ W if P outputs x and x 6 ∈ W if P ′ outputs x. This gives a decision procedure for W (and A∗\W ).

Definition. A function f : A∗^ → A∗^ is computable iff there is a procedure which, given x ∈ A∗, returns f (x).

Example. Length of a List, Modular Exponentiation, DFS tree, Sorting etc. all are computable functions.

Theorem 3 Let A be an alphabet, f : A∗^ → A∗^ be a function, and # 6 ∈ A. Then the following are equivalent.

c. Only αk is a halt instruction.

The starting instruction for the program is α 0. All registers are initially empty except R 0 which contains the input.

What can we say about the power of such register machines? Clearly, each register program gives rise to a procedure. However, there is a famous thesis of Church and Turing regarding the power of register machines and other equivalent models of computation like Turing machines, the lambda calcu- lus, general recursive functions, etc. The Church-Turing thesis says that no physically realizable notion of computation is more powerful than a register machine, or a Turing machine, or the lambda calculus, or general recursive functions, etc. While there cannot be any proof of this thesis, about 70 years of research supports this claim.

Lecture 2

In the previous lecture we saw the definition of a register machine and reg- ister programs. We begin with an example.

Example 1: Consider a register machine over the alphabet A = { 1 }. Lets write a Program to check if the input in R 0 has even number of 1’s or not.

0 if R 0 =  then 6 else 1 1 R 0 = R 0 − 1 2 if R 0 =  then 5 else 3 3 R 0 = R 0 − 1 4 goto 0 (i.e. if R 0 =  then 0 else 0) 5 R 0 = R 0 + 1 6 Print 7 Halt

From now on, we will assume that any algorithm, which we can give with pseudo code, can be turned into a register program.

Some Notations, P: X → halt - means register program P started with input X in R 0 eventually halts.

P: X → ∞ - means register program P started with input X in R 0 never halts. P: X → y - means register program P started with input X in R 0 halts and outputs only y.

Notice that, P(as given in example 1): X → halt. Also P’(as defined below): X → ∞.

P’ = 0 goto 0 1 Halt

As before, for W ⊆ A∗, we define

a. P enumerates W, if P on input , prints all words in W.

b. W is R-enumerable, if ∃ P s.t. P enumerates W.

c. P decides W if ∀x ∈ W , P: x →  and P: x → y (y 6 = ) otherwise.

d. W is R-decidable if ∃P s.t. P decides W.

e. for f : A∗^ → A∗, P computes f if and only if ∀x ∈ A∗, P:x→ f (x).

f. f is R-computable if ∃P which computes f.

Limits of Decidability

Are there sets that are not enumerable? Are there functions that are not computable? YES! we will give simple cardinality argument.

Theorem 4 There exists functions which are not computable. Also there exists sets which are not enumerable.

Proof: Consider all the functions from N → { 0 , 1 }. Notice that there are uncountably many such functions. But how many programs exists? Only countably many! (They are enumerable, as we’ve seen.) Therefore there exists functions which cannot be computed by any program. Here is another proof, allowing us to introduce a powerful technique known as diagonalization. Suppose that there are a countable number of functions; then the functions can be put into the following tabular form.

Note that the above holds for any P. But see what happens when we instantiate P with Pm (diagonalization!). We get

Pm : gPm → halts ⇐⇒ Pm : gPm → ∞

This is a contradiction. So our initial assumption that HALT’ must be decidable was wrong. The proof will be complete once we mention how to construct Pm from Pn. First, we can assume that Pn prints an answer and halts, therefore, we construct Pm so that when Pn prints , Pm does not halt, otherwise it does halt. This is accomplished by replacing the only halt instruction in Pn, which we assume is the kth instruction by:

k if R 0 =  then k else k + 1 k+1 halt

 To see in more detail why this is diagonalization, consider the following table.

0 1 2 3 4 5  a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 a 0 P 0 H ∞ ∞ H H H P 1 ∞ ∞ H ∞ H H P 2 H H ∞ ∞ H ∞ P 3 H ∞ ∞ ∞ ∞ H P 4 H H ∞ H ∞ H P 5 ∞ ∞ H ∞ H H P 6 ∞ ∞ ∞ H ∞ ∞

Notice that program Pm, by construction, differs from every program along the diagonal of the above table. This leads to a contradiction. Now we consider the classic Halting Problem.

HALT := {gP |P :  → halts}

Theorem 6 The language HALT is undecidable.

Proof: By reduction from HALT’: we will show that if HALT is decidable, then so is HALT’, a contradiction. Therefore, HALT is undecidable. Given program P , we construct P +^ from P , as follows. Program P +^ is as follows.

0 Let R 0 = R 0 + a 0 1 Let R 0 = R 0 + a 0 2 Let R 0 = R 0 + a 0 . . . |gP | − 1 Let R 0 = R 0 + a 0 P with all labels l replaced by l + |gP |

Notice that P +^ writes the G¨odel number gP in register R 0 , and then behaves just program P. Therefore:

P : gP → halts ⇐⇒ P +^ :  → halts

By the definition of HALT and HALT’, we can see that

P ∈ HALT’ ⇐⇒ P +^ ∈ HALT

Therefore, if HALT is decidable, then so is HALT’. But, since HALT’ is not decidable, neither is HALT. (This is an example of reduction.) 

Theorem 7 HALT, HALT’ are enumerable.

Proof: We want a program which prints out the G¨odel number of all the programs which halt. We cannot simply test programs for termination, be- cause if a program does not halt, we cannot determine this by running it. Similarly, we cannot cycle through all the programs running each one a finite number of steps, because there are an infinite number of programs. We use the following clever idea. We go through rounds, where in each round i, we run the first i programs for i steps. So if program 1,000, halts in a billion steps, we will find that out in the billionth round, and will print its G¨odel number. If some program does not halt, we will never write it down. 

Theorem 8 The set {P |gP : P /∈ HALT} is not enumerable.

Proof: We have already shown that HALT is enumerable, but not decidable. Note that the above set is the complement of HALT. But if both HALT and its complement are enumerable, then, as we have seen, both are decidable, a contradiction.