Simple Finite Continued Fraction is Almost Determined by Value

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

Let $(a_k)_{0 \leq k \leq m}$ and $(b_k)_{0 \leq k \leq n}$ be simple finite continued fractions in $\R$.

Let $(a_k)_{0 \leq k \leq m}$ and $(b_k)_{0 \leq k \leq n}$ have the same value.

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

Also see

 * Simple Infinite Continued Fraction is Uniquely Determined by Limit