You are on page 1of 21

GRAMMARS AND FORMAL

LANGUAGES
TASK N° 3
Juan Alejandro Mora
Jhon Alex Gaviria
1. PROBLEM DESCRIPTION
Build a Turing machine which accepts binary palindromes or palindromic words, using a multi-
tape machine.

A palindrome is a word, number, phrase, or other sequence of characters which reads the same
backward as forward, such as madam or racecar. There are also numeric palindromes or binary
palindromes like 1001 or 10101.
The Touring machine will be able to verify palindromic words based in the next restrictions, we
build a machine for binary numbers as well.

Restrictions:
*The input will be based in the alphabet ∑= {a,b,c}
*In case of binary numbers ∑= {1,0}
*The input can be an infinite sequence of those characters

The machine only accept palindormic words like caabaac, abacaba, abba, aaaaaaaaaaaaa, bcb
2. Touring Machine

Definition:

Γ   =¿𝑖=1¿𝑛𝛤 𝑖 ¿❑
We are using 2 tapes for solving
the problem, the transitions
between the different states for
both tapes are described in the
next table/matrix.
2.1 Transitions:

∑ a ∑i b ∑i c ∑i □(Blank) ∑i
Q
q00 ( (q00,(a,a),R) |- (q00,(□,□),S ) ) ((q00,(b,b),R)|-(q00,(□,□),S)) ((q00,(c,c),R)|-(q00,(□,□),S)) ((q11,(□, □),L) |- (q11,(□,□),S))

( (q11,(a,a),L) |- (q11,(□,a),R) ) ( (q11,(b,b),L) |- (q11,(□,b),R) ) ( (q11,(c,c),L) |- (q11,(□,c),R) ) ((q22,(□, □),R) |- (q22,(□,□),L))


q11
((q22,(a,a),S)|-(q22,(a,a),L)) ((q22,(b,b),S)|-(q22,(a,a),L)) ((q22,(c,c),S)|-(q22,(a,a),L))
q22 ((q22,(a,a),S)|-(q22,(b,b),L)) ((q22,(b,b),S)|-(q22,(b,b),L)) ((q22,(c,c),S)|-(q22,(b,b),L)) Ø
((q22,(a,a),S)|-(q22,(c,c),L)) ((q22,(b,b),S)|-(q22,(c,c),L)) ((q22,(c,c),S)|-(q22,(c,c),L))
((q33,(a,a),S)|-(q33,(□,□),R)) ((q33,(b,b),S)|-(q33,(□,□),R)) ((q33,(c,c),S)|-(q33,(□,□),R))

((q33,(a,a),R)|-(q33,(a,a),R)) ((q33,(b,b),R)|-(q33,(b,b),R)) ((q33,(c,c),R)|-(q33,(c,c),R)) ((q44,(□, □),R) |- (q44,(□,□),L))


q33

q44 Ø Ø Ø Ø
2.2 Machine graph
3. Desk check
Input  cabbac
Input  cabbac = Accept
4. Extra: Turing machine for binary palindromes

You might also like