A logical approach to discrete math
A logical approach to discrete math
Guarded commands, nondeterminacy and formal derivation of programs
Communications of the ACM
Concrete Mathematics: A Foundation for Computer Science
Concrete Mathematics: A Foundation for Computer Science
Program Construction: Calculating Implementations from Specifications
Program Construction: Calculating Implementations from Specifications
FUNCTIONAL PEARL: Enumerating the rationals
Journal of Functional Programming
Recounting the Rationals: Twice!
MPC '08 Proceedings of the 9th international conference on Mathematics of Program Construction
Proofs from THE BOOK
On Euclid's algorithm and elementary number theory
Science of Computer Programming
Designing an algorithmic proof of the two-squares theorem
MPC'10 Proceedings of the 10th international conference on Mathematics of program construction
On Euclid's algorithm and elementary number theory
Science of Computer Programming
Hi-index | 0.00 |
Algorithms can be used to prove and to discover new theorems. This paper shows how algorithmic skills in general, and the notion of invariance in particular, can be used to derive many results from Euclid's algorithm. We illustrate how to use the algorithm as a verification interface (i.e., how to verify theorems) and as a construction interface (i.e., how to investigate and derive new theorems). The theorems that we verify are well-known and most of them are included in standard number-theory books. The new results concern distributivity properties of the greatest common divisor and a new algorithm for efficiently enumerating the positive rationals in two different ways. One way is known and is due to Moshe Newman. The second is new and corresponds to a deforestation of the Stern-Brocot tree of rationals. We show that both enumerations stem from the same simple algorithm. In this way, we construct a Stern-Brocot enumeration algorithm with the same time and space complexity as Newman's algorithm. A short review of the original papers by Stern and Brocot is also included.