Professional Documents
Culture Documents
Automata Hw2
Automata Hw2
Pseudo Code:
-¿ 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
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)
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 image for Q1
TM image for Q2
4
5
6
7