Question

In: Computer Science

If L= {0a1b0c : b ≠ a + c; a, b, c ≥ _0}, Is this...

If L= {0a1b0c : b ≠ a + c; a, b, c ≥ _0}, Is this language context free? If so can you give me PDA, CFG .

Solutions

Expert Solution

Logic for PDA:
strings are in this format: 0^a1^b0^c, where b!=a+c
so,initially for each 0 we push 0 to stack, which keeps the count of 0^a
then for each 1 we pop one 0 from stack
here we have there cases: if a<b,a>b and a=b
case1)a<b
means incoming 1's count is greater than the 0's in the stack
so,in this when ever the 0's in stack are empty, we stack pushing 1's for each 1, means now stack will contain 1^(b-a)
then after 1's are finished,stack will contain 1^(b-a)
then for each 0 we will pop one 1 from stack //here number of 0's must not equal b-a//that is c=b-a
if reading 0's is done, and stack is not empty then, we accept the string,move to final state//since c<b-a : b!=c+a
if still there are incoming 0's and stack is empty then, we accept the string,move to final state//since c>b-a :b!=c+a
if reading 0's is done, and stack is empty, then we reject
case2)a>b
means incoming 1's count is smaller than the 0's count in stack
this means, b!=a+c //since already a is greater than b
so, we can move to final state, and just read all remaining 0's : 0^c
case3)a=b
means reading 1's done and stack is empty
now
if at least 0 comes, then we accept, so move to final state// since b!=c+a
other wise we reject


Related Solutions

L ={x^a y^b z^c | c=a+b} a) Prove that L is not regular. b)Prove by giving...
L ={x^a y^b z^c | c=a+b} a) Prove that L is not regular. b)Prove by giving a context-free grammar that the L is context free. c)Give a regular expression of the complement L'.
L ={x^a y^b z^c | c=a+b} a) Prove that L is not regular. b)Prove by giving...
L ={x^a y^b z^c | c=a+b} a) Prove that L is not regular. b)Prove by giving a context-free grammar that the L is context free. c)Give a regular expression of the complement L'.
L= {x^a y^b z^c | c=a+b(mod 2)} .Create a DFA and NFA for the language L....
L= {x^a y^b z^c | c=a+b(mod 2)} .Create a DFA and NFA for the language L. Solution and explanation please..
Is the L(r1) = L(r2) where r1 = (ab*+c)(λ+∅) and r2 = (a+c)(b*+∅)? what are the...
Is the L(r1) = L(r2) where r1 = (ab*+c)(λ+∅) and r2 = (a+c)(b*+∅)? what are the languages of L(r1), L(r2)? show the definition's using regular expression, assume Σ = (a,b,c)
Player 1 chooses T, M, or B. Player 2 chooses L, C, or R. L C...
Player 1 chooses T, M, or B. Player 2 chooses L, C, or R. L C R T 0, 1 -1, 1 1, 0 M 1, 3 0, 1 2, 2 B 0, 1 0, 1 3, 1 (a) Find all strictly dominated strategies for Player 1. You should state what strategy strictly dominates them. (b) Find all weakly dominated strategies for Player 2.  You should state what strategy weakly dominates them. (c) Is there any weakly dominant strategy for player...
Let a, b, c ∈ Q, (a, b) /= (0, 0), and consider the line L...
Let a, b, c ∈ Q, (a, b) /= (0, 0), and consider the line L = {(x, y) ∈ R2 ; ax + by = c}. State and prove a criterion in terms of the data a, b, c ∈ Q to check whether L∩Z2 = ∅, i.e., the line passes through no point with integer coordinates in the plane. Give an explicit example of such a line that is neither parallel to the x-axis nor to the y-axis!
Simplify the grammar G. Does L(G) contain ε ? S -> A B C | B...
Simplify the grammar G. Does L(G) contain ε ? S -> A B C | B a B A -> a A | B a C | a a a B -> b B b | a | D C -> C A | A C D -> ε
Patient A Patient B Patient C Na+ 138 mEq/L 142 mEq/L 148 mEq/L K+ 5.1 mEq/L...
Patient A Patient B Patient C Na+ 138 mEq/L 142 mEq/L 148 mEq/L K+ 5.1 mEq/L 6.1 mEq/L 3.8 mEq/L Ca+ 8.9 mg/dL 7.5 mg/dL 9.5 mg/dL Mg+ 1.3 mg/dL 0.9 mg/dL 2.1 mg/dL pH 7.40 7.32 7.42 PCO2 42 mm Hg 48 mm Hg 40 mm Hg PO2 95% 98% 99% HCO3 22 28 26 Patient B is complaining of numbness and tingling, especially around the mouth. What are the other two electrolyte imbalances in this patient that could...
Let L = {x = a r b s c t | r + s =...
Let L = {x = a r b s c t | r + s = t, r, s, t ≥ 0}. Give the simplest proof you can that L is not regular using the pumping lemma.
Draw three-dimensional representations of the following amino acids. Explain their structures. (a) L-phenylalanine (b) L-histidine (c)...
Draw three-dimensional representations of the following amino acids. Explain their structures. (a) L-phenylalanine (b) L-histidine (c) D-serine (d) L-tryptophan
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT