The inclusion map from the integers to the reals and universal properties of the floor and ceiling functions
1 Categories
If is a set, by a partial order on we mean a binary relation on that is reflexive, antisymmetric, and transitive, and we call a poset. If is a poset, we define it to be a category whose objects are the elements of , and for ,
In particular, .
Let be the inclusion map. If , define .
If and , then and
This shows that is a functor.
2 Galois connections
If and are posets, a function is said to be order-preserving if implies . A Galois connection from to is an order-preserving function and an order-preserving function such that
We say that is the left-adjoint of and that is the right-adjoint of .
Let be the inclusion map. Define by . For and , suppose . Then . But , so . Suppose . Then . Therefore , is the right-adjoint of :11 1 See Roland Backhouse, Galois Connections and Fixed Point Calculus, http://www.cs.nott.ac.uk/~psarb2/G53PAL/FPandGC.pdf, p. 14; Samson Abramsky and Nikos Tzevelekos, Introduction to Categories and Categorical Logic, http://arxiv.org/abs/1102.1313, p. 44, §1.5.1.
Define by . For and , suppose . Then . But , so . Suppose . Then . But , so . Therefore , is the left-adjoint of :
Lemma 1.
For ,
Proof.
For and ,
∎
Lemma 2.
If and , then
Proof.
For ,
This means that . ∎
Lemma 3.
If and , then
Proof.
For ,
This means
∎
3 The Euclidean algorithm and continued fractions
Let , . Let
Let
For , if then let
Then .22 2 See Marius Iosifescu and Cor Kraaikamp, Metrical Theory of Continued Fractions, p. 1, Chapter 1.
For example, let , . Then
Then
Then
Then
As and ,
Written as a continued fraction, we get
For example, let , . Then
Then
Then
Then
Then
Then
As and ,
Written as a continued fraction, we get
For example, let and . Then
Then
Then
Then
Then
As and ,
Written as a continued fraction, we get