CS 3613: Theoretical Foundations of Computing CS 3613: Theoretical Foundations of Computing
Spring 2008
Test 1
Student Name:
----------------------------------------------------
  1. The examination contains 3 problems. You have 75 minutes for 40 points.

  2. Show all important steps in your work. Your answers will be graded on its correctness and clarity.

----------------------------------------------------
  1. [20 points]
    1. [4 points] Recall that the reversal of a string w over an alphabet S can be defined inductively on |w|:

      wr = ì
      í
      î
      e
      if w = e
      a ur
      if w = u a for some u Î S* and a Î S
      Use the inductive definition of reversal and mathematical induction to show that for all strings x and y over an alphabet S, (x y)r = yr xr.


    2. [8 points] Let the alphabet S = { a, b }. Recall that a string x Î S* is called a palindrome if x = xr (x reads the same backward as forward).
      1. [5 points] Consider the following binary relation R on S* as follows: For all x, y Î S*, x R y if and only if |x| = |y| and x yr is a palindrome.
        1. [4 points] Show that R is an equivalence relation on S*.





































        2. [1 point] For an arbitrary x Î S*, describe the equivalence class [ x ]R (the equivalence class of R containing x). Justify your answer.











      2. [3] Consider the following binary relation R¢ on S* as follows: For all x, y Î S*, x R¢y if and only if x yr is a palindrome. Is R¢ an equivalence relation on S*? Justify your answer.




    3. [5 points] Let L be a language over an alphabet S such that L ¹ Æ, L ¹ { e}, and L2 = L. Prove that:
      1. [2 points] e Î L, and

      2. [3 points] L is not a finite language (that is, |L| is not finite).















































    4. [3 points] Consider the language:
      L = { x Î {a, b}* | x has exactly one occurrence of the substring aa }.
      Justify your solution by properly structuring and annotating your regular expression.




  2. [10 points]
    1. [5 points] Give the state-transition diagram of a deterministic finite automaton that accepts the following language:

      { x Î {a, b}* |   |#a(u) - #b(u)| £ 2 for every prefix u of x },
      where #c (u) denotes the number of occurrences of the symbol c in the string u. Give a brief interpretation of the states in your construction.


    2. [5 points] Let S = { a, b }, M = (Q, S, d, q0, A) be a deterministic finite automaton, and

      EM = { x | x Î L(M), and |x| is even }.
      Show that EM is regular by giving explicitly the 5-tuple definition of a deterministic finite automaton accepting EM. Give a brief interpretation of the states in your construction.



  3. [10 points] Let S be the alphabet of 3 symbols: S = { a, b, c }.
    1. [5 points] Consider the following language:
      L1 = { w Î S* | there exists a symbol of S not appearing in w }.
      Give the formal 5-tuple definition and the state-transition diagram of a nondeterministic finite automaton with at most 4-states (with or without e-transitions) that accepts L1. Notes: A brief and precise interpretation of the states of your machine is required, and no credit will be given to finite automaton with more than 4 states.


    2. [5 points] Consider the following language:
      L2 = { w Î S* | w has a substring of length 3 containing each of the symbols of S}.
      Give the state-transition diagram of a nondeterministic finite automaton (with or without e-transitions) with at most 8 states that accepts L2. Notes: A brief and precise interpretation of the states of your machine is required, and no credit will be given to finite automaton with more than 8 states.






File translated from TEX by TTH, version 3.35.
On 10 Feb 2009, 13:37.