You are on page 1of 7

Q1.

Pseudo Code:

-¿ Here we take x, y, z written on tape in order divided by ∆, We combine


x,y by addition (unary inputs)i.e. by overwriting the ∆ in x∆y with a 1, and
then deleting two 1s from either the beginning (left most ones to x).

-¿ Now let x+y = some k, We find min(k, z), for this, the TM should suc-
cessively replace a 1 from the k string with a symbol and delete a 1(replace
it with ∆) from z string, after this if 1s in z string are completely deleted we
should successively delete a from k and add a 1 to the z string until there
are no more s left and then stop, otherwise(In other case z not deleted) we
should successively convert the s back to 1s -¿ We get the required outpur
by following above steps already and then stop.

If you couldnt figure out the TM values (some of the transition values mal-
functioned in Latex) Please check below image of the same Turing Ma-
chine(which is clear, in the last slides)

1
11R
L1 L2 L3 L4
∆∆L ∆∆L ∆∆R

∆∆R 1∆L 1L
R 11L
S4 S9

11R
1∆R 1#R ∆∆L
S3 S5
S8
1∆R ∆∆R 11L
1∆L
S2 S6 S7
∆∆L
∆∆R 11R ∆∆L
E1 E2 E3
#∆L ∆∆R
S1 11L
1∆L #1L
∆1R

S0

11R

Image of TM for Q1 is in the last slides

2) Pseudo Code :

-¿ Here we simply need to compute TM for m¿n model but we have x¿2y 2y
is computed first by repeated addition algorithm as described in Q1 now 2y
= k, we do x¿k model.

-¿We achieve this by successively deleting a pair of 1s, one each from the
’x’ string and the ’k’ string. If this process terminates with a 1 left from the
’x’ string, then the TM should erase the tape and leave 11 on it. Otherwise
(if there is a 1 from the k string, or if both strings have been wiped), it should
erase the tape and leave a single 1 on it.

2
-¿ This gives required output to given function

If you couldnt figure out the TM values (some of the transition values
malfunctioned in Latex) Please check below image of the same Turing Ma-
chine(which is clear in the last slides)

D1L 11L ∆∆R ∆∆L


C5 C4 11L
S10 C0
11L S9 ∆ ∆ L ∆ ∆ R 11L 1∆L
1∆R
1∆L ∆∆R C1 C3
S8
∆∆R ∆∆L
1∆L 11R C2
E1 ∆∆L
S7
1∆R ∆1R 11R L1
∆ 1R
∆∆L E2
L2
11R 1∆L
S6
11R ∆ 1L
∆ 1R 11R
S2 S3 L3
∆∆R
S1 1DR
∆ 1L
∆ ∆ R DDR
S4
∆∆L 11L
S0
S5 11L
11R

Image of TM for Q2 in the last slides

Q3.Pseudo-Code: -¿ (x,y,z) be the tuple we need to compute for x¡(y+z)


using TM, For this we can use m¡n model, firstly we add y,z using algorithm

3
mentioned in Q1 and now that y and z are combined let y+z be p, we apply
m¡n model for x¡p

-¿We achieve this by successively deleting a pair of 1s, one each from the
’x’ string and the ’p’ string. If this process terminates with a 1 left from the
’x’ string, then the TM should erase the tape and leave 1 on it. Otherwise (if
there is a 1 from the k string, or if both strings have been wiped), it should
erase the tape and leave a 11 on it.

TM for Q3 next page

TM image for Q1

TM image for Q2

4
5
6
7

You might also like