You are on page 1of 4

Theory Of Automata

Assignment - 1
ABDULLAH MOHAMMAD SHAFIQUE
BCS-6A
FA19-BCS-007

Submitted to: Mr. Taimur Shahzad

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?

a) The words in S* that have seven or fewer letters:


 Atomic Letters: ‘ab’, ‘ba’
 Words with |S*| <= 7 are as follows:
o { λ, ab, ba, abab, abba, baba, baab, ababab, baabab, ababba, baabba, abbaab, babaab,
abbaba, bababa }

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.

c) What is the smallest word that is not in this language?


 The word ‘a’ and/or ‘b’ is the smallest word that doesn’t exist in the language.

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.

a) Is the string (abbba) a word in this language?


 ‘abbba’ cannot be a valid word under ‘S*’ language since there is a single ‘b’ which does not exist in
the set of letters ‘S’. Every letter ‘b’ has a preceding or following letter ‘a’, hence this this string is
not part of language.

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}

c) What is another way in which to describe the words in this language?


 In this language, letter ‘a’ can exist unbounded times. If there’s any letter ‘b’, it must have letter ‘a’
before it or after it. In other words, no words/strings can have ‘bb’ in the beginning or at the
ending. Letter ‘bb’ will always have letter ‘a’ on both ends. And b exists even number of times.

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?

a) Words aabaa, baaabaaa, and baaaaababaaaa are in this language?


 Tokenizing:
o ‘aabaa’ => (aa) (baa)
o ‘baaabaaa’ => (baa) (aba) (aa)
o ‘baaaaababaaaa’ => (baa) (aa) (aba) (baa) (aa)
o Since all these factors belong to S, hence these words are in this language.

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

You might also like