Category Theory 10.2: Monoid in the category of endofunctors

Поделиться
HTML-код
  • Опубликовано: 3 ноя 2024

Комментарии • 70

  • @mmbugaj
    @mmbugaj 7 лет назад +46

    Your contribution to knowledge of developers all over the world is invaluable. I can't wait to read your recent book on CT

  • @slvinaja9213
    @slvinaja9213 6 лет назад +21

    The last minute of this is just Bartosz dropping the mic, so good.

  • @wojciechzdzarski1838
    @wojciechzdzarski1838 4 года назад +12

    On behalf of all lambda freaks - thank you for your lectures!

    • @Evan490BC
      @Evan490BC 3 года назад

      Lambda calculus and functional programming: the *only* *True* religion!

  • @JuarezASF
    @JuarezASF 3 года назад +5

    Thank you from Brazil! I got to functional programming through a practical way and I have been wanting to understand what is all the talk about category theory. Your course was a great introduction! I am looking forward the book and the follow up courses.

  • @jacksnow1381
    @jacksnow1381 6 лет назад +14

    I've just finished this course and it was soooo great and helpful for me thank you Bartosz

  • @burnytech
    @burnytech 2 года назад +3

    A chapter of my life has been completed, thank you kind friend for sharing your wisdom, now I shall begin another one!

    • @agcouper
      @agcouper Месяц назад

      This feels like beating a Souls game!

  • @insomniwhale
    @insomniwhale 5 лет назад +5

    Excellent Course! I worried I would never understand this stuff; going straight to part 2.

  • @toddtrimble2555
    @toddtrimble2555 2 года назад +1

    It's not merely that a monoidal category is strict if (a \otimes b) \otimes c = a \otimes (b \otimes c), it's that the associator and unitor maps are identity morphisms [in theory one could have equality of those objects but without the associator being the identity]. Also, the word "lax" should be treated with caution: usually, among category theorists, it signals that the structural morphism in question is not assumed to be invertible.

  • @jmgimeno
    @jmgimeno 8 лет назад +10

    What does it mean to be a "tensor product"? What properties does it have? Are they necessary for the reasoning or any kind of "binary product-like" operation will suffice?

    • @BartoszMilewski
      @BartoszMilewski 8 лет назад +16

      It's actually a tricky question. There is a formal definition of a tensor product using a universal property in a multicategory, but it's way too advanced for this course. So here it's just a bifunctor that defines a monoidal category. Mac Lane puts "tensor product" in quotation marks when he talks about monoidal categories.

    • @MrMirville
      @MrMirville 3 года назад +1

      There are two contexts where one is allowed to speak of tensors and tensor products : the first is physics and the tensor as the name indicates is a matrix of a variable number of dimensions that expresses the set of tensions a quantity expressed by a vector is subject to. Tensor products in a more abstract sense is the product of an array of m dimensions by an array of n dimensions to give one of n + m dimensions expressing for instance a combined tension in the world of physics.

  • @KarenTazayan
    @KarenTazayan 3 года назад +1

    I've just completed this list. Thank you very much for the course! The next will be part II.

  • @developer_hatch
    @developer_hatch 2 года назад

    This is for sure the best video I have ever seen.

  • @giocosmiano
    @giocosmiano 6 лет назад +2

    I just finished this course and I thank you so much Mr. B Milewski for sharing this excellent series on CT. You made the lectures fun and easy to understand, particularly for developers like me transitioning from imperative to functional. Your lectures on Functors, Functoriality and the diagram chasing in Natural Transformations helped me understand and look behind the curtains when seeing some of the Haskell typeclass signatures. Looking forward to the next series. Thanks again.

  • @muratozturk5797
    @muratozturk5797 2 года назад

    Only one word about explanation of monads: Perfect!

  • @ShimshonDI
    @ShimshonDI 6 лет назад +1

    I'm reviewing monads (videos 3.2, 10.1, and this one) and trying to get my intuition solid before progressing further in the third and current course. The view in this video still seems a little weird, a bit like having a dog inside a dog. Please correct any mistakes:
    A monad is an example of a monoid inside a monoid, specifically a monoid object M in a monoidal category. A monoidal category is a monoid whose elements are the objects, and whose operation is the tensor product between two objects. One of the objects is the unit, I.
    A monoid object M is similar to the single-object monoid introduced in video 3.1, with one key difference. It relies on a second object, namely the unit object I, to "pick" its unit element using the unit morphism η. Remember that the single-object monoid accomplished this with its identity morphism. (So what does the identity morphism of a monoid object "do"?) The operation of M is called μ, which is an endomorphism, just like it was for the single-object monoid.
    In particular, the monoidal category where a monad "lives" is the category of endofunctors. The tensor product is composition of endofunctors.
    Now I have a question: where is the special composition of a monad (as used in programming) encoded? In the tensor product M⊗M? And what about the way it's defined in category theory results in the composition being special?

    • @DrBartosz
      @DrBartosz  6 лет назад +1

      Correction: μ is not an endomorphism.

  • @0Tsutsumi0
    @0Tsutsumi0 6 месяцев назад

    Great lecture, the only improvement I'd suggest is a clearer distinction between "Monoid" and "Monoidal Category"

  • @fredesch3158
    @fredesch3158 2 года назад

    You made it so clear, thanks, you're already helping a lot

  • @Adityarm.08
    @Adityarm.08 2 года назад

    Thank you so much. This series has been amazing.

  • @RichardSouthwell
    @RichardSouthwell 5 лет назад +3

    Good stuff, but I am a little confused about something. This definition of a monoidal category, looks simpler than the definition of a monoidal category given in Wikipedia (as well as page 417 of your book), which has coherence conditions involving 4 objects. Are these definitions equivalent, or is there some difference between these definitions ?

    • @DrBartosz
      @DrBartosz  5 лет назад +2

      I do mention coherence conditions in the book, although I don't list them. In such cases both Wikipedia and nLab are very reliable sources.

    • @RichardSouthwell
      @RichardSouthwell 5 лет назад +1

      @@DrBartosz Thanks. One more question, it is concerning a possible typo in Saunders Mac Lane's book (second edition, page 280, concerning single set representations of 2 categories). I understand if you don't respond, since it's outside the course, but I thought I'd better ask, since I bet you know, and it is really bugging me. My question is, is expression (8) a typo ? I thought it should be an equation, and if so what ? The interchange law ?

    • @DrBartosz
      @DrBartosz  5 лет назад +2

      @@RichardSouthwell Yeah, looks like a typo.

    • @RichardSouthwell
      @RichardSouthwell 5 лет назад +3

      @@DrBartosz Yea I thought so. Thanks.

  • @jeffreyhowarth7850
    @jeffreyhowarth7850 3 года назад

    A monoid is associative with identity and a category is associative with identity. I think of this relation when I see monad is a monoid in the category of endofunctors.

  • @jurgenreiss3264
    @jurgenreiss3264 4 года назад +3

    Hope I get this right: mu and eta exist for all objects in the category of endofunctors?! If so, then all objects in this category are monads, aren't they?

    • @BartoszMilewski
      @BartoszMilewski 4 года назад +1

      No, they definitely don't. Natural transformations, in general, are pretty constrained. And these have to satisfy additional laws.

    • @jurgenreiss3264
      @jurgenreiss3264 4 года назад +3

      @@BartoszMilewski But at the end (ruclips.net/video/GmgoPd7VQ9Q/видео.html) of the video you said "...pick one object in the category of endofunctors..." and you showed that mu and eta somehow "existed" for the object T. So this "picking" was already constrained?

  • @Evan490BC
    @Evan490BC 3 года назад +1

    You couldn't help it with the title of the video, Bartosz... 😉

  • @jatvarthur
    @jatvarthur 3 года назад

    Thanks for the great course!
    What I don't understand here, in the [C,C] we pick T as an object, but what T^2 would be? Is it another object with mu going from it to T, or something else? If it is another object, how T and T^2 are related in terms of composition? Can we pickup the composition of endofunctors from the category?

    • @DrBartosz
      @DrBartosz  3 года назад +2

      T^2 is T composed with T. Since it's also an endofunctor, it is an object in [C,C].

  • @Endomorphism
    @Endomorphism 3 года назад +1

    Thanks !!
    I did try to understand all of it.
    But maybe i understand 50% of it.
    Butni will revisit it more
    Thanka again

  • @iNerdier
    @iNerdier Год назад

    You had me until these last two lectures but somehow I lost it on the Monad sections. I still don't understand how a Monad can encapsulate both purity and some state but I'll have to re watch and see if I can work it out on paper following along again.

  • @adrianmiranda5531
    @adrianmiranda5531 6 лет назад +1

    Slightly more abstractly, a monad is a lax functor from the terminal bicategory into your bicategory K. When K = CAT, this picks out a category (often just taken to be Set), an endofunctor on it, and two natural transformations. The coherence axioms for a lax functor reduce to exactly the axioms for a monoid object.

    • @DrBartosz
      @DrBartosz  6 лет назад

      Yes, Paolo Capriotti has a very good blog post about it: www.paolocapriotti.com/blog/2015/06/22/monads-as-lax-functors/index.html .

    • @adrianmiranda5531
      @adrianmiranda5531 6 лет назад +1

      Bartosz Milewski Nice! And then if you view the monad as a diagram in your bicategory K, it's lax limit and colimit are precisely the eilenberg Moore and kleisli objects for the monad. Of course for comonads you take oplax functors instead of lax.
      Generalising slightly, but still being a special case of lax functors, a category enriched in a bicategory K is precisely a lax functor from an indiscrete 2-category on a class X. Indiscrete meaning every hom category is terminal. When K has only one object, you recover the definition for enrichment in monoidal categories.

    • @DrBartosz
      @DrBartosz  6 лет назад +1

      I didn't know that.

  • @the_allucinator
    @the_allucinator 3 года назад

    So a monoid C, despite having only one object, can multiplied to itself: [C,C], to create a multitude of functors, thus creating a new category.

  • @Alkis05
    @Alkis05 3 года назад

    So husk (the haskell category) is a small category, but we can use it to build higher level monoid categories, one of which is the category of endofunctors.

    • @XGD
      @XGD 3 года назад

      It's actually called "Hask" wiki.haskell.org/Hask

    • @allendupras
      @allendupras 3 года назад

      @@XGD I like Husk better! xD

  • @igNights77
    @igNights77 3 года назад

    Amazing course, thank you!

  • @Pitometsu
    @Pitometsu 3 года назад

    So an example from Hask of such an endofunctors composition would be [Maybe a] (or ([] . Maybe :: Type -> Type, if there type-level "."), and appropriate function mapping ("tensor product" of two of them, which is function composition "." here) is (fmap @([])) . (fmap @Maybe), is it? But Id (Maybe a) wouldn't be the same as Maybe (Id a), isn't it? Or is it up to isomorphism?

    • @BartoszMilewski
      @BartoszMilewski 3 года назад +1

      Composition of functors is defined in Haskell in Data.Functor.Compose . And, yes, it's up to isomorphism. You have to do some messy unpacking/repacking of data constructors.

    • @Pitometsu
      @Pitometsu 3 года назад

      @@BartoszMilewski Thank you a lot for such a great tutorials! And for the help!

  • @vantruongtran6425
    @vantruongtran6425 Год назад

    It as been a while and I am too afraid to ask the meaning of the eta morphism: in the notation eta: (() -> a. How is it called the unit morphism.

    • @DrBartosz
      @DrBartosz  Год назад

      It's called unit because of the unit laws.

  • @jmgimeno
    @jmgimeno 8 лет назад +1

    I think I'm having a problem in understanding the "monoid in the category of functors" because I'm trying to visualize it in a similar fashion as one visualizes a monoid on sets. (Maybe the problem is that a monoid on sets is itself a category but maybe this is not the case for monoid on endo-functors).
    A monoid in sets is a category with a single object (*) and each element of the set is an arrow from * to * and the composition table of arrows is the same as the binary operation corresponding to the monoid. Besides, one of the arrorw correspond to the unit of the monoid and is the identity arrow. And this is very simple to visualize.
    Can we visualize similarly a monoid in the category of endo-functors? I'm trying to imagine a single objec category, named (*) and each arrow corresponding to an application of the endo-functor. So I have arrows for M, M^2, M^3, ... and even I can imagine an arrow for M^0 = Id. And the arrow table is given by composition. I think this construction can be done for any functor, not necessarily a monad.
    In a monad, given that mu: M . M -> M, does it mean I only have an arrow? Where is the identity arrow? I'm the last one is related to eta, but I don not know how.
    What I'm doing wrong? Is this "visualization" possible with a monad (a monoid in the category of functions)?
    Any help will be much appreciated and thanks for all you are doing to help us understand Category Theory and Functional Programming.
    Juan Manuel

    • @unregisteredhypercam2427
      @unregisteredhypercam2427 8 лет назад +5

      I think the problem is that you are mistaking two different phenomena. To paraphrase Eugena Cheng, two different generalizations of the same idea can look very different, depending on the viewpoint you started with.
      Throughout this talk, monoid is meant to mean "monoid internal to some monoidal category". A monoid in the category of sets is a Set M with arrows 1 -> M, MxM -> M satisfying laws. It is in this sense that a monad is a monoid in [C, C]. It consists of a functor T with natural transformations id -> T, T . T -> T satisfying those same laws.
      On the other hand, you can indeed take the definition of a monoid to be a one object category, but that leads in a direction that is *significantly* more complicated and has little to do with what is discussed in this lecture (something to do with higher categories).

    • @unregisteredhypercam2427
      @unregisteredhypercam2427 8 лет назад +3

      One exercise that might be helpful to you is to work out what monoids inside of other monoidal categories are. For example, try to work out what a monoid in the category of abelian groups is (where the product is ordinary tensor product). You can probably guess the answer, but try to actually verify it.
      If you are feeling particularly brave, you could try to convince youself that a monoid in CAT, the category of small categoies and functors, is precisely monoidal category.

    • @jmgimeno
      @jmgimeno 8 лет назад

      Thanks for the answer. I was trying to make my life harder by trying to visualize the monad as a single object category.

    • @jmgimeno
      @jmgimeno 8 лет назад

      This is "Down the rabbit hole" because I've serached for "abelian group" and "tensor product" and there is lots of things I've to learn. Thanks for the challenge.

    • @unregisteredhypercam2427
      @unregisteredhypercam2427 8 лет назад +1

      Of couse! Hope I clarified things for you!
      If you aren't familiar with groups, I don't know how enlightening that example is going to be for you. It sounds like you might be from more of a cs background, in which case I'm not as qualified to comment on what would be a good exersise. (That said, the monoid in CAT example could still be useful to you).
      Since you are interested in category theory, I would definitely recommend learning some basic abstract algebra. Even if all you know is the definitions of groups, rings, fields, etc. and some basic examples, that could potentially provide you with a lot of useful intuition.

  • @kahnfatman
    @kahnfatman 3 года назад

    Which law do you major in? Monadic Law.

  • @WuzzupWhitey
    @WuzzupWhitey 5 лет назад

    This shit just got intense))

  • @srghma
    @srghma 6 лет назад

    Easy-peasy

  • @CliqueSpace
    @CliqueSpace 7 лет назад

    Hmmm... what do you call a monoid that isn't in the category of endofunctors? Does such a thing even exist? If not, why is the qualification given in the statement?

    • @DrBartosz
      @DrBartosz  7 лет назад

      I did define a general monoid, first as a single-category object, then as an object in a monoidal category.

    • @CliqueSpace
      @CliqueSpace 7 лет назад

      Okay, thanks Bartosz. I probably need to go over this and other material a number of times more, although it is slowly becoming clearer to me.

    • @PunitSoni00
      @PunitSoni00 4 года назад +1

      @@DrBartosz I was confused by these multiple definitions. Especially the difference between "category with 1 object" and "the monoidal category".
      Are all objects in the monoidal category called monoids? And if these objects are also endofunctors they are called Monads?

    • @BartoszMilewski
      @BartoszMilewski 4 года назад

      @@PunitSoni00 No, consider that Hask is a monoidal category and not all types are monoids.