{
  "translations": {
    "en": {
      "GNF": {
        "type": "select",
        "description": "<b>Theorem:</b> For any CFL $L$ that does not include $\\lambda$, there exists NPDA $M$ such that $L = L(M)$.<br/>We will prove that by presenting a method to convert any CFG to a NPDA.<br/>Given a ($\\lambda$ free) CFL $L$, we know that there exists a CFG $G$ such that $L = L(G)$.<br/>We also know that there exists $G'$ in GNF, such that $L(G) = L(G')$.",
        "question": "GNF means",
        "answer": "Greibach Normal Form",
        "choices": ["Greibach Normal Form", "Greater Normal Form", "Chomskey Normal Form"]
      },
      "GNFform": {
        "type": "select",
        "description": "<b>Theorem:</b> For any CFL $L$ that does not include $\\lambda$, there exists NPDA $M$ such that $L = L(M)$.<br/>We will prove that by presenting a method to convert any CFG to a NPDA.<br/>Given a ($\\lambda$ free) CFL $L$, we know that there exists a CFG $G$ such that $L = L(G)$.<br/>We also know that there exists $G'$ in GNF, such that $L(G) = L(G')$.",
        "question": "If a grammar $G' = (V,T,S,P)$ is in GNF, then all productions are in the form:",
        "answer": "$A \\rightarrow ax$ where $A \\in V$, $a \\in T$, $x \\in V^*$",
        "choices": ["$A \\rightarrow BC$ or $A \\rightarrow c$, where $A,B,C \\in V$, and $c \\in T$", "$A \\rightarrow B$ where $A,B \\in V$", "$A \\rightarrow \\lambda$ where $A\\in V$", "$A \\rightarrow ax$ where $A \\in V$, $a \\in T$, $x \\in V^*$"]
      },
      "numstates": {
        "type": "select",
        "description": "<b>Theorem:</b> For any CFL $L$ that does not include $\\lambda$, there exists NPDA $M$ such that $L = L(M)$.<br/>We will prove that by presenting a method to convert any CFG to a NPDA.<br/>Given a ($\\lambda$ free) CFL $L$, we know that there exists a CFG $G$ such that $L = L(G)$.<br/>We also know that there exists $G'$ in GNF, such that $L(G) = L(G')$.<br/><br/>Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.",
        "question": "Consider the CFG on the left (in GNF). We need to convert it to a PDA. How many states do we need for the PDA?",
        "answer": "3",
        "choices": ["1", "2", "3", "4", "5", "6", "7"],
        "incorrectFeedback": ["Look carefully at the definition for $Q$."],
        "correctFeedback": ["We need a start state, a final state, and a state in between to process the productions."]
      },
      "alpha": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.",
        "question": "What is the input alphabet for the PDA?",
        "answer": ["The alphabet for $L$"],
        "choices": ["The alphabet for $L$", "The grammar terminals", "The grammar variables", "The grammar start variable", "The stack start symbol $Z$"]
      },
      "alphastack": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.",
        "question": "What is the stack alphabet for the PDA?",
        "answer": ["The grammar variables", "The stack start symbol $Z$"],
        "choices": ["The grammar terminals", "The grammar variables", "The grammar start variable", "The stack start symbol $Z$"],
        "incorrectFeedback": ["Remember what we said in the overview for the conversion: For each production that we execute, we pop the terminal from the LHS off the stack, and put the variables from the RHS onto the stack. And like all PDAs, there is a stack bottom symbol."]
      },
      "q0q1": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.",
        "question": "What is the transition from $q_0$ to $q_1$?",
        "answer": "$\\delta(q_0, \\lambda, Z)\\ \\rightarrow (q_1, SZ)$",
        "choices": ["$\\delta(q_0, \\lambda, Z)\\ \\rightarrow (q_1, SZ)$", "$\\delta(q_0, a, $Z$)\\ \\rightarrow (q_1, SZ)$", "$\\delta(q_0, S, $Z$)\\ \\rightarrow (q_1, SZ)$"],
        "correctFeedback": ["$\\lambda$ in the second position of the production LHS means that we don't read anything from the tape. We simply start in $q_0$, confirm that the stack is empty ($Z$ is at the top), and put $SZ$ onto the stack."],
        "incorrectFeedback": ["We can only read a tape input symbol, or else $\\lambda$ (meaning don't read the tape for this transition)."]
      },
      "SaSA": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.",
        "question": "What is the transition for the highlighted production?",
        "answer": "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$",
        "choices": ["$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, $S$) \\rightarrow (q_1, SSA)$"]
      },
      "SaAA": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.",
        "question": "What is the transition for the highlighted production?",
        "answer": "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$",
        "choices": ["$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AAS)$"]
      },
      "Sb": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.",
        "question": "What is the transition for the highlighted production?",
        "answer": "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, S)$"]
      },
      "AbBBB": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.",
        "question": "What is the transition for the highlighted production?",
        "answer": "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$",
        "choices": ["$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, BBB)$"]
      },
      "Bb": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.",
        "question": "What is the transition for the highlighted production?",
        "answer": "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, $B$) \\rightarrow (q_1, B)$"]
      },
      "step3": {
        "type": "select",
        "description": "Now we show how to construct NPDA $M = (Q, \\Sigma, \\Gamma, \\delta, q_0, Z, F)$, where<br/>$Q = \\{q_0, q_1, q_f\\}, \\Sigma = T, \\Gamma = V \\cup \\{Z\\}, F = \\{q_f\\}$.<br/>1. $M$ starts by putting $S$ on the stack.<br/>2. For each production $A \\rightarrow a X_1 X_2 \\ldots X_n$, put $(q_1, X_1 X_2 \\ldots X_n)$ in $\\delta(q_1, a, A)$.<br/>In other words: Pop A from the stack, read “a” from the tape, and push $X_1 X_2 \\ldots X_n$ onto the stack.<br/>3. Accept if $S \\stackrel{*}{\\Rightarrow} w \\in \\Sigma^*$ (all variables on stack are replaced by terminals or $\\lambda$).",
        "question": "Once we reach $Z$, it means that all variables are converted to terminals or $\\lambda$ and popped from the stack. What is the transition from $q_1$ to $q_f$?",
        "answer": "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$",
        "choices": ["$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$", "$\\delta(q_1, \\lambda, S) \\rightarrow (q_f, S)$"]
      },
      "a1": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Starting from $S$, which production do we need to use to derive $abbbbb$?",
        "answer": "1",
        "choices": ["1","2", "3", "4","5"]
      },
      "b1": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Now we have $S \\Rightarrow aSA$. What is the next production we need to use to derive $\\textbf{a}bbbbb$?",
        "answer": "3",
        "choices": ["1","2", "3", "4","5"]
      },
      "b2": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Now we have $S \\Rightarrow aSA \\Rightarrow abA$. What is the next production we need to use to derive $\\textbf{ab}bbbb$?",
        "answer": "4",
        "choices": ["1","2", "3", "4","5"]
      },
      "b3": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Now we have $S \\Rightarrow aSA \\Rightarrow abA\\Rightarrow abbBBB$. What is the next production we need to use to derive $\\textbf{abb}bbb$?",
        "answer": "5",
        "choices": ["1","2", "3", "4","5"]
      },
      "b4": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Now we have $S \\Rightarrow aSA \\Rightarrow abA\\Rightarrow abbBBB \\Rightarrow abbbBB$. What is the next production we need to use to derive $\\textbf{abbb}bb$?",
        "answer": "5",
        "choices": ["1","2", "3", "4","5"]
      },
      "b5": {
        "type": "select",
        "description": "Now let us trace a string that is in $L(G)$ and show that the PDA will accept it.<br/><br/>Trace $abbbbb$.",
        "question": "Now we have $S \\Rightarrow aSA \\Rightarrow abA\\Rightarrow abbBBB \\Rightarrow abbbBB \\Rightarrow abbbbB$. What is the next production we need to use to derive $\\textbf{abbbb}b$?",
        "answer": "5",
        "choices": ["1","2", "3", "4","5"]
      },
      "PDAstart": {
        "type": "select",
        "description": "Now we have $S \\Rightarrow aSA \\Rightarrow abA\\Rightarrow abbBBB \\Rightarrow abbbBB \\Rightarrow abbbbB \\Rightarrow abbbbb$. The sring is derived form the grammar.",
        "question": "Let us do the same in the PDA. What transition should we start with?",
        "answer": "$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, SZ)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, SZ)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAa": {
        "type": "select",
        "description": "We have now primed the PDA with the grammar start variable. Start processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAb1": {
        "type": "select",
        "description": "Continue processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAb2": {
        "type": "select",
        "description": "Continue processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAb3": {
        "type": "select",
        "description": "Continue processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAb4": {
        "type": "select",
        "description": "Continue processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "PDAb5": {
        "type": "select",
        "description": "Continue processing the input.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      },
      "accept": {
        "type": "select",
        "description": "Now we have finished processing the input, and we are at the stack bottom. That means the PDA should accept the string.",
        "question": "What is the next transition?",
        "answer": "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$",
        "choices": ["$\\delta(q_0, \\lambda, Z) \\rightarrow (q_1, Z)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, SA)$", "$\\delta(q_1, a, S) \\rightarrow (q_1, AA)$", "$\\delta(q_1, b, S) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, b, A) \\rightarrow (q_1, BBB)$", "$\\delta(q_1, b, B) \\rightarrow (q_1, \\lambda)$", "$\\delta(q_1, \\lambda, Z) \\rightarrow (q_f, Z)$"]
      }
    }
  }
}
