218 points · by boris_m · 3y ago · 94 comments
Note that this page has no category theory yet since it explains sets, so if you already know sets, set product, etc and want to learn about category theory, my advice is to go directly to the next chapter, more specifically to this section:
https://abuseofnotation.github.io/category-theory-illustrate...
which uses set theory terms to define the category theory way of defining products (the corresponding "universal property").
You are right. (Curiously, the picture of the terminal object is correct, so they didn't just switch them!)
The Mathematician's Weapon | An Introduction to Category Theory, Abstraction and Algebra https://www.youtube.com/watch?v=FQYOpD7tv30
There are many kinds of mathematics, this is an unusual one.
"In Zermelo–Fraenkel set theory, the axiom of regularity and axiom of pairing prevent any set from containing itself."
Does the set of "all sets that do not contain themselves" contain itself?
[1]: https://en.wikipedia.org/wiki/Non-well-founded_set_theory
I'm confused about this statement. types give you important contextual information about the function in a summarized form, but surely we can have two functions with the same type signature that perform different mappings.
Yes - and you can count the mappings! Enums are sometimes referred to as 'sum types' because you can just add up the number of different states they can be in. Structs are sometimes call 'product types' because you can calculate the number of states they can be in by multiplying the number of states of their members. And functions are 'exponential types'.
I think what they mean is that two functions won’t have the exact same signature and result typings, though in practice this isn’t normally true for computer systems. Although there’s an argument that if it has those exact same things maybe you don’t need two functions but to improve your one function to be more robust.
For example, if you have a function of type ℕ x ℕ -> ℕ you know it could be doing addition, multiplication or exponentiation, but it can't do division because then it could only be a partial function. A more abstract signature ℕ x ℕ x Op -> ℕ, where Op is the set of binary operations on the natural numbers, can really only do one thing (apply the operands to the operation).
Another example, [A] -> A could be any fixed indexing function, but it can't be a function that produces a value of A not found in the list as the true signature of that function is just A per se.
As a sibling comment points out, in the context of programming the signature isn't as constraining as it would be in maths as the distinction between total and partial functions is often ignored and you can have side effects. But the more you model your functions to be pure and total the more you can reason about them abstractly.
Ok then what is relationship? There's a whole theory of relations, and I'd rather not dive into that for the article. Also, drawing arrows can give misleading intuition.
It's better to define a function as a set of pairs, then you don't need to use anything else not introduced yet.
If you're looking towards category theory, it may arguably be better to think in terms of abstract arrows as much as possible, so as not to get confused by non-"concrete" categories where there's no obvious "function semantics" for morphisms.
Though mostly I consider category theory useful not for its results but because its concepts generalize well. If you can relate something to a category then most of the concepts a category has (functors, limits etc.) will have some useful meaning. This makes it easy to come up with good concepts and gives some of their properties for free, which honestly is more practically useful than some clever theorem.
To add a bit to that, Yoneda's lemma says that you know everything about an object if you know the ways that it can be mapped to other objects. The "co-Yoneda's lemma", while often less useful in practice (in my practice, anyway), is maybe easier to understand in this intuitive way: you know everything about an object if you know the ways that other objects can be mapped to it, which I have heard phrased as something like "you can learn everything about an object by probing it with other objects."
`Free (Coyoneda f)` gives you `Freer` which allows you to build Monads without even a `Functor` on `f`.
https://ncatlab.org/nlab/show/Lawvere's+fixed+point+theorem
Emily Riehl:
"The author is told with distressing regularity that 'there are no theorems in category theory' ...
Sadly, the majority of the theorems that are personal favorites of the author were excluded because their significance is more difficult to explain."
(long list of theorems)
This isn't a really basic and accessible result, but IMO it gives a good flavour of what category theory is suitable for: formally describing constructions we didn't previously have the tools to express precisely.
https://www.sciencedirect.com/science/article/abs/pii/B97801...
Semantics is the topology of your diagrams.
CT is related amusingly to abstract nonsense. Basically CT's ability to prove things at such a high level that provides no insights into the going ons in low level details.
https://math.stackexchange.com/questions/823289/abstract-non...
Lists, sets, graphs, all seem quite fundamental to us humans, but where in nature does one observe these weird things? A cave or a jug are highly complex things. Perhaps molecules resemble a graph, but if I understand physics correctly, atoms move like crazy and it's almost accidental that the graph structure is somewhat stable in most molecules.
This led me to believe that these fundamental containers are probably a byproduct of how our brains work, more than that they are fundamental outside of those.
Thanks to ChatGPT, I now know that this makes me a mathematical fictionalist, or mathematical anti-realist.
Anyone care to talk me out of this? :)
Just as you ask, "where in nature does one observe these weird things?" I would to ask where in nature does one find a one? or a pi? or any other number really. Where do you find a triangle? Or a coordinate? Or any of the mathematical constructs we use day to day.
Sure you can point at something triangle shaped and go "there!" but is it _really_ a triangle? Or just an approximation? Sure you can count one of something, but that's not the same as the number one. Just like you can't have pi of something.
All of math is just a model that is surprisingly applicable to the real world.
All of math is a byproduct of our brains. It doesn't exist, out there, in some Platonic World. Anyone who thinks so, I'm looking at you Max Tegmark, is mistaking the map for the territory.
I could brashly say the exact opposite and would have proven just as much as you. Fictionalists often attempt to shunt the Platonic realm into an ill-conceived emanation of the mental realm (which just so happens to itself be an accident of matter). Somehow all of this works by virtue of following a kind of mathematical logic that just so happens to not exist or something. I suspect the fundamental problem here is some kind of neurosis that psychologically compels people to reduce the quality of their thought until hard problems disappear. I hope we one day are able to build a catalog of all the ways thought goes wrong so as to prevent such nonsense from proliferating in at least some section of the world.
I think a reasonably compelling way to teach yourself how to actually see The Problem (tm) is to view it from the perspective of Roger Penrose's three worlds ( https://hrstraub.ch/en/the-theory-of-the-three-worlds-penros... ) and actually think through the implications in a contemplative, meditative way over the course of several hours. Any analysis of this issue that doesn't involve a sustained look at both logic and phenomenology is a waste of time.
I do take umbrage at your insinuation that I have not actually thought "through the implications in a contemplative, meditative way over the course of several hours" on this subject. I have spent many years, and not a few semesters of college, contemplating this very subject.
Consider this, where would your platonic world go if there were no sentient beings in the universe? Would it sit there, on some "higher plane" awaiting discovery by no one? Would the pure idea of a Tree get lonely? We're very into "does a tree fall in the forest with no one to hear it does it make a sound?" territory, however I think this is extremely important when trying to decide what is Real.
Plato, a man who lived ~2,400 years ago, decided that ideas were Real with zero proof and you're just going to accept his word on this, I'm supposed to just accept this? This does strike me as extremely life-centric, for lack of a better, all encompassing, term. If all life in the universe disappeared, the universe itself does not suddenly vanish in a puff of smoke. Stars will still fuse the elements, blackholes will still gobble up matter, the earth will continue to orbit the sun until it's consumed by the sun or is disrupted by some massive interstellar traveler. But the world of ideas wouldn't exist because there would be nothing to think of them. Mathematics wouldn't exist, because there would be nothing to conceive of them.
If you assume the platonic realm exists, sure, I would grant you all of Penrose's Three Worlds, I would grant Tegmark's belief that somewhere out there is a physical Platonic realm. I'd also probably believe in a lot of other things with out evidence as well.
But, maybe I'm just from Missouri. You're gonna have to show me.
It is indeed not so simple. If I continue my thought experiments about sets not being universal or foundational, I run into a myriad of problems.
For one, how can one reason about anything when rejecting concepts? How can one conclude anything when rejecting logic? How can one infer anything when rejecting time?
These problems seem to point to some recursive or symmetric (or circular as the article suggests) dependency between the realist and non-realist perspectives.
I don't yet fully understand why there would have to be three worlds -- I'd intuitively say that two (e.g. physical and mental) suffice. The platonic world might simply follow from the mental one, or vice versa. I'll put in several hours of thought and report back in the next post that touches upon this subject.
I concluded for myself that logic, science, nor philosophy are going to be of much help with this. I therefore turned to contemporary art, where such thought still has some kind of validity. Let's see where that leads me :)
Edit: It seems that the "three world" idea is originally an idea by Karl Popper. Wikipedia [1] explains this in some detail, from which it becomes clear why the thought experiment has three, not two worlds.
go ahead
Trees are made up of billions of atoms, in extremely differing configurations, which can only be appreciated by machinery that is able to abstract it into the concept of a tree. To the rest of the universe it's just a bunch of atoms, with no clearly defined boundary.
So, counting is not necessarily a fundamental thing either. At least, according to how I like to interpret things :)
That's like asking "where in nature does one observe numbers"?
Literally everywhere.
Your jug partitions water into the set inside the jug and the set outside it.
Caves are a subset of rock formations.
So, no, I don't observe numbers in the universe, if I take on the perspective of, say, a rock.
Are you saying you want something that can be logically reasoned by a rock?
That's not a big issue nowadays since there is univalent foundations, which is based on ∞-groupoids instead of sets.
Otherwise, of course, lists, graphs, etc. are all objects on their own and exist independently of any encoding as sets.
I understand, and agree, that small functions, composed, are easier to understand and maintain, easier to port and easier to build upon than large monolithic functions.
But, aside from that, I'm not sure of the tangible day-to-day benefits of reciting parts of category theory.
I admit I don’t know category theory in much detail but I just can’t see the tangible benefit. Any hints would be appreciated.
Programmers use monads all the time without knowing it, but there is little need to understand the deep math-y concepts or proofs that underlie them.
But knowing I have a limited amount of time, I often suspect a lot of people extolling the benefits of understanding the mathematical underpinning of concepts are more showing off and in love with their own understanding than offering real benefits to programmers.
When I later learned more mathematics, I was also surprised to learn how informal everything is programming: Mathematicians use fancy symbols, but also ambiguous, idiosyncratic or inconsistent notation, and they always write proofs where a lot is left unspecified because the intermediate steps are assumed to be obvious. In software development it's the opposite, the compiler has to understand everything.
for wishy washy data like you have in almost every other case it isn't useful, unless you want to solve those problems by making a programming language. But in most cases you already have languages there, like SQL for relational data etc, so you don't have to solve those problems.
I see three reasons to learn it if you are a programmer:
1. You find it fun and interesting
2. You work in a language such as Haskell or Purescript that uses many aspects of category theory in its library, or Scala which has CT inspired third party libraries, or languages in general that have monads, functors explicitly mentioned. Languages that implement these concepts but don’t name them also count here. Understanding that all these things are based on quite easy to understand CT concepts helps to unify them all and make their purpose more clear. But you can also just look at the type signatures!
3. A bit more tenuous but I believe studying CT helps train your brain to be more mindful of structure and especially composition of structure.
I think it's quite useful in functional programming languages and gives a lot of insight on how to organise things that in the beginning seem totally unrelated.
You can quickly recognize common patterns, e.g. monads, functors, bijections.
This looks great - I love the illustrations, and as far as I know the information looks great! I've got it in my Pocket list and am looking forwards to reading it on the bus.
A while back there was a "Group Theory Coloring Book" that someone posted here. I was kinda hoping that this link would be another one of those. (Spoiler: it's an illustrated explanation of category theory - which is great! - not a coloring book).
Sorry in advance for hijacking this post, but it's kinda, sorta related to ask: Does anyone have a link to 'fun math/STEM-themed coloring books'?
Also, in the context of automata theory, functions = deterministic and relations = nondeterministic.
For a long time prior to E&M, mathematicians had used an informal notion of “natural” or “canonical” mapping, which meant something like one special mapping out of several available ones. Especially important is the idea of natural isomorphisms. Just knowing that two objects are isomorphic is often not good enough to prove results about them because you have to make a choice about which isomorphism of several you’re using, and you might have to make such an arbitrary choice about infinitely many pairs of objects all at once. Having a canonical choice solves this problem.
Prior to E&M, mathematicians couldn’t formalize this idea of canonical choice. They would hand wave about how natural their choice of isomorphism was and how this allowed them to avoid making arbitrary choices. Then E&M defined categories, functors, and natural transformations to formalize this idea of naturality. Their motivation was algebraic topology, but the abstractions they defined turned out to be extremely broadly useful across all much of mathematics.
[1] https://www.ams.org/journals/tran/1945-058-00/S0002-9947-194...
https://plato.stanford.edu/entries/category-theory/
>what limitations of set theory made it necessary to invent/discover category theory?
Category theory did not start as alternative to set theory.
But: "Category theory even leads to a different theoretical conception of set and, as such, to a possible alternative to the standard set theoretical foundation for mathematics."
>What do categories let us do that we can’t do with sets?
"At minimum, it is a powerful language, or conceptual framework, allowing us to see the universal components of a family of structures of a given kind, and how structures of different kinds are interrelated"
Some category theory constructions like adjoints and monads are higher level and more powerful than basic set theory constructions like power set.
"The number of mathematical constructions that can be described as adjoints is simply stunning."