0% found this document useful (0 votes)
53 views17 pages

Unit 3 Toc

The document discusses the Turing machine, which was invented by Alan Turing in 1936. It describes the key components and features of a Turing machine, including its finite state control, infinite tape for memory, read/write head, and transition function. It also discusses variations of the Turing machine model, such as multi-tape, multi-head, and non-deterministic Turing machines. The Church-Turing thesis states that a function is computable if and only if it is computable by a Turing machine.

Uploaded by

Manav Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views17 pages

Unit 3 Toc

The document discusses the Turing machine, which was invented by Alan Turing in 1936. It describes the key components and features of a Turing machine, including its finite state control, infinite tape for memory, read/write head, and transition function. It also discusses variations of the Turing machine model, such as multi-tape, multi-head, and non-deterministic Turing machines. The Church-Turing thesis states that a function is computable if and only if it is computable by a Turing machine.

Uploaded by

Manav Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Turing Machine

Turing machine was invented in 1936 by Alan Turing. It is an accepting device which accepts
Recursive Enumerable Language generated by type 0 grammar.

There are various features of the Turing machine:

1. It has an external memory which remembers arbitrary long sequence of input.


2. It has unlimited memory capability.
3. The model has a facility by which the input at left or right on the tape can be read easily.
4. The machine can produce a certain output based on its input. Sometimes it may be
required that the same input has to be used to generate the output. So in this machine,
the distinction between input and output has been removed. Thus a common set of
alphabets can be used for the Turing machine.

Formal definition of Turing machine


A Turing machine can be defined as a collection of 7 components:

Q: the finite set of states


∑: the finite set of input symbols
T: the tape symbol
q0: the initial state
F: a set of final states
B: a blank symbol used as a end marker for input
δ: a transition or mapping function.

The mapping function shows the mapping from states of finite automata and input symbol on
the tape to the next states, external symbols and the direction for moving the tape head. This is
known as a triple or a program for turing machine.

1. (q0, a) → (q1, A, R)

That means in q0 state, if we read symbol 'a' then it will go to state q1, replaced a by X and
move ahead right(R stands for right).

Example:
Construct TM for the language L ={0n1n} where n>=1.

Solution:

Turing machine work for 0011.


The simulation for 0011 can be shown as below:

Now, we will see how this turing machine will works for 0011. Initially, state is q0 and head
points to 0 as:

The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A
and head will move to the right as:

The move will be δ(q1, 0) = δ(q1, 0, R) which means it will not change any symbol, remain in
the same state and move to the right as:

The move will be δ(q1, 1) = δ(q2, B, L) which means it will go to state q2, replaced 1 by B and
head will move to left as:

Now move will be δ(q2, 0) = δ(q2, 0, L) which means it will not change any symbol, remain
in the same state and move to left as:
The move will be δ(q2, A) = δ(q0, A, R), it means will go to state q0, replaced A by A and
head will move to the right as:

The move will be δ(q0, 0) = δ(q1, A, R) which means it will go to state q1, replaced 0 by A,
and head will move to right as:

The move will be δ(q1, B) = δ(q1, B, R) which means it will not change any symbol, remain
in the same state and move to right as:

The move will be δ(q1, 1) = δ(q2, B, L) which means it will go to state q2, replaced 1 by B and
head will move to left as:

The move δ(q2, B) = (q2, B, L) which means it will not change any symbol, remain in the same
state and move to left as:
Now immediately before B is A that means all the 0?s are market by A. So we will move right
to ensure that no 1 is present. The move will be δ(q2, A) = (q0, A, R) which means it will go
to state q0, will not change any symbol, and move to right as:

The move δ(q0, B) = (q3, B, R) which means it will go to state q3, will not change any symbol,
and move to right as:

The move δ(q3, B) = (q3, B, R) which means it will not change any symbol, remain in the same
state and move to right as:

The move δ(q3, Δ) = (q4, Δ, R) which means it will go to state q4 which is the HALT state and
HALT state is always an accept state for any TM.

The same TM can be represented by Transition Diagram:


Basic Model of Turing machine
The turning machine can be modelled with the help of the following representation.

1. The input tape is having an infinite number of cells, each cell containing one input symbol
and thus the input string can be placed on tape. The empty tape is filled by blank characters.

2. The finite control and the tape head which is responsible for reading the current input symbol.
The tape head can move to left to right.

