3

The question is as follow: Suppose $A,B$ are regular expressions such that $R_1 = (A^* B^*)^*$ and $R_2 = (A + B)^*$: prove $L(R_1) = L(R_2)$

What I tried to do was: Let $w$ be a string such that $w ∈ x.y$ for strings $x$ and $y$ such that $x \in L(A^*)^*$ and $y \in (B^*)^* = x \in L(A^*).y \in L(B^*)$

But this is as far as I could get and not sure if I'm on the right path or what the next step should be...

J.-E. Pin
  • 40,163

3 Answers3

1

I will give you an intuitive proof by induction on the length of the word. We will prove a stronger statement:

Every $w$ in $L(R_1)$ and $L(R_2)$ is of the form $w=w_1...w_n$ where each word $w_i$ is in $L(A)$ or $L(B)$ or $w$ is the empty string.

It is definitely true for the base case $|w| = 0$, since it is easy to see that the empty word is in both $L(R_1)$ and $L(R_2)$. Therefore assume it is true for $|w| = 1,...,n$. Suppose that $|w|$ has length $n+1$. By Lemma 1 (below) we see that of the following

  1. $w = w'a$ for some $a \in L(A)$,
  2. $w = w'b $ for some $b \in L(B)$,
  3. or $w \notin R_1,R_2$

must be true. If the first or second case occurs then the induction hypothesis implies that $w$ is of the form $w=w_1...w_k$ where each word $w_i$ is in $L(A)$ or $L(B)$ (by modifying the argument in Lemma 1). If the third case is true then $w \notin R_1,R_2$ as is needed.

Lemma 1 One of the three cases above must be true and case 3 is mutually exclusive with the other two cases

(Proof): The reduction to the 3 cases can be rigorously proven by induction on the exponent that witnesses the statement $ x \in L(X^*) \iff (\exists n \in \mathbb{N}) \ x \in L(X)^n$; i.e. either $x = \emptyset_{\textrm{word}} $ or $x \in L(X)$ or $x \in L(X)\times L(X)$ or $x \in L(X)\times L(X)\times L(X)$ ... Setting $X = A+B$ we see that this statement is immediately true and setting $X = A^* B^*$ requires a second similar induction for the two possible cases $x \in A^*$ or $x \in B^*$. Essentially this proof is turtles all the way down. QED

0

To show that $L(R_2)\subseteq L(R_1)$ you should note that $L(A)\subseteq L(A^*)\subseteq L(A^* B^*)$, analogously $L(B)\subseteq L(A^* B^*)$, so $L(A+B)\subseteq L(A^* B^*)$ ah hence $L((A+B)^*)\subseteq L((A^* B^*)^*)$. For the converse, note that $L(A)\subseteq L(A+B)\subseteq L((A+B)^*)$ and (being the latter concatenation-closed) $L(A^*)\subseteq L(((A+B)^*)^*)=L((A+B)^*)$ analogously $L(B^*)\subseteq L((A+B)^*)$, so, again for concatenation closedness $L(A^*B^*)\subseteq L((A+B)^*)$ and you finally have (for the same reason) $L((A^*B^*)^*)\subseteq L((A+B)^*)$

Tancredi
  • 1,522
0

Any word $w \in L((A + B)^*)$ is of the form $w_1 w_2 \ldots w_n$ where each $w_i \in L(A) \cup L(B)$. If $w_i \in L(A)$, then $w_i = w_i \epsilon \in L(A^* B^*)$, and similarly if $w_i \in L(B)$, then $w_i = \epsilon w_i \in L(A^* B^*)$. Hence $w \in L((A^* B^*)^*)$, and so we have $ L((A + B)^*) \subseteq L((A^* B^*)^*)$. Can you make a similar style of argument for the opposite inclusion?

Joppy
  • 12,875
  • Is this correct for $L((A^B^)^) \subseteq L((A+B)^)$? Say $w \in L((A^B^)^)$ then $w$ can be written as $w_1 w_2 \ldots w_n$ where $w_i \in A^B^$. Each $w_i$ can be further written as $v^a_i v^b_i$ where $v^a_i \in L(A), v^b_i \in L(B)$. Since $L(A), L(B) \subset L(A) \cup L(B) \implies v^a_i, v^b_i \in L(A) \cup L(B) \implies w_i \in L(A) \cup L(B)$. Since each $w_i \in L(A) \cup L(B) \implies w \in (L(A) \cup L(B))^ \implies w \in L((A + B)^*)$ – sprajagopal Jan 08 '21 at 18:01
  • @sprajagopal: almost, but $v_i^a v_i^b$ is too restrictive. It would be better to say that any word $w \in L(A^* B^*)$ can be written as $a_1 \cdots a_n b_1 \cdots b_m$ for some $a_i \in L(A)$, $b_i \in L(B)$, and $n, m \geq 0$. – Joppy Jan 09 '21 at 00:09
  • Oh. How is that different though? $a_i \ldots a_n$ is simply $v^a_i$ no? I should have made it clearer that the $v$'s don't have equal length as you did with $m,n$ values? – sprajagopal Jan 09 '21 at 05:20
  • @sprajagopal: it’s probably just a misunderstanding of notation. When you write $v_i^n$ for a word $v_i$ (rather than a regular expression $v_i$), that means to take a specific word and repeat it $n$ times. On the other hand, if words $x,y$ are in a language $L$, then for example $xyyxxyyyyx$ is a word in $L^*$ which is not of the form $v^n$ for $v \in L$. – Joppy Jan 09 '21 at 09:04