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 the transition diagram (the graph) for a DFA accepting the following languages over the alphabet {0,1}. Your automata MUST be Deterministic L = { w | w begins with the substring 1110 or the substring 0110 }
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...
Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that there are two consecutive 0s or the number of 1s is not divisible by 5. Your DFA must handle all intput strings in {0,1}*. (Hint: look at solution of previous question)
Suppose alphabet Σ = {a} and consider the following regular language A, A = {w | |w| ≥ 4}, i.e., strings whose length is at least 4 (equivalently, unary numbers x ≥ 4). a) Construct a DFA that recognizes A with as few states as possible (draw a state diagram). b) Construct a PDA that recognizes A with as few states as possible (draw a state diagram). Note that the stack alphabet may include additional symbols.
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.
Give the state diagram for a deterministic finite automaton (DFA) recognizing the following language over Σ = {0,1}: L1 = {w : w contains an even number of 0’s AND w ends in 1}
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*}.