3. A finite set of states through which machine has to undergo.

4. Finite set of symbols called external symbols which are used in building the logic of turing
machine.
Variation of Turing Machine
1. Multiple track Turing Machine:

 A k-track Turing machine(for some k>0) has k-tracks and one R/W head
that reads and writes all of them one by one.
 A k-track Turing Machine can be simulated by a single track Turing
machine
2. Two-way infinite Tape Turing Machine:

 Infinite tape of two-way infinite tape Turing machine is unbounded in


both directions left and right.
 Two-way infinite tape Turing machine can be simulated by one-way
infinite Turing machine(standard Turing machine).
3. Multi-tape Turing Machine:

 It has multiple tapes and is controlled by a single head.


 The Multi-tape Turing machine is different from k-track Turing machine
but expressive power is the same.
 Multi-tape Turing machine can be simulated by single-tape Turing
machine.
4. Multi-tape Multi-head Turing Machine:

 The multi-tape Turing machine has multiple tapes and multiple heads
 Each tape is controlled by a separate head
 Multi-Tape Multi-head Turing machine can be simulated by a standard
Turing machine.
5. Multi-dimensional Tape Turing Machine:

 It has multi-dimensional tape where the head can move in any direction
that is left, right, up or down.
 Multi dimensional tape Turing machine can be simulated by one-
dimensional Turing machine
6. Multi-head Turing Machine:

 A multi-head Turing machine contains two or more heads to read the


symbols on the same tape.
 In one step all the heads sense the scanned symbols and move or write
independently.
 Multi-head Turing machine can be simulated by a single head Turing
machine.
7. Non-deterministic Turing Machine:

 A non-deterministic Turing machine has a single, one-way infinite tape.


 For a given state and input symbol has at least one choice to move (finite
number of choices for the next move), each choice has several choices of
the path that it might follow for a given input string.
 A non-deterministic Turing machine is equivalent to the deterministic
Turing machine.

TURING MACHINE VARIATIONS


Turing machines (TM) can also be deterministic or non-deterministic, but this does not make
them any more or less powerful.
However, if the tape is restricted so that you can only see use of the part of the tape with the
input, the TM becomes less powerful (linear bounded automata) and can only recognise
context sensitive languages.
Many other TM variations are equivalent to the original TM. This includes the following −
Multi-track

Multi-tape

Multi-head

Multi-dimensional tape

The off-line Turing machine

Multi-tape Turing Machine
A Turing machine with several tapes we call it a multi tape Turing machine.
Every tape’s have their own Read/Write head
For N-tape Turing Machine
M={( Q,X, ∑,δ,q0,B,F)}
We define
δ=QxXN ->Q x XN x {L,R}N
Example
If n=2 with current configuration δ(q0,a,e)=(q1,X,Y,L,R)

δ=QxXN ->Q x XN x {L,R}N


Non Deterministic Turing Machine
It is similar to DTM except that for any input and current state it has a number of choices.
A string is accepted by a NDTM if there is a sequence of moves that leads to a final state
The Transition function −
=Q x X ->2QxXx(L,R)
A NDTM is allowed to have more than one transition for a given tape symbol.

Multi-head Turing machine


It has a number of heads instead of one.
Each head independently reads/ writes symbols and moves left/right or keeps stationery.
Off-line Turing Machine
An offline Turing machine has two tapes, which are as follows −
 One tape is read-only and contains the input.
 The other is read-write and is initially blank.
Church’s Thesis for Turing Machine
In 1936, A method named as lambda-calculus was created by Alonzo Church in which
the Church numerals are well defined, i.e. the encoding of natural numbers. Also in
1936, Turing machines (earlier called theoretical model for machines) was created by
Alan Turing, that is used for manipulating the symbols of string with the help of tape.
Church Turing Thesis :

Turing machine is defined as an abstract representation of a computing device such


as hardware in computers. Alan Turing proposed Logical Computing Machines
(LCMs), i.e. Turing’s expressions for Turing Machines. This was done to define
algorithms properly. So, Church made a mechanical method named as ‘M’ for
manipulation of strings by using logic and mathematics.
This method M must pass the following statements:
 Number of instructions in M must be finite.
 Output should be produced after performing finite number of steps.
 It should not be imaginary, i.e. can be made in real life.
 It should not require any complex understanding.

Using these statements Church proposed a hypothesis called Church’s Turing


