Homework 1

Due Date: Feb 19, 2016

Be sure to follow the homework guidelines.

  1. We will assume ASCII encoding for characters. Write two python functions shortlex_less and dict_less, each taking two parameters, such that

    • shortlex_less(s, t) returns True if string s precedes string t in shortlex order and returns False otherwise.
    • dict_less(s, t) returns True if string s precedes string t in dictionary order and returns False otherwise.

    Email the source code for your functions as one text file to .

  2. Do Exercise 1.3 on page 83.

  3. Do Exercise 1.4(c) on page 83 as follows.

  1. Draw a transition diagram of a DFA that recognizes the language

{ w : w has an even number of a's }.

  1. Draw a transition diagram of a DFA that recognizes the language

{ w : w has one or two b's }.

  1. Use product construction to combine the two machines above into one that recognizes the language

{ w : w has an even number of a's and one or two b's }.

  1. Do Exercise 1.5(c) on page 84.

  2. Do Exercise 1.6 (e) on page 84.

  3. Do Exercise 1.6 (j) on page 84.

  4. (Extra credit) Do Problems 1.32 and 1.33 on page 88 and 89, or Problem 1.37 on page 89.