Section 1.2

Regular Languages and Regular Expressions

[20/60%]
Show
LaTeX
Example 1.11
?
(a)

Is the set {ε}\left\{ \varepsilon \right\} a regular language?

(b)

Is the set {001,110}\left\{ 001,110\right\} a regular language over the binary alphabet?

Example 1.12

a∗(a+b)∗=(a+ba∗)∗a^{*}(a+b)^{*}=\left(a+b a^{*}\right)^{*}.

?
Example 1.13

(ba)+(a∗b∗+a∗)=(ba)∗ba+b∗(ba)^{+}\left(a^{*} b^{*}+a^{*}\right)=(b a)^{*} b a^{+} b^{*}.

?
Example 1.14

Find a regular expression for the set of binary expansions of integers which are the powers of 4.

?
Example 1.15

Find a regular expression for the set of binary strings which have at least one occurrence of the substring 001.

?
Example 1.16

Find a regular expression for the set AA of binary strings which have no substring 001.

?
Example 1.17

Find a regular expression for the set BB of all binary strings with at most one pair of consecutive 0's and at most one pair of consecutive 1's.

?
Example 1.18

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.

?
Example 1.19

Find a regular expression for the set of all nonempty strings having no repeated adjacent symbols over the arabic digits.

?
Example 1.20

Find a regular expression for the set of all strings over alphabet

{[000],[100],[010],[001],[110],[101],[011],[111]} \left\{ \left[\begin{smallmatrix} 0 \\ 0 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 1 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 0 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 1 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 1 \\ 1 \end{smallmatrix}\right]\right\}

that represent correct additions over binary expansions of integers, with leading 0 's added when necessary. For example, the relation

0110+01011011 \begin{array}{r} 0110 \\ +\quad 0101 \\ \hline 1011 \end{array}

implies that the string

[001][110][101][011] \left[\begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix}\right]\left[\begin{smallmatrix} 1 \\ 1 \\ 0 \end{smallmatrix}\right]\left[\begin{smallmatrix} 1 \\ 0 \\ 1 \end{smallmatrix}\right]\left[\begin{smallmatrix} 0 \\ 1 \\ 1 \end{smallmatrix}\right]

is in the set.

?
Example 1.21

For each language LL over alphabet Σ\Sigma, let L′L^{\prime } be the set of all suffixes of strings in LL, that is, L′={w∣uw∈L for some string u}L^{\prime }=\left\{ w \mid u w \in L\text{ for some string }u\right\}. Show that if LL is a regular language so is L′L^{\prime }.

?
Example 1.22

Show that every regular language has a regular expression in disjunctive normal form α1+α2+⋯+αn\alpha_{1}+\alpha_{2}+\cdots +\alpha_{n}, in which each αi\alpha_{i}, for i=1,2,⋯ ,ni=1,2, \cdots , n, does not contain the operator + .

?
Problem 1.2.1

Describe in English the languages expressed by the following regular expressions:

?
(a)

(0∗1∗)∗0\left(0^{*} 1^{*}\right)^{*} 0.

(b)

(01∗)∗0\left(01^{*}\right)^{*} 0.

(c)

(00+11+(01+10)(00+11)∗(01+10))∗\left(00+11+(01+10)(00+11)^{*}(01+10)\right)^{*}.

(d)

0∗+(0∗1+0∗11)(0+1+0+11)∗0∗0^{*}+\left(0^{*} 1+0^{*} 11\right)\left(0^{+} 1+0^{+} 11\right)^{*} 0^{*}.

Problem 1.2.2

Simplify the following regular expressions:

?
(a)

(00)∗0+(00)∗(00)^{*} 0+(00)^{*}.

(b)

(0+1)(ε+00)++(0+1)(0+1)(\varepsilon +00)^{+}+(0+1).

(c)

(0+ε)0∗1(0+\varepsilon ) 0^{*} 1.

Problem 1.2.3

Construct regular expressions for the following languages over alphabet {0,1}\left\{ 0,1\right\} :

?
(a)

The set of all strings whose fifth symbol from right is 0.

(b)

The set of all strings having either 000 or 111 as a substring.

(c)

The set of all strings having neither 000 nor 111 as a substring.

(d)

The set of all strings having no substring 010.

(e)

The set of all strings having an odd number of 0 's.

(f)

The set of all strings having an even number of occurrences of substring 011. [Hint: First find the regular expression for the set of binary strings having no substring 011.]

Problem 1.2.4

Show that (02+03)∗=(020∗)∗\left(0^{2}+0^{3}\right)^{*}=\left(0^{2} 0^{*}\right)^{*}.

?
Problem 1.2.5

Construct a regular expression for the set of all strings over alphabet

{[000],[100],[010],[001],[110],[101],[011],[111]} \left\{ \left[\begin{smallmatrix} 0 \\ 0 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 1 \\ 0 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 0 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 0 \\ 1 \\ 1 \end{smallmatrix}\right],\left[\begin{smallmatrix} 1 \\ 1 \\ 1 \end{smallmatrix}\right]\right\}

that represent correct subtractions. For example,

101110−010010110 \begin{array}{rrrr} 1011 & 10 \\ - & 01001 \\ \hline 0110 \end{array}

implies that string

[100][011][101][110] \left[\begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix}\right]\left[\begin{smallmatrix} 0 \\ 1 \\ 1 \end{smallmatrix}\right]\left[\begin{smallmatrix} 1 \\ 0 \\ 1 \end{smallmatrix}\right]\left[\begin{smallmatrix} 1 \\ 1 \\ 0 \end{smallmatrix}\right]

is in the set.

?
Problem 1.2.6

Show that for any regular language L,Lodd={x∈L∣∣x∣=odd}L, L_{\text{odd}}=\left\{ x \in L \mid \left|x\right|=\text{odd}\right\} and Leven={x∈L∣∣x∣=even}L_{\text{even}}=\left\{ x \in L \mid \left|x\right|=\text{even}\right\} are regular.

?
Problem 1.2.7

Show that if LL is a regular language, then L′′={u∣∃v,uv∈L}L^{\prime \prime }=\left\{ u \mid \exists v, u v \in L\right\} is regular.

?
Problem 1.2.8

Suppose h:Σ∗→Γ∗h: \Sigma^{*} \rightarrow \Gamma^{*} is a mapping satisfying h(xy)=h(x)h(y)h(x y)=h(x) h(y) for any x,y∈Σ∗x, y \in \Sigma^{*}. Show that if AA is a regular set over Σ\Sigma, then h(A)={h(x)∣x∈A}h(A)=\left\{ h(x) \mid x \in A\right\} is a regular set over Γ\Gamma. Conversely, if BB is a regular set over Γ\Gamma, then h−1(B)={x∈Σ∗∣h(x)∈B}h^{-1}(B)=\left\{ x \in \Sigma^{*} \mid h(x) \in B\right\} is a regular set over Σ\Sigma.

?