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

Let G = (V, T, S, P) be the phrase-structure grammar with V = {0, 1, A, S}, T = {0, 1}, and set of productions P consisting of S → 1S, S → 00A, A → 0A, and A → 0.

a) Show that 111000 belongs to the language generated by G.

b) Show that 11001 does not belong to the language generated by G.

c) What is the language generated by G?

Short Answer

Expert verified

a) Proved, 111000 belongs to the language generated by G.

b) Proved, 11001 does not belong to the language generated by G.

c) \({\bf{L}}\left( {\bf{G}} \right){\bf{ = \{ }}{{\bf{1}}^{\bf{m}}}{{\bf{0}}^{\bf{n}}}{\bf{/m}} \ge {\bf{0,}}\,{\bf{n}} \ge {\bf{3\} }}\) is the language generated by G.

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

about the language generated by the grammar.

Let \({\bf{G = }}\left( {{\bf{V, T, S, P}}} \right)\) be a phrase-structure grammar. The language generated by G (or the language of G), denoted by L(G), is the set of all strings of terminals that are derivable from the starting state S

02

We shall show that 111000 belongs to the language generated by G.

Use the given information,

Let \({\bf{G = }}\left( {{\bf{V, T, S, P}}} \right)\) be the phrase-structure grammar with\({\bf{V = }}\left\{ {{\bf{0, 1, A, S}}} \right\}{\bf{, T = }}\left\{ {{\bf{0, 1}}} \right\}\), and production are\({\bf{S}} \to {\bf{1S, S}} \to {\bf{00A, A}} \to {\bf{0A}}\), and\({\bf{ A}} \to {\bf{0}}\).

\(\begin{array}{c}{\bf{S}} \to {\bf{1S}}\\ \to {\bf{11S}}\\ \to {\bf{111S}}\\ \to {\bf{11100A}}\\ \to {\bf{111000}}\end{array}\)

Hence, 111000 belongs to the language generated by G.

03

We shall Show that 11001 does not belong to the language generated by G.

Because of the productions

\(\begin{array}{l}{\bf{S}} \to {\bf{1S,}}\\{\bf{S}} \to {\bf{00A,}}\\{\bf{A}} \to {\bf{0A,}}\end{array}\)

And

\({\bf{A}} \to {\bf{0}}\)

Any sentence of the language generated by G ends with 0.

Hence, 11001 does not belong to the language generated by G.

04

We need to find what is the language generated by G.

The production \({\bf{S}} \to {\bf{1S}}\) generates the strings of the form \({{\bf{1}}^{\bf{m}}}{\bf{s}}\) and the production

\({\bf{S}} \to {\bf{00A}}\), generates the strings of the form 000A with \({\bf{A}} \to {\bf{0A, A}} \to {\bf{0}}\)

Hence,\({\bf{L}}\left( {\bf{G}} \right){\bf{ = \{ }}{{\bf{1}}^{\bf{m}}}{{\bf{0}}^{\bf{n}}}{\bf{/m}} \ge {\bf{0,}}\,{\bf{n}} \ge {\bf{3\} }}\)is the language generated by G.

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

Describe the elements of the set \({{\bf{A}}^{\bf{*}}}\)for these values of A.

a){10}b){111}c){0, 01}d){1,101}

a) Construct a phrase-structure grammar that generates all signed decimal numbers, consisting of a sign, either + or −; a nonnegative integer; and a decimal fraction that is either the empty string or a decimal point followed by a positive integer, where initial zeros in an integer are allowed.

b) Give the Backus–Naur form of this grammar.

c) Construct a derivation tree for −31.4 in this grammar.

Find five other valid sentences, besides those given in Exercise 1.

Describe how productions for a grammar in extended Backus–Naur form can be translated into a set of productions for the grammar in Backus–Naur form.

This is the Backus–Naur form that describes the syntax of expressions in postfix (or reverse Polish) notation.

\(\begin{array}{c}\left\langle {{\bf{expression}}} \right\rangle {\bf{ :: = }}\left\langle {{\bf{term}}} \right\rangle {\bf{|}}\left\langle {{\bf{term}}} \right\rangle \left\langle {{\bf{term}}} \right\rangle \left\langle {{\bf{addOperator}}} \right\rangle \\{\bf{ }}\left\langle {{\bf{addOperator}}} \right\rangle {\bf{:: = + | - }}\\\left\langle {{\bf{term}}} \right\rangle {\bf{:: = }}\left\langle {{\bf{factor}}} \right\rangle {\bf{|}}\left\langle {{\bf{factor}}} \right\rangle \left\langle {{\bf{factor}}} \right\rangle \left\langle {{\bf{mulOperator}}} \right\rangle {\bf{ }}\\\left\langle {{\bf{mulOperator}}} \right\rangle {\bf{:: = *|/}}\\\left\langle {{\bf{factor}}} \right\rangle {\bf{:: = }}\left\langle {{\bf{identifier}}} \right\rangle {\bf{|}}\left\langle {{\bf{expression }}} \right\rangle \\\left\langle {{\bf{identifier}}} \right\rangle {\bf{:: = a }}\left| {{\bf{ b }}} \right|...{\bf{| z}}\end{array}\)

Construct a deterministic finite-state automaton that recognizes the set of all bit strings beginning with 01.

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