100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS3701 Assignment 1 2022 Yearly Module 100% Guaranteed $2.86   Add to cart

Other

COS3701 Assignment 1 2022 Yearly Module 100% Guaranteed

 101 views  9 purchases
  • Course
  • Institution

COS3701 Assignment 1 2022 Yearly Module 100% Guaranteed

Preview 1 out of 17  pages

  • April 20, 2022
  • 17
  • 2022/2023
  • Other
  • Unknown
avatar-seller
ASSIGNMENT 01
Solution
UNIQUE ASSIGNMENT NUMBER: 712235



Question 1


Chapter 12 – Problem 1 on page 254

Consider the following CFG: S → aS | bb.

Prove that this generates the language defined by the regular expression a∗ bb


1. Observe that the CFG has only one terminal: bb. Thus, words generated by this language
must end with bb. And the shortest possible word is bb.

2. The production aS is right recursive which will expand to:

S ⇒ aS
... ⇒ aaS
... ⇒ aaaS
..
.
... ⇒ aaa ... aaaS



This means that the aS part of the production will generate an arbitrary number of as.


Based on observation 1, it is clear that the CFG can generate words with no as. Based on obser-
vation 2, it is clear that the CFG can generate words with an arbitrary number of as. This is exactly
the language described by a∗ bb which will either generate just the word bb, or all words with an
arbitrary number of as followed by bb.

Based on observations 1 and 2, it is also clear that the CFG cannot generate any other words than
those in the language a∗ bb.

An alternative solution

You will probably remember from COS2601 that the answer to this type of question should consist
of two parts. As soon as the language has been identified, we have to show firstly that the given
grammar only generates words that are in the language (thus no word which is not in the language,
may be generated), and secondly we have to show that every word belonging to the language can
actually be generated by the grammar.




2

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller studycheats. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $2.86. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

66579 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$2.86  9x  sold
  • (0)
  Add to cart