thesis that can be stated as: “The assumption that the intuitive notion of computable
functions can be identified with partial recursive functions.”
In 1930, this statement was first formulated by Alonzo Church and is usually referred
to as Church’s thesis, or the Church-Turing thesis. However, this hypothesis cannot
be proved.
The recursive functions can be computable after taking following assumptions:
1. Each and every function must be computable.
2. Let ‘F’ be the computable function and after performing some elementary
operations to ‘F’, it will transform a new function ‘G’ then this function ‘G’
automatically becomes the computable function.
3. If any functions that follow above two assumptions must be states as
computable function.

DECIDABILITY
The Church-Turing thesis says that every solvable decision problem can be transformed into
an equivalent Turing machine problem.
It can be explained in two ways, as given below −
 The Church-Turing thesis for decision problems.
 The extended Church-Turing thesis for decision problems.
Let us understand these two ways.

The Church-Turing thesis for decision problems


There is some effective procedure to solve any decision problem if and only if there is a Turing
machine which halts for all input strings and solves the problem.

The extended Church-Turing thesis for decision problems


A decision problem Q is said to be partially solvable if and only if there is a Turing machine
which accepts precisely the elements of Q whose answer is yes.

Proof
A proof by the Church-Turing thesis is a shortcut often taken in establishing the existence of
a decision algorithm.
For any decision problem, rather than constructing a Turing machine solution, let us describe
an effective procedure which solves the problem.
The Church-Turing thesis explains that a decision problem Q has a solution if and only if there
is a Turing machine that determines the answer for every q ϵ Q. If no such Turing machine
exists, the problem is said to be undecidable.
There are two types of languages in the theory of computation (TOC), which are as follows −
 Decidable
 Undecidable
A problem is called decidable, when there is a solution to that problem and also can construct
algorithms corresponding to that.

Example of Decidable Problem


Find all the odd numbers in the range from 1 to 50.
For this problem, we can easily find a solution by constructing an algorithm. In terms of Turing
Machine (TM), if a problem is decidable, then the Turing machine halts whether or not it
accepts its input.
In terms of finite automata (FA), decidable refers to the problem of testing whether a
deterministic finite automata (DFA) accepts an input string. A decidable language corresponds
to algorithmically solvable decision problems.

Decidability Theorem
A language L over Σ is called decidable if,
 There exist a Turing Machine M, that accepts language L
 w€Σ*, M halts

Decidability
For the Recursive Language
 A language ‘L’ is said to be recursive if there exists a Turing Machine which
will accept all the strings in ‘L’ and reject all the strings not in ‘L’.
 The TM will halt every time and give an answer either accepted or rejected for
each and every input.
Recursively Enumerable languages −
 A language ‘L’ is said to be recursively enumerable if there exists a TM which
accepts and halt for all input in ‘L’.
 But may or may not halt for all input, which are not in ‘L’.
A Language ‘L’ is decidable if it is a recursive language.
All decidable languages are recursive languages and vice versa.
The diagram given below explains the decidable language −

Halting Problem
The Halting Problem is the problem of deciding or concluding based on a given arbitrary
computer program and its input, whether that program will stop executing or run-in an infinite
loop for the given input.
The Halting Problem tells that it is not easy to write a computer program that executes in the
limited time that is capable of deciding whether a program halts for an input.
In addition to that the Halting Problem never says that it is not practicable to determine whether
a given random program is going to halt (stop).
Generally, it asks the question like “Given a random program and an input, conclude whether
the given random program is going to halt when that input is given”.

Write a Halting Problem


An example of writing the Halting Problem is as follows −
INPUT − Program P and a string S.
OUTPUT − if P stops on S, it returns 1.
Otherwise, if P enters into an endless loop on S, it returns 0.
Let us consider the Halting Problem called H having the solution.
Now H takes the following two inputs −
 Program P
 Input S.
If P stops on S, then H results in “halt”, otherwise H gives the result “loop”.
The diagrammatic representation of H is as follows −

Example
ATM = {(M,w) | M is a TM and M halts at input w }.
We can build a universal Turing machine which can simulate any Turing machine on any
input.
Let’s consider TM which recognizing the Altering Turing Machine (ATM) −
Recognize-ATM (<M,w>)
Simulate M using UTM till it halts
If M halts and accept then
Accept
Else
Reject
Suppose, if M goes into an infinite loop on input w, then the TM Recognize-ATM is going to
run forever which means TM is only a recognizer, not a decider.
A decider for this problem would call a halt to simulations that loop forever.
Now the question is whether an ATM is TM decidable is equivalent to asking the question
whether we can tell if a TM M will halt on input w.
Because of this, both versions of this question are generally called the halting problem.

