CHP 6 A
CHP 6 A
simulates M1 4
Configurations in the Original Machine M1
have corresponding configurations
in the Simulation Machine
M2
M1
Original Machine: d0 d1 d n
Simulation Machine: d 0 d1 d n
M2 5
Accepting Configuration
Original Machine: df
Simulation Machine: d f
L( M1 ) L( M 2 )
6
Turing machines with: • Stay-Option
• Semi-Infinite Tape
•Multidimensional
•Multitape
• Nondeterministic
7
This TM provide a extra option that read-
write head stay in place after rewriting ther
cell content .this will not exgend the power of
automata.
The head can stay in the same position
aababbcac a
q1 a b, S q2
9
Theorem: Stay-Option machines
have the same power with
Standard Turing machines
10
1. Stay-Option Machines
simulate Standard Turing machines
Since a TM with satay option is clearly an
extension of standard model, so any standard
TM can be stimulated by one with Stay
option.
11
2. Standard Turing machines
simulate Stay-Option machines
Consider let M1be a TM with stay option to
be stimulated by standard TM M2.
For each move of M1,the simulating machine
M2 does the following.
If the move of M1 does not involve the stay
option, the simulating machine M2 performs
one move, essentially identical to the move to
be simulated.
12
If S is involved in the move M1, then M2 will
make two moves:
The first rewrite the symbol and moves the
read- write head right.t
The second moves the read –write head left,
leaving the tape content unaltered.
a b, S
q1 q2
a b, L x x, R
q1 q2
a b, L
q1 q2
a b, L
q1 q2
Stay-Option Machine:
q1 a b, S q2 aaba baba
1 2
q1 q2
END OF PROOF
16
Multiple tracks
Sometimes TM wants to mark the symbol without
destroying them. In such cases, it is advisable to have
multiple tracks on the tape.
There is only one tape head, here the single input tape
is divided into multiple tracks then the input tape as
follows
prepared by :M.Jenifer 17
Multiple Track Tape
A useful trick to perform more
complicated simulations
One Tape
a b a b track 1
b a c d track 2
One head
One symbol ( a, b)
18
a b a b track 1
b a c d track 2
q1
a c a b track 1
b d c d track 2
q2
(b, a) (c, d ), L
q1 q2
19
Multi-tape Turing Machine
A multi-tape Turing Machine is like an ordinary
TM
There are k tapes
Each tape has its own independent
read/write head.
The only fundamental difference from the
ordinary TM is δ– the state transition function.
20
Read as:
If the TM is in state qi and
Tape 1 Tape 2
a b c e f g
Input string
22
Tape 1 Time 1 Tape 2
a b c e f g
q1 q1
(b, f ) ( g , d ), L, R
q1 q2
23
Theorem: Multi-tape machines
have the same power with
Standard Turing machines
24
1. Multi-tape machines simulate
Standard Turing Machines:
For proof the above, we can always elect to
run a multi tape TM with only one of its tape
.so it will prove Multi tape TM can stimulate
the standard TM.
25
2. Standard Turing machines simulate
Multi-tape machines:
Standard machine:
• Uses a multi-track tape to simulate
the multiple tapes
26
Multi-tape Machine-M
Tape 1 Tape 2
a b c e f g h
2
9
q2 Choice 1
a b, L
q1
a c, R q3 Choice 2
a b c
Time 1
q1
Choice 1
q2 b b c
a b, L
q2
q1
Choice 2
a c, R q3 c b c
q3 31
A computation of a Nondeterministic TM
is a tree, where each branch of the tree
looks like a computation of an ordinary
TM.
32
Deterministic Non-Deterministic
Computation Computation
reject
There is a computation:
34
Theorem: Nondeterministic machines
have the same power with
Standard Turing machines
35
1. Nondeterministic Machines simulate
Standard (deterministic) Turing Machines
36
2. Standard (deterministic) Turing machines
simulate Nondeterministic machines:
Proof Idea:
• Show that we can simulate an NTM N with DTM D.
37
Design D to explore the tree by using a breadth-first search.
This strategy explores all branches at the same depth before going to
explore any branch at the next depth. Hence, this method guarantees
that D will visit every node of N(w) until it encounters an accepting
configuration.
D has three tapes,
1. Tape 1 (called input tape) always contains the input (and the code
of N) and is never altered.
2. Tape 2 (called simulation tape) maintains a copy of the N’s tape
on some branch of its nondeterministic Computation
3. Tape 3 (called address tape) keeps track of D’s location in N’s
nondeterministic computation tree.
38
input tape
(never altered )
01 ............
D
xx#01x B ...... simulation tape
121 ...... address tape
0
number of states
......
01 bq
10
... q bb 11 ... b
1
non-deterministic
1 computation
2 3
111
1 1 2 1
1312
1 2 1 1 2
1 1 1 2
40
Address Tape
Every node in N(w) can have at most b
children, where b is the size of the largest set
of possible choices given by N’s transition
function.
42
The Description of D
1. Initially tape 1 contains w and tape 2 and 3 are
empty.
2. Copy tape 1 over tape 2
3. Use tape 2 to simulate N with input w on one
branch of its nondeterministic computation.
Before each step of N, consult the next symbol on tape 3
determine which choice to make among those allowed by
N’s transition function.
If no more symbols remain on tape 3 or if this
nondeterministic choice is invalid, abort this branch by
going to stage 4.
If a rejecting configuration is reached go to stage 4; if an
accepting configuration is encountered, accept the input.
4. Replace the string on tape 3 with the next string as
if it is a counter and go to stage 2.
43
A TM is a special purpose computer. Once δ
is defined, the machine is restricted to
carrying out one particular type of
computation.
Digital computers are general purposes
computer that can be programmed to do
different jobs at different times.
Consequently, TM cannot be considered
equivalent to general purpose computer.
This objective can overcome by designing a
reprogrammable TM –Universal TM.
44
A Universal TM Mu is an automaton that given as
input the description of any TM M and a string w,
can simulate the computation of M on w.
they execute
only one program
Question: Can we build a programmable TM that accepts
as input a (M: Turing machine, w: input string) pair and
outputs whatever M would output when started up on w?
Attributes:
• Reprogrammable machine
• Simulates any other Turing Machine
46
Universal Turing Machine
simulates any Turing Machine M
Description of transitions of M
Input string of M
47
Tape 1 contents of Universal Turing Machine:
binary encoding
of the simulated machine
M
Tape 1
1 0 1 0 11 0 11 0 10011 0 1 10 111 0 111 0 1100
48
To construct Mu, we first chose a standard
way of describing TM.
Assume Q={q1,q2,q3….q n}
With q1 the initial state, q2 is the single final
state and Γ = {a1,a2,..an} Where a1
represents blank.
Then select an encoding q1 is represented by
1, q2 is represented by 11 and so on. The
symbol 0 is used as separator.
With these, we can define completely
transition of input TM.
This represent any TM with a finite encoding
as a string(0+1)* and that given any encoding
of M . We can decode it uniquely
Some string will not represent any TM such as ( string
00011), from this we easily spot they are no concern.
Universal Language:
The universal language 𝐿𝑢 is set of binary strings
which can be modeled by a Turing machine. The
universal language can be represented by a pair (M,
w) where M is a TM that accepts this languages and w
is a binary string in (0 + 1)* such that w belongs to
L(M). thus we can say that any binary string belongs
to a universal language.
It has a structure of multi tape machine
Tape 1
Three tapes
Description of M
Universal
Tape 2
Turing
Machine
Tape Contents of M
Tape 3
State of M 51
The universal Turing machine U accepts the
TM M
The transitions of M are stored initially on
first tape along with the string w
On the second tape the simulated tape of M is
placed. Here the tape symbol 𝑋𝑖 of M will be
represented by 0𝑖 and tape symbols are
separated by single 1’s
On the third tape various states of machine M
are stored. the state 𝑞𝑖 is represented by i 0’s
Mu looks the content of tapes 2 and 3 to
determine the configuration of M.it then
consults tape 1 to see what M would do in
this configuration.Finally tapes 2 and 3 will
be modified to reflect the result of move.
This implementation of UTM will be done by a
programming language that describe
transistion of TM. So UTM is a general
purpose computer.
Tape 1
Description of M
54
Alphabet Encoding
Symbols: a b c d
55
State Encoding
States: q1 q2 q3 q4
Move: L R
Encoding: 1 11
56
Transition Encoding
Encoding: 1 0 1 0 11 0 11 0 1
separator
57
Machine Encoding
Transitions:
(q1, a) (q2 , b, L) (q2 , b) (q3 , c, R)
Encoding:
1 0 1 0 11 0 11 0 1 00 11 0 110 111 0 111 0 11
separator
58
A Turing Machine is described
with a binary string of 0’s and 1’s
Therefore:
59
Language of Turing Machines
111010011110010101,
……
…… }
60
Countable set:
61
Example: The set of even integers
is countable
Even integers: 0, 2, 4, 6,
Correspondence:
Positive integers: 1, 2, 3, 4,
2n corresponds to n 1
62
Definition
and
Enumeration output
Machine for S
s1, s2 , s3 ,
(on tape)
64
Example:
The set of all strings {a, b, c}
is countable
Proof:
We will describe an enumeration procedure
65
Consider the order in which the symbols will
appear in a dictionary. However this order will
not suite without modification.
In a dictionary,all words beginning with a are
listed before the string b. but when there
areinfinite words of a, we will never reach b..
Instead we use a different order in which we
take the length of the string as the first criteria
followed by an alphabet ordering of all equal
length strings.
Naive procedure:
Produce the strings in lexicographic order:
a
aa
aaa
aaaa
......
Doesn’t work:
strings starting with b
will never be produced
67
Better procedure: Proper Order
..........
68
a
b length 1
c
aa
ab
ac
Produce strings in ba
Proper Order: bb length 2
bc
ca
cb
cc
aaa
aab length 3
aac
...... 69
Theorem: The set of all Turing Machines
is countable
70
Enumeration Procedure:
Repeat
1. Generate the next binary string
of 0’s and 1’s in proper order
71