Proof (equivalence of context-free grammar and parse tree)

Call a sequence $(\mathbf{T}_0, \mathbf{T}_1, \ldots, \mathbf{T}_n)$ of $G$-parse trees derivative if

There is a one-to-one correspondence between $G$-derivations and derivative sequences of $G$-parse trees: a derivation $S = σ_0 \xrightarrow{G}_1 σ_1 \xrightarrow{G}_1 \ldots \xrightarrow{G}_1 σ_n$ uniquely defines a derivative sequence of $G$-parse trees $(\mathbf{T}_0, \ldots, \mathbf{T}_n)$ such that $σ_{\mathbf{T}_i} = σ_i$ and vice versa.

This shows that a $G$-parse tree starting from $S$ exists to parse every $w\in \mathcal{L}(G)$.

Conversely, let $\mathbf{T} = (T, l)$ be a $G$-parse tree starting from $S$ with $σ_\mathbf{T} = w$. We construct a derivative sequence of subtrees of $\mathbf{T}$:

  1. Let $\mathbf{T}_0 = (\set{ε}, l|_{\set{ε}})$.

  2. Having constructed $\mathbf{T}_i$, find some $t\in T_i$ that is a leaf in $T_i$ but not a leaf in $T$.

    • If such $t$ does not exist, we terminate.

    • Otherwise form $T_{i+1}$ by adding the $T$-successors of $t$ to $T_i$, and repeat step 2.

We claim that the construction terminates when $T_i = T$: suppose not. Since $T_i$ is a subtree of $T$, this means there exists $t\in T\setminus T_i$. On the branch leading to $t$ in $T$, there must be a maximal element of $T_i$. It is then a leaf of $T_i$ but not a leaf of $T$. This means our construction has not terminated.