0% found this document useful (0 votes)
18 views29 pages

Module-5 Notes

The document provides an overview of Turing Machines, a computational model proposed by Alan Turing in 1936, which is capable of simulating any algorithmic procedure. It describes the structure, functioning, and notation of Turing Machines, including concepts like the Church-Turing thesis, instantaneous descriptions, and various examples of Turing Machine designs for specific languages. Additionally, it discusses extensions to the basic Turing Machine, such as multi-tape and non-deterministic Turing Machines.

Uploaded by

hemalatha
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)
18 views29 pages

Module-5 Notes

The document provides an overview of Turing Machines, a computational model proposed by Alan Turing in 1936, which is capable of simulating any algorithmic procedure. It describes the structure, functioning, and notation of Turing Machines, including concepts like the Church-Turing thesis, instantaneous descriptions, and various examples of Turing Machine designs for specific languages. Additionally, it discusses extensions to the basic Turing Machine, such as multi-tape and non-deterministic Turing Machines.

Uploaded by

hemalatha
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/ 29

V semester

Course Name: Theory of Computations


Course Code: BCS503
Credits: 4
Scheme:2022

MODULE-5

Course Instructor: Mrs. Divya U H


Assistant Professor
Department of CSE, EPCET
[email protected] (9481975333)
TOC (BCS503) Module-5 Notes

TURING MACHINE

What is Turing Machine?

In 1936, Alan M Turing proposed the Turing machine as a model of


any possible computation. This model is computer like, rather than
program like, even though true electronic, or even electromechanical
computers were several years in the future.

A Turing machine is a computational model, like Finite Automata


(FA), Pushdown automata (PDA), which works on unrestricted
grammar. The Turing machine is the most powerful computation model
when compared with FA and PDA. Instead of using stack as in PDA,
the Turing Machine (TM) uses the tape to store the symbols.

Church-Turing thesis
Any algorithmic procedure that can be carried out by a human or a
computer, can also be carried out by a Turing machine. Now it is
universally accepted by computer scientists that TM is a Mathematical
model of an algorithm. TM has an algorithm and an algorithm has a
TM. If there is an algorithm problem is decidable, TM solves that
problem. This is known as Church-Turing thesis.

Notation of Turing Machine:

(Q. Explain the Turing Machine model working principle. (4M))


The Turing machine consists of a finite control, which can be in any of
a finite set of states. There is a tape divided into squares or cells, each
cell can hold any one of a finite number of symbols.

Department of CSE, EPCET 2025-26 2


TOC (BCS503) Module-5 Notes

• Initially, the input, which is a finite length string of symbols


chosen from the input alphabet, is placed on the tape. All other
tape cells, extending infinitely to the left and right, initially hold
a special symbol called the blank. The blank is a tape symbol,
but not an input symbol, and there may be other tape symbols
besides the input symbols and the blank, as well.

• There is a tape head that is always positioned at one of the tape


cells. The Turing machine is said to be scanning that cell.
Initially, the tape head is at the leftmost cell that holds the input.

• A move of the Turing machine is a function of the state of the


finite control and the tape symbol scanned. In one move, the
Turing machine will,
a) Change state: The next state optionally may be the same as
the current state.
b) Write a tape symbol in the cell scanned. This tape symbol
replaces whatever symbol was in that cell. Optionally, the
symbol written may be the same as the symbol currently
there.
c) Move the tape head left or right. In our formalism we require
a move, and do not allow the head to remain stationary. This
restriction does not constrain what a Turing machine can
compute, since any sequence of moves with a stationary head
could be condensed, along with the next tape head move, into

Department of CSE, EPCET 2025-26 3


TOC (BCS503) Module-5 Notes

a single state change, a new tape symbol, and a move left or


right.

Definition of Turing Machine:

(Q. Define Turing machine-2M)

A Turing machine M is a 7-tuple, namely (Q, Σ, Г, δ, qo, B, F),


