Simple Finite Continued Fraction is Almost Determined by Value

Theorem
Let $n,m \geq 0$ be natural number.

Let $\sequence {a_k}_{0 \mathop \le k \mathop \le m}$ and $\sequence {b_k}_{0 \mathop \le k \mathop \le n}$ be simple finite continued fractions in $\R$.

Let $\sequence {a_k}_{0 \mathop \le k \mathop \le m}$ and $\sequence {b_k}_{0 \mathop \le k \mathop \le n}$ have the same value.

Then either:
 * $n = m$, and the sequences are equal.
 * $n = m + 1$, $a_k = b_k$ for $k < m$, $a_m = b_m-1$ and $b_{m + 1} = 1$
 * $m = n + 1$, $a_k = b_k$ for $k < n$, $b_n = a_n-1$ and $a_{n + 1} = 1$

Also see

 * Simple Infinite Continued Fraction is Uniquely Determined by Limit