Chapter 13: Q19E (page 898)
Construct a Turing machine that computes the function \({\bf{f(n) = n - 3}}\) if \({\bf{n}} \ge {\bf{3}}\) and \({\bf{f}}\left( {\bf{n}} \right){\bf{ = 0}}\) for \({\bf{n = 0,1,2}}\) for all non-negative integers \({\bf{n}}\).
Short Answer
The constructed Turing machine that computes the function \(f{\rm{(}}n{\rm{)}} = n - 3\) if \(n \ge 3\) and \(f\left( n \right) = 0\) for \(n = 0,1,2\)for all non-negative integers n is
\(\begin{array}{c}{\bf{T = }}\left( {{\bf{S,I,f,}}{{\bf{s}}_{\bf{0}}}} \right)\\{\bf{S = }}\left\{ {{{\bf{s}}_{\bf{0}}}{\bf{,}}{{\bf{s}}_{\bf{1}}}{\bf{,}}{{\bf{s}}_{\bf{2}}}{\bf{,}}{{\bf{s}}_{\bf{3}}}{\bf{,}}{{\bf{s}}_{\bf{4}}}} \right\}\\{\bf{I = \{ 0,1,B\} }}\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{2}}}{\bf{,B,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,B,}}{{\bf{s}}_{\bf{4}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{2}}}{\bf{,1,}}{{\bf{s}}_{\bf{3}}}{\bf{,B,R}}} \right)\\\left( {{{\bf{s}}_{\bf{2}}}{\bf{,B,}}{{\bf{s}}_{\bf{4}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{3}}}{\bf{,1,}}{{\bf{s}}_{\bf{4}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{3}}}{\bf{,B,}}{{\bf{s}}_{\bf{4}}}{\bf{,1,R}}} \right)\end{array}\)