6 ms·
As someone with a maths degree, yet who admittedly hasn't looked into category theory beyond some basic notions, I still don't quite understand why anyone would
by Tainnor 4y ago
As someone with a maths degree, yet who admittedly hasn't looked into category theory beyond some basic notions, I still don't quite understand why anyone would want to learn category theory before e.g. abstract algebra or even just fundamental mathematical reasoning (definition, theorem, proof).
Maybe I'm missing something but it seems to me that all you can study monads in programming languages without having to also learn the category theory abstraction of it. The same goes for semigroups, monoids, folds, functors, ...
I'm sure there's a benefit in category theory once you want to unify all these abstractions and talk about all of them together, but I see so many people who think they have to learn CT before they can understand monads in e.g. Haskell, and I don't really understand why.
- larve 4y agoauthor here, for context, I do have a reasonable background in maths (algebra, analysis, statistics) at a CS master-ish level (self-taught and a long time ago, though), as well as spent quite some time with programming language / type theory when I was younger, and I do use monads quite a bit in my day to day programming. In fact, the fundamental algebra concepts (rings, groups, etc...) as well as fundamental CS theory (grammars, proof theory, semantics, ...) were the only maths I felt reasonably comfortable with, compared to say, calculus or statistics which really did my head in and ultimately caused me to drop out of university.
- Karrot_Kream 4y agoHow much do you think your predilection for algebra affected your interests? Most folks who do CT as a hobby that I know are much weaker in analytical concepts than any working mathematicians that I knew.
- larve 4y agoHonestly I'm pretty weak in both, but they seem to reflect my intuitions, if that makes sense? I'm nowhere near a working mathematician, and proofs usually bore me. I prefer writing code.
- Karrot_Kream 4y agoIf you're looking for an alternate perspective, I would suggest taking an advanced undergraduate analysis book and working through it, proofs and all. It'll teach you the same kinds of stuff that you're getting out of CT but will give you "working" (lol) knowledge of how to apply it. A lot of mathematical work is about creating math objects and relations and proving properties of these objects through their relations. The exercises in a good algebra book will exercise this muscle and make your software organization better, at least IMO. Learning the definitions just isn't a substitute. I can see why categories appeal if you're just looking at definitions, but CT often just abstracts/standardizes an approach that folks were already working with when working with rings, groups, topologies, etc. Going through the proofs will teach you when to apply what. Aluffi (Algebra: Chapter 0) makes a great book that teaches the basics of CT and brings it up while teaching regular algebra. I highly recommend it.
- larve 4y agoI studied CS in germany in 1999 and we had "analysis 1+2+3" which I think was a fairly rigorous analysis treatment, I definitely did more than my fair share of proofs. I think that foundation accompanied me through all those years of programming and helped me read and pick up concepts related to type theory, algebra and functional programming. In parallel I developed this very "visual" way of thinking about structure that makes me really resonate with CT. In a way I'm less interested in learning new maths, more so than learning more about how people approach (complex) structures I already know with these very rudimentary concepts, and seeing how their formalizations match my "folk mathematics". I'm having a lot of fun! edit: thanks for the book recommendation! that looks like my kind of maths book
- larve 4y agoi skimmed through aluffi, and it is indeed exactly the material I had at university in analysis and algebra, augmented with the category theory angle. this is great, thanks a lot. Now I have to find an affordable copy somewhere. I also like the focus on quotient groups and galois fields, as well as using graphs as recurring examples, which have been the only times I really put the pedal to the maths metal in my programming (for some crypto and error correction stuff).
- bmitc 4y agoHow do you know analysis at a "CS master-ish level" (not sure what that means given it's a mathematical subject) but calculus did your head in? I'm not being judgmental but am just genuinely confused given that analysis is the foundation for calculus. :)
- larve 4y agoCalculus (at least our exams and lecture) were so much about "calculating" and applying rules and clever tricks on complex functions and multiple dimensions which just... didn't work for me. I had a lot of other things going on, so this recollection is probably off. Calculus and diff eqs started making sense to me when I started working in mathematica and systemmodeler, and realizing that it was a brilliant tool. It probably also came from the way it was taught, which was completely devoid of any historical or practical context. It was just a lot of "compute the laplacian of e^i_sin(phi) or whatever. I found groups, limits, continuity, fields to be much more amenable to my thinking. It felt way more similar to the things I really enjoyed (building software in scheme and C and writing exploits in assembly).
- bmitc 4y agoOh, I see. So it seems it was more about the presentation and interest rather than the concepts. You may like Calculus by Michael Spivak if you're interested in it again. It is much more analytical than computational.
- larve 4y agoThat's one of the books I used when I got back into it. These days, there is so much great material on youtube and edx and coursera (plus maths stackexchange and discords) that it's absolutely fantastic to learn maths, as fantastic instructors are immediately available. For me, I realized thst I need to write the code to accompany the maths, because it helps me disambiguate mathematical notation and put "types" on things. It helped me a lot to work alongside real maths PhDs and realize that they have a very "intuitive" approach to maths, and don't necessarily yeet lemmas and proofs around all day, instead spending a lot of time brainstorming on the whiteboard and discussing things out, very similarly to software design. It was one of them telling me that my thinking was very mathematical that helped me "deconstruct" the fear of maths that I had built up.
- Tainnor 4y agoIt's a common observation that many mathematicians and maths students tend to fall into either the algebraic or the analytic camp, although of course, there are more nuances and some people are genuinely good at both. I myself find beauty in some parts of analysis, but algebra definitely speaks more to me (e.g. I find a proof of Lagrange's Theorem more beautiful than one of the Intermediate Value Theorem). So I can relate.
- SleekEagle 4y ago> It's a common observation that many mathematicians and maths students tend to fall into either the algebraic or the analytic camp (we don't talk about the topologists)
- Koshkin 4y agoAren’t all topologists algebraic topologists today?
- Karrot_Kream 4y agoNo way? It's a pretty even split between analysts and algebraists from what I can tell. Really depends on what you're researching. Only the internet and online CS-adjacent communities have these crazy algebra-dominated communities.
- School-Cotton 4y ago> As someone with a maths degree, yet who admittedly hasn't looked into category theory beyond some basic notions, I still don't quite understand why anyone would want to learn category theory before e.g. abstract algebra Because people think “category theory” means “abstract math” in general, due to cargo-culting in and around the Haskell community.
- Karrot_Kream 4y agoYeah when I read all of this "category theory expands your mind" thinking, it makes me think that folks were looking for mathematical maturity more than category theory. Work through any good book on algebra and analysis and you'll learn and prove a bunch of stuff about objects and relations.
- bmitc 4y agoI also have a math background but am now a software engineer, and I agree. One can learn category theory all by itself, but it's relatively unimportant in software and computer science as far as I can tell. It's really only powerful as a unifying, abstraction, and conceptual relating tool in upper mathematics where the divisions of mathematics begin to blur.
- Tainnor 4y agoI mean absolutely no disrespect to anyone doing serious work in CT or in Haskell - and I'm actually very interested in Haskell as a language per se and have been exploring it more in recent months - but having spent some time in Haskell communities, I have to agree. There's a lot of empty posturing by people who don't really seem to understand a lot of mathematics but still seem to have very strong convictions about certain aspects of it (constructivism is another such thing).
- btilly 4y agoI'm curious why you call out constructivism. I've only really seen constructivism talked about by people who actually have a strong math background. Because it is hard to speak out against, say, the classical notions of existence that say that there are more real numbers than rational ones unless you actually understand why the classical proofs don't work constructively. And not just as, "We don't allow that proof." To make that concrete, let's use computable analysis as a foundation for constructivism. In short, we represent Cauchy sequences as computer programs about which we can prove things in our favorite axiom system. You can build up a version of real analysis from that. It is easy to attempt Cantor's diagonal argument. You'll get a concrete program. But it will only represent a real number in our system if our axiom system can prove that every program it proves works, works as proven. This immediately brings up consistency. And so Gödel proves that showing this program represents a computable number in our system would imply our axioms to be inconsistent. (Bad axioms! Bad axioms!) And therefore Cantor's proof fails to produce a number in our system. Of course classically we would say that if the axioms are consistent, then the program will compute a Cauchy sequence. And so it really does represent a real number even though we couldn't verify it. But whether we accept this alternate argument is a question of philosophy, not logic.
- dwils098 4y agoI concur, the theory is not necessary to understand how to use it. Perhaps it is counter-intuitive and one would like hone their intuition. Still there are much better approaches to developing an adequate intuition than the theory, this is why traditional Math textbooks rely on exposition first, to establish the context of the theory...
- zozbot234 4y ago> or even just fundamental mathematical reasoning (definition, theorem, proof). Logic and proof theory is actually one of the areas in math where category theory is most clearly useful. Intuitively, this is because reflexivity ("A leads to A") and transitivity ("A leads to B and B leads to C, hence A leads to C") are well-known rules of any kind of proof writing or indeed of argumentation in general, and they exactly describe a category.
- layer8 4y agoHow exactly is it useful? Reflexivity and transitivity are concepts independent from category theory. How does category theory, specifically, help here? As someone familiar with algebraic objects and relations etc., I don’t see what category theory is adding in terms of practical usefulness in software development.
- Tainnor 4y agoI know a fair bit about logic and none of it involves any CT. That's not to say you can't find it in there somewhere as a unifying concept, but the fundamental theorems such as completeness and compactness of FOL, basic model theory, Gödel's theorems, etc. do not require any CT. Also, reflexivity, transitivity and symmetry just define an equivalence relation, no need for CT there.
- Koshkin 4y agoHeh, except when you wish to talk about "natural equivalence"!
- nonrandomstring 4y agoTo me it's part of the "stretch your mind" philosophy. Plenty of exercises that add some suppleness and help with all round problem solving. It's one reason I keep up with Lisp even though nobody cares much to learn or pay me to program in it these days. Any programme of discrete and abstract maths surely has the same benefits, with a little bit of different theory areas; number, group, sets, operator... all healthy stuff unless taken to extremes :)
- School-Cotton 4y agoBut you can study all of that stuff without category theory.
- larve 4y agoauthor here, Finding higher abstractions ultimately is about being able to draw parallels amongst a wider variety of concepts. It doesn't change the concrete thing / the lower levels of abstractions in the least, and it often makes sense to stay at that lower level when communicating or getting things done. Plus I personally enjoy it and I feel it gives me a much wider array of things to draw from when designing / thinking. It broadens my toolbox, even if at the end of the day, all I do is hammer nails.
- chobytes 4y agoYeah Im unsure what the point is. The motivation for CT in programming seems weak. Eg Stuff about types and endofunctors feels like trivial examples using the jargon just to use it. OTOH discovering the Top->Grp functor in algebraic topology is kind of unexpected and revealing.
- rssoconnor 4y agoI agree with you. CT seems mostly useful as a way of devising entirely new abstractions, but once those abstractions are developed, you don't need CT to use them. For example if it were 2008 and you want to be inventor Applicative functors for use in Haskell, then knowing lax monoidal functors from CT might be helpful. But if you want to just use Applicative functors, you don't need to learn lax monoidal functors first. So programmers probably don't need to learn CT because they can just let the computer scientists devise their abstractions for them. But if you want to be a computer scientist and one day devise your own abstractions[0], then maybe CT would be helpful. [0]https://news.ycombinator.com/item?id=33805923 https://news.ycombinator.com/item?id=33805923
- q7xvh97o2pDhNrh 4y agoDo you have any recommended reading for learning CT from the perspective of an engineer who does want to make their own abstractions? Your description is the single best sales pitch for learning it that I've ever heard. I'm legitimately interested now — in a way that I simply wasn't before your comment. Everyone else who tries to hype up CT is always like, "Whoa, bro, don't you know that addition is actually a monoid endofunctor over the set of all hyper-reals?" (Or something.) I guess that sort of breathless mathematical revelation is supposed to be so mind-blowing that anyone who hears it gets instantly hooked. My usual response was always just, "So what?" But you're telling me I can become a better engineer? A meta-engineer, who can engineer things to engineer with? Yeah, I'd definitely be up for that.
- larve 4y ago(author here) I found the corecursive podcast episode about "portal abstractions" with sam ritchie quite inspiring. It's about monoids from the algebraic point of view, but the mindset is very similar, I think. https://corecursive.com/050-sam-ritchie-portal-abstractions-2/ https://corecursive.com/050-sam-ritchie-portal-abstractions-... I think I might have linked it in the article.
- rssoconnor 4y agoMy method was to spend 25 years listening to colleagues mumble about Category Theory and slowly picking up the basics. Even I didn't really use Category Theory in my abstraction work. It's just that after months of effort to crack my problem, I showed my pages of work to the Category Theory folks and they were like "oh, it's simply Yoneda this and Yoneda that and your proof can be done in 4 lines.". That said, if I had to guess at what would be effective at getting up to speed without spending 25 years, would be to checkout https://github.com/hmemcpy/milewski-ctfp-pdf https://github.com/hmemcpy/milewski-ctfp-pdf Category Theory for Programmers. Milewski was one of those people who were like "Oh, it's simply Yoneda this and Yoneda that", and he figured it out all himself in parallel without seeing my proof. But I doubt it will be like, knowing Category Theory will enable you to have super powers for abstraction design. Rather it will be a matter of having enough mathematical tools at your disposal plus the right inspiration at the right time to realize that ones of those tools can happen to solve your abstraction programming problem you happen to be facing at some moment, in a way that is not obvious, if you are lucky. In fact, you likely have to first guess at what the right abstraction is and then fall back on Category Theory to verify the sanity of your guess.
- _448 4y agoIt is not that one has to learn CT to do FP, but not knowing it makes it difficult to take part in discussions on the mailing lists.
- SleekEagle 4y agoYeah, category theory isn't even broadly well studied amongst actual mathematicians lol. I'm all for learning for the sake of learning though!
- sargstuff 4y agoIt's tagged blocks, not anonymous numerical bits. (think like a schrodingers cat)