Question

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 alphabet is {0, 1}.

2. Show that if L is a regular language then so it swap every two(L).

below is a hint Hint: Try to construct an automaton accepting swap every two(L) from a DFA accepting L. The automaton you construct should conceptually process the input symbols in pairs, using its finite control to somehow remember the first symbol of the pair. If you use such a “proof-by-construction” approach, you should define the automaton formally and provide a brief, informal argument to show that your automaton accepts swap every two(L).

plz provide full detail! this assignment is very important for me

Homework Answers

Answer #1

1 (a) The language given is , and the operation swap_every_two is to be applied to L. According to the definition of the operation swap_every_two, for every string , swap_every_two(L) should contain the strings . So, this would mean that swap_every_two(L) should be formed by swapping the alternate symbols of all strings of even length in L. However, for the given language, swapping the alternate symbols should result in the same string. Thus, it would contain all the even length strings in L, which can be written as:

(b) The language given is . On applying the operation swap_every_two to L, the strings obtained by swapping alternate symbols of each member of L should be returned. So, each must be replaced with a . Hence, the language returned by the operation is:

2. The following is a procedure to construct a N.F.A. for the language swap_every_two(L) where L is a regular language:

  • Construct the D.F.A. which recognises L.
  • Construct a new D.F.A. where the alphabet is the Cartesian product of the alphabet of M with itself.
  • The transition function for is which is defined as follows:
    For and , .
  • Construct a new N.F.A. where .
  • The transition function for is which is defined as follows:
    For and , and .
  • is the required N.F.A.

The D.F.A. is constructed by taking pairs of symbols and leading to the state where the automata would have reached if the symbols were provided individually. The N.F.A. is constructed by adding dummy states corresponding to each state where for individually processing the pair of symbols. The order of processing is reversed. So, the N.F.A. recognises the language swap_every_two(L) which makes it 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
Automata Theory and Formal Languages Instructions: Draw the DFA (Deterministic Finite Automaton) of the following: DFA...
Automata Theory and Formal Languages Instructions: Draw the DFA (Deterministic Finite Automaton) of the following: DFA in which start and end symbol must be different Design a DFA in which start and end symbol must be same DFA in which every 'a' should be followed by 'b' DFA in which every 'a' should never followed by 'b' DFA in which every 'a' should followed by 'bb' DFA in which every 'a' should never followed by 'bb' DFA for anbm| n,m...
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 ?...
Each of the following languages is the union or intersection of two simpler languages. In each...
Each of the following languages is the union or intersection of two simpler languages. In each part, construct DFAs for the simpler languages, then combine them using the construction discussed in class to give the state diagram of a DFA for the language given. In all parts, Σ = {0,1}. 1. {w|w starts with an 0 and has at most one 1}
Let u and v be two particular strings over an alphabet Σ. Prove that the following...
Let u and v be two particular strings over an alphabet Σ. Prove that the following language B = {w ∈ Σ ∗ | w contains u as a substring but does not contain v as a substring} is regular. As a hint, think of using operations under which regular languages are known to be closed to simplify your argument. plz provide with the full detail !
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
Provide direct answers. This question has been posted here by someone else before, but the answer...
Provide direct answers. This question has been posted here by someone else before, but the answer is unreadable and does not indicate clearly the answer. DO C. Let Lodd = {w ∈ {0, 1}∗ | w contains an odd number of 0s}. a) - What is L∗odd? (arrive at a direct description of this language that does not refer to Lodd). b) Then Start with a DFA recognizing Lodd, and use the construction we saw in class to obtain an...
Provide direct answers. This question has been posted here by someone else before, but the answer...
Provide direct answers. This question has been posted here by someone else before, but the answer is unreadable and does not indicate clearly the answer. DO A. Let Lodd = {w ∈ {0, 1}∗ | w contains an odd number of 0s}. a) - What is L∗odd? (arrive at a direct description of this language that does not refer to Lodd). b) Then Start with a DFA recognizing Lodd, and use the construction we saw in class to obtain an...
Let S denote the set of all possible finite binary strings, i.e. strings of finite length...
Let S denote the set of all possible finite binary strings, i.e. strings of finite length made up of only 0s and 1s, and no other characters. E.g., 010100100001 is a finite binary string but 100ff101 is not because it contains characters other than 0, 1. a. Give an informal proof arguing why this set should be countable. Even though the language of your proof can be informal, it must clearly explain the reasons why you think the set should...
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S →...
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S → aSb / ∈ Grammar G2- S → aAb / ∈, A → aAb / ∈ a. is G1=G2 b. What is the grammar generated by the expression Problem 2: Let us consider the grammar. G2 = ({S, A}, {a, b}, S, {S → aAb, aA → aaAb, A → ε } ) Derive aaabbb Problem 3: Suppose we have the following grammar. G: N...
1. Given β = XT 1×nAn×nXn×1, show that the gradient of β with respect to X...
1. Given β = XT 1×nAn×nXn×1, show that the gradient of β with respect to X has the following form: ∇β = X T (A + A T ). Also, simplify the above result when A is symmetric. (Hint: β can be written as Pn j=1 Pn i=1 aijxixj ). 2. In this problem, we consider a probabilistic view of linear regression y (i) = θ T x (i)+ (i) , i = 1, . . . , n, which...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT