1. Check if two regular grammars with the following sets of productions: are equivalent (i.e. if...
Problem 2 (20 points). Give context-free grammars that generate the following languages. In all parts, the alphabet Sis {0, 1} 1. {w w contains at least two Os} 2. {ww contains a substring 010) 3. {w w starts and ends with the same symbol} 4. {ww = w that is, w is a palindrome }
Theory of Computation - Push Down Automata (PDA) and Context Free Grammars (CFG) Problem 1. From a language description to a PDA Show state diagrams of PDAs for the following languages: a. The set of strings over the alphabet fa, b) with twice as many a's as b's. Hint: in class, we showed a PDA when the number of as is the same as the number of bs, based on the idea of a counter. + Can we use a...
Automata Theory - Finding a regular expression for each of the following languages over {a,b} or {0,1}: I've written the solution . Please show steps on how to approach the problems that I mentioned in parentheses. The ones where I put my own regular expression check and see if it's still right. Thanks Strings with .... odd # of a's ---> (b*ab*ab*)b*ab* even # of 1's ---> 0*(10*10*)* ---> my answer was 0*10*10* (is this still right?) start & end...
Give context-free grammars that generate the following languages (E = {a,b}). (a) (1 point) L1 = {w | W contains at least two b's} (b) (1 point) L2 = {w/w = wf, w is a palindrome} (c) (1 point) L3 = {w w contains less a's than b's}. (d) (1 point) LA = {w w = ayn+1, n > 2} (e) (1 points) Ls = {w w = a";2(m+n)cm, m, n >0}; (S = {a,b,c}).
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...
1. Complete the following exercises a) For Σ = {a, b} find regular expressions for the compliment of the following languages L = L(aa*bb) b) Let Li = L(ab*aa), L2 = L(a"bba"). Find a regular expression for (L1 n Ljl2. c) The symmetric difference of two sets Sı and S2 is defined as sı Θ s,-(x : x E Si or x E S2 but x is not in both S1 and S2). Show that the family of regular languages...
1. (1 point) Which of the following is true? A. Every regular language is a context-free language. B. Every context-free language is a regular language. C. If a language is context-free, then there exists a pushdown automata to recognize it. D. The set of context free languages is strictly larger than the set of regular languages. E. Each of A,C, and D is true. 2. (1 point) The following diagram shows a context free grammar with start variable S and...
1. (1 point) Which of the following is true? A. Every regular language is a context-free language. B. Every context-free language is a regular language. C. If a language is context-free, then there exists a pushdown automata to recognize it. D. The set of context free languages is strictly larger than the set of regular languages. E. Each of A,C, and D is true. 2. (1 point) The following diagram shows a context free grammar with start variable S and...
Finite state machines & Regular Expressions Please select the best option 1. For the following questions Let r, s, t be regular expressions for the same alphabet "á" (left column). Get the property on the right side that produces equality for each regular expression. 2. From the diagram of the solution M = (Σ, Q, s,, F) is respectively: e would be NONE. 3. The following graph corresponds to a diagram of: A. Transition machine and states b. Transition...
For each of the following, construct context-free grammars that generate the given set of strings. If your grammar has more than one variable, we will ask you to write a sentence describing what sets of strings you expect each variable in your grammar to generate. For example, if your grammar were: S → EO E → EE CC 0+ EC C+01 We would expect you to say “E generates (non-empty) even length binary strings; O generates odd length binary strings;...