FizzyElt / functional-programming

帶你探索 functional programming
https://fizzyelt.github.io/functional-programming/
MIT License
25 stars 0 forks source link

直覺範疇論 #1

Closed dannypsnl closed 1 year ago

dannypsnl commented 1 year ago

說直覺是因為這不是完善的定義,但是作為入門或是簡要使用的定義「夠好」。我們說 $\mathcal{C}$ 是一個範疇的意思是:

  1. 有 $Ob(\mathcal{C})$ 此集合(collection),表示範疇中的物件。作為方便的記號,當 $a$ 為 $\mathcal{C}$ 中一物件,我們記成 $a \in Ob(\mathcal{C})$
  2. 當有 $a, b \in Ob(\mathcal{C})$,而 $f$ 為一 $a$ 到 $b$ 之態射(morphism) ,記為 $f \in \mathcal{C}(a, b)$ 或是 $f : a \to b$。態射可以組合,也就是說當有 $f : a \to b$ 且 $g : b \to c$,就一定有 $f \circ g$ 此態射存在。與上面相同, $\mathcal{C}(a, b)$ 是一個 collection。

要是 $\mathcal{C}(a, b)$ 剛好是集合,就說這是 locally small category,要是連 $Ob(\mathcal{C})$ 也只是集合,那就說這是 small category。

但在最開始的時候,只要簡單的相信範疇給定的定義即可。

dannypsnl commented 1 year ago

Functor

要是限定在 small category,那麼 functor 就是兩個函數:

  1. 在 $Ob(\mathcal{C})$ 中的每個物件,在 $Ob(\mathcal{D})$ 中都有對應的物件
  2. 在 $\mathcal{C}(a, b)$ 中的每個態射,在 $\mathcal{D}(a, b)$ 中都有對應的態射,並且需保留對應的組合事實
FizzyElt commented 1 year ago

第二部份我放在 Functor 檔案內,第一部份單獨一個放一個 這樣如何?

dannypsnl commented 1 year ago

可以啊

dannypsnl commented 1 year ago

可以修一下:用本性類表示 collection,良性類則是 set

dannypsnl commented 1 year ago

補充,範疇還需要

  1. $id_a, id_b$ 對 $f : a \to b$ 滿足 $f \circ id_a = f$ 跟 $id_b \circ f = f$
  2. $(f \circ g) \circ h = f \circ (g \circ h)$
FizzyElt commented 1 year ago

用本性類表示 collection,良性類則是 set 這是要改在哪裡

dannypsnl commented 1 year ago

直覺範疇裡面,廣泛的來說就是所有同時用到兩種概念的地方