Reducibility and its use in proving undecidability

Decidable Problems
A problem is decidable if we can construct a Turing machine which will halt in
finite amount of time for every input and give answer as ‘yes’ or ‘no’. A decidable
problem has an algorithm to determine the answer for a given input.
Examples
 Equivalence of two regular languages: Given two regular languages,
there is an algorithm and Turing machine to decide whether two regular
languages are equal or not.
 Finiteness of regular language: Given a regular language, there is an
algorithm and Turing machine to decide whether regular language is finite
or not.
 Emptiness of context free language: Given a context free language, there
is an algorithm whether CFL is empty or not.
Undecidable Problems
A problem is undecidable if there is no Turing machine which will always halt in
finite amount of time to give answer as ‘yes’ or ‘no’. An undecidable problem has
no algorithm to determine the answer for a given input.
Examples
 Ambiguity of context-free languages: Given a context-free language,
there is no Turing machine which will always halt in finite amount of time
and give answer whether language is ambiguous or not.
 Equivalence of two context-free languages: Given two context-free
languages, there is no Turing machine which will always halt in finite
amount of time and give answer whether two context free languages are
equal or not.
 Everything or completeness of CFG: Given a CFG and input alphabet,
whether CFG will generate all possible strings of input alphabet (∑*)is
undecidable.
 Regularity of CFL, CSL, REC and REC: Given a CFL, CSL, REC or
REC, determining whether this language is regular is undecidable.
Note: Two popular undecidable problems are halting problem of TM and PCP (Post
Correspondence Problem). Semi-decidable Problems
A semi-decidable problem is subset of undecidable problems for which Turing
machine will always halt in finite amount of time for answer as ‘yes’ and may or
may not halt for answer as ‘no’.
Relationship between semi-decidable and decidable problem has been shown in
Figure 1 as:

Rice’s Theorem
Every non-trivial (answer is not known) problem on Recursive Enumerable
languages is undecidable.e.g.; If a language is Recursive Enumerable, its
complement will be recursive enumerable or not is undecidable.
Reducibility and Undecidability
Language A is reducible to language B (represented as A≤B) if there exists a
function f which will convert strings in A to strings in B as:
w ɛ A <=> f(w) ɛ B
Theorem 1: If A≤B and B is decidable then A is also decidable.
Theorem 2: If A≤B and A is undecidable then B is also undecidable.
Post Correspondence Problem
Post Correspondence Problem is a popular undecidable problem that was
introduced by Emil Leon Post in 1946. It is simpler than Halting Problem. In this
problem we have N number of Dominos (tiles). The aim is to arrange tiles in such
order that string made by Numerators is same as string made by Denominators. In
simple words, lets assume we have two lists both containing N words, aim is to find
out concatenation of these words in some sequence such that both lists yield same
result. Let’s try understanding this by taking two lists A and B
A=[aa, bb, abb] and B=[aab, ba, b]
Now for sequence 1, 2, 1, 3 first list will yield aabbaaabb and second list will yield
same string aabbaaabb. So the solution to this PCP becomes 1, 2, 1, 3. Post
Correspondence Problems can be represented in two ways:
1. Domino’s Form
:

2. Table Form
:
Lets consider following examples. Example-
1:

Explanation –
 Step-1: We will start with tile in which numerator and denominator are
starting with same number, so we can start with either 1 or 2. Lets go
with second tile, string made by numerator- 10111, string made by
denominator is 10.
 Step-2: We need 1s in denominator to match 1s in numerator so we will
go with first tile, string made by numerator is 10111 1, string made by
denominator is 10 111.
 Step-3: There is extra 1 in numerator to match this 1 we will add first tile
in sequence, string made by numerator is now 10111 1 1, string made by
denominator is 10 111 111.
 Step-4: Now there is extra 1 in denominator to match it we will
add third tile, string made by numerator is 10111 1 1 10, string made by
denominator is 10 111 111 0.
Final Solution - 2 1 1 3
String made by numerators: 101111110
String made by denominators: 101111110
 As you can see, strings are same.

Recursive Theorem

You might also like