# Tab Completion

Listing of All Posts

# Basic Category Theory Terms

Last updated:

Magma: A set of objects that can be "added" or "combined" in some way, so that if you add any two of them the result is also in the set. That's it.

Semigroup: A magma whose "addition" operation obeys associativity: `(a + b) + c` must give the same answer as `a + (b + c)`. For example, strings form a semigroup with concatenation as their "addition" operator: `("foo" + "bar") + "baz" = "foobarbaz"`, etc. So do the integers under the `min()` operation.

Monoid: A semigroup with a "zero" element: something that, when "added" to any element in the group, produces that other element again. For example, the empty string is the "zero" element in the string/concat monoid. The integers with min() aren't a monoid, but they become one if you add `infinity` as the "zero" element. Lots of interesting things are monoids; it's a very simple and useful constraint to satisfy. If you satisfy "monoid", you get a free version of the `reduce` function using your operation.

Group: A monoid where every element has an opposite or "negative" version, so that if you "add" an element and its opposite, you get the "zero" element. Strings with concatenation are not a group - concatenation only ever produces larger strings, not smaller ones, so you can't ever take a string like "foo" and add another string to it to get the empty string. On the other hand, integer/addition is a group - the opposite of each member is just the negative integer corresponding to it.

## An Alternate Path to a Group

There's an alternate way to get from magma to group. You add different properties along the way, but when they're all combined they add up to the same thing that the previous path did. However, these properties are harder for most things to satisfy, and so they're not generally as useful; most of the things you use that'll satisfy any of these do so because they're all the way to a group already.

Quasigroup: A magma with "divisibility". This property's a little subtle: it means the operation can transform any element of the set to any other element by combining it with an appropriate third element. It has to do so whether the first element is the left or right argument, but the element you choose to combine it with can be different in the two cases.

The integers with subtraction form a quasigroup - if I want to transform "2" into "5", I can do it with `2 − -3 = 5` and `7 − 2 = 5`. (So do the integers with addition, but they satisfy so many of these definitions that they're not very interesting to talk about.) On the other hand, strings with concatenation are not a quasigroup - while you can transform some strings, like "foo" to "foobar", you can't generally do it both ways (nothing satisfies the equation `X + "foo" = "foobar"`), and most strings you can't transform between at all.

Loop: A quasigroup with a "zero" element, which transforms an element into itself regardless of which side it starts on. Or, equivalently, a group without associativity. Integer/subtraction is not a loop: `X − 0 = X`, which is what we want, but `0 − X = -X`, which isn't what we want (and no other number satisfies either side, obviously.) "Natural" examples of loops that aren't groups are a little hard to come by, but the non-zero octonions under multiplication are one (because they're non-associative; omitting the zero octonion is required to keep the "divisibility" quasigroup property, as you can't get from the zero octonion to anything else via multiplication).

Group: Ah, back to group. Along this path, a group is a loop with associativity.

## Going Further

Abelian or Commutative X: Any of the above types might have an operation which is commutative - it doesn't matter which order the arguments are. Integer/min is an abelian monoid, because `min(1, 10) = 10` and `max(10, 1) = 10`.

(a limited set of Markdown is supported)

Well, you obviously meant max at the end. :-)

For an example of a proper loop, nonzero octonions with multiplication are nice. Or "positive definite unit quaternions", where you redefine all squares to be 1 (instead of three of them being -1).

Reply?

(a limited set of Markdown is supported)
{"ft_lang_label":"__label__en","ft_lang_prob":0.93132466,"math_prob":0.8336793,"size":4120,"snap":"2019-35-2019-39","text_gpt3_token_len":1009,"char_repetition_ratio":0.11831876,"word_repetition_ratio":0.0027322404,"special_character_ratio":0.2407767,"punctuation_ratio":0.12207152,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96887565,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-08-18T04:59:12Z\",\"WARC-Record-ID\":\"<urn:uuid:d240ed31-ab51-4df1-9cd5-e5cbdcf72879>\",\"Content-Length\":\"34950\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:90d12bd6-6f00-403d-b6d7-d776ce17cf82>\",\"WARC-Concurrent-To\":\"<urn:uuid:fe03772b-9480-4840-815f-ff6f74090bb1>\",\"WARC-IP-Address\":\"208.94.117.105\",\"WARC-Target-URI\":\"https://www.xanthir.com/b4Uz0\",\"WARC-Payload-Digest\":\"sha1:7BMH6HGSK5KJ7576KNHI2GHOG4RNARGQ\",\"WARC-Block-Digest\":\"sha1:BF567TQOVWYK5EPJZARTHBZFXPNEHMVM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-35/CC-MAIN-2019-35_segments_1566027313617.6_warc_CC-MAIN-20190818042813-20190818064813-00264.warc.gz\"}"}