• 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 11 pages
Exam (elaborations)

COS Assignment 1.

Document preview thumbnail
Preview 2 out of 11 pages

COURSE: THEORETICAL COMPUTER SCIENCE III COURSE CODE: COS3701 SEMESTER: 2021 01 ASSIGNMENT: 01 UNIQUE NUMBER: DUE DATE: 15 TH MAY 2021 COS3701 REG. NO UNIQUE NO: Page 1 of 10 1. Problem 3(ii) on page 255. Consider the CFG S → XaXaX X → aX|bX|Λ What is the language this CFG generates? This CFG can generate (a+b)*a(a+b)*a(a+b)*. We can thus verify the language as follows: ▪ The CFG S → XaXaX only generates words that contain as, therefore the grammar only generates words in L. ▪ We select any word in L and write it down as y1ay2ay3 where yi(1 ≤ i ≤ 3) can be a string in as and bs. Taking S → XaXaX, we indicate the right side by X1aX2aX3 and then confirm if the first letter of yi(1 ≤ i ≤ 3) is an a. We can now confirm the production Xi → aXi and if the first letter is a b, then apply production Xi → bXi. We then apply the same to the successive letters until we finally apply Xi → Ʌ to remove X. This is applied to y1, y2 and y3 to get the word y1ay2ay3. Given that this is a word in L, it therefore indicates that the grammar can generate all words in L. 2. Problem 8(v) on page 256. Find CFGs for the following languages over the alphabet ∑ = {a b}: v. All words that have different first and last letters: {ab ba aab abb baa bba . . .}


Document information

Uploaded on
November 13, 2021
Number of pages
11
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers
$3.69

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.
LOVELY01
3.6
(127)
Sold
1015
Followers
881
Items
2321
Last sold
4 months 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

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