where,
• Q: is the finite nonempty set of states.
• Г is a finite nonempty set of tape symbols,
• B ∈ Г is the blank.
• Σ is a nonempty set of input symbols and is a subset of Г and
B ∉ Σ.
• δ is the transition function.

The arguments of δ (q, X) are a state q and a tape symbol X.


The value of δ(q, X) is a triple (p, Y, D) where:
• p is the next state, in Q.
• Y is the symbol in Г, written in the cell being scanned,
replacing whatever symbol was there.
• D is the direction, either L or R, standing for “left” or
“right” specifying the direction in which the R/W head
moves.
• qo ∈Q is the initial state, and
• F ⊆ Q is the set of final or accepting states.
Instantaneous Description (IDs) of Turing Machine:
In Turing Machine, the instantaneous description is defined on the
whole string and the current state of the machine.
Thus, we shall use the string X1X2,…….Xi-1 qXiXi+1…….Xn to
represent an ID in which,
1. q is the state of the Turing machine.
2. The tape head is scanning the ith symbol from the left.

Department of CSE, EPCET 2025-26 4


TOC (BCS503) Module-5 Notes

3. X1X2,….Xn is the portion of the tape between the leftmost and


the right most nonblank. As an exception, if the head is to the left
of the leftmost nonblank or to the right of the rightmost nonblank,
then some prefix or suffix of X1X2,….Xn will be blank.

Thus, the ID is as given in Fig. 9.3.

Department of CSE, EPCET 2025-26 5


TOC (BCS503) Module-5 Notes

The Language of a Turing Machine


In TM the input string is placed on the tape, and the tape head begins at
the leftmost input symbol. If the TM eventually enters an accepting
state, then the input is accepted, and otherwise not.

Formally, let M= (Q, Σ, Г, δ, qo, B, F) be a Turing machine. Then L(M)


is the set of strings w in ∑* such that,

for some state p in F and any tape strings α and β.

The set of languages we can accept using a Turing machine is often


called the recursively enumerable languages or RE languages.

Designing Turing Machine:


Examples:
1. Let us design a Turing machine and see how it behaves on a
typical input. The TM we construct will accept the language
L={0n 1n:n>=1}

Initially, it is given a finite sequence of 0’s and 1’s on its tape, preceded
and followed by an infinity of blanks. Alternately, the TM will change
a 0 to an X and then a 1 to a Y, until all 0’s and 1’s has been matched.

The formal specification of the TM M is,

This table is called as transition table.

Transition Diagrams for Turing Machines:

A transition diagram for TM consists of a set of nodes corresponding


to the states of the TM. An arc from state q to state p is labeled by one
or more items of the form X/Y, D where X and Y are tape symbols, and

Department of CSE, EPCET 2025-26 6


TOC (BCS503) Module-5 Notes

D is a direction, either L or R. That is, whenever δ(q,X)=(p, Y, D), we


find the label X/Y, D on the arc from q to p.

Let show the IDs for the input strings 0011 and 0010.

Example 2:
Construct a T.M. to accept the language L= {0n 1n 2n: n>=1}.
Ans:
The Turing machine works similar with the above example: it marks
the first 0 as X, the first 1 as Y, the first 2 as Z; then it goes back to the

Department of CSE, EPCET 2025-26 7


TOC (BCS503) Module-5 Notes

second 0, and marks it as X, the second 2 as Y, the second 2 as Z, and


so on.

Example 3:
Obtain a TM to accept a string of a’s and b’s such that na(w)=nb(w).
Ans:
The general procedure: When TM is in initial state q0, first symbol of
the input string can be either a or b. Replace the first symbol a (or b) by
X and search for next symbol b (or a) and replace it by symbol Y. Repeat
this until blank symbol B is scanned.

Department of CSE, EPCET 2025-26 8


TOC (BCS503) Module-5 Notes

Example 4: Obtain a TM to accept a palindrome constisting of a’s


and b’s of any length.
Ans: General idea is to place the given string in between blank symbols.
For string to be palindrome, its first and last, second and last but one
and so oon should match. If we found match, replaced matched symbols
by blank symbol B.
The transistion diagram is,

