3. Regular expressions
3.1. Formation rules (concatenation, reunion, Kleene star)
3.1.1.
$ A=\{ 0^{2k} \mid k \geq 1 \}$
$ B = \{0, \epsilon \}$
$ AB = ? $
3.1.2.
$ A = \{ 0^n 1^n \mid n \geq 1 \}$
$ B = \{ 1^n \mid n \geq 1 \} $
$ AB = ? $
$ BA = ? $
3.1.3.
$ A = \emptyset $
$ B = \{ 1^n \mid n \geq 1 \} $
$ AB = ? $
$ A^* = ? $
$ B^* = ? $
3.1.4
$ A = \{ 0^n 1^n 0^m \mid m \geq n \geq 1 \}$
$ B = \{ 0^n \mid n \geq 1 \} $
$ AB = ? $
$ BA = ? $
3.2. Writing Regular Expressions
3.2.1. Write a regular expression for the language of arithmetic expressions containing +, * and numbers. Hint: you can abbreviate $ 0 \cup 1 \cup \ldots \cup 9 $ by $ [0-9] $
3.2.2. Write a regular expression for $ L = \{ \omega \text{ in } \text{{0,1}} ^* \text{ | EVERY sequence of two or more consecutive zeros appears before ANY sequence of two or more consecutive ones} \} $
3.2.3. Write a DFA for $ L(( 10 \cup 0) ^* ( 1 \cup \epsilon )) $
3.2.4. Write a regular expression which generates the accepted language of A. Then try to find the most simple and easy to understand way to write it.
3.2.5. Find a regular expression for the set of all binary strings with the property that none of its prefixes has two more 0's than 1's nor two more 1's than 0's.
3.3 Regex Equivalence
Are the following regex pair equivalent?
3.3.1
$ E1 = ab|a|b $
$ E2 = (a|\epsilon)(b|\epsilon) $
3.3.2
$ E1 = a(b|c)(d|e)|abb|abc $
$ E2 = ab(b|c|d|e)|acd|ace $
3.3.3
$ E1 = (a\mid b)^*aa^* \mid \epsilon $
$ E2 = (a\mid ba)^*(b\mid ba)^* $
3.3.4
$ E1 = ((ab^*a)^+b)^* $
$ E2 = (a(b\mid aa)^*ab)^* $