[HN Gopher] Category Theory Illustrated - Sets ___________________________________________________________________ Category Theory Illustrated - Sets Author : boris_m Score : 121 points Date : 2023-09-12 08:13 UTC (1 days ago) (HTM) web link (abuseofnotation.github.io) (TXT) w3m dump (abuseofnotation.github.io) | MikeTheGreat wrote: | Disclaimer: I don't know category theory and I only skimmed the | linked page :) | | 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'? | zactato wrote: | Does anyone else study Category Theory in the hope of finding | Revelation/Truth? I'm mostly kidding but for some reason CT | scratches a different kind of itch. | rolisz wrote: | I've watched some lectures about CT (and they flew over my head | pretty quickly) and I did get the feeling that on one hand | there is some deep insight there (that I was barely able to | glimpse), but on the other hand it felt like that eagle eye | view that CT gives is missing too many details. | passion__desire wrote: | Physics say it's all probabilities. CT says it's all | relationships. | | 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... | red_trumpet wrote: | The term "abstract nonsense" was actually coined in context | of category theory: | https://en.wikipedia.org/wiki/Abstract_nonsense#History | hackandthink wrote: | >In particular, a set can contain itself. | | 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." | | https://en.wikipedia.org/wiki/Universal_set | axblount wrote: | This gives rise to Russell's Paradox: | | Does the set of "all sets that do not contain themselves" | contain itself? | righttoolforjob wrote: | simple: there is no such set. | tikhonj wrote: | You can have set theories that allows sets to contain | themselves without allowing Russell's Paradox. You can read | about non-well-founded set theory[1] if you're curious. | | [1]: https://en.wikipedia.org/wiki/Non-well- | founded_set_theory | hackandthink wrote: | I like the diagram of "the set containing itself". It | illustrates non-well-foundedness niceley. | seanhunter wrote: | Resolving this paradox is discussed in TFA as being the | founding rationale for the Zermelo-Fraenkel set theory in | fact. | bmacho wrote: | It is mentioned 2 sentences earlier that it was the case in | naive set theory. | tarkin2 wrote: | I still don't know how category theory will help me as a | programmer. | | 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. | ilyanoskov wrote: | I think Category Theory is useful in a way that it brings | abstractions for many areas of mathematics that used to be | considered unrelated to each other or quite distant. It studies | interactions between entities, rather than the details about | entities themselves. | | 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. | Jensson wrote: | Its useful when you have uber structured data. Think when | programming a programming language for example, the input is | extremely structured but you need to handle so many things in | so many structured ways. | | 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. | cubefox wrote: | Haskell uses some concepts from category theory, but even there | (as people pointed out in a Haskell thread a while ago) it is | not actually necessary to understand the category theory behind | them. E.g. to be able to use monads. If category theory isn't | even helpful for Haskell programming, we can be pretty sure | that it doesn't help at all with more common languages. | kweingar wrote: | I studied category theory for a while, and frankly it plays | zero role in my day-to-day programming. It would maybe be a | different story if I were writing libraries in Haskell or | something, but as it is, it's really not that relevant to me. | | 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. | tarkin2 wrote: | I worry this is often the case. I like the idea of learning | maths for maths sake. And I would love the time to do that. | | 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. | cubefox wrote: | Before I learned programming, I thought it had a lot to do | with mathematics. I mean both look pretty formal. I was | surprised to learn that mathematics played hardly a role in | ordinary software development. If you happen to write a | physics simulation, sure, you need math, but that is | because of physics, not because of programming being | inherently mathematical. | | 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. | edgyquant wrote: | I think that depends what the math is they're saying to | learn, does it not? | paulddraper wrote: | It's design patterns for functional programming. | | You can quickly recognize common patterns, e.g. monads, | functors, bijections. | smokel wrote: | As much as I like philosophy of mathematics, I never feel quite | at ease with sets being some universal foundation. | | 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? :) | paulddraper wrote: | > where in nature does one observe these weird 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. | smokel wrote: | All that partitioning and counting can only be performed by a | system that is able to abstract and differentiate between | different abstractions. Brains and computers appear to be | good at this, but other than that, I don't see many other | structures that are capable of doing this. | | So, no, I don't observe numbers in the universe, if I take on | the perspective of, say, a rock. | zehaeva wrote: | The ideas of sets being the universal foundation of math is | arbitrary as any other bit of math. Which is to say all of it | is arbitrary. | | 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. | NotSuspicious wrote: | > 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. | 2snakes wrote: | My answer would be: when we distinguish something from | something else. This is the root of all logic and cognition. | colobas wrote: | I like this answer. Been reading "Godel's Proof" and for a | demonstration where the definition of "tautology" in the main | text makes use of the concepts of True and False, there is an | appendix explaining that you can arrive at the same result | without those concepts, just by treating things as belonging | to one class vs another (there is a one to one correspondence | with True and False but the meaning is arbitrary) | tutfbhuf wrote: | > I never feel quite at ease with sets being some universal | foundation | | That's not a big issue nowadays since there is univalent | foundations, which is based on [?]-groupoids instead of sets. | auggierose wrote: | Sets being the foundation is a historical accident. It is | convenient and well-studied, and if you can encode your objects | and axioms in set theory, you have a sure footing (at least as | sure as it gets) with respect to consistency. | | Otherwise, of course, lists, graphs, etc. are all objects on | their own and exist independently of any encoding as sets. | wnc3141 wrote: | I think sets are fundamental to counting. An example: how many | trees are in the forest? It depends on where you draw the | boundary for tree. An Aspen Grove, for example have many stems | of one large interconnected tree. | smokel wrote: | Try to count trees from the perspective of the sun, or from | the perspective of an electron. | | 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 :) | deepsun wrote: | > A function is a relationship between two sets | | 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. | smohare wrote: | [dead] | convolvatron wrote: | "And they might be right. But mathematical functions have one big | advantage over non-mathematical ones -- their type signature | tells you everything that the function does. This is probably the | reason why most functional languages are strongly-typed." | | 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. | mrkeen wrote: | > 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'. | edgyquant wrote: | This might be true in a programming language but it's not for | mathematical functions which is what they refer to in the first | half of this paragraph. | | 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. | erehweb wrote: | Set theory has the big unexpected results of the reals being | bigger than the natural numbers, the independence of the Axiom of | Choice, and the undecidability of the Continuum Hypothesis. What | are some similarly big results in category theory, for a novice? | rozgo wrote: | Yoneda Lemma, an object is entirely determined by its | relationships to other objects. | contravariant wrote: | I'd say the Yoneda lemma should be in there. It's hard to | explain without going through all the definitions but very | broadly speaking it gives a precise way to characterize a | object by its relations to other objects. | | 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. | hackandthink wrote: | Lawvere's fixed point theorem as a generalisation of Cantor's | theorem is a big result. | | 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) | | https://math.jhu.edu/~eriehl/161/context.pdf | omginternets wrote: | One thing I would like to understand is what limitations of set | theory made it necessary to invent/discover category theory. Can | someone enlighten me? What do categories let us do that we can't | do with sets? | hackandthink wrote: | Jean-Pierre Marquis' article may be helpful: | | 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." | zzo38computer wrote: | I know how it relates to monoids, rather than to sets. For | example, you cannot just multiply together any two matrices | (like you can with monoids); they need to have the correct | dimensions. So, in category theory, this corresponds to the | composition of morphisms, so in this case, the objects are the | number of rows/columns and the morphisms are the matrices. | tanvach wrote: | This short youtube video really helped with me to understand the | big pictures of category theory with concrete examples. | | The Mathematician's Weapon | An Introduction to Category Theory, | Abstraction and Algebra | https://www.youtube.com/watch?v=FQYOpD7tv30 | xjm wrote: | Nice! | | 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"). | l__l wrote: | I'm surprised to see no mention of topos theory in this page? The | sense in which category theory is a generalisation of set theory | is pretty weak imo until you bring in concepts like subobject | classifiers. This isn't the only thing topoi generalise, but is a | pretty significant one | dhosek wrote: | One of the most powerful things I learned in topology was that | functions can be viewed as sets of ordered pairs with the | restriction that the first item in each ordered pair can only | appear once. | layer8 wrote: | Relations between sets are generalizations of functions, which | is another way to realize that. I think this was taught in my | first CS semester. | | Also, in the context of automata theory, functions = | deterministic and relations = nondeterministic. ___________________________________________________________________ (page generated 2023-09-13 23:00 UTC)