Module 5 Notes
Module 5 Notes
Module 5 Notes
TURING MACHINE
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.
• 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”.
Expected Behavior of H:
• If P with input I prints "hello, world" as its first output, H should
return "yes".
• Otherwise, it should return "no".
The challenge arises because:
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.
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.
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
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.
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,
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,
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.
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. 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.
• 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 multitape TM depends on the state and the symbol
scanned by each of the tape heads. In one move, the multitape 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.
Undecidability
Recursive ⊆ RE ⊆ Non-RE.
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).