therefore, M=(Q, ∑, Г,δ, q0, B, F) where,


Q={q0,q1,q2,q3,q4,q5,q6,qf}
∑={a,b}
Г={a,b,B}
δ is shown in the transition diagram
q0 is the initial state
B is the blank symbol
F={qf}

Example 5: Obtain a TM to accept the language L={wwR: wϵ


(a+b)*}
Ans: wwR is also a palindrome problem only, but length of the
palindrome must be even. Hence TM is same as previous but no
transition required from q3 and q6 towards the final state.
Therefore, the transition diagram is,

Department of CSE, EPCET 2025-26 9


TOC (BCS503) Module-5 Notes

Example 6: Let x and y are two positive integers. Obtain a turing


machine to perform x+y. (Addition operation on TM)

Ans: Let us represent the numbers on the tape using unary


representation 1’. Let 0 be the separator.
Ex: x=5 can be represented as 11111 and y=3 can be represented as 111
Then 5+3 can be represented on the tape together with 0 as a separated,

111110111
Then output should be of the form:
111111110
ic, read all 1’s until we encounter the 0. Then change 0 to 1 and keep
moving right until blank symbol is encounter. Once found move left
and change 1 to 0 and keep moving right read sum from leftmost blank
symbol.
The transition diagram is,

Department of CSE, EPCET 2025-26 10


TOC (BCS503) Module-5 Notes

Example 7: Monus operation or propoer subtraction on TM.


Let us,

TM, M will start with a tape consisting of 0m 1 0n surrounded by blanks.


M halts with 0m-n on its tape, surrounded by blanks.
Ic, for example 5-3 can be represented as,
B000001000B
The result 5-3=2 will be represented on the tape as,
BBBBB00BBBB

The transition diagram is,

Here the symbol→ indicates R(right)


and  indicates L (left)

Programming Techniques for Turing Machines


The goal is to give a sense of how a Turing machine can be used to
compute in a manner not unlike that of a conventional computer.
Eventually, we want to convince you that a TM is exactly as powerful
as a conventional computer.
a) Storage in the State

Department of CSE, EPCET 2025-26 11


TOC (BCS503) Module-5 Notes

The transition diagram is,

b) Multiple Tracks
Another useful “trick” is to think of the tape of a Turing machine as
composed of several tracks. Each track can hold one symbol, and the
tape alphabet of the TM consists of tuples, with one component for each

Department of CSE, EPCET 2025-26 12


TOC (BCS503) Module-5 Notes

“track”. Thus, for instance, the cell scanned by the tape head in Fig.
shown below contains the symbol [X, Y, Z]. Based on the current state
and the symbols it reads, it can write new symbols to each track and
move the R/W head.

For example, consider the language L= {wcw: wϵ{a, b}*}. We may


construct 2 tracks T.M., with 1st track holding one copy of the w and
other track having second copy. Then R/W head can check the
similarity of the symbols simultaneously.

c) Subroutine:
A subroutine in a Turing machine is a small group of states designed to
perform a specific task, just like a function in a normal program. This
group has a start state, where the subroutine begins, and a return state,
which has no transitions and is used to return control to the main part
of the machine after finishing the task. A subroutine is “called”
whenever the TM transitions into its start state. Since a Turing machine
cannot remember from where it was called (it has no return address
mechanism), the same subroutine cannot be shared across multiple
calling points. Instead, if the machine needs to call the same procedure
from different states, we create separate copies of the subroutine, each
with its own set of states, so that each copy can return to a different
required state.

Extensions to the Basic Turing Machine Or Variants of


Turing Machine
There are 2 main variants of standard TM:
a) Multi-Tape TM
b) Non-deterministic TM

Department of CSE, EPCET 2025-26 13


TOC (BCS503) Module-5 Notes

a) Multi-Tape Turing Machines


