Reading Category Theory for Programmers by Bartosz Milewski on stream.
Previous reading: 20260227042453
- Follow the Arrows
- Reminding myself that Category Theory is focused on morphisms instead of objects.
- Not sure where the author is going, but it is reminding me of Hoogle, where you can write function signatures to find the function you want to use.
- Initial Object
- We can define an ordering by looking at how many morphisms point from one object to another.
- The initial object is the object that has one and only one morphism going to any object in the category.
- Sets do not always have initial objects. For example, the partially ordered set (or poset) of all integers both negative and positive does not have an initial object. But wait, isn't the set of all integers completely ordered? Why is he calling a poset?
- In the category of types, Haskell's
Voidis the initial object; you can always useabsurd :: Void -> ato go to any other object.
- Terminal Object
- The terminal object is the object with one and only one morphism coming to it from any object in the category.
- In the category of sets, Haskell's
()is the terminal object; you can alwaysunit :: a -> ()to go from any other object. - Uniqueness is important; other types like
Boolcan't work because they can be eithertrueorfalse, which means that you can have more than one morphism going to it rather than one and only one.
- Duality
- Any category C has an opposite COP which is created by reversing all of the arrows.
- For example,
f :: a -> bandg :: b -> ccan be composed to makeh :: a -> c, and can each be reversed to go fromc -> a - Reversing identity is a no-op.
- For every construction in category theory, the opposite construction can be made by reversing the arrows and this opposite construction is usually named by prefixing the original name with the prefix "co-"
- The terminal object is the initial object in the opposite category.
- Isomorphisms
- An isomorphism is a pair of functions
a -> bandb -> awhich are inverses of one another and, when composed, create the identity morphism. - Any two initial objects are isomorphic (having
the property of isomorphism)
- Since there is only one representation of an
initial object, all of the possible morphisms for
two initial objects are a function from one initial
object to another (
f :: a -> bandg :: b -> a) and the identity morphisms. Since f ⋅ g and g ⋅ f give you the identity morphism, this means that these objects are isomorphic.
- Since there is only one representation of an
initial object, all of the possible morphisms for
two initial objects are a function from one initial
object to another (
- Any two terminal objects are isomorphic, for the same reason
- I literally do not understand what they mean by "up to isomorphism" and "up to unique isomorphism"
- Chat says "unique isomorphism" means that it is the only isomorphism between a pair of isomorphic objects.
- I still don't know why they mean when they say that "uniqueness up to unique isomorphism is the important property of all universal constructions." What is a universal construction???
- An isomorphism is a pair of functions
- Products
- I get the general idea that a product is a combination of two sets and that it is the most generalized, abstract version of the constituent sets, the combination, and the morphisms between them. However, I do not understand the example.
- He keeps using the word "universal construction" like I'm supposed to know what it means
- A product of two objects a and b is the object c with two projections (morphisms from c to a and from c to b) such that for any other object c’ with two projections there is a unique morphism m from c’ to c that factorizes those projections.
- Not sure what "factorizes" means, chat says it's when a morphism is written in terms of a composition of multiple morphisms.
- Given what chat is saying, i think they mean that the projections referred to in "there is a unique morphism m from c’ to c that factorizes those projections." are the projections associated with c′
- I feel like I don't understand this section.
- Coproducts
- Definition of a coproduct is the opposite of a product.
- Given that i don't understand the product section, this doesn't make any sense either.
- I think the only information I got out of this really is that the "canonical" product type is a tuple and the "canonical" coproduct type is a sumtype.
- Asymmetry
- It makes sense to me that a product is like multiplication and the coproduct is like addition, because all of the possible states of a tuple is equal to all of the possible states of its constituents multiplied together and all of the possible states of a sumtype is equal to all of the possible states of its constituents added together.
- Thinking about what would be similar to the power operation. It seems like the "power type" could be an array, because the number of possible states in the array is a function of its length to the power of all of the possible states of its constituent (this only works if the array can only hold one type, like god intended).
- He says that this shows that the category of sets is not symmetric, but he didn't even define what symmetry means!
- I don't know what the author is talking about.
- Chat says "unique to isomorphism" means if there are multiple things that satisfy the property, they must all be isomorphic.
This is how I feel about "unique to isomorphism":
Merriam Webster: please define "unique to isomorphism"
me: "what the"
me: "you can't just combine math words and pretend that they mean something"
is like
Some Guy "with a good idea, bet": the best game idea is obviously VR MMO Cyberpunk Idle Game Betting App Souls-like
me: "what the"
me: "you can't just combine genre words and pretend it's a real game idea, you have to define what the fuck your idea IS"
me: This cannot be your GDD