[HN Gopher] Category Theory Illustrated
___________________________________________________________________
Category Theory Illustrated
Author : signa11
Score : 107 points
Date : 2023-03-16 06:10 UTC (2 days ago)
(HTM) web link (abuseofnotation.github.io)
(TXT) w3m dump (abuseofnotation.github.io)
| superb-owl wrote:
| I'm enjoying the article, but this line is comically false:
|
| > noone bashed string theory for failing to make useful
| predictions
| diyseguy wrote:
| not to mention the "moist interesting category-theoretical
| concepts"
| dang wrote:
| Related:
|
| _Category Theory Illustrated - Functors_ -
| https://news.ycombinator.com/item?id=35173632 - March 2023 (3
| comments)
|
| _Category Theory Illustrated - Logic_ -
| https://news.ycombinator.com/item?id=28660157 - Sept 2021 (112
| comments)
|
| _Category Theory: Orders_ -
| https://news.ycombinator.com/item?id=26658111 - April 2021 (52
| comments)
| timmg wrote:
| Working as a SWE for lots of years, I've worked with people that
| always feel the need to "add a level of abstraction" or "build a
| framework" for (and out of) everything. A lot of the time it
| doesn't make things better (and often makes things worse).
|
| Every time I try to learn about Category Theory, I get to a
| certain point and just start wondering "why?"
|
| I can't tell if I'm not smart enough to get it (I think that's
| the most likely answer). But it _feels_ like some math people --
| who have nothing better to do -- are just trying to create
| another level of abstraction.
|
| Are there things that Category Theory does that other branches
| couldn't already do? I'm curious to hear other takes on this.
| epgui wrote:
| Why are we not all downvoting anti-intellectualist comments
| like this?
|
| The odds that a whole discipline of mathematics is "of little
| use" or "nothing more than an inappropriate abstraction" is
| basically nil.
|
| I see little difference between this comment, and a comment
| that calls sociology or philosophy useless. No sympathy from
| me!
| timmg wrote:
| Sorry if I offended your sensibilities. Feel free to downvote
| my comment if you don't think it adds to the conversation.
|
| I would appreciate, though, if you didn't misquote my comment
| when replying to it. Neither of the things you have quoted
| are things I wrote. Worse, they are a misrepresentation of my
| comment.
| thfuran wrote:
| Why? For a lot of mathematicians, work being of practical use
| isn't even a consideration. I know math professors who would
| freely tell you that they were never aware of any application
| for their PhD work and never cared, because it was
| interesting. A lot of math does have a lot of useful
| applications, and there certainly are applied mathematicians,
| but it is not, on the face of it, absurd to suppose that
| there are areas of math with little to no known practical
| application.
| wisnesky wrote:
| If you have a symmetric system, you can use group theory to
| make predictions about it. Similarly, if you have a
| compositional system, you can use category theory to make
| predictions about it. As for whether those predictions are
| useful, or non-obvious, or worth it, etc, tends to very a lot
| depending on the application, and the other techniques
| available- it's not a matter of being smart enough to get it.
| FWIW, I think category theory is certainly indispensable in
| denotational programming language semantics.
| hermitcrab wrote:
| >Working as a SWE for lots of years, I've worked with people
| that always feel the need to "add a level of abstraction" or
| "build a framework" for (and out of) everything.
|
| You might be interested to read Spolsky's essay on
| 'architecture astronauts':
| https://www.joelonsoftware.com/2001/04/21/dont-let-architect...
| nuancebydefault wrote:
| Very funny to read, especially because it feels outdated.
| "With this new architecture we cannot simply..." years after
| we can say we can! Edit - "No, Sun, we're not going to be
| able to analyze our corporate sales data "as simply as
| putting a DVD into your home theatre system."" is what I am
| talking about
| adamnemecek wrote:
| It's a general scaffolding that can be shared between branches
| of math.
| resource0x wrote:
| Between _some_ branches of math. And you have to be familiar
| with _these_ branches of (graduate level) math to appreciate
| it. Learning category theory in isolation will leave you
| baffled. Why it 's being constantly pushed on HN is beyond
| me.
| gryn wrote:
| > Why it's being constantly pushed on HN is beyond me.
|
| the answer is haskell
| dimitrios1 wrote:
| And that's a fine enough reason. Sometimes learning
| assembly leads people to learn about electrical
| engineering concepts, and boolean algebra. Sometimes
| writing algorithms that need to be efficient leads people
| to learn about number theory. Sometimes people trying to
| develop a really effective database schema get interested
| in set theory.
|
| These are good things.
| gryn wrote:
| I agree, just pointing out the reason/gateway drug.
| epgui wrote:
| Exactly, and it's supposed to be what this forum is all
| about: intellectual curiosity and (to some degree)
| interdisciplinary knowledge-sharing!
|
| It drives me nuts that the anti-intellectual stance is so
| prevalent.
| resource0x wrote:
| I actually put some effort in learning it, and found it
| intellectually empty. If you find it enlightening - good
| for you. :-)
| agentultra wrote:
| You haven't taken the time to understand it, therefore it must
| be useless. Others who practice it must be doing useless
| things. This seems like a common solipsism among software
| developers.
|
| The problem with your definition of abstraction is that you're
| thinking of _indirection_.
|
| Abstractions in mathematics create precise definitions with
| provable laws. When you have a proof of a theorem you can
| ignore the details underneath and think in terms of the
| abstraction.
|
| I wouldn't be so cavalier about dismissing category theory.
| It's interesting for many reasons but it's not here to serve
| you. You could find ways that it can improve your programs and
| how you think about them, as others have, or you can get on
| without it. And that's fine too!
| l__l wrote:
| So I come at this from a mathematical background --- graduate
| student in categorical algebra --- but I've done a couple years
| of SWE work, so I'm not unsympathetic to this point of view.
| The way I see it, when you want to reason about things like
| data processing (which is what a massive chunk of writing
| software is, moving data from form A to form B), category
| theory provides what is in some sense the "correct"
| language/framework in which to think. It's not just an
| abstraction circle-jerk, it's a genuinely useful perspective,
| particularly for guiding your mind to spot non-obvious
| connections between pieces of code.
|
| The problem as I view it is that CT is first and foremost a
| discipline of maths. It was developed to help mathematicians,
| is very sophisticated, and very specialised; learning CT for
| SWE is taking a sledgehammer to a nut. I can't honestly
| recommend it as a field of study to someone who isn't
| interested in the problems it was developed to solve. If you
| don't have a solid grounding in set theory, logic, algebra,
| topology, etc., it's a very tough field to motivate. The vast
| majority of CT is of little to no relevance for SWE work.
| Adjunctions, for example, are absolutely fundamental to all of
| maths, but in truth are not really relevant for SWEs. As a
| result, you see people trying to teach concepts like monads
| without reference to them; this is slightly insane from where
| I'm standing...
|
| Your question about whether there are things CT does that other
| branches didn't already do; one of the fundamental utilities of
| CT in pure mathematics is "making trivial things trivially
| trivial". That is to say, it makes it very clear which parts of
| your problem are local to your specific situation, and which
| are purely "structural" from the categorical constraints. The
| SWE analogy would be separating business logic from other
| layers. So at least for mathematicians, it absolutely does have
| novel utility, and has drawn links between a huge number of
| disparate studies that were not well-understood previously.
|
| So if you _do_ care about posets and groups and cohomology
| theories, CT will genuinely open your eyes, and (albeit, this
| coming from someone with less working experience than yourself)
| it could give you a deeper, or at least different understanding
| of the code you're writing. Otherwise, I'm not sure it's worth
| putting yourself through it, tbqh.
|
| (If you do decide to give it another go, please use a better
| resource than the linked post; after a quick scan it looks
| pretty weak)
| skrtskrt wrote:
| I think this is a good perspective - it follows the general
| approach in software engineering that if you're going to
| introduce something with a massively different approach,
| learning curve, and cost of adoption, it needs to come with
| the associated real-world benefits.
|
| For most software stuff it would be very hard the benefit of
| introducing this stuff vs. what the standard paradigms that
| everyone already knows
| bmacho wrote:
| > Every time I try to learn about Category Theory, I get to a
| certain point and just start wondering "why?"
|
| > I can't tell if I'm not smart enough to get it (I think
| that's the most likely answer). But it feels like some math
| people -- who have nothing better to do -- are just trying to
| create another level of abstraction.
|
| > Are there things that Category Theory does that other
| branches couldn't already do? I'm curious to hear other takes
| on this.
|
| No, category theory was not created for the sake of an another
| level of abstraction. It was created to talk about algebraic
| topology. I am not sure if you gain anything studying that.
| Probably you won't but who knows. (But I am thinking more and
| more that CT advocates are harmful, they trick people to dive
| into CT which just steals their time, and gives them nothing.)
| pohl wrote:
| Mathematics, at its foundations, loves to see how much they can
| get with the smallest number of concepts and assumptions. It's
| good to learn what's really necessary.
| [deleted]
| maxiepoo wrote:
| It sounds like category theory likely has no direct impact on
| your life. So you can move on.
|
| But please do not let this bleed into a criticism of category
| theory as used in mathematics. Category theory from the very
| beginning was developed to help manage the complexity of modern
| mathematical fields like algebraic topology. It was then
| famously used by Grothendieck in algebraic geometry where some
| of the basic notions (schemes) were defined in terms of
| category theoretic concepts (functors). It's been applied to
| many other fields, since, including yes computer science, and
| mainly for the same purpose: giving precise terminology to
| common patterns (monads functors etc) and giving us the right
| concepts to design new functional programming languages. As
| someone who is an expert on these topics I find some of the
| popular sentiments about programmers using category theory to
| be a bit silly, but I'll admit it's overall probably good for
| my field because it cultivates a lot of interest in students.
| It probably plays a similar role to pop science/math in other
| fields: not very deep but fun and can be a gateway to "the real
| thing".
|
| The popular perception of category theory is a bit bizarre to
| me though. It is a beautiful theory with many useful results.
| But you don't see the same excitement or resentment towards
| fields like order theory or abstract algebra, which are very
| closely related to, and just as abstract as, category theory
| and are used in similar ways.
| dimitrios1 wrote:
| What is your recommendation for learning? I've been
| recommended Bartosz Milewski enough times, and started to
| dive in. I am not interested in learning the totality of
| Category theory, just enough to be more effective in FP
| languages like Haskell.
| cfiggers wrote:
| Have you been recommended his blog series/book only, or the
| playlists on YouTube as well? I really like his recorded
| lectures on YouTube and they cover similar ground in a
| similar order to the blog posts (from what I've read--I'm
| further into the YouTube series than I am his written
| material).
| khazhoux wrote:
| > It sounds like category theory likely has no direct impact
| on your life. So you can move on.
|
| Very dismissive statement that misses the person's point.
|
| > It is a beautiful theory with many useful results.
|
| But what are those results? Besides Yoneda, are there
| insightful, surprising, delightful results? I personally gave
| up on my CT study after seeing that it was just chapter after
| chapter of _definitions_ and nothing else.
|
| I always compare it to abstract algebra. AA can be studied
| without any connection whatsoever to the physical world or
| even to numbers -- as "abstract" as math can get. And yet
| from the first chapter you are hit with surprising theorems,
| and they continue non-stop, challenging your brain at every
| turn. I fail to see this in CT.
| Twisol wrote:
| > Very dismissive statement that misses the person's point.
|
| I read it as acknowledging that you shouldn't feel like you
| have to spend time on things that provide you no value.
| That seems to directly acknowledge the point I took from
| the earlier comment, which is that they keep spending time
| on it and coming away with no idea what they even should be
| getting from it, much less getting anything specifically.
|
| (I like category theory, but it's a reasonable reaction for
| most people. I'd love for more people to engage with it on
| its merits, but also, people have finite time and may
| rather spend it on things they derive joy from.)
| jiggawatts wrote:
| This is what turned me off also. Category theory is all
| promises of potential benefits, but none seem to have
| materialised.
|
| The closest example to something useful I've seen is a CT-
| based explanation for why Automatic Differentiation is
| formulated the way it is.
|
| However, AD was invented before CT, and the explanation
| didn't add any value that I could see. It didn't result in
| a "better" AD, it simply attached esoteric labels to
| existing things.
| umanwizard wrote:
| Category theory has virtually zero application to software
| engineering. Abstract algebra (knowing what a group, monoid,
| etc. are) has a bit more practical application. Knowing what a
| monad is (in the programming sense) has some as well. Neither
| of the latter two require learning category theory.
| francogt wrote:
| > Category theory has virtually zero application to software
| engineering. > Knowing what a monad is (in the programming
| sense) has some [practical application]as well.
|
| You're contradicting yourself. You don't need to know
| category theory to use practical abstractions like functors
| and monads. They are still however category theoretical
| concepts. If these category theoretical concepts have "some
| practical application" as you say, then category theory does
| have application to software engineering.
| umanwizard wrote:
| It had application in the sense that it provided
| inspiration for these concepts, yes. However learning
| anything _else_ from category theory is irrelevant to
| understanding and using them.
| dr_kiszonka wrote:
| I can't answer your question in terms of pragmatic
| applications. Based on skimming this book and similar resources
| posted on HN, my -- naive, I am sure -- understanding is that
| category theory unifies other theories and serves as a glue.
|
| One example from the linked book, "Remember that we said that
| programming types (classes) are somewhat similar to sets, and
| programming methods are somewhat similar to functions between
| sets, but they are not exactly identical? A formal connection
| between the two can be made via category theory."
| mjmsmith wrote:
| "The set of queens of England is a singleton set."
|
| Hmmm.
| civilized wrote:
| I'm a sympathetic mathematician but I found this whole passage
| bizarrely off-base:
|
| > mathematics is in a weird and, I'd say, unique position of
| always having to defend what they do with respect to it's value
| for other disciplines. I again stress that this is something that
| would be considered absurd when it comes to any other discipline.
|
| > People don't expect any return on investment from physical
| theories - noone bashed string theory for failing to make useful
| predictions.
|
| Huh? Tons of people bash string theory for failing to make useful
| predictions! There was a whole book criticizing it called "Not
| Even Wrong", meaning it didn't even reach the point of being
| testable.
|
| A better argument for advanced math: it's not always clear in
| advance what math will be useful. A popular example is Riemannian
| geometry, which had no clear real-world value when developed, but
| ended up being used for General Relativity a few decades later.
|
| I also support the argument that math is intrinsically and
| aesthetically valuable, but for those who don't agree, the
| argument above may make some headway.
| analog31 wrote:
| Just to quibble a little bit, but the entire effort of string
| theory (et al) was to find a testable theory. It's not that
| they weren't interested in useful predictions, but just that
| they didn't find any. It wasn't that they weren't making the
| effort, but that the effort has so far failed.
|
| But the day is young, as they say. It took humanity 1000 years
| to figure out how to solve quadratic equations. Physics theory
| has had a lot of quick successes, but you still never know when
| the next one will arrive. We might figure it out in a year, or
| a decade, or a century, or we might never figure it out.
| cubefox wrote:
| > A better argument for advanced math: it's not always clear in
| advance what math will be useful. A popular example is
| Riemannian geometry, which had no clear real-world value when
| developed, but ended up being used for General Relativity a few
| decades later.
|
| This is the classical argument, but I don't think it is
| plausible. It seems even less likely that, say, transfinite set
| theory will ever become remotely useful than string theory ever
| becoming useful.
|
| The argument "it might be useful in the future" can justify
| research in any theory whatsoever, no matter how esoteric. It's
| like defending an outlandish conspiracy theory by pointing out
| that it is _possible_ that it is true. That 's technicality
| correct, but what matters here is the probability that it is
| true, which might well be close to zero. Similarly, while we
| can't rule out that transfinite set theory might have a useful
| application someday, this probability is so small as to not
| being worth discussing.
|
| I think people should admit that they are interested in
| theoretical math (as opposed to applied math) for its own sake,
| like people who are interested in cosmology or string theory or
| theoretical philosophy or whatnot. Pointing to the technical
| possibility of future usefulness seems to be a dishonest fig
| leaf.
| posix86 wrote:
| Researchers at universities only have to justify their work
| in very broad strokes when it comes to mathematics, if at
| all.
|
| It's true that most researchers are motivated like you say,
| because they like it, because if you do it due to utility,
| you'll have a hard time. But, the research money that was
| released to the researchers was justified that it might (and
| probably will) become useful one day. It has paid off many
| times in the past.
| cubefox wrote:
| I'm not sure work in theoretical math has really often
| turned out to be useful. There are some examples, but it
| seems likely that Einstein & Co would otherwise have simply
| come up with concepts from Riemannian geometry themselves,
| ad hoc, as the need arose. There are in fact several cases
| where useful math (such as integration) has been reinvented
| multiple times by scientists who were unaware that it
| already existed. I think the people who do theoretical
| mathematics don't even believe themselves in practical
| applications of their research, they just mention this
| possibility because it sounds good in their grant
| applications.
|
| This reminds me of a logician who is interested in non-
| classical logic, and then writes in his research proposal
| that it might have applications for AI. Of course this
| would be GOFAI, which doesn't work, but the guys reviewing
| the grant application wouldn't know. Or a historian who is
| interested in neolithic culture in India, and now has to
| justify how this research could be useful. He probably
| could write something far-fetched, but the truth is that it
| very probably won't be useful. Which doesn't mean that it
| isn't of intrinsic interest.
| civilized wrote:
| Actually, no, there are results from transfinite set theory
| which are foundational to so much mathematics that there
| would be extensive damage to the theoretical foundations of
| very practical math if it were unavailable.
|
| For example, the distinction between countable and
| uncountable is important in analysis and measure theory.
| Countable subsets of the real line have Lebesgue measure
| zero, and this result is used in many theorems in probability
| and stochastic process theory with practical implications.
|
| Now that we've seen a statement which was rated as almost
| certain is incorrect, it seems to reinforce my original
| point: it is not so clear what kind of math has applications,
| so it is good to develop math broadly.
|
| I agree that it shouldn't be our only argument, but it does
| pack a significant punch.
| cubefox wrote:
| Most mathematicians never use ZFC or any similar
| "foundational" system. That something can serve as such a
| foundation doesn't remotely mean that it is useful. Math is
| not like a house which breaks down without a foundation.
|
| The distinction between countable and unaccountable
| infinity is precisely something that finitists point out as
| being useless. For example, analysis existed well before
| Cantor, and it's notion of limits and convergence
| ironically provides a potential notion of infinity which
| doesn't treat it as a mathematical object, contrary to the
| set theoretical notion of actual infinity, where we have a
| zoo of transfinite numbers.
|
| And the fact that the countable/uncountable distinction can
| be integrated in some practical theories doesn't show that
| it has any practical implication. That would only be the
| case if those practical theories wouldn't exist otherwise.
| But analysis existed before Cantor, and other practical
| theories, like probability theory, could have existed
| before him. They are perfectly compatible with being a
| finitist.
| practal wrote:
| If we are talking about "most" mathematicians, then you
| should also admit that most mathematicians are not a
| member of the finitist church, and that most
| mathematicians appreciate the distinction between
| countable and uncountable.
| civilized wrote:
| Yeah, I'm not sure I follow the logic of "transfinite set
| theory isn't useful because any applications it has could
| be replaced with finitist math", when this is something
| that no one wants to do.
|
| Reminds me of that famous old HN comment about how
| Dropbox is pointless because an equivalent service could
| be set up with Linux utilities. Sure, but there are
| reasons people don't want to do that. Most people prefer
| the ease of use of mainstream foundations.
|
| To be fair to the original commenter, I would be willing
| to bet some money that, say, large cardinal theory won't
| inspire any applications in the next 20 years. But next
| 100 years or 1000 years, I wouldn't. Maybe there will be
| some weird cross-fertilization with other more applied
| fields that leads to something.
| cubefox wrote:
| "transfinite set theory isn't useful because any
| applications it has could be replaced with finitist math"
| would be a misleading way to phrase it. Like, analysis is
| not an "application" of transfinite set theory. It
| doesn't presuppose the existence of any transfinite
| numbers. No piece of applied math does. There is nothing
| which needs to be replaced with "finitist math".
| civilized wrote:
| To repeat my earlier comment: analysis on mainstream
| foundations uses infinite sets of multiple transfinite
| cardinalities, and there are results like "countable sets
| have Lebesgue measure zero", and the difference between
| finite, countable, and uncountable
| sums/unions/intersections, that are relevant to proving
| results that have practical significance, as well as
| (crucially) to avoiding erroneous calculations.
|
| If you want to prove the same results in a finitist
| framework, there is nontrivial work to do, and few
| mathematicians are interested in doing it.
|
| If your contention is that only calculations matter, not
| proofs, I would agree with you that transfinite set
| theory may not be relevant. You can do calculations
| without any rigor at all. But I think the position that
| proofs are of no practical value is untenable. It is
| historically simply not the case that engineer or
| physicist intuition is a sufficient guide to deriving
| results reliably.
| alexvoda wrote:
| I do believe we are getting sidetracked by the example.
| The original argument was that some fields are studied
| for their own sake. And that is a good thing.
|
| Pretending that the reason to study them is that they may
| prove useful in some undetermined future is just a
| distraction used to convince others, usually in order to
| provide funding or as a means to gain status. We should
| simply embrace that things are worth studying for the
| sake of knowledge itself instead of letting the pursuit
| of knowledge be corrupted by all devouring capitalism
| which reduces everything to a monetary value by denying
| the existence of any other kind of value.
| cubefox wrote:
| That was not the issue here though. Whether one is
| finitist or a Cantorian or agnostic doesn't play a role
| in applied math precisely because applied math doesn't
| require any transfinite set theory.
| [deleted]
| canjobear wrote:
| When I think of string theory, the first thing that pops into
| my head is "mathematically sophisticated theory that sucked in
| a generation of physicists but is dead now because it doesn't
| make any testable predictions".
| layer8 wrote:
| String theory continues to be the leading candidate for
| quantum gravity. Very far from dead.
| daxfohl wrote:
| Dead?
| civilized wrote:
| But some of the fancy math in this area is turning out to be
| helpful for QFT calculations, and it's becoming clear that we
| need more powerful math to even formulate proper quantum
| field theories. Check this article out for a briefing:
| https://www.quantamagazine.org/the-mystery-at-the-heart-
| of-p...
| hermitcrab wrote:
| Not sure that is much of a return on investment for the
| millions (?) of person-years of research that was spent on
| string theory.
| civilized wrote:
| Compared to what? Civilization spends on a lot of
| speculative stuff. Venture capital is the art of
| investing in failures 999 times out of 1000. And
| personally I'd rather have tens of billions spent on
| speculative theory research than on, say, Meta's VR
| boondoggle.
| hermitcrab wrote:
| >I'd rather have tens of billions spent on speculative
| theory research than on, say, Meta's VR boondoggle.
|
| We can certainly agree on that!
| alexvoda wrote:
| I believe the lesson here is not that we shouldn't invest
| in speculative theory research. It's that we need more
| breadth, we need to not get stuck researching only one
| option.
| tylerhannan wrote:
| Even in the late 90s when I was studying Topology there was a
| bit of furor over the lack of application...
|
| Until, suddenly, it was quite applicable in evolutionary
| biology and knot theory in context of D?NA enzymes.
| hermitcrab wrote:
| >noone bashed string theory for failing to make useful
| predictions
|
| That stuck out for me. Lots of people have criticized string
| theory for exactly that reason. A theory that makes not
| testable predictions is not a scientific theory.
|
| Mathematics doesn't have to have real word applications. But
| science has to make predictions that can be tested
| experimentally.
| jbottoms wrote:
| "...and mathematics their" ?
___________________________________________________________________
(page generated 2023-03-18 23:00 UTC)