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(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..
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...
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
What is the reaction A(g) + B(g) + C(g)------------> D(g) Experiment Initial [A] (mol/L) Initial [B]...
What is the reaction A(g) + B(g) + C(g)------------> D(g) Experiment Initial [A] (mol/L) Initial [B] (mol/L) Initial [C] (mol/L) Initial rate (M/s) 1 0.0500 0.0500 0.0100 6.25*^(-3) 2 0.1000 0.0500 0.0100 1.25*^(-2) 3 0.1000 0.1000 0.0100 5*10^(-2) 4 0.0500 0.0500 0.0200 6.25*10^(-3) 1) What is the order with respect to each reactant? 2) Write the rate law 3) Calculate K (using the data from experiment 1)
Suppose that the utility function is U(c, l) = c^(a) l^(1−a) where < a < 1....
Suppose that the utility function is U(c, l) = c^(a) l^(1−a) where < a < 1. Calculate the slope of an indifference curve for this utility function. What happens to the slope of the indifference curve when c decreases and l increases? Explain.
Say the household has utility U (c, l) = c + log (l) and is endowed...
Say the household has utility U (c, l) = c + log (l) and is endowed with h = 1 units of time and no units of capital. The government has planned expenditures of G = 1. The firm's production technology is Y = 4N. Now assume that the government cannot finance G trough a lump-sum tax, but has to rely on a proportional tax on income. Solve for the value (or values) of τ that allows the government to...
There are A, B and C, three plastic balls, A and B, B and C, C...
There are A, B and C, three plastic balls, A and B, B and C, C and A are attracted to each other, if A is positive: Group of answer choices 1. Both B and C are negatively charged. 2. One of the B balls and the C balls is going to be negatively charged and the other one is not charged 3. B ball, C ball has no charge 4. B ball is negatively charged, C ball is positively...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT