Theory of Computati ON: Dept. Cs&It Uet Peshawar

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

THEORY OF

COMPUTATI
ON
BY: Muhammad Muneeb Ullah
MS(CS) Batch# IV

Dept.
CS&IT UET
PESHAWAR

THEORY OF COMPUTATION

Contents
UNDECIDIABILITY...................................................................................................................... 2
The Acceptance Problem for TMs:......................................................................................... 2
Theorem:............................................................................................................................... 2
Proof:.................................................................................................................................. 2
Conclusion:......................................................................................................................... 2
The Diagnalization Method:................................................................................................... 2
Some Basic Terminologies:.................................................................................................... 2
Function:............................................................................................................................. 2
Example:............................................................................................................................ 2
One-To-One Function:......................................................................................................... 3
Example:............................................................................................................................ 3
Example:............................................................................................................................ 3
Example:............................................................................................................................... 3
Onto Function:........................................................................................................................... 3
Example................................................................................................................................ 3
Example:............................................................................................................................... 3
Example:............................................................................................................................... 4
Correspondence Function:..................................................................................................... 4
Countable Sets:..................................................................................................................... 4
Example:............................................................................................................................ 4
Example:............................................................................................................................ 5
Answer: yes............................................................................................................................. 5
Uncountable:......................................................................................................................... 6
Example:............................................................................................................................ 6

THEORY OF COMPUTATION
UNDECIDIABILITY
The Acceptance Problem for TMs:
Consider the problem of testing whether a Turing Machine accepts a given
input.

Theorem

ATM { M , w : M is a TM that accepts input string w}.

ATM
Is undecidable
Proof:

First we observe that is Turing-recognizable. (Hence recognizers are more powerful than deciders).
Requiring a TM to halt on all inputs restricts the kinds of languages that it can recognize.
The following TM U recognizes
U = on input <M,w>, where M is a TM and w is a string:
1. Simulate M on input w.
2. If M ever enters it accept state, accept. If M ever enters its reject state, reject.

Note, this machine loops on input <M,w> if M loops on w. If the algorithm had some way to determine
that M was not halting on w, it could reject Hence the halting problem. I will show an algorithm has no
way to make this determination.
U is an example of universal Turing machine first proposed by Turing. It is capable of simulating any other
Turing machine from the description of that machine. The universal Turing machine played an important
early role in stimulating the development of stored-program computers.
Conclusion:

The general problem of software verification is not solvable algorithmically (by computer).

The Diagnalization Method:


The proof of the undecidability of the halting problem uses a technique called
Diagnalization, discovered first by mathematician Georg Cantor in 1873.
But before going into depth, some topics are necessary to be familiar with them.

Some Basic Terminologies:


Function:
A function is a mapping from one set to another that satisfies certain properties. Let A and B
be sets. A mapping m from A to B is a subset of A B. We denote that m is a mapping from A to B by f: A B
Example:
Let A = {1, 2, 3} and B = {a, b, c}. Then
A B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c), (3, a), (3, b), (3, c)}.
So m = {(1, a), (1, b), (2, a), (2, c)} is a mapping from A to B. Note that this is just one possible mapping from A to
B.

THEORY OF COMPUTATION
One-To-One Function:

A function f: A B is said to be one-to-one (or injective) if and only if f(x) = f(y) implies
x = y for all x and y in A. That is, for each element b B, there is at most one element from A that maps to
it.
Example:

Let A = {1, 2, 3} and B = {a, b, c} and f = {(1, b), (2, c), (3, a)}. This function is
one-to-one.
Example:

Let A = {1, 2, 3} and B = {a, b, c} and f = {(1, a), (2, b), (3, a)}. This function is not oneto-one since more than one element maps to a.
The requirement for a function to be one-to-one is that no arrows in the diagram point to the same element
of B. If A and B are finite sets then for f: A B to be 1-1 it is necessary for |A| |B|.

A
B
1

Example:

