美文网首页
前言扯淡+Chapter1

前言扯淡+Chapter1

作者: thehgz | 来源:发表于2017-05-31 23:49 被阅读33次

    Warning
    直接看书看视频 比 看我这篇笔记强无数倍,这个笔记纯粹是写着玩的。目的是防止本人repeat myself。
    本人对一切潜在谬误误导不负责任。但欢迎批评指正。

    范畴论,高大上的东西,听说过这个是因为知乎上的安利,好像学范畴论可以帮助理解函数式编程里的很多概念。
    先去YouTube上强行看了这个
    https://www.youtube.com/watch?v=ZKmodCApZwk&list=PL8Ky8lYL8-Oh7awp0sqa82o7Ggt4AGhyf
    似懂非懂,然后就决定撸书了。
    Category Theory 2nd edition
    这本书我很难看完。毕竟智商有限。加上看到大段的数学符号就头疼。真不是那块料啊。orz
    用博文来记范畴论笔记非常不爽,因为图多,字体多。就算用tex /texmacs 这些也没用,我是为了学东西,又不是为了学怎么用排版工具写各种符号/代替笔。
    事实上买个surface book 记笔记才是最佳选择。然而太贵了。surface book 2 一定要上 1050 啊 (跑题到哪里去了啊,喂!)

    书中的记法,一般花体表示category,大写是object,小写是arrow。
    本文中用 花体{X} 表示 花体的X
    把 o 读成 after,能帮助捋顺到底是怎么复合的。

    前言

    书的主线是
    Category
    Functor
    Natural Transformation
    Adjunction
    看公开课时我还是不理解adjuction是干啥的。。。丢人啊

    类型和函数组成的category很好理解,你就把所有函数类型签名一起画个图,每个类型只出现一遍。出来的图再加上identity和composition就是个 category 了。刚才说这个过程也叫构造 free category,后面再扯。

    Category的定义

    。Objects A,B,C ...
    。 Arrows f,g,h ...
    。For each arrow f, there are given objects
    domain of f dom(f)
    codomain of f cod(f)
    f:A->B means dom(f)=A god(A)=B
    。 Given f:A->B and g:B->C there is g o f :A->C
    called copositon of f and g
    。For each object A ,here is identity arrow 1A:A->A
    A是下标不会打。。。)
    。Associativity
    h o ( g o f) = (h o g) o f
    。Unit
    f o 1A = f = 1b o f
    for all f:A->B

    其中最重要的就是满足结合律。
    有哪些不满足结合律的东西呢?减法,除法,指数,无限长序列求和,浮点数运算。
    都是从这里找的https://en.wikipedia.org/wiki/Associative_property#Non-associative

    例子:
    Sets : sets as objects ,functions as arrows
    一个 Partial ordered set Pos:每个元素为object, A<= B 则 A->B

    Functor的定义

    A functor between category 花体{C} and 花体{D}
    F:花体{C} -> 花体{D}
    is a mapping of objects to objects and arrows to arrows
    (a) F(f:A->B) = F(f):F(A)->F(B)
    (b) F(1A) = 1F(A)
    (c) F(g o f) = F(g) o F(f)

    Isomorphisms

    An arrow f:A->B is called an Isomorphism if there is an arrow g:B->A in C such that
    g o f = 1A and f o g = 1B

    We say A is isomorphis to B

    Constructs on categories

    1,product
    product of 2 categories {花体}\C and {花体}\D , C x D has
    。objects of the form (C,D)
    。arrows (f,g) : (C,D) -> (C',D')
    。composition (f',g') o (f,g) = (f' o f,g' o g)
    。identity 1(C,D) = (1C,1D)
    //不能写富文本真是囧啊

    坑了,打字写不出数学符号太难受了

    未完待续~~~

    相关文章

      网友评论

          本文标题:前言扯淡+Chapter1

          本文链接:https://www.haomeiwen.com/subject/vsqsfxtx.html