2. Give a CFG for each of the following languages where m, n, k, l ≥ 0.
(a) L = {am bn ck dl | m = n + k + l}.
(b) L = {am bn ck dl | k = m + n + l}.
(c) L = {am bn ck dl | m + 2l = n + k}.
(d) L = {am bn ck dl | m + k = 2n + l}.
a)
Grammar
S -> aSd | A
A -> aAc | C
C -> aCb | epsilon
Explanation
S is to have l number of a's and d's
A is to have l number of a's and c's
C is to have l number of a's and b's
-------- Multiple questions are posted. Answered
first one. Please post one at a time. Policy of
Chegg.
2. Give a CFG for each of the following languages where m, n, k, l ≥...
Prove that each of the following languages is not regular A) L= {a^n b^m c^k : k = 2n + 3m and n, m, k ≥ 0} B) L = {a^n : n is a power of 5}
Provide CFG for the following languages. 4.1.1 f) { 0^2 1^2n | n>=1} 4.1.2 h) The set of the strings of the form w1^n, where w is the string of 0’s and 1’s of length n.
Problem 1 Create a CFG that generates each of the languages below. [10 points] [10 points] wR is a substring of r if there are strings y, z E {a, b)" such that r = ywR2. A = {w I w E {a, b)" has more as than bs} B = {w#r l w,xe(a, b)" and wR a. b. is a substring of r). Rememb er, c. [10 points] C = {amb"ck 1 m, n > 0 and k =...
Give context-free grammars that generate the following languages. { anw | w in { a, b }*, |w| = 2n, n > 0 } { an bm | n, m ≥ 0; n < 2m } { anx an y | n > 0, x,y in { a, b }* } { ai bj ck | i, j, k ≥ 0; j = i + k }
Give a context free grammar for the language L where L = {a"bam I n>:O and there exists k>-o such that m=2"k+n) 3. Give a nondeterministic pushdown automata that recognizes the set of strings in L from question 3 above. Acceptance should be by accept state. 4. 5 Give a context-free grammar for the set (abc il j or j -k) ie, the set of strings of a's followed by b's followed by c's, such that there are either a...
Prove if the following languages are CFL or not.
If L is a CFL, give its
CFG. Otherwise, prove it by Pumping Lemma.
If any closure property of
CFL is applicable, apply them to simplify it before its proof.
L = {wwRw | w {a,
b}*}
L =
{anbjanbj|
n >= 0, j >= 0}
L =
{anbjajbn|
n >= 0, j >= 0}
The context free grammar for L = {(an)(bm)(ck) : k ≠ n + m; n, m, k ≥ 0} is n+m < k S1-> aS1c|cS1|cB B->bS1C|λ n+m > k S2 -> aS2c|aS2|bS2|a|b|B B-> bBc|λ Convert the cfg to chomsky reduced normal form.
The languages L1 = {anbm | m = n or m = 2n } and L2 = {a n b m | n <= m <= 2n } are context free. a. Choose one of the languages and write a CFG for it. b. Write the PDA that comes from your grammar (part a). Show the first 4 moves it would make on some string in your language (of length at least 4). Be sure to show state, input, and...
Provide context-free grammars for the following languages : (a) {(a^n)(b^m) | n ≥ (2^m)}. (b) {(a^i)(b^j)(c^k)(d^l)| i + j = k + l}.
Give a natural PDA and a CFG for the language { am bn cs dt : m+n=s+t, m,n,s,t ≥ 0} For example, aacd and abbbccdd are in the language.