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 phrase-structure grammars to generate each of these sets.

a) \(\left\{ {\left. {{{\bf{0}}^{\bf{n}}}} \right|{\bf{n}} \ge {\bf{0}}} \right\}\)

b) \(\left\{ {\left. {{{\bf{1}}^{\bf{n}}}{\bf{0}}} \right|{\bf{n}} \ge {\bf{0}}} \right\}\)

c) \(\left\{ {\left. {{{\left( {{\bf{000}}} \right)}^{\bf{n}}}} \right|{\bf{n}} \ge {\bf{0}}} \right\}\)

Short Answer

Expert verified

a) The phase structure grammar is \(S \to SS,S \to 0,S \to {\rm{\lambda }}\).

b) The phase structure grammar is \(S \to A0,A \to AA,A \to {\rm{1,A}} \to {\rm{\lambda }}\).

c) The phase structure grammar is \(S \to SS,S \to 000,S \to {\rm{\lambda }}\).

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

Let’s construct a phrase-structure grammar

Let\(G{\bf{ }} = {\bf{ }}\left( {{\rm{V, T, S, P}}} \right)\)be the phrase structure grammar that produces all signed decimal numbers. It consists of a sign, either + or -, a non-negative integer, and a decimal fraction, which can either be the empty string or a decimal point followed by a positive integer.

02

Construct phrase-structure grammars to generate \(\left\{ {\left. {{{\bf{0}}^{\bf{n}}}} \right|{\bf{n}} \ge {\bf{0}}} \right\}\).

a)

\(L = \left\{ {\left. {{0^n}} \right|n \ge 0} \right\}\).

Then, \(G{\bf{ }} = {\bf{ }}\left( {V,{\bf{ }}T,{\bf{ }}S,{\bf{ }}P} \right)\) is a phrase structure grammar which generates the language L if \(V{\bf{ }} = {\bf{ }}\left\{ {0,{\bf{ }}S} \right\},{\bf{ }}T{\bf{ }} = {\bf{ }}\left( 0 \right)\), S is the starting symbol and the productions are

Hence, the phase structure grammar for the set is \(S \to SS,S \to 0,S \to {\rm{\lambda }}\).

03

Construct phrase-structure grammars to generate \(\left\{ {{{\bf{1}}^{\bf{n}}}{\bf{0|n}} \ge {\bf{0}}} \right\}\). b)

\(L = \left\{ {\left. {{1^n}0} \right|n \ge 0} \right\}\)

Then, \(G{\bf{ }} = {\bf{ }}\left( {V,{\bf{ }}T,{\bf{ }}S,{\bf{ }}P} \right)\) is a phrase structure grammar which generates the language L if \(V{\bf{ }} = {\bf{ }}\left\{ {1,{\bf{ }}0,{\bf{ }}S,{\bf{ }}A} \right\},{\bf{ }}T{\bf{ }} = {\bf{ }}\left\{ {1,{\bf{ }}0} \right\}\), S is the starting symbol and the productions are

Hence, the phase structure grammar for the set is \(S \to A0,A \to AA,A \to {\rm{1,A}} \to {\rm{\lambda }}\).

04

Construct phrase-structure grammars to generate \(\left\{ {\left. {{{\left( {{\bf{000}}} \right)}^{\bf{n}}}} \right|{\bf{n}} \ge {\bf{0}}} \right\}\). c)

\(L = \left\{ {\left. {{{\left( {000} \right)}^n}} \right|n \ge 0} \right\}\)

Then, \(G{\bf{ }} = {\bf{ }}\left( {V,{\bf{ }}T,{\bf{ }}S,{\bf{ }}P} \right)\) is a phrase structure grammar which generates the language L is \(V{\bf{ }} = {\bf{ }}\left\{ {0,{\bf{ }}S} \right\},{\bf{ }}T{\bf{ }} = {\bf{ }}\left\{ 0 \right\}\), S is the starting symbol and the productions are

Hence, the phase structure grammar for the set is \(S \to SS,S \to 000,S \to {\rm{\lambda }}\).

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

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.

Suppose that A is a subset of\({{\bf{V}}^{\bf{*}}}\)where V is an alphabet.Prove or disprove each of these statements.

\(\begin{array}{l}{\bf{a)}}\,\,{\bf{A}} \subseteq {{\bf{A}}^{\bf{2}}}\\{\bf{b)}}\,\,{\bf{if}}\,{\bf{A = }}{{\bf{A}}^{\bf{2}}}{\bf{,then}}\,{\bf{\lambda }} \in {\bf{A}}\\{\bf{c)}}\,\,{\bf{A\{ \lambda \} = A}}\\{\bf{d)}}\,\,{{\bf{(}}{{\bf{A}}^{\bf{*}}}{\bf{)}}^{\bf{*}}}{\bf{ = }}{{\bf{A}}^{\bf{*}}}\\{\bf{e)}}\,\,{{\bf{A}}^{\bf{*}}}{\bf{A = }}{{\bf{A}}^{\bf{*}}}\\{\bf{f)}}\,\,\left| {{{\bf{A}}^{\bf{n}}}} \right|{\bf{ = }}{\left| {\bf{A}} \right|^{\bf{n}}}\end{array}\)

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

In Exercises 43โ€“49 find the language recognized by the given nondeterministic finite-state automaton.

Given a deterministic finite-state automaton \({\bf{M = (S,I,f,}}{{\bf{s}}_{\bf{o}}}{\bf{,F)}}\), use structural induction and the recursive definition of the extended transition function f to prove that \({\bf{f }}\left( {{\bf{s, x y}}} \right){\bf{ = f }}\left( {{\bf{f }}\left( {{\bf{s ,x}}} \right){\bf{, y}}} \right)\)for all states \({\bf{s}} \in {\bf{S}}\)and all strings\({\bf{x}} \in {\bf{I}}*{\bf{andy}} \in {\bf{I}}*\).

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