An equational way to prove associativity of least upper bounds

Traditionally, to prove the associativity of the least upper bounds, i.e. x \vee (y \vee z) = (x \vee y) \vee z we need few lines to prove the inequality from the left hand side and conversely. However, by turning the definition of finit join to the adjunction form, we have a more compact and algebraic-like way to do it. Continue reading

Well-definedness

脫稿好久,而且還不是本來預定要寫的東西,只是最近即便是這簡單的例子,也發現把事情講清楚的重要性。

給定一個等價類 \equiv,事實上這個 relation 的性質跟等式一樣,因此作 quotient set 的意義實際上是替代原本的等式,換成這個 relation,所以就有 [a] = [b] 若且唯若 a \equiv b 這件事情。實際上構造也很簡單,就是定義 [a] = \{ x \in X : a \equiv x \}.

接下來的問題是,我們要怎麼在 quotient set 上定義函數呢?事實上就跟一般函數的定義方式一樣,取 C \in X/\equiv 指定對應的對象就好了。但是既然 quotient set 可以寫成 \{ [a] \subseteq X : a \in X \},我們是不是能根據 a 來定義呢?可以的,但是數學教科書都會寫,必須是良好定義的,也就是若 [a] = [b],那麼 f([a]) = f([b]),白話來講,原本被看作一樣的東西,對應過去也是要一樣的。

那為甚麼在一般的集合上定義不需要呢?若是根據 [a]a 表示來定義,事實上我們定義的是一個從原本集合 X 為定義域的函數,而不是 X/\equiv 這個新的集合,而為了要說這個函數可以沿用到 X/\equiv 上,我們自然必須檢查是否還是個集合。

若是用範疇論的語言來解釋的話,考慮 \equiv \overset{\pi_1, \pi_2}{\longrightarrow} X 其中箭頭代表兩個投影函數 (x, y) 分別對應成 xy 的投影而已,那麼 quotient set 事實上是該 diagram 的 coequalizer ,那麼定義 f : X \rightarrow Y  用表示來定義的函數,若是對所有 (x, y) \in R 都滿足 f(x) = f(y) 的話,那麼自然從 coequalizer 會有一個唯一的映射到 Y,而那就是 quotient set 上的函數。

用箭頭語言講的好處是,我們清楚知道是哪些物件在作用,每個步驟都是 diagram 裡的一部分,但是我們又不限定多餘的東西:誰說 quotient set 一定要是 \{[a] \subseteq X : a \in X\}呢?因為與 quotient set 相等的集合有很多,只要有一對一且映成的函數連結起來就夠了。

A technical difficulity of modelling transition systems

To be precise, the title should be read as “a technical … using well-founded set theory such as ZFC axioms”. One of the major achievement  in mathematics is to find a standard or canonical form of a formula, a system or any mathematical entity. Continue reading

Yoneda argument – Application

A simple application of Yoneda argument is to prove that a^1 \cong a in Cartesian closed category.

Lemma. In Cartesian closed category, a^1 \cong a where 1 is terminal.

Proof. hom(b, a) \cong hom(b \times 1, a) \cong hom(b, a^1) for all objects b. Hene a \cong a^1.

It’s also quite easy to see that a^{b \times c} \cong (a^b)^c since hom(d, a^{b \times c}) \cong hom(d \times b \times c, a) \cong hom(d \times c, a^b) \cong hom(d, (a^b)^c).  Hence a^{b \times c} \cong (a^b)^c. It’s just like that we prvoe the equality c \wedge b \rightarrow a = c \rightarrow (b \rightarrow a) in the Heyting algebra!

Yoneda argument

I don’t want to repeat the Yoneda lemma, but one of the important corollary should be emphasized. Roughly speaking, given any object c in the category \mathcal{C}, c is determined by its morphisms up to isomorphism. That is, the natural isomorphism between hom-sets corresponds to the isomorphism between objects, i.e. hom(-, c) \cong hom(-, d) \Leftrightarrow c \cong d. How do we prove it? Well, let’s see a simpler analogy in partial orders.

Lemma. \uparrow x = \uparrow y if and only if x = y.
Proof. If \uparrow x = \uparrow y , then a \in \uparrow b and b \in \uparrow a which imply a \leq b and b \leq a. Hence a = b. The converse is quite trivial.

First, we can prove it by brute force method.

Lemma. hom( - , c ) \cong hom( - , d ) if and only if c \cong d.
Proof. Consider the following diagrams,

by replacing f with \phi^{-1}_{d}(id_{d}), we will see that id_{d} = \phi_{c}(id_c) \circ \phi^{-1}_{d}(id_{d}) and we will have the other isomorphism by replacing f with \phi_{c}(id_c) and reversing the arrows.

However, the diagram above is exactly used in Yoneda lemma, and of course we can use Yoneda lemma to prove it.

First recall that Yoneda lemma states that Nat ( hom ( - , r ), K ) \cong Kr where K is a Set-valued functor and r is an object in a locally small category \mathcal{C}. Let K be the hom-set functor hom(-, s). It gives the isomorphism between Nat(hom(-, r), hom(-, s)) \cong hom(r, s). Hence, it indeed tells you that Y(d) = hom(-, d) is fully faithful. Therefore, we have the second proof.

Proof2. Given that Y is fully faithful, thus the natural isomorphisms Y ( d ) \cong Y ( c ) actually correspond to the isomorphism d \cong c and vice verse. That’s it!

為甚麼是 Functional Programming?– call by need

call-by-need 是另外一點值得強調的部份。程式基本上只能作有限的計算,而回傳資料也總是有限的,所以不大可能在程式語言中,有個值完整代表無理數,或者是無窮的資料,只是有限的估計而已。是這樣嗎? Continue reading

為甚麼是 Functional Programming?

正在 Midlands Graduate School 2010 上課,想到一些東西寫點輕鬆的。

我第一個學的語言,嚴格講起來應該是小學二年級的 GW-Basic,姊姊正在念高職時,借她的課本來看,稍微玩一下。不過並沒有認真學,到最後電腦只是拿來玩電動而已。在那之後過很久,高中電子辭典有些內建 gw-basic,那時候還稍微記得上課會寫些東西打發時間,但就只是玩玩而已。 Continue reading

恭喜 Josh ~

恭喜 Josh 獲得 Clarendon Scholarship – University College MPLS Scholarship!(當然同時也獲得入學許可了),原文在此

這代表我以後去 Oxford 可以住 University College 了嗎?XD

a^1 \cong a

I’d like to show that a^1 \cong a. First, I tried to prove it by algebraic way, i.e. writing down the diagram and looking for the suitable equality. However, it goes wildly messy eventually, but I finally proved it by its universal properties as follows.

Let g be a isomorphism between A \times 1 and A, and f be any morphism from A \times A to A. Since we have A \times 1 \cong A, it doesn’t matter whether we write A \times 1 or A. According to the product diagram, we have the unique making the diagram commute (why we don’t care about 1?). However, it also means A \times 1 has the same universal property as A^1.

Another example is (X^Y)^Z \cong X^{Y \times Z}.

It tells me that to prove categorical idea we had better to prove it by its universal properties. It’s quite different what we do in set theory. We usually prove things are the same if they have the same elements. It seldom works very well in category theory, and I think it is the wrong way to think about it.

a x 1 \cong a

A quick note: A \times 1 \cong A where 1 is the terminal object.

Consider the following diagram,

we have id_a = \pi_1 \circ \langle id_a, ! \rangle already, and we attempt to find whether \langle id_a, ! \rangle \circ \pi_1 is equal to id_{a \times a}. However, \langle id_a, ! \rangle \circ \pi_1 = \langle id_a \circ \pi_1, ! \circ \pi_1 \rangle where

.

Since 1 is a terminal object, the morphism a \times a \rightarrow 1 is unique. So, ! \circ \pi_1 = \pi_2 and therefore \langle id_a \circ \pi_1, ! \circ \pi_1 \rangle = \langle \pi_1, \pi_2 \rangle which is the identity of a \times 1.

To see that \langle \pi_1, \pi_2 \rangle is the identity, we just draw the following diagram,

where id_{a \times b} also makes the diagram commute. Since \langle \pi_1, \pi_2 \rangle is unique, it must be as same as id_{a \times b}.

Also, to see \langle f, g \rangle \circ h = \langle f \circ h, g \circ h\rangle we just draw the following diagram,

where \langle f, g \rangle \circ h = \langle f \circ h , g \circ h \rangle by the similar argument.