HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Two regular languages over the same alphabet, regular or not regular?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
alphabetsamethelanguagesregulartwonotover

Problem

TRUE or FALSE:

Let $L_1, L_2$ be any two regular languages over the same alphabet $\Sigma$, then the language $L=\{w\in\Sigma^* \mid w\in L_1 \text{ or } w\notin L_2\}$ is regular.

So we have to determine whether $L_1 \cup \overline{L_2}$ is regular or not.

Proof:

First attempt:

First we have to prove that a complement of a regular language is also regular: the complement of a language $L$ with respect to an alphabet $\Sigma$ such that $\Sigma^$ is $\Sigma^-L$. Since $\Sigma^*$ is surely regular the complement of a regular language is always regular.

Let's prove that the union of two regular languages is also regular: For example, let $\Sigma = \{a,b\}$. Assume $L_1 = \{a\}$ and $L_2 = \{b\}$ so they are regular language. Then the union: $\{a\} \cup \{b\} = \{ab\}$ is also regular. Since $\{a\}$ is regular , $\{a\}^*$ is also a regular language.

After these two proofs we can say that the statement above is True.

Second attempt:

A regular language is regular iff there is a finite state machine recognizing it. Let $L_1 = \{S_1,\Sigma,\delta_1,s_0^1, F_1\}$ and $L_2 = \{S_2,\Sigma,\delta_2,s_0^2, F_2\}$ be two automata. First we have to take the complement of $L_2$. The complement of $L_2$ is the set of states without the set of final states: $\overline{L_2} = \{S_2,\Sigma,\delta_2,s_0^2, S_2-F_2\}$. Then we can create the product automaton of the two languages which is: $L = \{S_1 \times S_2,\Sigma,\delta_1 \times \delta_2,s_0^1 \times s_0^2, F_1\ \times (S_2-F_2)\}$. The final states of the language $L = L_1 \cup \overline{L_2}$ is the set of states where $F_1$ or $S_2 - F_2$ is final. Since there exists a finite state machine that recognizes the language $L$, we can say that $L$ is a regular language.

Can somebody please correct me? Maybe I made a mistake.

Solution

I see several problems.

In your first part you say that, given a regular language $L$, $\overline{L}$ is regular since $\Sigma^*- L$ is also regular. This is true, but it is implicitly using the fact that regular languages are closed under difference. It is not clear if you're allowed to use that fact as a black box (since it is a more general statement than the one you're trying to prove).

In your second part you are not giving a proof. You are just showing that $L_1 \cup L_2$ is regular when $\Sigma=\{a,b\}$, $L_1 = \{a\}$ and $L_2 = \{ b \}$. What if $\Sigma \neq \{a,b\}$? What if $L_1 \neq \{a \}$?
Your proof needs to work for all possible choices of $\Sigma, L_1,$
and $L_2$.

Moreover, $L_1 \cup L_2 \neq \{ab\}$ contrarily to what you claim.

Finally, you say that since $\{a\}$ is regular then so is $\{a\}^*$. This is true but it is unclear why you need this.

Context

StackExchange Computer Science Q#123899, answer score: 8

Revisions (0)

No revisions yet.