When you pointed out that the natural transformation had an interpretation as an optimization in a compiler, my mind was blown. Absolutely amazing. I can't believe this sort of knowledge is hidden behind dense graduate level textbooks. I need to let this one digest for a bit before your next lecture because that's where I start getting a bit lost. Absolutely amazing lecture. I'm so glad there's tons more for me to go through. 😁
Thanks again for recording this, it really helps me as a FP programmer and Category Theory lover
3 года назад
For me the naturality condition really only clicked when I remembered that in a category, all compositions of morphisms are also morphisms. This means there is a fifth arrow (not drawn by Prof) going from Fa to Gb, and that arrow is equivalent to the composition of both paths. This also explains why αb is not fully determined by (Ff, αb, Gf) - there can be multiple candidates for the composition to equal the fifth morphism.
Best way of teaching.......I have studied from many books for this(natural transformation).but was not able understand it. Today I got it not only algebraically but also geometrically. Thank you sir.. You are awesome..
I came to two conclusions from this video that I’m not sure are valid: 1. You mentioned that a -> [a] is a natural transformation from Identity a to [a]. Does that mean every Functor constructor is really a natural transformation from the identity functor to that functor? 2. Also, thinking about your description of natural transformations as changing the packaging of an object from one functor to another. Does that mean the left map of a bifunctor could be seen as a natural transformation from the perspective of the object on the right? In which case a bimap can be seen as a commutative diagram? Thanks for clarifying!
This lecture elevated my card magic to a level beyond anything described in magic literature. Sleight of hand and forced cards are amateur's tricks compared to what I can do now. Without my touching the cards, I can instruct my spectator to perform a couple simple manipulations of cards' positions to achieve impossible illusions. The beauty is explaining how any one of my new illusions works requires knowledge of this underlying mapping optimization paradigm. What I could have achieved during my career as a nuclear engineer with this is a thrill future designers will enjoy in my stead. Thanks for posting these lectures.
@@PunitSoni00 I have not published any of my illusions. However, as Arthur C. Clarke said, technology is magic to the uninformed and I use that principle when designing my entertainments.
Around 44:00 there was a comment that natural transformations are associative. I think what he meant was commutative. Could you respond to... "so it is almost like commutivity?" Oh, that is why they are called "commuting diagrams" (of course).
So if I know that one functor, say, has a product and there is a natural transformation between this functor and some other one, then from naturality condition we can deduce that this other functor also has a product-that's why natural transformations are a "high level language" of category theory. So what we actually do is search for sub-categories inside a bigger category and define relations between them. Am I getting it wrong?
Could you say that a natural transformation from F to G is a functor from F's image to G's image? I'm not completely sure I understand the consequences of this. Let us take two arbitrary functors, but because I have no imagination I'll call them 'List a' and 'Array a' (and completely disregard whatever they might mean). If I understand correctly, saying that there exists a natural transformation from List to Array means that: • There exists a function 'x :: (f: a -> b) -> List a -> Array b' that is implemented as 'foo(List.map f)' • There exists a function 'y :: (f: a -> b) -> Array a -> List b' that is implemented as 'bar(Array.map f)' • The functions 'x' and 'y' are identical ? I don't really understand how that is possible, since 'x' and 'y' have different types.
I don't get both the mix of Haskell function signatures and C-like function signatures, AND the mix of List and Array. Also, the implementations of fmap for List and for Array are nowhere near the same, although they provide the same effect.
If I understood correctly: *any* polymorphic function n :: F a -> G a is a natural transformation. The consequence is what he explains, any funtion f :: a -> b can be applied *in any order* combined with fmap and the natural transformation: fmap f . n = n . fmap f Where the left hand fmap is for functor F and right hand fmap is for functor G. Which means that the right hand side acts (with f) on the contents of F a first and then converts it into G a. And the left hand side converts it into G a first and then acts on the contents. With some x it can be a little clearer written as: fmap f (n x) n (fmap f x) Where x is of type F a. Edit: given that F and G is not contravariant in a, or something like that. Edit2: with List a and Array a an example would be the natural transformation toArray :: List a -> Array a and the list l: fmap f (toArray l) toArray (fmap f l) Should produce identical results.
Can some of objects of functor's domain be images of different functors at the same time? Why so? And if not -- is that true that natural transformation is just a functor between functor's images?
I have a question, can we have a morphism between natural transformations? ex: we have "A" a natural transformation e B other natural transformation, i want to know if can exist a morphsm between A and B.
Does applying a filter on a list have a corresponding category theory operation? Looks like it is not a natural transformation since we cannot define an equivalent alpha.
Since lists are recursive data structures, operations on lists come under the heading of F-algebras. Filtering could be defined as a catamorphism that uses a list as the carrier type.
A filter isn't a natural transformation because it's a function from (a -> Bool) -> [a] -> [a]. The type 'a' appears in contravariant position in the predicate type. To get a natural transformation, the type parameter can only appear in covariant positions.
Is it possible to see a polymorphic function length [a] -> Int as a natural transformation from the List functor to the Identity Functor? In the video it is said to be a natural transformation from List to Const, and in the blog post of the same subject (bartoszmilewski.com/2015/04/07/natural-transformations/) it is demonstrated like so: unConst :: Const c a -> c unConst (Const x) = x length :: [a] -> Const Int a length [] = Const 0 length (x:xs) = Const (1 + unConst (length xs)) length [1, 2, 3] -- Const 3 But I can also do: unIdentity ::Identity a -> a unIdentity (Identity x) = x length :: [a] -> Identity Int length [] = Identity 0 length (x:xs) = Identity (1 + unIdentity (length xs)) length [1, 2, 3] -- Identity 3
Edward Kmett uses a lot of categorical tricks to optimize algorithms. See for instance his blog posts on codensity monads: comonad.com/reader/2011/free-monads-for-less/
Awesome work! I truly hope the lectures don't stop now as things are starting to get interesting (like most online resources unfortunately). Managing to cover Yoneda, Limits and Adjunctions would be really cool! Covering Monads, Algebras and Kan extensions would be EPIC (even if done in a future series soon after this one :) )