In CLRS in the dynamic programming chapter, there is a theorem about the longest common subsequence prefix that states the following:
Theorem Let the $X=(x_1,x_2,\dots,x_m)$ and $Y=(y_1,y_2,\dots,y_n)$ be sequences, and let $Z =(z_1,z_2,\dots,z_k)$ be their LCS.
If $x_m = y_n$, then $z_k = x_m = y_n$ and $Z_{k-1}$ is an LCS of $X_{m-1}$ and $Y_{n-1}$.
The theorem has two more points but I am interested particularly in the first point, I don't understand why we only consider $Z_{k-1}$ to be the LCS of $X_{m−1}$ and $Y_{n−1}$ and not $Z$ to be the LCS of all of $X$ and $Y$, if already the last element in all sequences match.