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

COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025; 100% TRUSTED Complete, trusted solutions and explanations.. Ensure your success with us..

Rating
-
Sold
-
Pages
23
Grade
A+
Uploaded on
02-07-2025
Written in
2024/2025

COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025; 100% TRUSTED Complete, trusted solutions and explanations.. Ensure your success with us..

Institution
Course










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

Connected book

Written for

Institution
Course

Document information

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

Subjects

Content preview

[TYPE THE COMPANY NAME]




COS3701 Assignment 3
(COMPLETE ANSWERS)
2025
NO PLAGIARISM

[Pick the date]




[Type the abstract of the document here. The abstract is typically a short summary of the contents of
the document. Type the abstract of the document here. The abstract is typically a short summary of
the contents of the document.]

,Exam (elaborations)
COS3701 Assignment 3 (COMPLETE
ANSWERS) 2025
Course

 Theoretical Computer Science III (COS3701)
 Institution
 University Of South Africa (Unisa)
 Book
 Theoretical Computer Science

COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025; 100%
TRUSTED Complete, trusted solutions and explanations.. Ensure your success
with us..



Question 1 [10] Given that L1 = (aa)* and L2 = (a + b)*ab(a + b)*. Find
grammars for L1 and L2. Then use Theorem 37 to find L1L2.

Step 1: Understanding the Languages
 L₁ = (aa)*
This language contains any number (including zero) of aa repetitions. Examples: ε, aa,
aaaa, aaaaaa, ...
 L₂ = (a + b)*ab(a + b)*
This language contains all strings over {a, b} that contain at least one occurrence of the
substring "ab".




Step 2: Define Grammars for L₁ and L₂
Grammar for L₁ = (aa)*

Let’s define a grammar G₁ = (V₁, Σ, R₁, S₁):

 V₁ = {S}
 Σ = {a}
 R₁:
o S → aaS | ε

This generates strings with any number of "aa" blocks.

, Grammar for L₂ = (a + b)*ab(a + b)*

Let’s define a grammar G₂ = (V₂, Σ, R₂, S₂):

 V₂ = {S, A, B}
 Σ = {a, b}
 R₂:
o S → aS | bS | A
o A → aB
o B → bC
o C → aC | bC | ε

Explanation:

 S → aS | bS allows any prefix before ab
 A → aB and B → bC enforces "ab"
 C generates any suffix (a or b)*




Step 3: Use Theorem 37 (Concatenation of Context-Free
Languages)
Theorem 37:

If L₁ and L₂ are context-free languages, then so is their concatenation L₁L₂, and there exists a
context-free grammar for it.

Constructing the Grammar for L₁L₂

Let G₁ = (V₁, Σ, R₁, S₁) and G₂ = (V₂, Σ, R₂, S₂)

Define a new grammar G = (V, Σ, R, S) where:

 V = V₁ ∪ V₂ ∪ {S}
 S is the new start symbol.
 R = R₁ ∪ R₂ ∪ {S → S₁S₂}

So:

Final Grammar G for L₁L₂

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.
tabithamwendwa73 Chamberlain College Nursing
Follow You need to be logged in order to follow users or courses
Sold
379
Member since
1 year
Number of followers
82
Documents
1032
Last sold
1 month ago
brilliant tutorials

brilliant tutorials Attention all students! Are you struggling with a particular subject or just need some extra support to help you succeed? Look no further than our expert tutorial services! Our experienced tutors provide personalized one-on-one sessions to help you overcome your academic challenges and reach your full potential. Whether you need help with any module, our tutors are here to help. With flexible scheduling and competitive pricing, there\'s no reason to struggle on your own. Invest in your academic success today and book a tutorial session with us

Read more Read less
3.6

64 reviews

5
28
4
14
3
3
2
4
1
15

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