logoalt Hacker News

Category Theory Illustrated – Orders

226 pointsby boris_myesterday at 6:40 AM59 commentsview on HN

Comments

ralphctoday at 12:22 AM

I've barely read about Category Theory, but isn't it a just a slightly more mathy version of what programmers have been doing all along? Going up and down levels of abstraction, graphs, functions that transform one type of "object" into another?

seanhunteryesterday at 11:10 AM

If you want to learn category theory in a way that is more orthodox, a lot of people recommend Tom Leinster’s Basic Category Theory, which is free[1]. I’m going to be working through it soon, but the bit I’ve skimmed through looks really good if more “mathsy” than things like TFA. It also does a better job (imo) of justifying the existence of category theory as a field of study.

[1] https://arxiv.org/pdf/1612.09375

show 1 reply
gobdovanyesterday at 10:43 AM

If someone does not want to check the mathematics line by line and prefers to give the article the benefit of the doubt, note that it also presents this JavaScript:

[1, 3, 2].sort((a, b) => { if (a > b) { return true

  } else {

    return false
  } 
})

This is not a valid comparator. It returns bools where the API expects a negative, zero or positive result, on my Chrome instance it returns `[1, 3, 2]`. That is roughly the level of correctness of the mathematics in the article as well, which I'm trying to present in sibling comment: https://news.ycombinator.com/item?id=47814213

show 1 reply
dganyesterday at 8:00 AM

I think it is pretty obvious that at the challenge with all abstract mathematics in general and the category theory in particular isnt the fact that people dont understand what a "linear order" is, but the fact it is so distant from daily routine that it seems completely pointless. It's like pouring water over pefectly smooth glass

show 3 replies
throw567643u8yesterday at 3:37 PM

The author's writing style and overuse of parentheses is excruciating. True parenthetic material is rare, good technical writers use them sparely.

show 1 reply
ynacyesterday at 4:30 PM

I once saw a man with a notebook and pencil drawing these kinds of diagrams, at the time I saw them as graph theory. I wasn't in an extrovert moment and missed my chance to ask. He seemed to be working recreationally on them. I'm wondering about puzzles that could be easily created using these theories / maths. You, practitioners, any suggestions?

show 1 reply
arketypyesterday at 7:59 AM

There is a way to frame category theory such that it's all just arrows -- by associating the identity arrow (which all objects have by definition) with the object itself. In a sense, the object is syntactic sugar.

show 1 reply
adaptityesterday at 10:44 AM

This resource is a really clear breakdown of order relations; visualizing the structure like this makes the abstract concepts much more digestible

cubefoxyesterday at 9:29 PM

This does the standard thing of treating preorders as the default generalization of partial orders. But an (arguably) more natural, and more useful, generalization of partial orders is acyclicity.

Unfortunately acyclicity isn't called an "order" so people assume it's something unrelated. But "orders" are just second-order properties that binary relations can fulfill, and acyclicity is also such a property.

Acyclicity is a generalization of strict (irreflexive) partial orders, just like strict partial orders are a generalization of strict total (linear) orders. Every strict partial order relation is acyclic, but not every acyclic relation is a strict partial order.

A strict partial order is a binary relation that is both acyclic and transitive, i.e. a strict partial order is the transitive closure of an acyclic relation.

Binary relations of any kind can be represented as sets of pairs, or as directed graphs. If the binary relation in the directed graph is acyclic, that graph is called a "directed acyclic graph", or DAG. In a DAG the transitive closure (strict partial order) is called the reachability relation.

Examples of common acyclic relations that are not strict partial orders: x∈y (set membership), x causes y, x is a parent of y.

gobdovanyesterday at 8:26 AM

Unless there's some idiosyncratic meaning for the `=>`, the Antisymmetry one basically says `Orange -> Yellow => Yellow -/> Orange`. The diagram is not acurate. The prose is very imprecise. "It also means that no ties are permitted - either I am better than my grandmother at soccer or she is better at it than me." NO. Antisymmetry doesn't exclude `x = y`. Ties are permitted in the equality case. Antisymmetry for a non-strict order says that if both directions hold, the two elements must in fact be the same element. The author is describing strict comparison or total comparability intuition, not antisymmetry.

show 3 replies
eli_dove02yesterday at 11:16 AM

studying category theory for my master's in 2015 showed me how orders influence everything from data structures to algorithms. foundational stuff.

theQuietCliff89yesterday at 11:15 AM

this reminds me of Haskell’s type classes; they elegantly define order concepts through their own set of rules, capturing relationships in a clean way.

scotty79yesterday at 11:12 AM

I love how math is like a new language, in a new country, of culture you are not exactly familiar with.

This article is like living there for few months. You see things, some of them you recognize as something similar to what you have at home, then you learn how the locals look at them and call them. And suddenly you can understand what somebody means when they say:

"Each distributive lattice is isomorphic to an inclusion order of its join-irreducible elements."

Having a charitable local (or expat with years there under their belt) that helps you grasp it because they know where you came from, just like the person who wrote this article, is such a treasure.

somewhereoutthyesterday at 8:41 AM

The first 90% of this is standard set theory.

I'm unclear what the last 10% of 'category theory' gives us.

show 1 reply
ashCrafts62yesterday at 11:14 AM

binary relations defining order are more nuanced than they seem; a linear order isn't just about ranking, it's about the structure of the relationships themselves.