(Q. Write a short note on Multi-tape TM. (06M))
A multi-tape TM is as shown below. The device has a finite control
“state”, and some finite number of tapes. Each tape is divided into cells,
and each cell can hold any symbol of the finite tape alphabet. Each tape
has its own R/W head for reading and writing.

As in the single tape TM, the set of tape symbols includes a blank, and
has a subset called the input symbols, of which the blank is not a
member. The set of states includes an initial state and some accepting
states.
Multi-tape TM is defined as, M=(Q, Σ, Г, δ, qo, B, F), where,
• Q: is the finite nonempty set of states.
• Г is a finite nonempty set of tape symbols,
• B ∈ Г is the blank.
• Σ is a nonempty set of input symbols and is a subset of Г and
B ∉ Σ.
• qo ∈Q is the initial state,
• F ⊆ Q is the set of final or accepting states. And
• δ is the transition function defined as,
Q X Гn → Q X Гn X { L, R}n

Example: for 3- tape TM, we may define transition function as, δ(q, a,
b, c)=(p, X, Y, Z, L, L, R)

Working principle:
Initially,
• The input, a finite sequence of input symbols, is placed on the
first tape.
• All other cells of all the tapes hold the blank.
• The finite control is in the initial state.
Department of CSE, EPCET 2025-26 14
TOC (BCS503) Module-5 Notes

• The head of the first tape is at the left end of the input
• All other tape heads are at some arbitrary cell. Since tapes other
than the first tape are completely blank, it does not matter where
the head is placed initially; all cells of these tapes, “look” the
same.
A move of the multi-tape TM depends on the state and the symbol
scanned by each of the tape heads. In one move, the multi-tape TM
does the following:
• The control enters a new state, which could be the same as the
previous state.
• On each tape, a new tape symbol is written on the cell scanned.
Any of these symbols may be the same as the symbol previously
there.
• Each of the tape heads makes a move, which can be either left,
right, or stationary. The heads move independently, so different
heads may move in different directions, and some may not move
at all.

b) NON-DETERMINISTIC TURING MACHINES


(Q. Write a short note on Nondeterministic TM)
In the case of standard Turing δ (q1, a) was defined for some elements
of Q x Г as an element of Q x Г x {L, R}.
Now we extend the definition of δ. In a nondeterministic TM, δ (q1, a)
is defined as a subset of Q x Г x {L, R}. ic, a transition function δ such
that for each state q and tape symbol X, δ(q, X) is a set of triples

So a nondeterministic Turing machine is a 7-tuple (Q, Σ, Г, δ, qo, B,


F), where,
• Q is a finite nonempty set of states.
• Г is a finite nonempty set of tape symbols,
• B ∈ Г is the blank.
• Σ is a nonempty set of input symbols and is a subset of Г and
B ∉ Σ.
• qo ∈Q is the initial state, and
• F ⊆ Q is the set of final states.
• δ is a partial function from Q x Г into the power set of Q x Г
x {L. R}.
ic Q X Г → 2Q X Г X { L, R}

Department of CSE, EPCET 2025-26 15


TOC (BCS503) Module-5 Notes

Equivalence of one-tape TM and Multi-tape TM:

(Q. Prove that every language accepted by a multi-tape TM is


recursively enumerable.5M)

Department of CSE, EPCET 2025-26 16


TOC (BCS503) Module-5 Notes

Undecidability

Problems that Computer Cannot Solve


Consider a simple C program with a simple print statement:

It is easy to discover that this program prints hello, world and


terminates.

However, we may have another program that might print hello, world
as shown below. It takes an input n, and looks for positive integer
solutions to the equation xn+yn=zn. If it finds one, it prints hello, world.
If it never finds integers x, y, and z to satisfy the equation, then it
continues searching forever and never prints hello, world.

Department of CSE, EPCET 2025-26 17


TOC (BCS503) Module-5 Notes

Can we always know in advance whether a program will halt or not?


This question leads to the concept of decidability.

Decidable vs Undecidable Problems


• A problem is decidable if there exists an algorithm that always
gives a correct yes/no answer for any input.
• A problem is undecidable if no algorithm can solve it for all
inputs.

