From Eric Lehman et al.'s Mathematics for Computer Science [PDF]:
Problem 9.13. $\,$ Define the Pulverizer state machine to have: $$ \begin{align*} \text{states} ::=& \mathbb{N}^6&\\ \text{start state} ::=& (a, b, 0, 1, 1, 0)&(\text{where }a \ge b > 0)\\ \text{transitions} ::=& (x, y, s, t, u, v) \longrightarrow\\ &(y, \text{rem}(x, y), u-sq, v-tq, s, t )& (\text{for }q=\text{qcnt}(x, y), y > 0). \end{align*} $$ (a) Show that the following properties are preserved invariants of the Pulverizer machine: $$ \begin{align*} \gcd(x, y) &= \gcd(a, b), &(\text{Inv1})\\ sa + t b &= y, \text{and} &(\text{Inv2})\\ ua + vb &= x. &(\text{Inv3})\\ \end{align*} $$ (b) Conclude that the Pulverizer machine is partially correct.
(c) Explain why the machine terminates after at most the same number of transi- tions as the Euclidean algorithm.
where the Pulverizer state machine is defined as follows
Today, the Pulverizer is more commonly known as the “Extended Euclidean Gcd Algorithm,” because it is so close to Euclid’s algorithm.
some notation definition:
We use the notation $\text{qcnt}(n, d )$ for the quotient and $\text{rem}(n, d )$ for the remainder.
I can prove (a).
$\text{rem}(x,y)\ge 0$ and it is strictly decreasing when the machine runs. Does (b) says that we need to let $\text{rem}(x,y)= 0$ as the termination condition which is same as the Euclidean algorithm? This is different from the implicit condition $y=0$ implied by $y>0$.
But if so, then it will cause these 2 algorithms have the same number in (c). If not, it should take more number but not at most. Then (c) is still not as the problem expected.
Implied by wikipedia, the above process adding 2 sequences based on the standard Euclidean algorithm should have "correct" for (b) and "same number" for (c). Then what does the book mean for the above statements?
Could you offer one answer or some hints for (b)? And I will try to understand (c) based on that since someone told me it is not one good habit to ask multiple questions in one post.