Proving \mathsf {GCDR} correct [00K3]

We will begin by formally proving the correctness of the recursive Euclidean Algorithm. But before we can even do that, we have to back up a bit: what does it even mean for an algorithm to be "correct"?

In this case, the specification we have in mind is the mathematical definition of \gcd ; the implementation we have in mind is the \mathsf {GCDR} function. We are starting with \mathsf {GCDR} because it's usually much easier to prove things about recursive algorithms than about iterative ones!

In order to prove that \mathsf {GCDR} is correct, we first need two small lemmas about the mathematical \gcd function. The proofs are included only for completeness—feel free to skip them unless you are interested.

Now we can prove that \mathsf {GCDR} matches its specification.

Context

The Euclidean Algorithm [00JU]

Backlinks

Euclidean Algorithm problems [00KF]

Related

Algorithm. Recursive Euclidean Algorithm [00K4]