I am trying to prove the following theorem:
For every derivation-tree in a context-free grammar $G=(V,T,P,S)$ there exists at most one leftmost derivation.
My partial proof by contradiction (I stucked at Cases (2) and (3)):
Let $G = (V,T,P,S)$ be a context-free grammar.
Suppose that for some derivation-tree there are two distinct rightmost derivations:
$S = πΆ_0 βΉ_{lm} πΆ_1 βΉ_{lm} πΆ_2 βΉ_{lm} β¦ βΉ_{lm} πΆ_n = x$
$S = π·_0 βΉ_{lm} π·_1 βΉ_{lm} π·_2 βΉ_{lm} β¦ βΉ_{lm} π·_m = x $
(x is the frontier of the tree)
It is clear that $πΆ_1 = π·_1$ since the first derivation uses a production rule of the form $S βΆ Y_1 β¦ Y_k$ where $Y_1 β¦ Y_k$ are the children of the root node $S$.
Now since the derivations are distinct we get that there are three cases:
(1) $β i_0 β \{2, β¦ , min(m, n)\}, (β k β \{ 0, β¦ , i0 -1 \}, πΆ_k = π·_k ) β πΆ_{i_0} β π·_{i_0}$
(In other words: it says that the two derivations are identical till we reach some point in both derivations where they become distinct)
(2) $n < m β β k β \{ 0, β¦ , n \}, πΆ_k = π·_k$
(In other words: it says that the first derivation is a βsubβ derivation of the second one)
(3) $n > m β β k β \{ 0, β¦ , m \}, πΆ_k = π·_k$
(In other words: it says that the second derivation is a βsubβ derivation of the first one)
Case (1): If $β i0 β \{2, β¦ , min(m, n)\}, (β k β \{ 0, β¦ , i0 -1 \}, πΆ_k = π·_k ) β πΆ_{i_0} β π·_{i_0}$ , We get that $βwβT^*, π·β(VβͺT)^* , AβV, πΆ_{i_0-1} = π·_{i_0-1} = wAπ·$ , Since both derivations are in the same derivation-tree, The only possibility is that different production rules where used on different variables, but since the derivations are leftmost-derivations, we must use at the $i_0$βth derivation the corresponding production-rule (in the derivation-tree) on $A$, since $A$ is the leftmost variable. Again, since the derivations are in the same derivation-tree, The production rule used on A must be the same rule $A βΆ Z_1 β¦ Z_k$ where $Z_1 β¦ Z_k$ are the children nodes of the node $A$. Therefore we reached the contradiction $πΆ_{i_0} = π·_{i_0}$.
Case (2): If $n < m β β k β \{ 0, β¦ , n \}, πΆ_k = π·_k$ then we get that $πΆ_n = π·_n$ , Now since $πΆ_n = x$ we get $πΆ_n = π·_n = x$, Since m > n and since $x = π·_n βΉ_{lm} β¦ βΉ_{lm} π·_m = x$, we get that $x βΉ_{lm}^+ x$.
Now I do not know how to proceed.
Case (3): If $n > m β β k β \{ 0, β¦ , m \}, πΆ_k = π·_k$ then we get that $πΆ_m = π·_m$ , Now since $πΆ_m = x$ we get $πΆ_m = π·_m = x$, Since n > m and since $x = πΆ_m βΉ_{lm} β¦ βΉ_{lm} πΆ_n = x$, we get that $x βΉ_{lm}^+ x$.
Now I do not know how to proceed.
Maybe it got something to do with the fact that $x$ is the frontier of the derivation tree.
Thanks for any help.