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

What does the Turing machine described by the five-tuples \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,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,L}}} \right)\), \(\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\)do when given

\({\bf{a)}}\)\({\bf{101}}\)as input\(?\)

\({\bf{b)}}\)an arbitrary bit string as input\(?\)

Short Answer

Expert verified

\((a)\)The final tape contains the string \({\bf{1}}11\).

\((b)\) Every input string of length \(n\) is changed to a string consisting of \(n\)\(1{\bf{'s}}\).

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

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

01

Step \({\bf{1}}\): Definition

A Turing machine \({\bf{T = }}\left( {{\bf{S,I,f,}}{{\bf{s}}_{\bf{0}}}} \right)\) consists of a finite set \({\bf{S}}\) of states, an alphabet \({\bf{I}}\) containing the blank symbol \({\bf{B}}\), a partial function \({\bf{f}}\) from \({\bf{S \times I}}\) to \({\bf{S \times I \times \{ R,L\} }}\), and a starting state \({{\bf{s}}_{\bf{0}}}\).

\({\bf{T}}\)is defined by the following five-tuples:

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

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

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

02

Finding the final tape

(a)

It starts from the initial state \({{\bf{s}}_{\bf{0}}}\) of the Turing machine \({\bf{T}}\). The tape needs to contain \({\bf{1}}\)\({\bf{0}}\)\({\bf{1}}\) and it starts from the first non-blank position on the tape.

\({\bf{ \ldots BB101BBB \ldots }}\)

Since itis at state \({{\bf{s}}_{\bf{0}}}\) while the position on the tape is \({\bf{0}}\), it uses the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\). This implies that it remains state \({{\bf{s}}_{\bf{0}}}\), the current position on the tape remains \({\bf{1}}\) and it moves one position to the right on the

tape.

\({\bf{ \ldots BB101BBB \ldots }}\)

Since itis at state \({{\bf{s}}_{\bf{0}}}\) while the position on the tape is \({\bf{1}}\), you use the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\). This implies that it remains at state \({{\bf{s}}_{\bf{0}}}\), the current position on the tape is changed to \({\bf{1}}\) and it moves one position to the right on the tape.

\({\bf{ \ldots BB111BBB \ldots }}\)

03

Finding the final tape

Since itis at state \({{\bf{s}}_{\bf{0}}}\) while the position on the tape is \({\bf{0}}\), it uses the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\). This implies that it remains state \({{\bf{s}}_{\bf{0}}}\), the current position on the tape remains \({\bf{1}}\) and it moves one position to the right on the tape.

\({\bf{ \ldots BB111BBB \ldots }}\)

Since itis at state \({{\bf{s}}_{\bf{0}}}\) while the position on the tape is B, it uses the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,B,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,L}}} \right)\). This implies that it moves to state \({{\bf{s}}_{\bf{1}}}\), the current position on the tape remains \({\bf{B}}\) and it moves one position to the left on the tape.

\({\bf{ \ldots BB111BBB \ldots }}\)

Since it is at state \({{\bf{s}}_{\bf{1}}}\) while the position on the tape is \({\bf{1}}\), it uses the five-tuple \(\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\). This implies that it moves to state \({{\bf{s}}_{\bf{2}}}\), the current position on the tape remains \({\bf{1}}\) and it moves one position to the right on the tape.

\({\bf{ \ldots BB111BBB \ldots }}\)

Since itis at state \({{\bf{s}}_{\bf{2}}}\)while the position on the tape is \({\bf{B}}\), the machine halts (as there is no five-tuple that has \({{\bf{s}}_{\bf{2}}}\)as its first coordinate).

Therefore, the final tape then contains the string \({\bf{1}}11\) .

04

Step 4:Verifying the input

It starts from the state \({{\bf{s}}_{\bf{0}}}\).

Due to the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,0,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\), it changes all \({\bf{0}}\) -digits to \({\bf{1}}\).

Due to the five-tuples \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,1,}}{{\bf{s}}_{\bf{0}}}{\bf{,1,R}}} \right)\) and \(\left( {{{\bf{s}}_{\bf{1}}}{\bf{,1,}}{{\bf{s}}_{\bf{2}}}{\bf{,1,R}}} \right)\)all \({\bf{1}}\)-digits remain \({\bf{1}}\).

Due to the five-tuple \(\left( {{{\bf{s}}_{\bf{0}}}{\bf{,B,}}{{\bf{s}}_{\bf{1}}}{\bf{,B,L}}} \right)\), the string keeps the same size.

Hence, every input string of length \(n\) is changed to a string consisting of \(n\)\(1{\bf{'s}}\).

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

Give production rules in extended Backusโ€“Naur form that generate all decimal numerals consisting of an optional sign, a nonnegative integer, and a decimal fraction that is either the empty string or a decimal point followed by an optional positive integer optionally preceded by some number of zeros.

a) Explain what the productions are in a grammar if the Backusโ€“Naur form for productions is as follows:

\(\begin{array}{*{20}{l}}{{\bf{ < expression > :: = }}\left( {{\bf{ < expression > }}} \right){\bf{ }}\left| {{\bf{ < expression > + < expression > }}} \right|}\\\begin{array}{c}{\bf{\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;}}\,\,\,\,{\bf{ < expression > * < expression > |}}\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{\bf{ < variable > }}\end{array}\\{\,\,\,\,\,\,\,\,\,{\bf{ < variable > :: = xly}}}\end{array}\)

b) Find a derivation tree for \(\left( {{\bf{x*y}}} \right){\bf{ + x}}\) in this grammar.

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.

For each of these strings, determine whether it is generated by the grammar given for postfix notation. If it is, find the steps used to generate the string.

\(\begin{array}{l}{\bf{a) abc* + }}\\{\bf{b) xy + + }}\\{\bf{c) xy - z*}}\\{\bf{d) wxyz - */ }}\\{\bf{e) ade - *}}\end{array}\)

Construct a finite-state machine that models a newspaper vending machine that has a door that can be opened only after either three dimes (and any number of other coins) or a quarter and a nickel (and any number of other coins) have been inserted. Once the door can be opened, the customer opens it and takes a paper, closing the door. No change is ever returned no matter how much extra money has been inserted. The next customer starts with no credit.

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