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

COS3701 ASSIGNMENT 03 2025 Due 21 AUGUST 2025

Rating
-
Sold
-
Pages
16
Grade
A+
Uploaded on
25-07-2025
Written in
2024/2025

Unlock your academic potential with the ultimate study resource for COS3701 ASSIGNMENT 03 2025 Due 21 AUGUST 2025 This 100% exam-ready assignment come with expert-verified answers, in-depth explanations, and reliable references, meticulously crafted to ensure you grasp every concept with ease. Designed for clarity and precision, these fully solved material is your key to mastering any subject and acing your exams. Don’t just study—study smart. Grab your path to academic success today and elevate your grades with confidence.

Show more Read less










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

Document information

Uploaded on
July 25, 2025
Number of pages
16
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3701
Assignment 3

Due 21 August 2025

,Question 1

Given that L1 = (aa)∗ and L2 = (a + b)∗ ab(a + b)∗ , find grammars
for L1 and L2 . Then use Theorem 37 to find a grammar for L1 L2 .

The language L1 = (aa)∗ consists of all strings over {a} formed by zero or more repetitions
of the substring ”aa”. Examples include ϵ, aa, aaaa, and so on. Although this is a regular
language, we construct a context-free grammar (CFG) for the purpose of composition with
another CFG.

Grammar for L1 :

Variables: {S1 }

Terminals: {a, b}

Productions:



S1 → aaS1 | ϵ


Start symbol: S1

This grammar generates strings composed only of an even number of a’s. The terminal
b is included in the alphabet for compatibility with L2 , although it does not appear in
L1 ’s productions.

The language L2 = (a + b)∗ ab(a + b)∗ consists of all strings over {a, b} that contain at
least one occurrence of the substring ab. Examples include ab, aab, aba, and baaba.

To construct a CFG for L2 , the required substring ab is made explicit in the middle,
allowing arbitrary strings of a’s and b’s before and after it.

Grammar for L2 :

Variables: {S2 , X}


1

, Terminals: {a, b}

Productions:



S2 → XabX

X → aX | bX | ϵ


Start symbol: S2

This grammar ensures the presence of at least one ab within any derivation, with both
sides allowing arbitrary strings from X.

Theorem 37 states that if L1 and L2 are context-free languages with grammars G1 =
(V1 , Σ, P1 , S1 ) and G2 = (V2 , Σ, P2 , S2 ), and V1 ∩ V2 = ∅, then their concatenation L1 L2
is also context-free. A grammar for L1 L2 can be constructed as follows:

Variables: V = V1 ∪ V2 ∪ {S}

Terminals: {a, b}

Productions:



S → S1 S2

S1 → aaS1 | ϵ

S2 → XabX

X → aX | bX | ϵ


Start symbol: S

To validate the correctness of this grammar, we examine several sample derivations.

Example: “ab”



S → S1 S2 → ϵS2 → XabX → ϵabϵ = ab



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.
BeeNotes teachmetutor
View profile
Follow You need to be logged in order to follow users or courses
Sold
281
Member since
6 months
Number of followers
0
Documents
486
Last sold
4 weeks ago
BeeNotes

BeeNotes: Buzzing Brilliance for Your Studies Discover BeeNotes, where hard-working lecture notes fuel your academic success. Our clear, concise study materials simplify complex topics and help you ace exams. Join the hive and unlock your potential with BeeNotes today!

4,0

35 reviews

5
20
4
3
3
8
2
1
1
3

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 exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT 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