• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

COS3701 Assignment 3 2026

Document preview thumbnail
Preview 2 out of 7 pages

Theoretical Computer Science III - COS3701 Assignment 3 2026; 100 % TRUSTED workings, Expert Solved, Explanations and Solutions. For assistance call or W.h.a.t.s.a.p.p us on ...(.+.2.5.4.7.7.9.5.4.0.1.3.2) Question 1 [10] Let L1 be the grammar generating (a + b)∗ . Let L2 be the grammar generating (aa)*b(a + b)*. First provide the grammars generating L1 and L2 respectively. Then apply the applicable theorem from Chapter 17 (Theorem 36) to determine L1 + L2. A CFG which generates L1 is S → aS | bS | Λ This can easily be seen by applying the production rules. A CFG which generates L2 is S → XbY X → aaX | Λ Y → Ya | Yb | Λ Once again this can easily be seen by applying the production rules. We now apply Theorem 36 on page 376 of Cohen to find a CFG for L1 + L2 First we write the CFG for L1 as S1 → aS1 | bS1 | Λ And we write the CFG for L2 as S2 → XbY X → aaX | Λ Y → Ya | Yb | Λ By Theorem 36, the CFG for L1 + L2 is then S → S1 | S2 S1 → aS1 | bS1 | Λ S2 → XbY X → aaX | Λ Y → Ya | Yb | Λ Note that Theorem 36 does not guarantee that this is the simplest (or only) CFG for L1 + L2.

Content preview

COS3701
ASSIGNMENT 3 2026
UNIQUE NO:
DUE DATE:

, THEORETICAL COMPUTER SCIENCE III - COS3701

ASSIGNMENT 3 2026

Question 1 [10]

Let $L_1$ be the grammar generating $(a+b)^{*}$. Let $L_2$ be the grammar
generating $(aa)^{*}b(a+b)^{*}$. First, provide the grammars generating $L_1$ and
$L_2$ respectively. Then apply the applicable theorem from Chapter 17 (Theorem 36)
to determine $L_1 + L_2$.

 CFG generating $L_1$:

$$S \rightarrow aS \mid bS \mid \Lambda$$

 CFG generating $L_2$:

$$S \rightarrow XbY$$

$$X \rightarrow aaX \mid \Lambda$$

$$Y \rightarrow Ya \mid Yb \mid \Lambda$$

 Applying Theorem 36 to find a CFG for $L_1 + L_2$: First, rewrite the
grammar for $L_1$ using a distinct start symbol $S_1$:

$$S_1 \rightarrow aS_1 \mid bS_1 \mid \Lambda$$

And keep the grammar for $L_2$ with start symbol $S_2$:

$$S_2 \rightarrow XbY$$

$$X \rightarrow aaX \mid \Lambda$$

$$Y \rightarrow Ya \mid Yb \mid \Lambda$$

Connected book
 image
Publisher: 1979 ISBN: 9782881249617 Edition: Unknown

Document information

Uploaded on
October 21, 2026
Number of pages
7
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$4.68

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
LIBvault
4.2
(17)
Sold
149
Followers
1
Items
287
Last sold
13 hours ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions