@Justin Y. few things: 1) Kind of Board should be either (* -> *) or just *. 1.1) data Board a implies Board has a kind of (*->*), but the all you have after the "=" doesn't even defines a constructor that "data" keyword requires. 2)Even if it was "data Board a = Board (a -> (Board, a))", "Board" on the right side requires type as argument. 3)I'm failing to see how "data Board a = Board (a -> (Board a, a))" can represent a board with mutable drawings (it's atleast not obvious how to construct non-trivial instance(object, value, e.t.c.) of type "Board a"). I think the declaration of the Board typeclass should be something like that: class Board b where erase :: (Monoid (b s)) => b s erase = mempty draw :: (Monoid (b s), Applicative b) => s -> b s -> b s s `draw` a = pure s a infixr 8 `draw` instance Board [] instance Board Identity --and so on
I'm both a math teacher and a programmer, and I have tried reading some books on category theory years ago, but just found them too abstract and unintelligible. I mean, I kind of "knew" some basic things about monomorphisms, functors, etc. but I just failed to see the... Meaning of it all. It was just words. This is not the case with your lectures, I really, really like the way you explain things. By the way... The "arrow" analogy in the first lecture, how we still can't think outside of our hunter-gatherer past, really blew my mind. Was using arrows all my life but I never thought about it! :-) Thank you for your work!
Thanks, Bartosz, wasn't expecting to find myself watching lections on category theory 1 month ago... but here we are! These should be put to some gold or platinum RUclips collection, is too good material. Thanks for sharing, and I hope you're doing well!
5:55 is a great visualisation of the problem of composition between these embellished functions, there's a disconnect between m b and b.. and how Kleisli category is there to help with that.. kinda blew my mind. Thousand thanks for making this video series.. I have ADHD and reading is often very frustrating and cumbersome for me but I can quite easily follow these lectures in video format, pause and think for a while, rewind if my mind wanders. I had pretty much given up ever understanding category theory even at the basic level but now I'm hopeful.. I've had so many rewarding a-ha moments. I will eventually get back to Haskell and this time I'm better armed :D
You are a great lecturer. I've read your blog posts on C++ and some Haskell stuff. I'd say the blog post on category theory is quite lengthy and intimidating. But this series of videos is an enjoyment to watch. Thank you.
Not exactly sure how to ask this question but hopefully this makes sense. On the board, you have two categories, the one on the left with a "C" above (category of types I believe in this example) and the one on the right which is the "Kleisli" category. Within the Kleisli category you have objects "a, b, c" - are these the mappings from category "C"? In that is "a" from the Kleisli category "m a" from the "C" category on the left? What I'm trying to understand is the "arrow" between "a -> b" in the Kleisli category, which is said to be the "a -> m b" from the "C". Little fuzzy, as the end of the arrows, would be "m a" and "m b". Given that identity in the Kleisli category "a -> a" would be "a -> ma" or the "arrow" would be anyway in the "C" category. (Again using "C" to refer to the diagram on the left).
We are trying to build a new category K. What are the objects in it? The same as the objects in C. What are the arrows? Pick two objects a and b in K (same as in C). Peek at the category C and find out how many arrows there are from a to m b. These are exactly your arrows in K between a and b. You just transplant them. Will they compose correctly? Maybe so, or maybe not. If they do, you were successful in building K.
Ok so in K you have "a -> b", where the arrow between "a -> b" is an arrow from C, namely one that looks like "a -> m b" - where I think I get stuck is that the end of that arrow is "m b" not "b". This mismatch perhaps is the point, in that in order one to state there is a K where "a -> b" there has to be a way to take an "m b" to "b"? Likewise, there must be a way to compose two arrows as well in K in the case of "a -> b -> c" etc to satisfy the axioms. btw, great video series. While I may still have a ways to go in fully wrapping my head around this your videos do help a great deal!
I still don't get it. How those arrows could be the same if they connect different objects (a->b vs a->mb), but these objects is what defines arrows? Say, we have g::a->b in K, and f::a->mb in C. For me it is quite obvious that g and f simply cannot be the same, since b/=mb.
I see your problem. I do say "equal," and this could be confusing. After all, what does it mean for an arrow in one category to be "equal" to an arrow in another category. A better ways of saying this is that "under" every arrow a->b in the Kleisli category there is an arrow a->mb in C. If you want to see how it composes with another arrow in K, just look what's under those arrows. I do say that one arrow "is implemented" in terms of the other arrow, and that makes better sense.
i am confused about some of the objects in C. where did the m a, m b, and m c objects come from? are they already in the C category? or did we add them to the category when we "implemented" the map?
Thank you for these amazing videos. I have a question on Void: "Void" is an object that has only outgoing arrow. How come it has arrow "id"? then that arrow "id" is an example of an incoming arrow to the "Void" object!
9:30 ( more or less) now my understanding is that "objects serve no other purpose than to indicate which pairs of morphisms can be combined by the composition operator of the category. "
For any set A there exist function f from empty set {} to A because we can take some mapping f to A, and because we have empty input to it we will have empty output from it namely empty set {}. And because {} is subset of A, f will be mapping: {} -> {} ⊆ A => {} -> A.
The intuition that all arrows along the path to terminal object compose to the one single arrow is nice. I wonder about the mechanics of composing of infinite numbers of arrows.
I have a hard time wrapping my head around why there is a unique function Void -> a absurd. How do we decide whether two functions are equal? For example why is f :: Void -> Int = const 1 NOT different from g :: Void -> Int = const 2?
36:55 I don't really grab why we can't assert two objects are equal by just considering their identity arrow. Because isomorphism definition take advantage to identity arrow to assert it's an isomorphic arrow. But why object don't just take advantage of the identity arrow directly?
Thanks a lot Bartosz for this great series of lectures. I'm having a hard time with `there is an arrow from empty set to singleton set`. I know that empty relations exist, and by definition, an empty relation (an empty subset of the cartesian product) is also a function (it does not violate the characteristic constraint of functions because it has no elements to violate it, and ex falso quodlibet). So if we pick an empty set as our domain, the cartesian product of it with a singleton set (or any other set) is also empty, so we can have only one function, the empty function. Is this the one arrow from Void to ()? or the so called `absurd` in Haskell (the bluff function you mentioned in the last lecture)? If that's the case, then we'll have one and only one unique arrow from Void to any other object, right? Disclaimer: I just watched up to the terminal objects and I just want to make sure that my mathematical understanding is correct up to this point and it corresponds to the absurd function in Haskell.
What is the category of types and how is it different from the category of sets? In the category of types, when we say "singleton" do we mean an instance of the the singleton, say {1}, or do we mean the collection of all singleton sets, say {{1},{2},{3},...,{a},...}, or do we mean something else?
In the category of types, when you say "void", you mean the empty set, and since there is only one empty set {} you can talk about it as an object in the category. However then you talk about THE singleton object, you can't because the are more than once instance of the singleton, namely {1} and {2}.
In the category of types, the singleton element is a *type* that has a single value. In Haskell one example is the null-ary tuple called "()" (a.k.a. Unit). I think you're getting the notion of a "singleton type" mixed up. When you say "more than one instance of the singleton", you're thinking of "singleton lists" (as in "one-element lists"). Those are different _elements_ of a type, let's call it List, for example. This type List (an object in our category of types) is not a singleton type, precisely because it has many values: {1}, {2} and all other lists. We could think of other singleton types in programming languages, for example an enum type with only entry: enum Foo { FOO }. But then there's an isomorphism from Foo to Unit: foo2unit f = (); unit2foo () = FOO. This means that there can be multiple terminal objects in our category - and they will all be isomorphic to each other. So yes, it's an instance of a singleton, but not as in "{1}". Sorry about the hodge-podge of programming language notations there, but I didn't want to assume any particular language.
Really great lectures--they really helped, thank you! I followed your discussion of terminal objects, and the uniqueness proof. But I don't understand how that would apply to initial objects, absent switching to the opposite category. Specifically, how can you have an identity morphism on the initial object? If all the unique morphisms are required to go outwards from the initial object?
Try this trick when you are stuck: Try to prove the opposite. How would you prove that the initial object cannot have an identity morphism? Which part of the definition of the initial object precludes that? Be very literal in reading the definition.
Thank you for the lecture. Concerning matching for terminal and initial objects. If to assume that there are isomorphic let’s say terminal objects and we use matching as it was defined in the lecture, would we be able to define any terminal object? I mean let’s assume that a and b are terminals and f (dom = a, cod = b), g (dom = b, cod = a) are morphisms between them. Then according to the matching a
In the video 3.1 you said you can have this abc::()->a, and a can be any object, but this apply also for the absurd function void->a. So, the difference between void and () is that void can't be construct, right? So, do we should make sure that the initial object doesn't have any incoming arrow to it?
The definition of the initial object puts no restriction on incoming arrows. It's a coincidence that in the category of sets the initial object is an empty set and there can be no function to an empty set.
Unrelated comment, only relevant for german speaking audience: He looks to me like chris töpperwien if he didn't drop out of college & go sell sausages in the US in 20 years, lol Great lecture, thanks a lot Bartosz, you're the closest to Feynman in category theory I've ever seen :) Please, keep it going, would love do dive even deeper into this! :)
Nit (@36:08): aren't two objects are equal if they are the same object? just as two arrows are equal if they are the same arrow. The thing that isn't usually defined (afaik) is isomorphism of arrows, perhaps that could be defined in terms of a commuting diagram with some (any) isomorphisms between the two sources and targets, or alternatively some "universal" property.
Reflexivity, a=a, is a property of equality, not its definition. But notice how we use equality. We construct something and than we say that the result of the construction is equal to something else. That's what we do with arrows. We construct some arrow by composing other arrows and then we say that the result is equal to yet another arrow (which may also be a result of some composition). You must be able to compare results of different constructions.
You mentionned at the end of last episode that this doesn't work only for String, but for all Monoids; so it's possible to build a Kleisli category from any category and its 'embellished' version, which consists of pairs of the original category and of a Monoid. Does this work with something other than a pair as well? Or should it specifically be a pair with a Monoid, or a union with a Monoid, or something like that.
I'm not sure I followed the first part of this lecture. So you have an initial category called C, and you have functions from objects in C to ordered pairs (A, var) where A is an object in C and var is a variable of some given type. In the construction of the Kliesli category, is all that you're doing abstracting away the "var" but saying there exists a unique morphism in the Kliesli category for each value of var? If I comprehend this much, than am I correct in saying that "The Kliesli Category" is better thought of as the output of a function of two arguments-one of the arguments being a category and the other argument being a type of variable?
This reminds me of the concept of Monotheism that every thing are morphed to unit it is terminal, and the fact that all actual things are happening by side effect that shows by the unit is more likely a Monotheistic concept:)
Wait, why is there a __unique__ function from void to any other type? Can't there be multiple functions from void to another type? E. g. `int f(void v) { return 1; } int g(void v) { return 2; }` and so on?
So what's the difference between the two functions? That they return something else when called? But to call them you'd need to produce an element of Void, and that's impossible. (Maybe you're confusing a Void type with C++ void, which is a singleton type.)
@@DrBartosz Thanks for the reply! I haven't confused it with the c++ void. I am lacking in knowledge about set theory however. As I see it: from the perspective of the function, there is an "imaginary", local value of the empty set. And the function doesn't care that it makes no sense in the global context; that there is no element for it to be applied to. If there were an element for it to map to 1 (or 2, or any constant element of any other set), it would. So I don't see how these functions are equal. Or is it that such a function definition is illegal in itself? Is it that we know there exists some function f :: Void -> a, but we can't even think about what it does? Is the answer to my question "read a big book about set theory"? :D
@@mark0nius Ask yourself the opposite question: how are these functions different? Can you provide a value for the argument for which the first function produces a different result than the second one? It must be a value of the type Void. You see the problem? They are just two ways of encoding the same mathematical function.
@@DrBartosz Ok, I think I understand a bit better. I still don't quite "feel" it as correct, but I'm happy to accept it as truth based on your confidence (before I start digging deeper into the subject myself). Anyway, kudos on these lectures, the world needs more teachers like you. I'm learning so much from so little. And thanks for making an effort to interact with your audience!
@@DrBartosz I'm hearing "sameness is presumed until/unless difference is demonstrated." I don't necessarily have a problem with that, but I'm curious about what happens (breaks) if you take the opposite convention. Perhaps it 's necessary because without it one can no longer define initial as opposite of terminal?
Hello Bartosz, thanks for putting these lectures online, I'm enjoying them very much. I'm a bit puzzled though by the construction of the Kleisli category. My confusion comes from the objects in the "source" category being the same objects in the "constructed" category. which means a = a and b = b. But then with construction a remains a but the constructed b = (b, str) which is not equal to b. What point am I missing to resolve this conflict?
One thing that confuses me is why at the beginning you drew the mapping from a to mb, etc. in the category C. Does it even make sense to consider that as part of the category, since it doesn't compose there? Is it just for illustration? (Btw: these lectures are amazing, thank you so much for recording them :D)
The definition says that if two morphisms are composable (target of one is the source of the other) then their composition exists. Notice the "if". There are many pairs of morphisms in a category that are not composable.
First, thank you very much for sharing these lessons online and for your book. Second, I am not sure if from a terminal object it is allowed to have arrows to other non-terminal objects. My understanding is that it is possible, but it is not explicitly stated in the lesson (e.g. in Haskell we can have the following functions: one :: () -> Int; two :: () -> Int...). Also, if so, the simmetry or duality with the initial object is not perfect as we cannot have morphisms a -> Void, except for Void -> Void. Am I missing something?
Thanks, Bartosz! This lectures are the best. I have one question. You mentioned that we can't say if two objects in a category are equal, but we can say if two arrows are equal. But why can't we say then that two object are equal if their identity arrows are equal? In a manner of doing without object.
@@DrBartosz Got your point, thank you! But what if we are dealing with small category. Can we then say that there is set of objects and for each object there is set of arrows => we have set of all arrows of the small category and we can compare any two arrows in it?
@@MrRobot-pv6mo If we have a set of objects than we can compare them for equality. I'm not saying it's impossible, we just don't want to do it in category theory. (In fact it's technically called "evil" to use equality of objects.)
I don't understand the motivation for including the absurd arrows. In set theory the function space from the empty set to an arbitrary set is the same as the function space from an arbitrary set to the empty set (i.e. both are the empty set). In the category of sets, for any non-empty set A and any set B, C(A,B) = A→B. Obviously C(∅,∅)≠∅→∅ because ∅ needs an identity morphism, but I don't see a compelling reason to add the absurd morphisms. Is the motivation just to make ∅ an initial object in the category of sets?
Actually, this is also true in set theory. A function is a special kind of relation. A relation is a subset of the product of two sets. But an empty set is a subset of every set, so the empty set is a relation between any two sets, including empty sets. A function is a special relation: for every element of the first set there is one and only one element of the second set related to it. If your source set is empty, this statement is (vacuously) true. So there is a function from the empty set to any set. But if your source is not empty, then you can pick an element in it . And if your target is empty, you can't find its related element. So there is no function from a non-empty set to the empty set.
@@DrBartosz Thanks. I remembered that a relation is just a subset of the cartesian project, but somehow confused myself into thinking the function space was also a subset of the cartesian product, not a subset of the set of all relations between those two sets (e.g. I used A×B when I should have used P(A×B)). Thanks again.
I don't understand why there is ONLY ONE ARROW from any object to the terminal object. In my mind there are multiple arrows in fact. Any object is connected to the terminal object by an infinite number of arrows. Say we have the object INT. I can construct the following. f:: Int -> () f x = let x = "not important" in () g:: Int -> () g x = let x = "also not important" in () Now i have 2 different functions, f and g which come form the same object - INT - and go to the same terminal object (). f: INT -> () g: INT -> () z: INT -> () ... What i did not understand here? I feel I am missing something important about this uniqueness you mention. Thanks.
Mathematically speaking a function is just a set of pairs (argument, value), so your two functions are just different encodings of the same mathematical function. You can define equality of functions (so called extensional equality): two functions are equal if they give same results for same arguments. So your functions are extensionally equal. Admittedly, there is a wrinkle in there, because in Haskell you can define a function that loops forever so, strictly speaking Haskell's type system is not exactly the category Set. If I say it's a category called Hask, I will get in trouble, because there is no proof that Hask is a category. But that's a different story.
I understand why the initial object of the category Set is the empty set (because of the empty function), but I am having great difficulty convincing myself that the terminal object of Set is the singleton set (and a unique singleton set at that). Is this just because all sets with elements have elements of something, so if we are talking about dogs we can ask "what do all the non-empty sets contain?" and then answer "dogs" then call that question-answer a morphism from any non-empty set of dogs to the singleton set "dog"? Is this what you mean by the unit function?Excellent job on these lectures, btw. You do a great job of making very abstract concepts extremely palatable in my opinion.
Your concerns are justified. The category Set with functions is special in that there is only one initial object, the null set. In general, initial objects (or terminal objects) are "unique up to isomorphism in a strong sense." For example, in Set all singleton sets are terminal objects, and for any two singleton sets, there is a unique isomorphism between them. This idea of talking about things that are not quite the same, but the same up to everything we care about will also show up in the categorical definition of kernel.
I'm a little confused about your equivalence between Haskell's Unit type and singleton sets. There are many different singleton sets, but only one Haskell Unit type. Am I mistaken?
Truth is dual to false (Boolean) The colour black is dual to the colour white, the concept of colour is inherently dual (objective and subjective). On is dual to off (Binary or digital)
I don't understand the construction of singleton set. Does the constitution construct every singleton set? Or does it identify every singleton set into one object in the category? Are you claiming that any two Single-Element sets are identical?
Also, you kept saying"the" terminal object. But there could certainly be multiple objects which have a single arrow coming from all other objects, right?
I think there is a slight confusion at the end of the video. the terminal object is the limit of an _empty_ pattern, not a pattern with only one object.
Why there aren't infinitely many arrows from void -> any? I don't see the argument where absurd has to be unique. If absurd exists then there must absurd2 exists.
You talked about the bluff, so I thought I can bluff about infinite many such functions. I discussed it into math exchange and someone suggested me to prove these absurd functions are unique. I got it void x Bool will be empty hence, there can be at most one relation and that relation itself is function(set)/morphism(category). Consider it being resolved.
Thank you for lecture! I've got a question about terminal objects in Set category. As I could understand the terminal object is unique in every category. And you said that singleton in Set category is the terminal object. But there can be many sets with single element. What about uniqueness in this case? Or terminal object in Set category is not just singleton, but the singleton with all single arrows pointing to it from all other sets?
I likely am missing something fundamental here, but how can we talk about one arrow starting in the ‘same’ object as the other arrow ends in if we can’t compare objects for equality? What is ‘sameness’ then?
Well, to mathematicians, sameness and equality are not the same. I'm afraid it's not an easy thing to explain. Two things can be the same by definition (definitional equality, see ncatlab.org/homotopytypetheory/show/definitional+equality ) or they can be equal because there is a non-trivial proof of equality. In a category, objects really play a secondary role: they are labels assigned to arrows. When two arrows are composable, their endpoints are definitionally equal.
People usually start with set theory, but then the question is, which set theory? With or without the axiom of choice? Then there is a problem of size: if you say objects form a set, then you can't have a category of sets. So you have to have a way of defining a collection which is not a set. Or you introduce Grothendieck universes. The problem is, despite what you might have heard, mathematics doesn't have solid foundations. This is why there's so much interest in HoTT, homotopy type theory. And this is why I was making all these caveats about sizes and equality.
Nice lecture, but i `m confused about the example at the end. The terminal object has the property of having an incoming arrow from any other object, but the ranking from your example is not a total order, and yet you conclude that you can always find a terminal object. Isn't that incorrect?
I don't think I said you can _always_ fined a terminal object. In fact I gave an example of natural numbers, where there's no terminal object (no largest integer). And, as you can see, even having total order doesn't guarantee that there's a terminal object.
Thank you for the reply Dr. Milewski. Now it's more clear. You intuitive understanding and explanations are amazing, something that doesn't exist in most books. Thanks and waiting for your next video.
"Arrows are all that we have" ←↔ ⃗ and that means: We must all come to an end (). The unit () is much like NULL. Does NULL have a type? Is a NULL String the same as NULL Integer? Kaboom!
Sorry, but I don't see how there can be only one function from integers to unit. I see the function that maps 0 to unit, the function that maps 1 to unit, that makes two functions, and they are different.
Ok I found the answer below. There can be only one function, the one that maps 0 and 1 and so on to unit. Funny how the brain works. I can't even understand how I could be confused to begin with.
He is teaching it like no one else I would love to know how he have learned all that, I mean he did not have the same luck as us who are learning it from him ?
46:50 This explanation of Ranking is incorrect, in general case. Imagine a category, with all objects just having id, except 2 objects having a morphism between them. By this "ranking" they will become initial and terminal objects, but not by the correct definition
While defining our universal construction for terminal objects, 1. pattern: just any object 2. ranking: 'a' is better than 'b' if there is a unique morphism g::b->a. 3. selection: Pick object which is better than everything else In order to avoid questions like can an object be better than itself, Can i change my pattern to pick objects that have unique morphism to itself?
@@SrinivasSardi Strictly speaking, one should call it "not worse" or "better or as good as", rather than "better" relation. An object can then be "as good as" itself.
This is one of these questions that category theory tries to get away from. In set theory you encode everything using trees with empty sets at the leaves so, yes, that would be one encoding of a singleton set. Another would be a set whose only element is some other set.
Yup! Void has a unique morphism to every type, including itself. If you give it an element of void, it will return it back (good luck finding an element of void, though!)
I'm wondering if the ranking is actually a pre-order rather than a partial order since for example the in the isomorphism category a and b both have unique arrows to each other and are thus both better than each other.
I'm really lost from 10:16 on in this one, like didn't happen anywhere else in the lectures. I guess I can ignore that part and move on with more practical concerns, but it's annoying me greatly. When handwaving of stuff I cannot make any connected sense about goes on for more than 10 minutes or so, I struggle to even keep attention. I can't see where is it going, I can't make sense of it, and the intuition of initial and terminal I guess it's enough to carry on, but the definition of them here I can't make any sense of it. I'm on my fifth rewatch hoping it eventually clicks.
Fellow CT/FP noob here, so take this with a grain of salt, but I think you may be over-complicating the concepts which are being presented in this video. He's explaining the idea of a universal construction, which is simply a pattern, and a way to rank matches on that pattern. Why would we need this? Well, it gives us a way of mapping concepts from more concrete maths, like set theory, into category theory, where we can talk about that concept in a more abstract way, which may be applicable to other concrete areas. So now, we can take, for example, the idea of the empty set from set theory, check what that looks like in terms of category theory, give it a categorical name (initial object), and start asking if we can find this construction in categories other than Set; which we do by universal construction. If we find do find initial object(s) in another category, then we can apply a bunch of the knowledge that we already have about how to work with empty sets, and apply it in a new domain, where we may not have noticed those properties before. In short, universal constructions let us discover patterns that are shared between categories (or domains), and then use what we know about that pattern in one concrete domain, and apply it to another. Bartosz focuses on the initial and terminal object constructions here, simply because they are two of the most straightforward constructions. As for the constructions themselves: Initial and terminal objects are no more complicated than what he said in the video - Terminal object has one unique arrow from every other object in category, and vice-versa for initial object. That's my understanding, anyway :)
@@glircom I appreciate the time you took to answer. Maybe it's because of my CS background that the relative lack of formalism actually makes me wonder about every unproven claim and I get too distracted. Still, I'm going through it with a couple of books that just arrived and I'm doing better now. Barr-Wells 1998 mainly.
Counting "elements" of an object by counting morphisms from terminal object into it has some curious side effects. If we try to do it in the category Grp (groups and homomorphisms) we will discover that every group has only one "element".
Initial is dual to final (terminal) Start is dual to finish Energy is dual to mass -- Einstein Dark energy is dual to dark matter Form is dual to formlessness Vectors are dual to co-vectors (forms) Zero (void) is dual to infinity Zeroes are dual to poles (eigenvalues) in optimized control theory Points or singularities are actually dual, the observer is the observed, points are objective and subjective both at the same time.
I feel like functional programming lectures should always be done in permanent marker. Dry-wipe is a form of mutable state.
Agreed. But then since they put this on video, those boards will become garbage.
It would make sense if you volunteer as a garbage collector...
erase :: IO(Board) -> IO(Board)
Coming from OO programming, I confirm this comment. If OO was not there we'd never known the importance of functional programming.
@Justin Y. few things:
1) Kind of Board should be either (* -> *) or just *.
1.1) data Board a implies Board has a kind of (*->*), but the all you have after the "=" doesn't even defines a constructor that "data" keyword requires.
2)Even if it was "data Board a = Board (a -> (Board, a))", "Board" on the right side requires type as argument.
3)I'm failing to see how "data Board a = Board (a -> (Board a, a))" can represent a board with mutable drawings (it's atleast not obvious how to construct non-trivial instance(object, value, e.t.c.) of type "Board a").
I think the declaration of the Board typeclass should be something like that:
class Board b where
erase :: (Monoid (b s)) => b s
erase = mempty
draw :: (Monoid (b s), Applicative b) => s -> b s -> b s
s `draw` a = pure s a
infixr 8 `draw`
instance Board []
instance Board Identity
--and so on
yes it is ironic that function programmers still want to erase the board.
I'm both a math teacher and a programmer, and I have tried reading some books on category theory years ago, but just found them too abstract and unintelligible. I mean, I kind of "knew" some basic things about monomorphisms, functors, etc. but I just failed to see the... Meaning of it all. It was just words. This is not the case with your lectures, I really, really like the way you explain things. By the way... The "arrow" analogy in the first lecture, how we still can't think outside of our hunter-gatherer past, really blew my mind. Was using arrows all my life but I never thought about it! :-) Thank you for your work!
Thanks, Bartosz, wasn't expecting to find myself watching lections on category theory 1 month ago... but here we are! These should be put to some gold or platinum RUclips collection, is too good material. Thanks for sharing, and I hope you're doing well!
5:55 is a great visualisation of the problem of composition between these embellished functions, there's a disconnect between m b and b.. and how Kleisli category is there to help with that.. kinda blew my mind.
Thousand thanks for making this video series.. I have ADHD and reading is often very frustrating and cumbersome for me but I can quite easily follow these lectures in video format, pause and think for a while, rewind if my mind wanders. I had pretty much given up ever understanding category theory even at the basic level but now I'm hopeful.. I've had so many rewarding a-ha moments. I will eventually get back to Haskell and this time I'm better armed :D
When I used unerasable marker, I'd squeeze some purell handwash to the whiteboard then wipe them. Works every single time.
You are a great lecturer. I've read your blog posts on C++ and some Haskell stuff. I'd say the blog post on category theory is quite lengthy and intimidating. But this series of videos is an enjoyment to watch. Thank you.
Not exactly sure how to ask this question but hopefully this makes sense.
On the board, you have two categories, the one on the left with a "C" above (category of types I believe in this example) and the one on the right which is the "Kleisli" category.
Within the Kleisli category you have objects "a, b, c" - are these the mappings from category "C"? In that is "a" from the Kleisli category "m a" from the "C" category on the left?
What I'm trying to understand is the "arrow" between "a -> b" in the Kleisli category, which is said to be the "a -> m b" from the "C". Little fuzzy, as the end of the arrows, would be "m a" and "m b". Given that identity in the Kleisli category "a -> a" would be "a -> ma" or the "arrow" would be anyway in the "C" category. (Again using "C" to refer to the diagram on the left).
We are trying to build a new category K. What are the objects in it? The same as the objects in C. What are the arrows? Pick two objects a and b in K (same as in C). Peek at the category C and find out how many arrows there are from a to m b. These are exactly your arrows in K between a and b. You just transplant them. Will they compose correctly? Maybe so, or maybe not. If they do, you were successful in building K.
Ok so in K you have "a -> b", where the arrow between "a -> b" is an arrow from C, namely one that looks like "a -> m b" - where I think I get stuck is that the end of that arrow is "m b" not "b".
This mismatch perhaps is the point, in that in order one to state there is a K where "a -> b" there has to be a way to take an "m b" to "b"? Likewise, there must be a way to compose two arrows as well in K in the case of "a -> b -> c" etc to satisfy the axioms.
btw, great video series. While I may still have a ways to go in fully wrapping my head around this your videos do help a great deal!
I still don't get it. How those arrows could be the same if they connect different objects (a->b vs a->mb), but these objects is what defines arrows? Say, we have g::a->b in K, and f::a->mb in C. For me it is quite obvious that g and f simply cannot be the same, since b/=mb.
I see your problem. I do say "equal," and this could be confusing. After all, what does it mean for an arrow in one category to be "equal" to an arrow in another category. A better ways of saying this is that "under" every arrow a->b in the Kleisli category there is an arrow a->mb in C. If you want to see how it composes with another arrow in K, just look what's under those arrows. I do say that one arrow "is implemented" in terms of the other arrow, and that makes better sense.
i am confused about some of the objects in C. where did the m a, m b, and m c objects come from? are they already in the C category? or did we add them to the category when we "implemented" the map?
This is just great!! This is the first I see how learning math can benefit from being a programmer.
Thank you for these amazing videos. I have a question on Void:
"Void" is an object that has only outgoing arrow. How come it has arrow "id"? then that arrow "id" is an example of an incoming arrow to the "Void" object!
I didn't say it has "only" outgoing arrows, did I?
9:30 ( more or less) now my understanding is that "objects serve no other purpose than to indicate which pairs of morphisms can be combined by the composition operator of the category. "
For any set A there exist function f from empty set {} to A because we can take some mapping f to A, and because we have empty input to it we will have empty output from it namely empty set {}. And because {} is subset of A, f will be mapping: {} -> {} ⊆ A => {} -> A.
The intuition that all arrows along the path to terminal object compose to the one single arrow is nice. I wonder about the mechanics of composing of infinite numbers of arrows.
Thank you for these lectures: really interesting and informative to me!
I have a hard time wrapping my head around why there is a unique function Void -> a absurd. How do we decide whether two functions are equal? For example why is
f :: Void -> Int = const 1
NOT different from
g :: Void -> Int = const 2?
haha the "bloopers" at the end is gold
Great lecture
36:55
I don't really grab why we can't assert two objects are equal by just considering their identity arrow.
Because isomorphism definition take advantage to identity arrow to assert it's an isomorphic arrow. But why object don't just take advantage of the identity arrow directly?
Thanks a lot Bartosz for this great series of lectures.
I'm having a hard time with `there is an arrow from empty set to singleton set`.
I know that empty relations exist, and by definition, an empty relation (an empty subset of the cartesian product) is also a function (it does not violate the characteristic constraint of functions because it has no elements to violate it, and ex falso quodlibet).
So if we pick an empty set as our domain, the cartesian product of it with a singleton set (or any other set) is also empty, so we can have only one function, the empty function. Is this the one arrow from Void to ()? or the so called `absurd` in Haskell (the bluff function you mentioned in the last lecture)?
If that's the case, then we'll have one and only one unique arrow from Void to any other object, right?
Disclaimer: I just watched up to the terminal objects and I just want to make sure that my mathematical understanding is correct up to this point and it corresponds to the absurd function in Haskell.
See: bartoszmilewski.com/2015/01/07/products-and-coproducts/
Is the cartesian product of the empy set with itself equal to the empty set? I have a hard time with empty sets not preserving types.
What is the category of types and how is it different from the category of sets?
In the category of types, when we say "singleton" do we mean an instance of the the singleton, say {1}, or do we mean the collection of all singleton sets, say {{1},{2},{3},...,{a},...}, or do we mean something else?
In the category of types, when you say "void", you mean the empty set, and since there is only one empty set {} you can talk about it as an object in the category. However then you talk about THE singleton object, you can't because the are more than once instance of the singleton, namely {1} and {2}.
In the category of types, the singleton element is a *type* that has a single value. In Haskell one example is the null-ary tuple called "()" (a.k.a. Unit).
I think you're getting the notion of a "singleton type" mixed up. When you say "more than one instance of the singleton", you're thinking of "singleton lists" (as in "one-element lists"). Those are different _elements_ of a type, let's call it List, for example. This type List (an object in our category of types) is not a singleton type, precisely because it has many values: {1}, {2} and all other lists.
We could think of other singleton types in programming languages, for example an enum type with only entry: enum Foo { FOO }. But then there's an isomorphism from Foo to Unit: foo2unit f = (); unit2foo () = FOO. This means that there can be multiple terminal objects in our category - and they will all be isomorphic to each other. So yes, it's an instance of a singleton, but not as in "{1}".
Sorry about the hodge-podge of programming language notations there, but I didn't want to assume any particular language.
Really great lectures--they really helped, thank you!
I followed your discussion of terminal objects, and the uniqueness proof. But I don't understand how that would apply to initial objects, absent switching to the opposite category.
Specifically, how can you have an identity morphism on the initial object? If all the unique morphisms are required to go outwards from the initial object?
Try this trick when you are stuck: Try to prove the opposite. How would you prove that the initial object cannot have an identity morphism? Which part of the definition of the initial object precludes that? Be very literal in reading the definition.
Thank you for the lecture.
Concerning matching for terminal and initial objects. If to assume that there are isomorphic let’s say terminal objects and we use matching as it was defined in the lecture, would we be able to define any terminal object? I mean let’s assume that a and b are terminals and f (dom = a, cod = b), g (dom = b, cod = a) are morphisms between them. Then according to the matching a
The way I understand it is that since the objects are isomorphic, it's OK to say that they're tied for how good they are.
In the video 3.1 you said you can have this abc::()->a, and a can be any object, but this apply also for the absurd function void->a.
So, the difference between void and () is that void can't be construct, right?
So, do we should make sure that the initial object doesn't have any incoming arrow to it?
The definition of the initial object puts no restriction on incoming arrows. It's a coincidence that in the category of sets the initial object is an empty set and there can be no function to an empty set.
Bartosz Milewski Thank you, I get it at the beginning of the 4.2 video.
Thank you for your answer. :)
@@BartoszMilewski "...and there can be no function to an empty set."
How about id_void ?
@@Bratjuuc Correct! No function except identity.
Unrelated comment, only relevant for german speaking audience: He looks to me like chris töpperwien if he didn't drop out of college & go sell sausages in the US in 20 years, lol
Great lecture, thanks a lot Bartosz, you're the closest to Feynman in category theory I've ever seen :) Please, keep it going, would love do dive even deeper into this! :)
Nit (@36:08): aren't two objects are equal if they are the same object? just as two arrows are equal if they are the same arrow. The thing that isn't usually defined (afaik) is isomorphism of arrows, perhaps that could be defined in terms of a commuting diagram with some (any) isomorphisms between the two sources and targets, or alternatively some "universal" property.
Reflexivity, a=a, is a property of equality, not its definition.
But notice how we use equality. We construct something and than we say that the result of the construction is equal to something else.
That's what we do with arrows. We construct some arrow by composing other arrows and then we say that the result is equal to yet another arrow (which may also be a result of some composition). You must be able to compare results of different constructions.
You mentionned at the end of last episode that this doesn't work only for String, but for all Monoids; so it's possible to build a Kleisli category from any category and its 'embellished' version, which consists of pairs of the original category and of a Monoid.
Does this work with something other than a pair as well? Or should it specifically be a pair with a Monoid, or a union with a Monoid, or something like that.
Lots more. This is just a preview of coming attractions.
I'm not sure I followed the first part of this lecture. So you have an initial category called C, and you have functions from objects in C to ordered pairs (A, var) where A is an object in C and var is a variable of some given type. In the construction of the Kliesli category, is all that you're doing abstracting away the "var" but saying there exists a unique morphism in the Kliesli category for each value of var? If I comprehend this much, than am I correct in saying that "The Kliesli Category" is better thought of as the output of a function of two arguments-one of the arguments being a category and the other argument being a type of variable?
This reminds me of the concept of Monotheism that every thing are morphed to unit it is terminal, and the fact that all actual things are happening by side effect that shows by the unit is more likely a Monotheistic concept:)
I'm loving this
Wait, why is there a __unique__ function from void to any other type? Can't there be multiple functions from void to another type? E. g. `int f(void v) { return 1; } int g(void v) { return 2; }` and so on?
So what's the difference between the two functions? That they return something else when called? But to call them you'd need to produce an element of Void, and that's impossible. (Maybe you're confusing a Void type with C++ void, which is a singleton type.)
@@DrBartosz Thanks for the reply! I haven't confused it with the c++ void. I am lacking in knowledge about set theory however. As I see it: from the perspective of the function, there is an "imaginary", local value of the empty set. And the function doesn't care that it makes no sense in the global context; that there is no element for it to be applied to. If there were an element for it to map to 1 (or 2, or any constant element of any other set), it would. So I don't see how these functions are equal. Or is it that such a function definition is illegal in itself? Is it that we know there exists some function f :: Void -> a, but we can't even think about what it does? Is the answer to my question "read a big book about set theory"? :D
@@mark0nius Ask yourself the opposite question: how are these functions different? Can you provide a value for the argument for which the first function produces a different result than the second one? It must be a value of the type Void. You see the problem? They are just two ways of encoding the same mathematical function.
@@DrBartosz Ok, I think I understand a bit better. I still don't quite "feel" it as correct, but I'm happy to accept it as truth based on your confidence (before I start digging deeper into the subject myself).
Anyway, kudos on these lectures, the world needs more teachers like you. I'm learning so much from so little.
And thanks for making an effort to interact with your audience!
@@DrBartosz I'm hearing "sameness is presumed until/unless difference is demonstrated." I don't necessarily have a problem with that, but I'm curious about what happens (breaks) if you take the opposite convention. Perhaps it 's necessary because without it one can no longer define initial as opposite of terminal?
love the blooper reel
Hello Bartosz, thanks for putting these lectures online, I'm enjoying them very much. I'm a bit puzzled though by the construction of the Kleisli category. My confusion comes from the objects in the "source" category being the same objects in the "constructed" category. which means a = a and b = b. But then with construction a remains a but the constructed b = (b, str) which is not equal to b. What point am I missing to resolve this conflict?
It's about arrows. In the new category an arrow between a and b corresponds to an arrow between a and (b, str) in the old category.
One thing that confuses me is why at the beginning you drew the mapping from a to mb, etc. in the category C. Does it even make sense to consider that as part of the category, since it doesn't compose there? Is it just for illustration? (Btw: these lectures are amazing, thank you so much for recording them :D)
The definition says that if two morphisms are composable (target of one is the source of the other) then their composition exists. Notice the "if". There are many pairs of morphisms in a category that are not composable.
@@DrBartosz Thanks for the quick reply! Seems I had fundamentally misunderstood the definition then 😅
First, thank you very much for sharing these lessons online and for your book. Second, I am not sure if from a terminal object it is allowed to have arrows to other non-terminal objects. My understanding is that it is possible, but it is not explicitly stated in the lesson (e.g. in Haskell we can have the following functions: one :: () -> Int; two :: () -> Int...). Also, if so, the simmetry or duality with the initial object is not perfect as we cannot have morphisms a -> Void, except for Void -> Void. Am I missing something?
I just show the next video and you answered this question in the first minute. Nice!
The is a function that goes to a empty set, it is null bucket.
Thanks, Bartosz! This lectures are the best. I have one question. You mentioned that we can't say if two objects in a category are equal, but we can say if two arrows are equal. But why can't we say then that two object are equal if their identity arrows are equal? In a manner of doing without object.
We can only compare elements of the same set. id_a and id_b are elements of two different sets, so we can't compare them for equality.
@@DrBartosz Got your point, thank you! But what if we are dealing with small category. Can we then say that there is set of objects and for each object there is set of arrows => we have set of all arrows of the small category and we can compare any two arrows in it?
@@MrRobot-pv6mo If we have a set of objects than we can compare them for equality. I'm not saying it's impossible, we just don't want to do it in category theory. (In fact it's technically called "evil" to use equality of objects.)
@@DrBartosz Got it, thanks! I guess it is "evil" because we disregard arrows and just return to set theory type of reasoning.
I don't understand the motivation for including the absurd arrows. In set theory the function space from the empty set to an arbitrary set is the same as the function space from an arbitrary set to the empty set (i.e. both are the empty set). In the category of sets, for any non-empty set A and any set B, C(A,B) = A→B. Obviously C(∅,∅)≠∅→∅ because ∅ needs an identity morphism, but I don't see a compelling reason to add the absurd morphisms. Is the motivation just to make ∅ an initial object in the category of sets?
Actually, this is also true in set theory. A function is a special kind of relation. A relation is a subset of the product of two sets. But an empty set is a subset of every set, so the empty set is a relation between any two sets, including empty sets.
A function is a special relation: for every element of the first set there is one and only one element of the second set related to it. If your source set is empty, this statement is (vacuously) true. So there is a function from the empty set to any set.
But if your source is not empty, then you can pick an element in it . And if your target is empty, you can't find its related element. So there is no function from a non-empty set to the empty set.
@@DrBartosz Thanks. I remembered that a relation is just a subset of the cartesian project, but somehow confused myself into thinking the function space was also a subset of the cartesian product, not a subset of the set of all relations between those two sets (e.g. I used A×B when I should have used P(A×B)). Thanks again.
I don't understand why there is ONLY ONE ARROW from any object to the terminal object. In my mind there are multiple arrows in fact. Any object is connected to the terminal object by an infinite number of arrows.
Say we have the object INT. I can construct the following.
f:: Int -> ()
f x =
let x = "not important"
in ()
g:: Int -> ()
g x =
let x = "also not important"
in ()
Now i have 2 different functions, f and g which come form the same object - INT - and go to the same terminal object ().
f: INT -> ()
g: INT -> ()
z: INT -> ()
...
What i did not understand here? I feel I am missing something important about this uniqueness you mention. Thanks.
Mathematically speaking a function is just a set of pairs (argument, value), so your two functions are just different encodings of the same mathematical function. You can define equality of functions (so called extensional equality): two functions are equal if they give same results for same arguments. So your functions are extensionally equal. Admittedly, there is a wrinkle in there, because in Haskell you can define a function that loops forever so, strictly speaking Haskell's type system is not exactly the category Set. If I say it's a category called Hask, I will get in trouble, because there is no proof that Hask is a category. But that's a different story.
@Bartosz Milewski now everything is very clear. can't thank you enough for this series :))
But, how to find the rule to construct the arrow
I understand why the initial object of the category Set is the empty set (because of the empty function), but I am having great difficulty convincing myself that the terminal object of Set is the singleton set (and a unique singleton set at that).
Is this just because all sets with elements have elements of something, so if we are talking about dogs we can ask "what do all the non-empty sets contain?" and then answer "dogs" then call that question-answer a morphism from any non-empty set of dogs to the singleton set "dog"? Is this what you mean by the unit function?Excellent job on these lectures, btw. You do a great job of making very abstract concepts extremely palatable in my opinion.
Your concerns are justified. The category Set with functions is special in that there is only one initial object, the null set. In general, initial objects (or terminal objects) are "unique up to isomorphism in a strong sense." For example, in Set all singleton sets are terminal objects, and for any two singleton sets, there is a unique isomorphism between them. This idea of talking about things that are not quite the same, but the same up to everything we care about will also show up in the categorical definition of kernel.
I'm a little confused about your equivalence between Haskell's Unit type and singleton sets. There are many different singleton sets, but only one Haskell Unit type. Am I mistaken?
Actually, you can define another terminal object in Haskell
data Terminal = MakeTerminal
Of course, it is isomorphic to ().
Truth is dual to false (Boolean)
The colour black is dual to the colour white, the concept of colour is inherently dual (objective and subjective).
On is dual to off (Binary or digital)
lol You may have two as long as it's just one.
I can not understand why unit function can ignore argument and return unit and void function can not ignore argument and return empty set?
It would have to return an _element_ of the empty set.
I don't understand the construction of singleton set. Does the constitution construct every singleton set? Or does it identify every singleton set into one object in the category? Are you claiming that any two Single-Element sets are identical?
Also, you kept saying"the" terminal object. But there could certainly be multiple objects which have a single arrow coming from all other objects, right?
I see after listening further that terminal objects are isomorphic. This was a confusing point until reaching that explanation.
I think there is a slight confusion at the end of the video. the terminal object is the limit of an _empty_ pattern, not a pattern with only one object.
I included the apex as part of the pattern.
i see. thanks
Why there aren't infinitely many arrows from void -> any? I don't see the argument where absurd has to be unique. If absurd exists then there must absurd2 exists.
Show me two functions from Void to Int, and prove that they are different (return different values when called with the same argument).
You talked about the bluff, so I thought I can bluff about infinite many such functions. I discussed it into math exchange and someone suggested me to prove these absurd functions are unique.
I got it void x Bool will be empty hence, there can be at most one relation and that relation itself is function(set)/morphism(category).
Consider it being resolved.
Objects are dual to subjects
Objectivity is dual to subjectivity
Duality is being conserved here!
ebellished arrow ;)
Thank you for lecture! I've got a question about terminal objects in Set category. As I could understand the terminal object is unique in every category. And you said that singleton in Set category is the terminal object. But there can be many sets with single element. What about uniqueness in this case? Or terminal object in Set category is not just singleton, but the singleton with all single arrows pointing to it from all other sets?
It's only unique up to unique isomorphism. This is true about all universal construction.
I likely am missing something fundamental here, but how can we talk about one arrow starting in the ‘same’ object as the other arrow ends in if we can’t compare objects for equality? What is ‘sameness’ then?
Well, to mathematicians, sameness and equality are not the same. I'm afraid it's not an easy thing to explain. Two things can be the same by definition (definitional equality, see ncatlab.org/homotopytypetheory/show/definitional+equality ) or they can be equal because there is a non-trivial proof of equality. In a category, objects really play a secondary role: they are labels assigned to arrows. When two arrows are composable, their endpoints are definitionally equal.
Then my question becomes: What are the prerequisites to understanding the precise mathematical definition of a category?
People usually start with set theory, but then the question is, which set theory? With or without the axiom of choice? Then there is a problem of size: if you say objects form a set, then you can't have a category of sets. So you have to have a way of defining a collection which is not a set. Or you introduce Grothendieck universes. The problem is, despite what you might have heard, mathematics doesn't have solid foundations. This is why there's so much interest in HoTT, homotopy type theory. And this is why I was making all these caveats about sizes and equality.
Nice lecture, but i `m confused about the example at the end. The terminal object has the property of having an incoming arrow from any other object, but the ranking from your example is not a total order, and yet you conclude that you can always find a terminal object. Isn't that incorrect?
I don't think I said you can _always_ fined a terminal object. In fact I gave an example of natural numbers, where there's no terminal object (no largest integer). And, as you can see, even having total order doesn't guarantee that there's a terminal object.
Thank you for the reply Dr. Milewski. Now it's more clear.
You intuitive understanding and explanations are amazing, something that doesn't exist in most books.
Thanks and waiting for your next video.
"Arrows are all that we have" ←↔ ⃗ and that means: We must all come to an end ().
The unit () is much like NULL. Does NULL have a type? Is a NULL String the same as NULL Integer? Kaboom!
Sorry, but I don't see how there can be only one function from integers to unit. I see the function that maps 0 to unit, the function that maps 1 to unit, that makes two functions, and they are different.
Ok I found the answer below. There can be only one function, the one that maps 0 and 1 and so on to unit. Funny how the brain works. I can't even understand how I could be confused to begin with.
What does the first function return when called with 1?
He is teaching it like no one else I would love to know how he have learned all that, I mean he did not have the same luck as us who are learning it from him ?
46:50 This explanation of Ranking is incorrect, in general case. Imagine a category, with all objects just having id, except 2 objects having a morphism between them. By this "ranking" they will become initial and terminal objects, but not by the correct definition
How is it guaranteed that there is a unique morphism from an object to itself, when we are constructing terminal objects using universal construction.
It's a definition, so it doesn't guarantee anything. If there isn't a unique morphism to itself, then it's not a terminal object.
While defining our universal construction for terminal objects,
1. pattern: just any object
2. ranking: 'a' is better than 'b' if there is a unique morphism g::b->a.
3. selection: Pick object which is better than everything else
In order to avoid questions like can an object be better than itself, Can i change my pattern to pick objects that have unique morphism to itself?
@@SrinivasSardi Strictly speaking, one should call it "not worse" or "better or as good as", rather than "better" relation. An object can then be "as good as" itself.
are Unit and set of empty set the same things?
This is one of these questions that category theory tries to get away from. In set theory you encode everything using trees with empty sets at the leaves so, yes, that would be one encoding of a singleton set. Another would be a set whose only element is some other set.
Are you sure void has an id morphism? I don't understand the logic behind this. I'm confused.
Yup! Void has a unique morphism to every type, including itself. If you give it an element of void, it will return it back (good luck finding an element of void, though!)
Is there a book that goes along with these lectures or even a blog/set of articles?
Yes, start with the blog and see the links there: bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/
I'm wondering if the ranking is actually a pre-order rather than a partial order since for example the in the isomorphism category a and b both have unique arrows to each other and are thus both better than each other.
I'm really lost from 10:16 on in this one, like didn't happen anywhere else in the lectures. I guess I can ignore that part and move on with more practical concerns, but it's annoying me greatly. When handwaving of stuff I cannot make any connected sense about goes on for more than 10 minutes or so, I struggle to even keep attention. I can't see where is it going, I can't make sense of it, and the intuition of initial and terminal I guess it's enough to carry on, but the definition of them here I can't make any sense of it.
I'm on my fifth rewatch hoping it eventually clicks.
Fellow CT/FP noob here, so take this with a grain of salt, but I think you may be over-complicating the concepts which are being presented in this video. He's explaining the idea of a universal construction, which is simply a pattern, and a way to rank matches on that pattern. Why would we need this? Well, it gives us a way of mapping concepts from more concrete maths, like set theory, into category theory, where we can talk about that concept in a more abstract way, which may be applicable to other concrete areas. So now, we can take, for example, the idea of the empty set from set theory, check what that looks like in terms of category theory, give it a categorical name (initial object), and start asking if we can find this construction in categories other than Set; which we do by universal construction. If we find do find initial object(s) in another category, then we can apply a bunch of the knowledge that we already have about how to work with empty sets, and apply it in a new domain, where we may not have noticed those properties before.
In short, universal constructions let us discover patterns that are shared between categories (or domains), and then use what we know about that pattern in one concrete domain, and apply it to another. Bartosz focuses on the initial and terminal object constructions here, simply because they are two of the most straightforward constructions.
As for the constructions themselves: Initial and terminal objects are no more complicated than what he said in the video - Terminal object has one unique arrow from every other object in category, and vice-versa for initial object.
That's my understanding, anyway :)
@@glircom I appreciate the time you took to answer. Maybe it's because of my CS background that the relative lack of formalism actually makes me wonder about every unproven claim and I get too distracted. Still, I'm going through it with a couple of books that just arrived and I'm doing better now. Barr-Wells 1998 mainly.
@@ergwer45624 I know the feeling; hand-waving makes me uneasy too. Barr-Wells looks like a great resource though! I may read that myself
void -> () is that right?
yes, a->() uniquely for all types a, including void
also void->a for all types a (absurdly)
Counting "elements" of an object by counting morphisms from terminal object into it has some curious side effects.
If we try to do it in the category Grp (groups and homomorphisms) we will discover that every group has only one "element".
We compare morphisms using all morphisms, why not compare objects using all categories. Lol probably will be paradoxical.
Initial is dual to final (terminal)
Start is dual to finish
Energy is dual to mass -- Einstein
Dark energy is dual to dark matter
Form is dual to formlessness
Vectors are dual to co-vectors (forms)
Zero (void) is dual to infinity
Zeroes are dual to poles (eigenvalues) in optimized control theory
Points or singularities are actually dual, the observer is the observed, points are objective and subjective both at the same time.
34:25 Ha ha ha