Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Construct a Turing machine that recognizes the set of all bit strings that end with a \({\bf{0}}\).

Short Answer

Expert verified

The constructed Turing machine that recognizes the set of all bit strings that end with a\({\bf{0}}\)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}}}} \right\}\\{\bf{I = \{ 0,1,B\} }}\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,0,R}}} \right)\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,B,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{1}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,0,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\end{array}\)

Step by step solution

01

Definition

A Turing machine \({\bf{T = }}\left( {{\bf{S,I,f,}}{{\bf{s}}_{\bf{0}}}} \right)\) contains a finite set \({\bf{S}}\) of states, an alphabet \({\bf{I}}\) containing the blank symbol \({\bf{B}}\), a starting state \({{\bf{s}}_{\bf{0}}}\) and a partial function from \(S{\bf{ \times I}}\) to \({\bf{S \times I \times }}\{ R,L\} \). Note: The partial function \({\bf{f}}\) is often represented as \(5{\bf{ - }}\)tuples.

It will require \(3\) states \({{\bf{s}}_{\bf{0}}}\), \({{\bf{s}}_{\bf{1}}}\) and \({{\bf{s}}_{\bf{2}}}\)\({{\bf{s}}_{\bf{0}}}\) is the start state, \({{\bf{s}}_{\bf{1}}}\) will be the state that indicates that the end of the input was reached, and \({{\bf{s}}_{\bf{2}}}\) will be the final state), which will be contained in the set \({\bf{S}}\).

\({\bf{S = }}\left\{ {{{\bf{s}}_{\bf{0}}}{\bf{,}}{{\bf{s}}_{\bf{1}}}{\bf{,}}{{\bf{s}}_{\bf{2}}}} \right\}\)

The alphabet \({\bf{I}}\) needs to contain the tape symbols. The tape symbols are given as \(0,1\)and\({\bf{B}}\).

\({\bf{I = \{ 0,1,B\} }}\)

02

Defining the partial function as five-tuples

Next, it will define the partial function as five-tuples.

As long as the input is a \(0\) or a \(1\), it will keep the input unchanged and move one position to the right.

\(\begin{array}{c}\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,0,R}}} \right)\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\end{array}\)

Once it arrives at the first blank symbol, it will move to the state \({{\bf{s}}_{\bf{1}}}\) as itis at the end of the string. It also moves one position to the left on thetape such that it can check the value of the last digit in the state \({{\bf{s}}_{\bf{1}}}\).

\(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,B,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,R}}} \right)\)

03

Defining the partial function as five-tuples

Once itis at state \({{\bf{s}}_{\bf{1}}}\), it knows that the current input will be the last digit of the input. If the input is a \(1\), then it remains at the non-final state \({{\bf{s}}_{\bf{1}}}\) such that the string won't be accepted.

\(\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{1}}}{\bf{,1,R}}} \right)\)

If the input is \(0\) at state \({{\bf{s}}_{\bf{1}}}\), then it moves to the final state \({{\bf{s}}_{\bf{2}}}\) as the string ends with a \(0\) and thus should be recognized by the Turing machine.

\(\left( {{{\bf{s}}_{\bf{1}}}{\bf{,0,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\)

Once itis in the final state \({{\bf{s}}_{\bf{2}}}\), the machine will need to halt as it knows that the string ends with a \(0\). This will occur when it does not add a five-tuple that has \({{\bf{s}}_{\bf{2}}}\) as its first coordinate.

Hence, the constructed Turing machine that recognizes the set of all bit strings that end with a\({\bf{0}}\)is

\(\begin{array}{c}\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,0,R}}} \right)\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{0}}}{\bf{,B,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{1}}}{\bf{,1,R}}} \right)\\\left( {{{\bf{s}}_{\bf{1}}}{\bf{,0,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\end{array}\)

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

For each of these strings, determine whether it is generated by the grammar for infix expressions from Exercise 40. If it is, find the steps used to generate the string.

\(\begin{array}{*{20}{l}}{{\bf{a) x + y + z}}}\\{{\bf{b) a/b + c/d}}}\\{{\bf{c) m*}}\left( {{\bf{n + p}}} \right)}\\{{\bf{d) + m - n + p - q}}}\\{{\bf{e) }}\left( {{\bf{m + n}}} \right){\bf{*}}\left( {{\bf{p - q}}} \right)}\end{array}\)

Give production rules in Backusโ€“Naur form that generate all identifiers in the C programming language. In โ€˜Cโ€™ an identifier starts with a letter or an underscore (_) that is followed by one or more lowercase letters, uppercase letters, underscores, and digits.

Several extensions to Backusโ€“Naur form are commonly used to define phrase-structure grammars. In one such extension, a question mark (?) indicates that the symbol, or group of symbols inside parentheses, to its left can appear zero or once (that is, it is optional), an asterisk (*) indicates that the symbol to its left can appear zero or more times, and a plus (+) indicates that the symbol to its left can appear one or more times. These extensions are part of extended Backusโ€“Naur form (EBNF), and the symbols?, *, and + are called metacharacters. In EBNF the brackets used to denote nonterminal are usually not shown.

In Exercises 16โ€“22 find the language recognized by the given deterministic finite-state automaton

Let G be the grammar with V = {a, b, c, S}; T = {a, b, c}; starting symbol S; and productions \({\bf{S }} \to {\bf{ abS, S }} \to {\bf{ bcS, S }} \to {\bf{ bbS, S }} \to {\bf{ a, and S }} \to {\bf{ cb}}{\bf{.}}\)Construct derivation trees for

\(\begin{array}{*{20}{l}}{{\bf{a) bcbba}}{\bf{.}}}\\{{\bf{b) bbbcbba}}{\bf{.}}}\\{{\bf{c) bcabbbbbcb}}{\bf{.}}}\end{array}\)

Determine whether all the strings in each of these sets are recognized by the deterministic finite-state automaton in Figure 1.

a){0}* b){0} {0}* c){1} {0}*

d){01}* e){0}*{1}* f){1} {0,1}*

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free