We will use induction on regular expressions. We will use the notaion == to denote equivalence. So A == B means that reg exp A is equivalent to reg exp B (which menas they define the same language). - If R = empty then we can take R' = R since R is epsilon-free, and now R == R'. - if R = epsilon then R == epsilon + empty (so here R' = empty). - if R = sigma then again, since R is epsilon-free we can just take R' = R. - if R = ST then inductively we know that S == S' or S == epsilon + S', and also T == T' or T == epsilon + T', where S',T' are epsilon-free. * If S==S' and T==T' then ST == S'T' (verify why) * if S==epsilon+S' T=T' then ST == (epsilon+S')T' == S'T' + T' and S'T' + T' is epsilon free. * if S==S' T=epsilon+T' then ST == S'(epsilon+T') == S' + S'T' and this is epsilon-free. * if S==epsilon+S' T=epsilon+T' then ST == (epsilon+S')(epsilon+T') == epsilon + S' + T' + S'T' and S' + T' + S'T' is epsilon free. - if R = S+T then again, inductively we know that S == S' or S == epsilon + S', and also T == T' or T == epsilon + T', where S',T' are epsilon-free. Let R' = S'+T', and notice that R' is epsilon-free. * If S==S' and T==T' then S+T == S'+T' * if S==epsilon+S' T=T' then S+T == (epsilon+S') + T' == epsilon + S' + T' == epsilon + R' * if S==S' T=epsilon+T' then S+T == S'+ (epsilon+T') == epsilon + S' + T' == epsilon + R' * if S==epsilon+S' T=epsilon+T' then ST == (epsilon+S')+(epsilon+T') == epsilon + S' + T' == epsilon + R' We have shown the inductive step and so every expression R is equivalent to an epsilon free expression or to an expression which is epsilon + an epsilon free expression. 2. L1 - L2 = L1 intersection (L1^c), where L1^c is the complelent of L1. But since (i) The complelemt of a regular language is regular (ii) The intersection fo two regular languages is regular. Hence L1-L2 is regular. 3. L2 U L3 is regular as the union of two regular languages. And L1 intersection (L2 U L3) is regular as the intersection of two regular languages. 4. The statemt is wrong and here is a counter example. Let L1 be the language {x in {0,1}* : (num of 0s in x) = (num of 1s in x) } We saw that L1 is not regular. We take L2 = L1^c. But now L1 U L2 = {0,1}* which is obviously regular; however, L1 is not regular. (BTW - can you see why also L2 is not regular?). 5. Of course, I meant to ask is L7 regular? The answer is YES. We can constract a DFSA for it as follows: we'll have 7 states. Each will represent different reminder of Z(x)-N(x) when it is divided by 7. Specifically, we will have q_0,q_1,...,q_6. whenever we get a zero we move from q_i to q_{i+1} (and if i =6 we move from q_6 to q_0). whenever we get a one we move from q_i to q_{i-1} (and if i =0 we move from q_0 to q_6). It is now easy to see that the state reached if the remainder of Z(x)-N(x) when it is divided by 7 is i, then the state reached when reading x is q_i. For example, Example. When x=0100 the automaton will move from q_0 to q_1 to q_0 to q_1 to q_2. Here Z(x) - N(x) = 3 - 1 = 2, and indeed the remainder of 2 when it is divided by 7 is 2. 6.Let L= {s1,s2,s3,...sn} be a language of n strings. Then we can simply weite the regular expression s1 + s2 + s3 + ... + sn, and clearly it defines the languge L. To be more formal the expresionis (...((s1+s2) + s3 ) + .... + sn). Another option is We will prove by induction that if |L|=n then L is regular. An alternative proof will be to prove that for all n P(n) holds, where P(n) is "if L is a language of size n then it is regular". Indeed, P(0) holds, as the empty language is regular. if P(n) holds then so does P(n+1): take a language L with n+1 strings, and pick one of them s. Let L' = L - {s}. Now, L' is regular since it is of size n. {s} is also regular as the regular expression s accepts it. So L = L' U {s} is regular. Can you see how we used the condition of L being finite in the above proof?