Question

Let A and B be regular languages. Show that A \ B is also regular. (Recall...

Let A and B be regular languages. Show that A \ B is also regular. (Recall that A \ B = {x ∈ A | x ∉ B}. In other words, this operation removes from A all the strings that are also in B.)

Homework Answers

Answer #1

Let M1 be the DFA that accepts A and M2 be the DFA that accepts B.

We create a DFA M that accepts A\B.

Let Q1 be the set of states of M1 and Q2 be the set of states of M2.

We define Q=Q1xQ2 to be the set of states of M where Q1xQ2 represents the Cartesian product of Q1 and Q2.

Let d1 and d2 be the transition functions of M1 and M2 respectively. We define the transition function of M to be d where, if Qa be a state in M1 and Qb be a state in M2, and a be an alphabet then, d((qa,qb),a)=d(qa,a),d(qb,a).

If q1 and q2 be the initial states of M1 and M2 respectively then (q1,q2) is the initial state of M.

We make the accept states of M to be those states where the state from M1 is final but that from M2 is not.

The DFA M we constructed accepts only those strings which are accepted by A but rejected by B. Hence A\B is a regular language.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Prove that regular languages are closed under the set dierence operation. That is, if A and...
Prove that regular languages are closed under the set dierence operation. That is, if A and B are regular languages, then, A - B is also a regular language.
Use the pumping lemma to show that the following languages are not regular. b. A2 =...
Use the pumping lemma to show that the following languages are not regular. b. A2 = {www| w € {a, b}*}
Which one of the following languages over the alphabet {0,1} is described by the regular expression...
Which one of the following languages over the alphabet {0,1} is described by the regular expression (0+1)* 0 (0+1)* 0 (0+1)* ? a.The set of all strings that begin and end with either 0 or 1 b.The set of all strings containing at most two zeros c.The set of all strings containing at least two zeros. d.The set of all strings containing the substring 00
3. (15 pt.) Prove that the class of regular languages is closed under intersection. That is,...
3. (15 pt.) Prove that the class of regular languages is closed under intersection. That is, show that if ? and ? are regular languages, then ? ∩ ? = {? | ? ∈ ? ??? ? ∈ ?} is also regular. Hint: given a DFA ?1 = (?1 , Σ, ?1 , ?1 , ?1) that recognizes ? and a DFA ?2 = (?2 , Σ, ?2 , ?2 , ?2) that recognizes ?, construct a new DFA ?...
1.2 Which of the following statements is wrong?        a). A set is a subset of itself...
1.2 Which of the following statements is wrong?        a). A set is a subset of itself        b). Emptyset is a subset of any set        c). A set is a subset of its powerset        d). The cardinality of emptyset is 0 1.3. Which of the following statements is correct?        a). A string is a set of symbols from an alphabet        b). The length of the concatenation of two strings can           be the same as one of them        c). The length of...
Are the following languages over {a, b} regular? If they are then prove it. If they...
Are the following languages over {a, b} regular? If they are then prove it. If they are not prove it with the Pumping Lemma {an bm | m != n, n >= 0} {w | w contains the substring ‘aaa’ once and only once } Clear concise details please, if the language is regular, provide a DFA/NFA along with the regular expression. Thank you. Will +1
Let F be the set of all finite languages over alphabet {0, 1}. Show that F...
Let F be the set of all finite languages over alphabet {0, 1}. Show that F is countable
Let swap_every_two be an operation on languages that is defined as follows: swap_every_two(L) = {a2a1a4a3 ....
Let swap_every_two be an operation on languages that is defined as follows: swap_every_two(L) = {a2a1a4a3 . . . a2na2n−1 | a1a2a3a4 . . . a2n−1a2n ∈ L where a1, . . . , a2n ∈ Σ} In this definition, Σ is the alphabet for the language L. 1. What languages result from applying swap every two to the following languages: (a) {1 n | n ≥ 0}, where the alphabet is {1}. (b) {(01)n | n ≥ 0}, where the...
Let L be a regular language over {0, 1}. Show how we can use the previous...
Let L be a regular language over {0, 1}. Show how we can use the previous result to show that in order to determine whether or not L is empty, we need only test at most 2n − 1 strings.
Draw the state diagram of DFAs recognizing the following languages. a. A = {w|w starts with...
Draw the state diagram of DFAs recognizing the following languages. a. A = {w|w starts with 0 and has odd length, or starts with 1 and has even length} b. B = {w|w is any string except 11 and 111} c. C = {, 0} Example of set difference: A = {0, 01}, and B = {0, 11}. Then, A − B = {01}. Prove that regular languages are closed under the set difference operation. That is, if A and...