Question

In: Computer Science

For a given language L = { w | na(w) + nb(w) = nc(w) } where...

For a given language L = { w | na(w) + nb(w) = nc(w) } where S = G = {a, b, c} Looking for answer to 3

  1. Construct a PDA M that accepts L with S = G = {a, b, c}
  2. Show the sequence of instantaneous descriptions for the acceptance of acacbcbc by M in 1).
  3. Give a CFG G that generates L, L(G) = L.

Solutions

Expert Solution

Language L = { w | na(w) + nb(w) = nc(w) } where S = G = {a, b, c}

1 ) pushdown automata is below

how the PDA work ( Z0 is the initialized stack symbol,

                               E denote epsilon , delete one element from stack )

* initial stak element is

*when a or b come , we push the element to stack.

*when C come above a or b in stack , delete one element from stack.

*when C come above Z0 we push C to stack.

*when a or b come above C in stack , delete one element.

*when c come above c n stack , push c to stack

*when come above Z0 go to accept state

2 ) sequence of instantaneous descriptions for the acceptance of acacbcbc

    initial stack symbol is Z0.

    "a " come push to stack

    " c " come delete "a"

     "a " come push to stack

     " c " come delete "a"

      "b " come push to stack

     " c " come delete "b"

    "b " come push to stack

     " c " come delete "b" ( now only Z0 is in stack )

     " come above Zo" ----> go to accept state

3) CFG G that generates L, L(G) = L

S -> aX/ bX /

X- >S A / A S

A -> c

the above grammar only accept string with number of " c " = number of "a"+ number of " b "


Related Solutions

1. Design a FA for the language L = {w : na(w) ≤ 4}. 2. Design...
1. Design a FA for the language L = {w : na(w) ≤ 4}. 2. Design a FA that accepts all strings that contain the substring aba. 3. Design a FA for the language L = {ai baj : i, j ≥ 0, i + j is odd} 4. Design a FA for the language L = {bnam : n ≤ 2, m ≥ 3}
Given the language L={w| the number of a’s is greater than or equal to the number...
Given the language L={w| the number of a’s is greater than or equal to the number of b’s in w} a) Using the Pumping Lemma to prove L is not a regular language. b) Using closure property to prove L is not a regular language.
Suppose an individual’s weekly labour supply is given by L = -10 + w, where L...
Suppose an individual’s weekly labour supply is given by L = -10 + w, where L is labour supply in hours and w is the hourly after-tax wage. Assume that firms are willing to pay a before-tax wage of $40/hr. In the absence of taxation, how many hours per week will the individual work? What are weekly earnings? Illustrate the choice in a diagram. [4] Suppose the government institutes a 25% tax on labour income. What is the after tax...
Let L ⊆ Σ ∗ and define S(L), the suffix-language of L, as S(L) = {w...
Let L ⊆ Σ ∗ and define S(L), the suffix-language of L, as S(L) = {w ∈ Σ ∗ | x = yw for some x ∈ L, y ∈ Σ ∗ } Show that if L is regular, then S(L) is also regular.
Draw an NFA for the following language then convert to a DFA: L = {w :...
Draw an NFA for the following language then convert to a DFA: L = {w : |w| is odd or |w| is a multiple of 4} where Σ = {0, 1}
w = 50,000 + 10,000L where w is wages, L is the number of players The...
w = 50,000 + 10,000L where w is wages, L is the number of players The demand for players is given by the Marginal Revenue Product: MRP = 500,000 – 20,000L The Marginal Factor Cost to the club is : MFC = $50,000 + 25,000L If the NFL labor market were competitive, what would be the equilibrium number of players employed? If the NFL labor market were competitive, what would be the equilibrium wage of a player? We know that...
Prove a language {wwR0m where wR is the reverse of w and w has m 0’s...
Prove a language {wwR0m where wR is the reverse of w and w has m 0’s } is not context-free using the pumping lemma.
Given two languages A and B, let A/B denote the language {w | w x ∈...
Given two languages A and B, let A/B denote the language {w | w x ∈ A for some x ∈ B}. Show that if A is a context-free language and B is a regular language, then A/B is a context-free language. hint (construct PDAs)
The market demand for labour is given by w = 28 – 0.05L, where w is...
The market demand for labour is given by w = 28 – 0.05L, where w is the wage rate ($/week) and L is the number of workers the firm want to employ. The market supply of labour is given by w = 2 + 0.05L, where w is the wage rate ($/hr) and L is the number of workers who want to work. What is the equilibrium wage rate? If the government introduces the minimum wage rate of $15.75/hr, what...
3. The market demand for labour is given by w = 18 – 0.05L, where w...
3. The market demand for labour is given by w = 18 – 0.05L, where w is the wage rate ($/hr) and L is the number of workers the firm want to employ. The market supply of labour is given by w = 10 + 0.15L, where w is the wage rate ($/hr) and L is the number of workers who want to work. The government introduces the payroll tax $1 per hr per worker. a. What is the portion...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT