[4 points] Recall that the reversal of a string w over an alphabet S can be defined inductively on |w|:
wr =
ì í
î
e
ifw = e
a ur
ifw = uaforsomeu Î S*anda Î 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.
[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).
[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.
[4 points] Show that R is an equivalence relation on S*.
[1 point] For an arbitrary x Î S*, describe the equivalence class [ x ]R (the equivalence class of R containing x). Justify your answer.
[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.
[5 points] Let L be a language over an alphabet S such that L ¹ Æ, L ¹ { e}, and L2 = L. Prove that:
[2 points] e Î L, and
[3 points] L is not a finite language (that is, |L| is not finite).
[3 points] Consider the language:
L = { x Î {a, b}* | x hasexactlyoneoccurrenceofthesubstringaa }.
Justify your solution by properly
structuring and annotating your regular expression.
[10 points]
[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 foreveryprefix 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.
[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| iseven }.
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.
[10 points] Let S be the alphabet of 3 symbols: S = { a, b, c }.
[5 points] Consider the following language:
L1 = { w Î S* | thereexistsasymbolof S notappearingin 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.
[5 points] Consider the following language:
L2 = { w Î S* | whasasubstringoflength3containingeachofthesymbolsof 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.