1(a)Draw the state diagram for a DFA for accepting the following
language over
alphabet {0,1}:
{w | the length of w is at least 2 and has the same symbol in its
2nd and last
positions}
(b)Draw the state diagram for an NFA for accepting the following
language over
alphabet {0,1} (Use as few states as possible):
{w | w is of the form 1*(01 ∪ 10*)*}
(c)If A is a language with alphabet Σ, the complement of A is
the set of all strings over
Σ that are not in A.
Show, with the help of a diagram, that the class of regular
languages is closed
under complement. That is, show that if A is a regular language,
then so is the
complement of A.
(d)Prove that the following language, A, is NOT regular, by
using the Pumping
Lemma for regular languages.
A ={ab^nc^n | n≥ 0}.
Thank you very much.
answer of que 1
answer of que 2
que3
Let M = < Q , , q0 , , x > be a DFA that accepts a language L.
Then a DFA that accepts the complement of L, i.e. * - L, can be obtained by swapping its accepting
states with its non-accepting states, that is Mc = < Q ,
, q0 , , Q - x > is a DFA that accepts * - L .
For example the following DFA accepts the language a+ over
= { a , b }.
ques 4
Let L = {ab^nc^n | n ≥ 1}.
Then L is not regular.
Proof: Let n be as in Pumping Lemma.
Let w = ab^nc^n
If L is a regular language, then there is an integer n > 0 with
the property that: (*) for any string x ∈ L where |x| ≥ n, there
are strings u, v, w such that
(i) x = uvw, (ii) v != null (iii) |uv| ≤ n, (iv) uvkw ∈ L
for all k ∈ N. To prove that a language L is not regular, we use proof by contradiction.
Here are the steps. 1. Suppose that L is regular.
2. Since L is regular, we apply the Pumping Lemma and assert the existence of a number n > 0 that satisfies the property (*).
3. Give a particular string x such that (a) x ∈ L, (b) |x| ≥ n. This the trickiest part. A wrong choice here will make step 4 impossible.
4. By Pumping Lemma, there are strings u, v, w such that (i)-(iv) hold. Pick a particular number k ∈ N and argue that uvkw != L, thus yielding our desired contradiction.
Let L = {ab^kc^k : k ∈ N}. We prove that L is not regular.
[step 1] By way of contradiction, suppose L is regular.
[step 2] Let n be as in the Pumping Lemma.
[step 3] Let x = ab^nc^n . Then x ∈ L [definition of L] and |x| = 2n ≥ n.
[step 4] By Pumping Lemma, there are strings u, v, w such that
(i) x = uvw, (ii) v !=null, (iii) |uv| ≤ n, (iv) uvkw ∈ L for all k ∈ N.
Let y be the prefix of x with length n. I.e., y is the first n symbols of x. By our choice of x, y = ab^n .
By (i) and (iii), uv = ab^j for some j ∈ N with 0 ≤ j ≤ n.
Combining with (ii), v = 0^j for some j ∈ N with 0 < j ≤ n.
By (iv), uv^2w ∈ L.
(#) Aside: We are picking k = 2. Indeed, any k != 1 will do here.
However, uv^2w = uvvw = ab^n+jc^n is not belonging to L,
[definition of L; since j > 0, n + j != n] which contradicts (#). Therefore L is not regular.
1(a)Draw the state diagram for a DFA for accepting the following language over alphabet {0,1}: {w...
Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that there are no consecutive 0s, and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a way to approach the problem: First focus only building the DFA which accepts the language: As you build your DFA, label your states with an explanation of what the state actually represents in terms...
Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that the number of 0s is divisible by 2 and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a methodical way to do this: Figure out all the final states and label each with the shortest string it accepts, work backwards from these states to...
Give a DFA for the following language over the alphabet Σ = {0, 1}: L={ w | w starts with 0 and has odd length, or starts with 1 and has even length }. E.g., strings 0010100, 111010 are in L, while 0100 and 11110 are not in L.
John Doe claims that the language L, of all strings over the alphabet Σ = { a, b } that contain an even number of occurrences of the letter ‘a’, is not a regular language. He offers the following “pumping lemma proof”. Explain what is wrong with the “proof” given below. “Pumping Lemma Proof” We assume that L is regular. Then, according to the pumping lemma, every long string in L (of length m or more) must be “pumpable”. We...
4(10 points] Let A be the language over the alphabet -(a, b) defined by regular expression (ab Ub)aUb. Give an NFA that recognizes A. Draw an NFA for A here 5.10 points] Convert the following NFA to equivalent DFA a, b 4(10 points] Let A be the language over the alphabet -(a, b) defined by regular expression (ab Ub)aUb. Give an NFA that recognizes A. Draw an NFA for A here 5.10 points] Convert the following NFA to equivalent DFA...
Three. Show a DFA over the alphabet {a, b} for the following language via complement construction (as in Exercise l.5.d): {w belongs to Sigma* | w is not in a*b*}.
Question 1: Every language is regular T/F Question 2: There exists a DFA that has only one final state T/F Question 3: Let M be a DFA, and define flip(M) as the DFA which is identical to M except you flip that final state. Then for every M, the language L(M)^c (complement) = L( flip (M)). T/F Question 4: Let G be a right linear grammar, and reverse(G)=reverse of G, i.e. if G has a rule A -> w B...
Prove the following language is not regular (you may use pumping lemma and the closure of the class of regular languages under union, intersection, and complement.): (w | w ∈ {0,1}* is not a palindrome} Please show work/explain. Thanks.
Construct an DFA automaton that recognizes the following language of strings over the alphabet {a,b}: the set of all strings over alphabet {a,b} that contain aa, but do not contain aba.
1. Construct a Finite Automata over Σ={0,1} that recognizes the language {w | w ∈ {0,1}* contains a number of 0s divisible by four and exactly three 1s} 2. Construct a Finite Automata that recognizes telephone numbers from strings in the alphabet Σ={1,2,3,4,5,6,7,8,9, ,-,(,),*,#,}. Allow the 1 and area code prefixing a phone number to be optional. Allow for the segments of a number to be separated by spaces (denote with a _ character), no separation, or – symbols.