ITCS317 Automata and Formal Languages
Instructor: Hesham Al-Ammal
Lab 4. Turing Machines and Computable Functions
Due: Mon 29 Nov 2024
Consider the following function which returns the number of a's in the input string divided by 2
(i.e. integer division with no remainder):
$f(x) = n_a(x) \div 2$
For example, the following is the result for some possible inputs:
$f(ababa \ aabbbb) = n_a(ababa \ aabbbb) \div 2 = 5 \div 2 = 2$
$f(bababa \ ab) = n_a(bababa \ ab) \div 2 = 4 \div 2 = 2$
Assume that we are using a unary numbering system, where 0 is represented by a blank tape.
Problem: Show that the function $f(x)$ for $x \in \{a, b\}^*$ is Turing computable.
Hint: You can build this Turing machine in a modular approach, by building a machine that will
take an input from the domain with a's and b's and count how many a's exist. The next machine
will take this output as input and calculate the modulo of this integer number. You link the two
machines by making the first machine's (TM1) final state the second machine's (TM2) initial
state. This is basically how modular programming works, by breaking down a long program into
functions that use each other's output successively.
abaabaa
TM1
Final state $q_{f1}$
11111
TM2
2
Initial state $q_{f1}$
Use JFLAP to build the Turing machine as described above, and upload the file here by the due
date.