Example:
The Halting Problem — determining whether a program halts or runs
forever — is undecidable.

• Hypothetical tester: If a problem has an algorithm like H that


always tells correctly whether an instance of the problem has
answer “yes” or “no” then the problem is said to be “decidable”.
Otherwise, the problem is “undecidable”.

The hypothetical tester is a conceptual tool introduced in the study of


undecidable problems to illustrate why certain problems cannot be
solved by any algorithm. In this context, the "hypothetical tester" is
designed to determine whether a given program, when executed with
specific input, will output a particular result—in this case, whether it
prints "hello, world" as its first output.
This program, denoted as H, takes two inputs:
1. A program P (the code to be tested).
2. An input I (the input to the program P).
The goal of H is to decide if the program P with input I will produce the
output "hello, world" as the first set of characters it prints.

Expected Behavior of H:
• If P with input I prints "hello, world" as its first output, H should
return "yes".
Department of CSE, EPCET 2025-26 18
TOC (BCS503) Module-5 Notes

• Otherwise, it should return "no".

The challenge arises because:

• A program P may take an infinite amount of time to decide its


output. For instance:
• If P is searching for a mathematical solution (like Fermat's Last
Theorem) before it prints anything, H cannot predict whether it
will eventually find a solution and print "hello, world" or loop
indefinitely.
• Even for programs that terminate, analyzing the behavior of
every possible program P with every possible input I is non-
trivial and undecidable.

The hypothetical tester is a classic example used to demonstrate:

1. Limits of Computation: Some problems, even simple-sounding


ones, are fundamentally unsolvable by any algorithm.
2. Undecidability: The inability to solve a problem algorithmically
is a critical concept in theoretical computer science and is at the
core of problems like the Halting Problem.

The Halting Problem is a fundamental concept in computer science


and computational theory. It addresses whether it's possible to design
an algorithm that can determine, for any given program and input,
whether the program will eventually stop running (halt) or continue
running forever.

Reducing one problem to another: A problem that cannot be solved


by computer is called undecidable. A reduction technique is used to
prove the undecidability of a halting problem. It is sufficient to show
that if we could solve the new problem, then we could use that solution
to solve a problem we already know is undecidable. The strategy is
suggested in the figure given below. The technique is called the
reduction of P1 to P2.

Department of CSE, EPCET 2025-26 19


TOC (BCS503) Module-5 Notes

Using this technique, a problem P1 is reducible to problem P2 if a


solution to the problem P2 can be used to solve the problem P1. Thus,
➢ if P1 is reducible to P2 and P2 is decidable, then P1 is decidable
➢ If P1 is reducible to P2 and P2 is undecidable, then P1 is
undecidable.

Turing Machines and Halting Problem:


There is another notion of “acceptance” that is commonly used for
Turing machines “acceptance by halting”. We say a TM halts if it enters
a state q, scanning a tape symbol X, and there is no move in this
situation i_e, δ(q,X) is undefined.

DECIDABILITY
● The term decidability defined using Turing machines.
When a Turing machine reaches a final state, it halts.
● We can also say that a Turing machine M halts when M
reaches a state q and a current symbol ‘a’ to be scanned so
that δ(q, a) is undefined.
● There are TMs that never halt on some inputs in any one of
these ways. So, we make a distinction between the
languages accepted by a TM that halts on all input strings
and a TM that never halts on some input strings.

Definition of Recursively Enumerable Language:


“A language L⊆Ʃ* is recursively enumerable if there exists a TM
M, such that L= L(M)”.

Definition of Recursive Language:


A language L⊆Ʃ* is recursive if there exists some TM M that
satisfies the following two conditions.
i) If w ϵ L then M accepts w (that is, reaches an
accepting state on processing w) and halts.
ii) If w ∉L then M eventually halts without reaching an

Department of CSE, EPCET 2025-26 20


TOC (BCS503) Module-5 Notes

accepting state

Definition Decidable: A problem with two answers (Yes/No) is


