The inclusion map from the integers to the reals and universal properties of the floor and ceiling functions

Jordan Bell
April 29, 2016

1 Categories

If X is a set, by a partial order on X we mean a binary relation ≤ on X that is reflexive, antisymmetric, and transitive, and we call (X,≤) a poset. If (X,≤) is a poset, we define it to be a category whose objects are the elements of X, and for x,y∈X,

Hom⁢(x,y)={{(x,y)}x≤y∅¬⁡(x≤y).

In particular, idx=(x,x).

Let U:ℤ→ℝ be the inclusion map. If (j,k)∈Hom⁢(j,k), define U⁢(j,k)=(U⁢j,U⁢k)∈Hom⁢(U⁢j,U⁢k).

U⁢idj=U⁢(j,j)=(U⁢j,U⁢j)=idU⁢j.

If (j,k)∈Hom⁢(j,k) and (k,l)∈Hom⁢(k,l), then (k,l)∘(j,k)=(j,l) and

U⁢(k,l)∘U⁢(j,k)=(U⁢k,U⁢l)∘(U⁢j,U⁢k)=(U⁢j,U⁢l)=U⁢(j,l)=U⁢((j,l)∘(j,k)).

This shows that U:(ℤ,≤)→(ℝ,≤) is a functor.

2 Galois connections

If (A,≤) and (B,≤) are posets, a function G:A→B is said to be order-preserving if a≤a′ implies G⁢(a)≤G⁢(a′). A Galois connection from A to B is an order-preserving function G:A→B and an order-preserving function H:B→A such that

G⁢(a)≤b if and only if a≤H⁢(b),a∈A,b∈B.

We say that G is the left-adjoint of H and that H is the right-adjoint of G.

Let I:ℤ→ℝ be the inclusion map. Define F:ℝ→ℤ by F⁢(x)=⌊x⌋. For n∈ℤ and x∈ℝ, suppose I⁢(n)≤x. Then F⁢(I⁢(n))≤F⁢(x). But F⁢(I⁢(n))=n, so n≤F⁢(x). Suppose n≤F⁢(x). Then I⁢(n)≤I⁢(F⁢(x))≤x. Therefore F:ℝ→ℤ, F⁢(x)=⌊x⌋ is the right-adjoint of I:ℤ→ℝ: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.

I⁢(n)≤x⇔n≤F⁢(x),n∈ℤ,x∈ℝ.

Define C:ℝ→ℤ by C⁢(x)=⌈x⌉. For n∈ℤ and x∈ℝ, suppose C⁢(x)≤n. Then I⁢(C⁢(x))≤I⁢(n). But I⁢(C⁢(x))≥x, so x≤I⁢(n). Suppose x≤I⁢(n). Then C⁢(x)≤C⁢(I⁢(n)). But C⁢(I⁢(n))=n, so C⁢(x)≤n. Therefore C:ℝ→ℤ, C⁢(x)=⌈x⌉ is the left-adjoint of I:ℤ→ℝ:

C⁢(x)≤n⇔x≤I⁢(n),x∈ℝ,n∈ℤ.
Lemma 1.

For x≥0,

⌊⌊x⌋⌋=⌊x⌋.
Proof.

For k∈ℤ≥0 and y∈ℝ≥0,

k≤⌊⌊y⌋⌋ ⇔I⁢(k)≤⌊y⌋
⇔k2≤⌊y⌋
⇔k2≤y
⇔k≤y
⇔k≤⌊y⌋.

∎

Lemma 2.

If x∈R and n∈Z≥1, then

⌊⌊x⌋n⌋=⌊xn⌋.
Proof.

For k∈ℤ,

k≤F⁢(I⁢(F⁢(x))/I⁢(n)) ⇔I⁢(k)≤I⁢(F⁢(x))/I⁢(n)
⇔I⁢(k)⁢I⁢(n)≤I⁢(F⁢(x))
⇔I⁢(k⁢n)≤I⁢(F⁢(x))
⇔k⁢n≤F⁢(x)
⇔I⁢(k⁢n)≤x
⇔I⁢(k)≤x/I⁢(n)
⇔k≤F⁢(x/I⁢(n)).

This means that F⁢(I⁢(F⁢(x))/I⁢(n))=F⁢(x/I⁢(n)). ∎

Lemma 3.

If n∈Z≥1 and m∈Z, then

⌈mn⌉=⌊m+n-1n⌋.
Proof.

For k∈ℤ,

k≤F⁢(I⁢(m+n-1)/I⁢(n)) ⇔I⁢(k)≤I⁢(m+n-1)/I⁢(n)
⇔I⁢(k)⁢I⁢(n)≤I⁢(m+n-1)
⇔k⁢n≤m+n-1
⇔k⁢n-n+1≤m
⇔k⁢n-n<m
⇔I⁢(k-1)<I⁢(m)/I⁢(n)
⇔k-1<C⁢(I⁢(m)/I⁢(n))
⇔k≤C⁢(I⁢(m)/I⁢(n)).

This means

F⁢(I⁢(m+n-1)/I⁢(n))=C⁢(I⁢(m)/I⁢(n)).

∎

3 The Euclidean algorithm and continued fractions

Let a,b∈ℤ≥1, a>b. Let

v0=a,v1=b.

Let

a1=⌊v0/v1⌋,v2=v0-a1⁢v1.

For m≥2, if vm≠0 then let

am=⌊vm-1/vm⌋,vm+1=vm-1-am⁢vm.

Then 0≤vm+1<vm.22 2 See Marius Iosifescu and Cor Kraaikamp, Metrical Theory of Continued Fractions, p. 1, Chapter 1.

For example, let a=83, b=14. Then

v0=83,v1=14.

Then

a1=⌊83/14⌋=5,v2=83-5⋅14=13.

Then

a2=⌊v1/v2⌋=14/13⌋=1,v3=v1-a2v2=14-1⋅13=1.

Then

a3=⌊v2/v3⌋=⌊13/1⌋=13,v4=v2-a3⁢v3=13-13⋅1=0.

As v3=1 and v4=0,

gcd⁡(83,14)=1.

Written as a continued fraction, we get

1483=[0;5,1,13].

For example, let a=168, b=43. Then

v0=168,v1=43.

Then

a1=⌊168/43⌋=3,v2=v0-a1⁢v1=168-3⋅43=39.

Then

a2=⌊43/39⌋=1,v3=v1-a2⁢v2=43-1⋅39=4.

Then

a3=⌊v2/v3⌋=⌊39/4⌋=9,v4=v2-a3⁢v3=39-9⋅4=3.

Then

a4=⌊v3/v4⌋=⌊4/3⌋=1,v5=v3-a4⁢v4=4-1⋅3=1.

Then

a5=⌊v4/v5⌋=⌊3/1⌋=3,v6=v4-a5⁢v5=3-3⋅1=0.

As v5=1 and v6=0,

gcd⁡(168,43)=1.

Written as a continued fraction, we get

43168=[0;3,1,9,1,3].

For example, let a=1463 and b=84. Then

v0=1463,v1=84.

Then

a1=⌊1463/84⌋=17,v2=1463-17⋅84=35.

Then

a2=⌊84/35⌋=2,v3=84-2⋅35=14.

Then

a3=⌊35/14⌋=2,v4=35-2⋅14=7.

Then

a4=⌊14/7⌋⁢2,v5=14-2⋅7=0.

As v4=7 and v5=0,

gcd⁡(1463,84)=7.

Written as a continued fraction, we get

841463=[0;17,2,2,2].