Complete Solutions to COS2601 Assignment 2 for the year 2023.
Please note this is programming-language fluid and may not be 100% as per your chosen programming language.
The appropriate universal set for this language is the set of all possible strings over the alphabet Σ =
{a, b}. Let's denote this set as U.
Question 1b
The generators of ODDnotAB can be defined as follows:
The empty string ε is a generator of ODDnotAB.
For any string x in ODDnotAB, the strings xa and xb are also generators of ODDnotAB.
Question 1c
Function on the Universal Set:
We need to define a function on the universal set that determines whether a given string belongs to
ODDnotAB or not. Let's denote this function as isInODDnotAB(x), where x is a string from the
universal set U. The function isInODDnotAB(x) returns true if x belongs to ODDnotAB, and false
otherwise.
Question 1d
Recursive Definition of ODDnotAB:
Using the concepts described above, we can write the recursive definition for the language
ODDnotAB as follows:
1. Base Cases:
a) The empty string ε is in ODDnotAB.
isInODDnotAB(ε) = true
b) Strings of length 1:
For any single character string x, isInODDnotAB(x) = true.
2. Recursive Cases:
a) If x is a string in ODDnotAB, then the strings xa and xb are also in ODDnotAB.
isInODDnotAB(xa) = isInODDnotAB(x)
isInODDnotAB(xb) = isInODDnotAB(x)
b) If x is a string in ODDnotAB, then the strings xaa and xab are also in ODDnotAB.
isInODDnotAB(xaa) = isInODDnotAB(x)
isInODDnotAB(xab) = isInODDnotAB(x)
c) If x is a string in ODDnotAB, then the strings xba and xbb are also in ODDnotAB.
isInODDnotAB(xba) = isInODDnotAB(x)
isInODDnotAB(xbb) = isInODDnotAB(x)
By using these base cases and recursive cases, we can determine whether a given string belongs to the
language ODDnotAB or not.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Learn2Progress. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R100,00. You're not tied to anything after your purchase.