Professional Documents
Culture Documents
Assignment - 1
ABDULLAH MOHAMMAD SHAFIQUE
BCS-6A
FA19-BCS-007
24 / 03 / 2022
Q1): Consider the language S*, where S = {ab, ba}. Write out all the words in S* that have seven or
fewer letters. Can any word in this language contain the substrings aaa or bbb? What is the smallest
word that is not in this language?
b) Can any word in this language contain the substrings aaa or bbb?
No, it is not possible to have this substring in any word since ‘a’ or ‘b’ doesn’t exist as single
symbol. For every ‘a’ there is a ‘b’ preceding or following it and vice versa, which doesn’t allow
‘aaa’ or ‘bbb’ to exist.
Q2): Consider the language S*, where S = {a, ab, ba}. Is the string (abbba) a word in this language?
Write out all the words in this language with six or fewer letters. What is another way in which to
describe the words in this language? Be careful, this is not simply the language of all words without
bbb.
b) Write out all the words in this language with six or fewer letters:
Words with |S*| <= 6 are as follows:
o { λ, a, aa, aaa, aaaa, aaaaa, aaaaaa, aab, aaab, aaaab, aaaaab, … etc. all of length 6 and less}
Page 1 of 3
Q3): Consider the language S*, where S = {aa, aba, baa}. Show that the words aabaa, baaabaaa, and
baaaaababaaaa are in this language. Can any word in this language be interpreted as a string of
elements from S in two different ways? Can any word in this language have an odd total number of
a’s?
b) Can any word in this language be interpreted as a string of elements from S in two different ways?
No, Words in this language can only be interpreted in a single way since each word has a unique
positioning of letter ‘b’ with respect to letter ‘a’. Hence, all the valid words will have consistent
factors (defined in only one possible way) belonging to S.
For example:
o If the word has only ‘a’, then we can group them in (‘aa’) thus only one way.
o If there are (2n * ‘a’) before ‘b’, then they can be grouped as (‘aa’) and no other way.
o If there are (2n-1 * ‘a’) before ‘b’, then the word has (‘aba’) and (‘aa’) before ‘b’ and that’s
the only way.
o Etc.
c) Can any word in this language have an odd total number of a’s?
No, no valid words can ever have odd number of letter “a’s” in this language since each factor of
words (elements in S) contain even number of letters ‘a’. Hence, each word will have even
multiples of ‘a’ ( 2n * ‘a’ ).
Q4): Give an example of a set S such that the language S* has more six-letter words than seven
letter words. Give an example of an S* that has more six-letter words than eight-letter words. Does
there exist an S* such that it has more six-letter words than twelve letter words?
a) Give an example of a set S such that the language S* has more six-letter words than seven letter
words.
S = {ab, bd} or {aaa, bbb} or {abc, def, ghi}
Length of any word belonging to S will be a factor of 6. i.e., any word belonging to S will not have
length of 7 since concatenating factors of 6 will produce words of length that is also factor of 6 and
not 7.
Page 2 of 3
b) Give an example of an S* that has more six-letter words than eight-letter words.
S = {aaa, bbb} or {abc}
Length of any word belonging to S will be a factor of 6. i.e., any word belonging to S will not have
length of 8 since concatenating factors of 6 will produce words of length that is also factor of 6 and
not 8. So, there will be no words of length 8.
c) Does there exist an S* such that it has more six-letter words than twelve letter words?
No, that’s not possible since 6 is also a factor of 12 (6 x 2 = 12) so any word of length 6
concatenated by itself will produce word of length 12. This way there will be equal number of
words with length 6 and length 12.
Page 3 of 3