100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS3701 Assignment 1 2022 Yearly Module 100% Guaranteed

Rating
-
Sold
9
Pages
17
Uploaded on
20-04-2022
Written in
2022/2023

COS3701 Assignment 1 2022 Yearly Module 100% Guaranteed

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
April 20, 2022
Number of pages
17
Written in
2022/2023
Type
Other
Person
Unknown

Subjects

Content preview

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

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
studycheats University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
889
Member since
5 year
Number of followers
209
Documents
48
Last sold
1 month ago

4.3

38 reviews

5
26
4
5
3
3
2
2
1
2

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions