Assignment 2
Assignment 2
Instructions
• You are free to consult each other for verbal help. However, copying or sharing the soft/hard copy with each
other will not only result in the cancellation of the current assignment, but it may also impact your grade
in all the future assignments and exams as well.
• List your collaborators on the last page of your assignment. Collaborators are any people you discussed this
assignment with. This is an individual assignment, so be aware of the course's collaboration policy.
• You must attach this assignment at the top of your solution.
Task 1. Build an FA that accepts only the language of all words with b as the second letter. Show both the picture
and the transition table for this machine and find a regular expression for the language (10 Marks)
Task 2. Build an FA that accepts only the words baa, ab and abb and no other strings longer or shorter (5 Marks)
Task 4.
a. Recall from chapter 4 the language of all words over the alphabet {a, b} that have both the letter a and the
letter b in them, but not necessarily in that order. Build and FA that accepts this language. (10 Marks)
b. Build an FA that accepts the language of all words with only as or only b’s in them. Give a regular expression
for this language. (10 Marks)
Task 5. Build an FA such that when labels a and b are swapped the new machine is different from the old one but
equivalent (the language defined by these machines is the same) (10 Marks)
Task 6. Build a TG that accepts the language L1 of all words that begin and end with the same double letter, either
of the form aa….aa or bb…bb. Note aaa and bbb are not words in this language (10 Marks)
Task 7. Given a TG called TG1 that accepts the language L1 and a TG called TG2 that accepts the language L2, show
how to build a new TG called TG3 that accepts exactly the languae L1 + L2. (10 Marks)
Task 8. Verify that there are indeed three and only three ways for the TG on p.84 (chapter 6) of your book that
accept the word abbbabbbabba (7 Marks)
Task 9. For each of the five FAs pictured in problems 17, 19, and 20 in chapter 5, build a transition graph that
accepts the same language but has fewer states. (15 Marks)