Let A = {a, b, c, d} and B = {1, 2, 3, 4, 5} and f(a) = 4, f(b) = 5, f(c) = 1, and f(d) = 3.
This function is one-to-one.

Onto Function:
A function f: A B is said to be onto (or surjective) if and only if for every element b
B, there is at least one element from A that maps to it.
That is, f: A B is onto if yBxA[f(x) = y].
Example

Let A = {1, 2, 3} and B = {a, b, c} and f = {(1, a), (2, b), (3, a)}. This function is not onto since there is no
element that maps to c.
Example:

Let A = {1, 2, 3} and B = {a, b, c} and f = {(1, b), (2, c), (3, a)}. This function is onto.
The requirement for a function to be onto is that each element of B has at least one arrow pointing
3

THEORY OF COMPUTATION
Into it. If A and B are finite sets then for f: A B to be onto it is necessary for |A| |B|.
Example:

Let A = {a, b, c, d} and B = {1, 2, 3, 4, 5} and f(a) = 4, f(b) = 5, f(c) = 1, and f(d) = 3. This function is not
onto (nothing maps to 2).

Correspondence Function:
A function f is a one-to-one correspondence (or a bijection), if is both one-to-one (injective) and onto
(surjective) .They also allow us to have a concept cardinality for infinite sets.

a1

b1

a2

b2

a3

b3

a4

b4

This is One-to-one and also Onto, so it is a Bijection or a One-to-one Correspondence


Cantor was concerned with the problem of measuring the sizes of infinite sets. If we have two infinite sets,
how can we tell whether one is larger than other or whether they are of the same size? For finite sets, of
course, answering these questions is easy. We count the elements in a finite set, and the resulting number is
its size. But, if we try to count the elements of an infinite set we will never finish. Cantor proposed a rather
nice solution to this problem. He observed that two finite sets have the same size if the elements of one set
can be paired with the elements of the other set. This idea can be extended to infinite sets.

Countable Sets:
A set A is countable if either it is finite or it has the same size as N.
Example:

Let N be the set of natural numbers {1,2,,} and E is the set of even
natural numbers {2,4,}. Using Cantors definition of size we can see that N and E
have the same size. The correspondence f mapping N to E is simply f(n) = 2n.
n
1
2
3

F(n)
2
4
6

THEORY OF COMPUTATION
Q {

m
: m, n N }.
n

Example:

Let Q be the set of positive rational numbers, that is


Is Q countable?
If Q is countable then how to show?

Answer: yes
In order to show that Q is countable there is a method called Diagnalization.
How to do?
Q seems to be much larger than N, yet these two sets have the same size: Q is countable
Steps:
1. Create a matrix containing all positive rational numbers.
m
n
2. Row, i=
contains all nos with Nominator m.
m
n
3. Column, j=
contains all nos with denominator j.
i
j
4.
, locate it ( i , j ).
5. Then turn this matrix into a list
1
1
3 2 1
2
3
2 3 4
Like from below figure { 1, 2 , , 3, ,4 , ,
, ,}
Note: Skip an element if it would cause a repetition.

THEORY OF COMPUTATION

Uncountable:
( 3.1415926..., 2 1.4142135...)
For some infinite sets no correspondence with N exists. Such sets are called
uncountable. (These sets are simply too big.)
A real number is one that has a decimal representation
Example:

The set of all real numbers R is uncountable.


Cantor proved this by using the Diagnalization method.
We show by contradiction that no correspondence exists between N and R.
Suppose the correspondence f existed. f must pair all the members of N with all the members of R. But we
will find an x in R that is not paired with anything in N, which will be our contradiction. We will construct
this x. We choose each digit of x to make x different from one of the real numbers that is paired with an
element of N. In the end we are sure that x is different from any real number that is paired. We illustrate
this idea by giving an example. We give decimal representation of x. It is a number between 0 and 1. Our
objective is to ensure that x is not f(n) for any n.

x = 0.4641

We know that x is not f(n) for any n since it differs from f(n) in the nth fractional digit.

You might also like