Lecture 6 - Context-Free Languages and Push-down Automata

Date Pre-lecture slides Post-lecture scribbles Lecture recording
September 12 2023 Lecture 6 - Context-Free Languages and Push-down Automata Lecture 6 - Context-Free Languages and Push-down Automata Lecture 6 - Context-Free Languages and Push-down Automata
 

Notes

Context Free Language

Context Free Grammar

Formal Definition: Defined by 4 tuples G = (V, T, P, S)

Example: For generating a language with equal number of 0s and 1s of the form $0^{n}1^{n}$. We will have the G = ({S, A}, {0, 1}, {S→0A1, A→0A1 | $\varepsilon$}, S)



Push-down Automata

PDA Diagram

Formal Definition: Defined by 6 tuples P = (Q, $\Sigma$, $\Gamma$, $\delta$, s, A)

Transition Function $\delta$
$\delta$ = $Q\times\Sigma \cup {\varepsilon}\times\Gamma \cup {\varepsilon}$ → $P(Q \times (\Gamma\cup{\varepsilon}))$

PDA Basic Graph


Example: Let’s construct a PDA that accepts the language $L = {0^n1^n | n\ge1}$
PDA Example

Closure Properties of CFL

Given two CFG $G_1 = (V_1, T, P_1, S_1)$ and $G_2 = (V_2, T, P_2, S_2)$ and assume that $V_1 \cap V_2 = \phi$. Let $L1$ and $L2$ be languages produced by $G1$ and $G2$ respectively.

Additional Resources

Contributors

Gautham Varma