decidable if the corresponding language is recursive. In this
case, the language L is also called decidable.
Definition Undecidable: A problem/language is undecidable if
it is not decidable.

We then divide problems that can be solved by a Turing machine


into two: classes, those that have an algorithm ic, a Turing machine
that halts whether or not it accepts its inputs, and those that are only
solved by Turing machines that may run forever on inputs they do not
accept.

A Language That Is Not Recursively Enumerable:

• A Language L is recursively enumerable (RE) if L=L(M) for


some TM M. A language is recursively enumerable if there exists
a Turing machine that will enumerate all the strings in the
language or accept strings in the language but may not halt for
strings not in the language.
• A language 𝐿 is recursive if and only if there exists a Turing
machine 𝑀 such that
i) 𝐿 = 𝐿(𝑀) and
ii) 𝑀 always halt (even if it does not accept).

Definition: A language 𝐿 is undecidable iff 𝐿 is not recursive.

Note: The term “recursive” as synonym for “decidable” comes from


Mathematics (prior to computers).

Non-Recursively Enumerable (Non-RE) Languages


Definition: A language is non-recursively enumerable if no Turing
machine exists that can enumerate or accept all strings in the language.
In other words, it is not possible to construct an algorithm to semi-
decide membership.
o These are the most complex and "unsolvable" problems.
o The language and its complement are both non-recursively
enumerable.

Department of CSE, EPCET 2025-26 21


TOC (BCS503) Module-5 Notes

Summary:
Category Description Halting

Recursive Languages TM halts and decides Always halts


yes/no for every input

Recursively TM halts only for accepted May not halt


Enumerable (RE) strings; loops for others
Languages
Non-RE Languages No TM can even semi- Not
decide the language enumerable

Following figure suggests the relationship among three classes of


languages:

1. The recursive languages


2. The languages that are recursively enumerable but not recursive.
3. The non-recursively-enumerable(non-RE) languages.

Recursive ⊆ RE ⊆ Non-RE.

Undecidability often involves proving that certain problems cannot


be solved by any algorithm (or equivalently, any Turing machine).

• To analyze such problems, we need a formal way to represent


them as inputs to Turing machines. Binary coding provides a way
to encode:
o Strings in a language.
o Descriptions of Turing machines.
o Complex decision problems.

Department of CSE, EPCET 2025-26 22


TOC (BCS503) Module-5 Notes

Example for undecidable problems:

i)The Halting Problem


• The Halting Problem asks whether a Turing machine halts on a
given input.
• To analyze it, both the Turing machine (its states and transitions)
and the input string are encoded into a single binary string. This
encoding allows us to reason about whether a universal Turing
machine (UTM) can solve the problem.

ii) Post Correspondence Problem (PCP)


The Post Correspondence Problem (PCP) is an undecidable problem in
computer science where you are given two lists of strings, A and B, of
equal length. The goal is to determine if there exists a sequence of
indices for the dominoes (pairs of strings) such that the concatenation
of the strings from list A in that order is identical to the concatenation
of the strings from list B in the same order. A solution is a sequence of
indices, and it is a decision problem because it asks a yes/no question:
"Does a solution exist?".
Example 1
Consider the following two lists:
α1 α2 α3 β1 β2 β3
a ab bba baa aa bb

A solution to this problem would be the sequence (3, 2, 3, 1), because


𝛼3 𝛼2 𝛼3 𝛼1 = 𝑏𝑏𝑎 ⋅ 𝑎𝑏 ⋅ 𝑏𝑏𝑎 ⋅ 𝑎 = 𝑏𝑏𝑎𝑎𝑏𝑏𝑏𝑎𝑎 = 𝑏𝑏 ⋅ 𝑎𝑎 ⋅ 𝑏𝑏 ⋅

𝑏𝑎𝑎 = 𝛽3 𝛽2 𝛽3 𝛽1 .

Codes for Turing Machines:


Let us devise a binary code for Turing machines so that each
TM with input alphabet {0, 1} may be thought of as a binary
string.

