Hacker News new | past | comments | ask | show | jobs | submit login
A Gentle Introduction to Category Theory [pdf] (psu.edu)
93 points by ihodes on June 30, 2011 | hide | past | favorite | 14 comments



What's the deal with category theory on HN? Seriously, how is it interesting or relevant without introducing it along with concepts from fields in which it is of main use (e.g. (homological) algebra and algebraic toplogy)? I don't think I'd be able to appreciate, or even understand CT without having a thorough understanding of concepts it tries to generalize -- hell, I do have trouble to consider it useful even with it. Since I do not believe that HN us full of mathematicians (even though there are a few) researching algebraic topology or homological algebra, I wonder who reads and posts such things here.


Category theory is much beloved of functional programming researchers, at least in my computer science department, mostly as a way of analysing and conceptualising type theory.

For example, one of my friends is working on showing equivalences between I/O in Haskell (purely functional) and Lucid (demand-driven dataflow). Category theory shows a neat relationship between the models and a way to move between them.


Not just FP researchers, although they are a particularly good fit because typed lambda calculi are Cartesian closed categories.

Other areas of CS where category theory is applied:

1. Algebraic data types and modules. E.g., http://reperiendi.wordpress.com/2007/11/03/category-theory-f...

2. Semantics of non-terminating programs. E.g., http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.2...

3. Semantics of concurrency. E.g., http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.62.8...

These are probably the most important places, besides FP, where categories are used in computer science, but there are others: logic programming, computer graphics and vision, knowledge representation, ontology, &c. The applications to FP are most visible because (i) Haskell monads are a little slice of category theory, so users as well as language designers need to get their hands dirty[+], and (ii) it's very natural to want a realisation of a categorical semantics to have first-class functions, ideally lazy functions, because that makes the realisation easier.

[+] Categorical abstractions in semantics are dirty, don't let people fool you into believing they are pure and clean.


So one should introduce category theory along with its usage. Category theory makes little sense without it -- it turns to mundane symbol (or rather, diagram) manipulation. The category-theoretical notions do not seem to have any relevance if you do not know what other notions they try to generalize. What I mean is that it is more natural to notice that various products in all kind of mathematical structures have some universal property in common, than to say that these are examples of categorical notion of product. Or, it is more natural to notice that van Kampen's theorem really says something about connection between fundamental groups of a space and its subspaces, than to say that fundamental grupoid of a space is a colimit of a diagram created by fundamental grupoids of certain families of subspaces, with arrows being induced by inclusions. The second approach in case of van Kampen theorem (and many more, actually) is useful when you want to prove or use van Kampen theorem, because it is a bit easier to prove an universal property of a colimit than to prove that the fundamental group of a space is a free product product of the fundamental group of its subspaces with an amalgamation along fundamental group of their intersection. Nevertheless, categorical approach does not provide you with the intuition which initially led to the formulation of this theorem. I believe that the case is similar with your friend's work -- it's his intuition and insight which led him to notice this equivalence, and category theory only helps him formulate his thoughts in an elegant way.

Learning category theory before learning more substantial facts is in my opinion going totally in backward order. Or maybe I'm just an (metaphorically) old grump and refuse to acknowledge the revolution just like mathematicians in the beginning of twentieth century were refusing to accept set theory.


I'm inclined to agree.

I've tried a few times to learn category theory in the abstract, and struggled to motivate myself when I couldn't clearly "see" the structure and the application, in categories (like Hask or Vect) which I know reasonably well.

I'm glad it exists though, so I know where to look if I want some kind of deeper unifying intuition about structural ideas in whatever area of maths I'm studying, which might help me connect them to other areas, and as I read more graduate-level maths I imagine more of these opportunities will crop up.

Perhaps it's one of those things where it's helpful to learn the basic definitions early on, and their implications in categories (initially probably fairly straightforward ones) which you already know.

But then, just keep it gently percolating while you study other things, rather than trying to force it and make sense of adjoint functors etc before you've studied enough applications to justify the abstraction.


For a demonstration,

I recommend the "Going Deep" show episodes of Erik Meijer and Brian Beckman, http://channel9.msdn.com/search?term=erik+meijer+brian+beckm...

plus the book "Algebra of Programming" by Richard Bird, Oege de Moor http://www.amazon.com/Algebra-Programming-Prentice-Hall-Inte...


Hacker news is for Hackers. Programming languages are heavily influenced by Category Theory. Hackers use programming languages and love to learn new ways to become better hackers. Look up the reason why pg called his incubator YCombinator. Its a complex programming theory based in lambda calculus. http://en.wikipedia.org/wiki/Fixed_point_combinator


You know, maybe the average HNer will not get 1ct of benefit from reading 1paper on category theory; but maybe they can get .1ct from reading .1paper. The functor pattern is pretty cool. It's easy to use in most languages (Java and C++ included), it's pretty powerful, maybe it gets people thinking a certain way. Maybe someone will read the first bit of this paper and think, "Huh, I heard monads are from category theory too. Don't know what those are, but the first 20 pages of this weren't too bad". Don't complain about people posting useless things; clearly someone voted for it.

Math isn't ever "useful". Math only generates more math. Math is measured in ideas inspired.


Functor pattern is certainly something else than functor in category theory.

By "useful" I mean "useful in getting new results or new, better proofs". By this metric, singular homology is certainly useful, because it enables us to create clean and elegant proofs of some highly non-trivial and interesting facts, but I cannot imagine anything more useless in real life.


Functor typeclass in Haskell models category-theoretic endofunctor rather well.


Functor typeclass in Haskell is not what is usually meant by "functor pattern", e.g. the function object, something that "implements Runnable".


I had no idea the gang of four had appropriated that word too. My bad. I really did mean the category theory functor, not whatever its other meaning is.

However useful or not category theory is for producing new proofs, I found it enlightening and am glad this was posted.


The Haskell Programmer’s Guide to the IO Monad:

"This guide explored the theoretical backgrounds of Haskell’s IO monad. On the way we have seen functors, natural transformations, and finally monads. All these purely theoretic concepts appeared to have a quite practical correspondence in the Haskell programming language, as emphasized by the according examples. It should be clear now, how the IO monad is used to pass around the state of the world, without allowing the programmer to access it “too much”.

http://stefan-klinger.de/files/monadGuide.pdf


For my money a good introduction to CT must have compelling examples, which I don't quite see here. To understand basic category theory this is a fantastic introduction http://www.mscs.dal.ca/~selinger/papers.html#graphical . It is not meant to be an introduction to CT but it's basic CT with some amazing examples.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: