Category Theory 8.1: Function objects, exponentials

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ธ.ค. 2024

ความคิดเห็น • 59

  • @jyrikgauldurson8169
    @jyrikgauldurson8169 7 ปีที่แล้ว +3

    I have to say, this is the best explanation of exponentials I have encountered by far. Textbooks really struggle when it comes to category theory.

    • @sublunarymessaging7462
      @sublunarymessaging7462 3 ปีที่แล้ว

      Goldblatt's book on topoi is good. I tend to watch yt vids and look in that book when I don't understand something

  • @derelbenkoenig
    @derelbenkoenig 4 ปีที่แล้ว +2

    Wow! I've known about currying for some time but I always just took for granted that it obviously works. Very gratifying to see a formal definition of it

  • @TheGrandUser
    @TheGrandUser 8 ปีที่แล้ว +18

    I just have to ask... are there coexponentials? :)
    Or put another way, would turning all the arrows be meaningful? As it seems to be so elsewhere.

    • @BartoszMilewski
      @BartoszMilewski 8 ปีที่แล้ว +17

      Yes, although they are not that interesting. See the following discussions: math.stackexchange.com/questions/635993/what-is-the-dual-of-implication and www.reddit.com/r/dependent_types/comments/3bdzi7/the_dual_of_product_and_is_coproduct_or_what_is/

  • @5pp000
    @5pp000 12 วันที่ผ่านมา

    10:06 Using the name 'eval' for the function that takes (z, a) to b is very odd. If you're trying to use traditional Lisp terminology, you've got it wrong. The correct name for that function is 'apply'. 'eval' is a function from _s-expressions and environments_ to values (I'm eliding mention of the store since we're in the functional paradigm here).

  • @ineedvids92
    @ineedvids92 3 ปีที่แล้ว +1

    why is there only one function from Void -> a for a type a? if a was Bool, why aren’t “give me any Void and I’ll give you True” and “give me any Void and I’ll give you False” different functions?
    i guess it comes down to “how do we precisely define when two functions are the same?”

    • @brooksbryant2478
      @brooksbryant2478 8 หลายเดือนก่อน

      I think because you can never actually give the function a Void, any two functions from Void to an are the same. They have the same output for all possible inputs, because there are no possible inputs

  • @Bratjuuc
    @Bratjuuc 3 ปีที่แล้ว +1

    So, function object (a ⇒ b) is such object that:
    1) there is morphism eval : (a ⇒ b) × a → b,
    2) and for every given object z, for every given morphism g : (z × a) → b, there is unique morphism h : z → (a ⇒ b), such that g = eval ∘ (h × idₐ)
    ???

  • @binshuo
    @binshuo 7 ปีที่แล้ว +7

    This is so cool, explaining currying in category theory.

    • @aoeu256
      @aoeu256 5 ปีที่แล้ว +2

      From a linguistic perspective verbs are functions generalized to be a relations[logic programming], contextual, ambigious, and able to look at the structure of its arguments (nouns). However, lets consider them functions, and when you say "I went to the store to buy food". The verb buy here is applied only one argument food where it would normally have another argument called the subject this means that buy is "curried" so you have a dependent clause that you can feed into a higher-order function (buy) to do its work.

    • @allendupras
      @allendupras 4 ปีที่แล้ว +2

      @@anirudhdhullipalla5214 You know the Curry-Howard-Lambek Isomorphism that Bartosz has mentioned!? Well Lambek also worked on something known as Lambek calculus which relates grammar and its logical form to categories. There was also Montague who first used lambdas with grammars.

    • @anirudheka9950
      @anirudheka9950 4 ปีที่แล้ว +1

      @@allendupras Ah, cool!

  • @ПетяТабуреткин-в7т
    @ПетяТабуреткин-в7т 4 ปีที่แล้ว +9

    So, in category theory 0^0 is definitely 1?
    Since there's only one Void -> Void.

    • @Bratjuuc
      @Bratjuuc 3 ปีที่แล้ว

      The only reason 0^0 is undefined in calculus is because a limit of kind "0^0" can be equal to 1, or 0, or any other number, which contradicts the uniqueness of limit.

    • @SharplEr
      @SharplEr 3 ปีที่แล้ว

      @@Bratjuuc I'm not a real mathematician, but i always thought 0^0=1 because it's empty product. As 0! = 1. Also I'm not sure we can use limits here until we are talking about function f(n)^g(n), where f(n)->0 and g(n)->0 when n->+inf. Btw if f(n)=g(n) then limits will be 1. Limits doesn't work for numbers only for functions or sequences. Imagine we have only integers in that case there are no limits at all because we can't come close enough to any number and still be unequal to it.

    • @Bratjuuc
      @Bratjuuc 3 ปีที่แล้ว

      @@SharplEr >btw if f = g then the limit will be equal to 1
      That's a very specific example, which in no way proves that 0^0 is always 1, it just shows that there exist one limit of such type that equals to 1.
      What if f(n) = 1/123456^n, g(n) = -1/n? What would the limit of f(n)^g(n) look like?

    • @Bratjuuc
      @Bratjuuc 3 ปีที่แล้ว

      @@SharplEr yeah, to talk about limits, we need to have metrics. A lot of calculus is defined in limits, f.e. pi^e. How do we even talk about pi^e, what does that even mean? How do we multiply a number with itself irrational number of times? This is where limits are coming to the rescue, Turns out that for every positive a, f x = a^x is continuous, we already know how to compute a^x for rational x, so we can just plug limits in the "holes" in the number line, by holes I mean irrational numbers. Sadly, we can't do that for 0^0.

    • @SharplEr
      @SharplEr 3 ปีที่แล้ว

      @@Bratjuuc you mixed up limits and operations. Zero is natural, so we could use definition of natural powers : a^n = Prod a, i=1..n. And by definition empty prod is 1. This fact often used in all types of discrete math. All this limits arrives only if we are trying to work with real numbers. But here we could don't care about it because zero is natural. For example even more problems arrives when you trying to work with complex numbers or more exotic quaternion, for example.

  • @mateuszbaginski5075
    @mateuszbaginski5075 2 ปีที่แล้ว +1

    Sir, you opened a new chapter in my journey through mathematics and programming

  • @jonathanberliner288
    @jonathanberliner288 3 ปีที่แล้ว

    The connection between functions and exponentials is beautiful!
    Is there any work connecting the size of these exponentials to Occam's razor? Comparing the size of function sets seems like a promising route for model comparison.

  • @Bratjuuc
    @Bratjuuc 3 ปีที่แล้ว

    What is the exact formal difference between a product and a function object? If I pick b as a (a ⇒ b) object, I will automatically get eval as a projection, and also maybe a morphism h, but I'm not sure.

  • @mechadense
    @mechadense 3 ปีที่แล้ว

    33:19 explanation of interpretation as exponential

  • @tna2014
    @tna2014 3 ปีที่แล้ว

    Thank you for the awesome lecture. I have a question. Is it required to have a product for every pair of objects to define function types?

  • @TimTeatro
    @TimTeatro 7 ปีที่แล้ว

    2:38 If the objects in *Hask* are types, and functions of a given signature are a type, then isn't it fair to say that *Hask* contains its hom-sets? Where is my misunderstanding? Is there something about the bottom values that ruins the relationship?

    • @DrBartosz
      @DrBartosz  7 ปีที่แล้ว

      Haskell type a->b is the exponential object. It is isomorphic to the hom-set between a and b.

    • @TimTeatro
      @TimTeatro 7 ปีที่แล้ว +1

      Thanks Dr. Milewski. If you'd be so kind as to carry me a step further, I'm struggling to see the difference between b^a and hom(a, b). Perhaps... If b^a ~ hom(a, b), would it be straightforward for you to define the isomorphism, say for the case of Int -> Int (i.e. std::function)? In that case, hom(Int, Int) = Int x Int = Int^Int, right?
      Perhaps, is the distinction when the function is strictly a subset of the Cartesian product? In other words when the domain and codomain are not equal? In that case, I could see that hom(A, B) is a subset of AxB. But then hom(A, B) isn't isomorphic to AxB because the relationship isn't surjective: I could easily find an element in the cartesian product which isn't mapped to from hom(A,B), since the cartesian product would also contain hom(B,A).
      Thanks for taking the time to worth through all of that.

    • @DrBartosz
      @DrBartosz  7 ปีที่แล้ว +1

      Probably the best way to see this is to realize that hom(1, b^a) is isomorphic to hom(a, b), where 1 is the terminal object. This follows directly from the definition of the exponential object using an adjunction, and the fact that the terminal object is the unit of the product. In Hask, a function from the unit picks an element of the set, here the element of the exponential set.

  • @naayou99
    @naayou99 4 ปีที่แล้ว +2

    Beautify how Currying falls off the construction

  • @firstnamelastnamesons6830
    @firstnamelastnamesons6830 7 ปีที่แล้ว +1

    Hi,
    at 41m55s, an interesting question pop up in mind mind. how does the Category theory deals with undefine limis from calculus like 1^\infinity ?

    • @firefly618
      @firefly618 6 ปีที่แล้ว

      Seeing as ∞ is not a number, but a symbol used in calculus to denote the behavior of certain limits, you would have to define limits in category theory first.

  • @ashish123mishragkp
    @ashish123mishragkp 8 ปีที่แล้ว +1

    Thanks for Great Lectures. What supplementary text you would suggest for further reading and solving problems. Thanks.

    • @BartoszMilewski
      @BartoszMilewski 8 ปีที่แล้ว +6

      My blog goes over this material, sometimes in more detail, and it has exercises. bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/

  • @lwave9544
    @lwave9544 6 ปีที่แล้ว

    Can you give an example for a non-cartesian category? Additionaly what does a category witch is not Set-like looks like?

    • @DrBartosz
      @DrBartosz  6 ปีที่แล้ว

      Most random bunches of objects and arrows that satisfy category axioms will not have products (and are not Set-like). In particular, a single-object monoid is not Set-like, a preorder of natural numbers is not Set-like. Any discrete category (no arrows other than identities) is non-cartesian.

  • @CliffStamp
    @CliffStamp 7 ปีที่แล้ว

    I could follow this well except for the part at ~30 where the diagram is interpreted to say a function of two arguments is equivalent to a function which returns a function. Now I understand what the conclusion means, but not how you get it from the diagram.
    g`=g o h x id
    How can you infer from that that g` (a function of two arguments) is the same as h (a function of one argument) . There is also a g in that equation which is a function of two arguments (z x a, just like g` is a function of z`x a) .
    Does equivalent mean more loose like up to isomorphism?

    • @DrBartosz
      @DrBartosz  7 ปีที่แล้ว +3

      You don't so much get it from the diagram as from the words: For every g (a function of a product of two arguments) there is a unique function h (which produces a function a=>b). That defines a mapping from g to h. The other way around is trivial: for every h you construct g = eval . (h x id).

  • @mcf1110
    @mcf1110 5 ปีที่แล้ว

    Something funny crossed my mind. For every morphism a -> b we have an object (a -> b) X a, and a morphism ((a -> b) X a) -> b. If that's so, wouldn't we also have an object that represents ((a -> b) X a) -> b and, therefore, a morphism ((a -> b) X a) -> b) X ((a -> b) X a), and so on?

  • @s2260
    @s2260 ปีที่แล้ว

    omfg!!! this is magic

  • @carl8703
    @carl8703 4 ปีที่แล้ว

    9:48 for some reason I found this hilarious

  • @batyrkhan1844
    @batyrkhan1844 5 ปีที่แล้ว

    Thank you for the great lectures!

  • @eliastandel
    @eliastandel 5 ปีที่แล้ว

    So by analogy f :: Void -> Void would be equivalent to 0^0, which is undefined, so f doesn't exist!

    • @DrBartosz
      @DrBartosz  5 ปีที่แล้ว +4

      There's a whole Wikipedia article on the topic of 0^0. In category theory this is a set of morphisms from the initial object to itself so it must be a singleton. Every object has at least one endomorphism, the identity. Void is no exception.

    • @eliastandel
      @eliastandel 5 ปีที่แล้ว

      @@DrBartosz Indeed, I had a very simplistic view of 0^0 that came from introductory analysis classes at university a long time ago :) .
      Also, I should have realized that Void -> Void is the identity morphism for this object =/
      Thanks a lot for the reply and the clarification!

  • @Yetipfote
    @Yetipfote 3 ปีที่แล้ว

    this b^a thing is again something where I thought "WTF?? Why do mathematicians make everybody's lives hard??" but then realize after the explanation that it really makes totally sense from a certain perspective.
    ps: at 40:44 you can really tell by his voice that he went full crazy and it is too late.

  • @brandomiranda6703
    @brandomiranda6703 6 ปีที่แล้ว

    Sorry for the spam. In what video do you define/explain universal property?

  • @brandomiranda6703
    @brandomiranda6703 6 ปีที่แล้ว

    Which video do u explain where you treat types as objects?

  • @brandomiranda6703
    @brandomiranda6703 6 ปีที่แล้ว

    what do you mean that what we do in programming is approximately what the category of Set is?

  • @aion2177
    @aion2177 6 ปีที่แล้ว +2

    crrrrssssshhhhrrrrghhhh booom! Mind blown !! :)) This is how mi mind was when i saw: Bool -> Int to be Int ^ 2 then Int ^ Bool
    Rely awesome stuff !! Wish i stumbled upon this concepts sooner :))

  • @brandomiranda6703
    @brandomiranda6703 6 ปีที่แล้ว

    Why is it none trivial to form products of morphisms?

  • @brandomiranda6703
    @brandomiranda6703 6 ปีที่แล้ว

    Whats a hom-set? A set of morphisms?