Department of CSE, EPCET 2025-26 23


TOC (BCS503) Module-5 Notes

Department of CSE, EPCET 2025-26 24


TOC (BCS503) Module-5 Notes

The Diagonalization Language:


From the concept of coding the Turing Machine, we come to know that
every Turing machine can be encoded as a binary string.
Let Mi be the i-th Turing machine, whose code is wi (the i-th binary
string).
If a binary string wi is not a valid TM code, then Mi is assumed to be a
simple TM that immediately halts without accepting anything.

For instance,
• code:1101 does not begin with 0 and
• code: 0010111010010100 is not valid because it has three
consecutive 1’s.
If wi is not a valid TM code, we shall take Mi to be the TM with one
state and no transitions.

The diagonalization language, Ld = {wi | the Turing machine Mi does


not accept input wi }

That is, Ld consists of all strings w such that the TM M whose code is
w does not accept when given w as input.

The reason Ld is called a “diagonalization” language can be seen if we


consider following figure:

Department of CSE, EPCET 2025-26 25


TOC (BCS503) Module-5 Notes

Here,
• Each row i corresponds to the language L(Mi)
• Each column j corresponds to the input wj
• The entry is 1 if Mi accepts wj, else 0

The diagonal entries are:

• (M1 accepts w1?), (M2 accepts w2?), (M3 accepts w3?), …


• These diagonal values tell whether Mi accepts wi.

To construct Ld, we complement the diagonal. For example in the


figure, diagonal values are: 0, 1, 1, 1…, the complemented diagonal
would begin 1, 0, 0, 0,…..
Because this complemented diagonal differs from every row, Ld cannot
be the language of any Turing machine. Therefore, Ld is not
Recursively Enumerable. This construction is called diagonalization.

Complements of Recursive and RE languages:


(Q. Prove that complement of recursive language is recursive)

Theorem: If L is a recursive language, so is L

Department of CSE, EPCET 2025-26 26


TOC (BCS503) Module-5 Notes

Q. Prove that complement of recursively enumerable language is


recursive.

The Universal Turing Machine & Universal Language:


(Q. Write a short note on Universal Language)
A Universal Turing Machine (UTM) is a special type of Turing
Machine that can simulate the behavior of any other Turing Machine.
It means — instead of designing a new Turing Machine for every
problem, we can have one single machine (the UTM) that can take as
input:
• the description of another Turing Machine (M), and
• an input string (w) for that machine.
The Universal TM then behaves exactly as M would behave on w.

Definition: A Universal Turing Machine 𝑈 is a machine that accepts


inputs of the form:
Department of CSE, EPCET 2025-26 27
TOC (BCS503) Module-5 Notes

⟨𝑀, 𝑤⟩
where 𝑀 is the description (or code) of a Turing Machine, and 𝑤 is the
input string. If 𝑀 accepts 𝑤, then 𝑈 also accepts ⟨M, w⟩.

A Turing machine could be used to simulate a computer that had been


loaded with an arbitrary program. That is to say, a single TM can be
used as a “stored program computer”, taking its program as well as its
data from one or more tapes on which input is placed.

We define Lu, the universal language, to be the set of binary strings


that encode, a pair (M,w), where M is a TM with, the binary input
alphabet, and w is a string in (0+1)* such that w is in L(M).

That is, Lu is the set of strings representing a TM and an input accepted


by that TM. We shall show that there is a TM U, often called the
universal Turing machine, such that Lu=L(U).

The Structure of U is shown in Fig. 9.5


U is designed as a multi-tape Turing machine with:
1. Tape 1: Holds the code (transitions) of machine 𝑀and the input
𝑤.
2. Tape 2: Simulated tape of 𝑀(holds symbols using binary
encoding).
3. Tape 3: Current state of 𝑀.
4. Scratch area: For temporary operations.

The operation of U can be summarized as follows:

Department of CSE, EPCET 2025-26 28


TOC (BCS503) Module-5 Notes

*****************************************************

Department of CSE, EPCET 2025-26 29

You might also like