The aim of this lecture is to convince you of the crucial concept of a structure preserving map. It pervades all of computer science, mathematics and physics [1] and appears in many different incarnations, the simplest one coming from universal algebra.
We will use ideas from our lecture on universal algebra
to illustrate the importance of structure preserving maps from the point of view of data types and
to axiomatise induction in a completely syntax independent way using nothing more than the notion of a structure preserving map.
We start with the following question that will lead us right to the heart of the issue.
What do you think: Are there more rational numbers than integers?
(This is one of those great questions where both yes and no is a correct answer depending on how you justify it.)
Convention: Only for this lecture, when I talk about rationals and integers I mean the positive rationals and positive integers and I denote them by
Conclusion 1: There are strictly more rationals than integers.
At first, it seems obvious that there are more rationals than integers.
We can visualise this by looking at the numberline where there are gaps between integers, but the rationals are dense.
In symbolic notation, we look at the inclusion
which is injective but not surjective, hence not bijective: Every integer is a rational, but there are rationals that are not integers.
But maybe we can encode rationals by integers?
After all, we know that rationals are stored in a computer as sequences of bits and that every sequence of bit is an integer in binary notation.
This suggests that there is an injective function
showing that there are at least as many rationals as integers. Equivalently, and easier to explain, we can also look for a surjective function
We know from the fact that rationals can be represented on a digital computer that such a map must exist.
But what is an easy way to describe such a map explicitely?
It was found by Cantor and is most easily given by a picture. You can derive from the picture an algorithm that computes the functions
Remark: The map
Conclusion 2: There is a bijection between integers and rationals. In other words, there are exactly as many integers as there are rationals.
It seems that we reached a contradiction between the two Conclusions.
Thinking about it, it looks like Concusion 2 is winning. Because, by reaching Conclusion 1, we made a mistake. We argued that an map
Nevertheless, Conclusion 1 looks intuitively correct. So can we restore intuition and justify it by an explanation that stands up to scientific standards of scrutiny?
The answer is yes and what we need for the justification is the notion of structure preserving map.
Extending Conclusion 2, we can say that all countably infinite sets are of the same size.
This is familar for us from programming. All infinite data types can be encoded by sequences of bits, so any infinite data type can be encoded by any other infinite data type.
But, surely, that does not mean that all data types are the same.
How do we solve this conundrum?
We get our cue from the previous discussion of abstract data types: Data types are more than data, they are also operations on data.
So in what sense is the inclusion
a "good" map but the encoding
a "bad" map?
Let us denote by
Exercise: Find examples that show that addition and multiplication are not preserved by
Claim: There is no structure preserving bijection [3]
Conclusion 3: To summarize:
Remark: Addition and multiplication are examples of algebraic structure, given by operations, ie, functions. There are other example of structure, such as relational structure. For example we may ask: Is there an order-preserving bijection
This is an excursion that leads a bit off the main thread, so feel free to skip. But it is too important to not stop for a few comments.
We have seen that Cantor showed that there are as many rationals as integers. Sets that have the same size, or cardinality as one says in mathematics, as the integers are called countable. Obviously, by definition, all countably infinite sets have the same size. Cantor's discovery was that there are more countably infinite sets than one might first think. Even the rationals, that are dense on the numberline, are countable.
But even more importantly, Cantor also showed that we cannot simply say: "Integers and Rationals have the same size because they are both infinite". In fact, Cantor showed that the infinite sets form an infinite hierarchy of ever strictly bigger infinite sets. The mathematical area called set theory studies this infinite hierarchy of infinite sets.
Exercise: If you know Cantor's proof that there is no bijection from integers to reals, think about why this proof fails to show that there is no bijection between integers and rationals.
… and much more … linguistics is another area and I am sure we can think about more. ↩︎
In programming terms: If we first type-cast the integers 1 and 2 to floats 1.0 and 2.0 and then add them as floats we get the same result as if we first add 1 and 2 and then type-cast the result to a float. In other words, type casting, which is a map int->float
, preserves addition (and multiplication and a lot of other operations). ↩︎
Let
Preservation of addition implies preservation of order. But the converse is not true. So there are more order-preserving maps than addition preserving one. Nevertheless, the answer to the question is "No". ↩︎