数学构造(Mathematical structure)
在数学上,在集合上的一个构造是一个附加的数学对象,赋予这个集合某种意义。node
范畴论(category theory)
范畴论的目的是:规范化数学构造。
方法为:使用带标签的有向图。
研究内容:各类数学结构之间的关系。app
一个范畴是一个带标签的有向图,其节点为对象(object),带有标签的有向边为箭头(arrow or morphism)。dom
一个范畴C包含3个数学实体:ide
对象集合:ob(C)
每一个元素都是一个对象,一个对象又能够认为是一个集合。函数
态射集合: hom(C)
态射集合的每一个元素是一个态射, \(f: a \to b\),每一个态射f有一个源对象(source object) a和目标对象(target object)b。
\(hom(a, b)\)表示从a到b的全部态射。flex
态射能够理解为一个函数,在范畴论中,每每表示为一个对象和另外一个对象的map关系。
态射做为函数理解的时候,不用纠结于参数的个数。ui
态射的种类(\(f: a \to b\)):spa
单态射(monomorphism or monic)
若是\(f \circ g_1 = f \circ g_2 \implies g_1 = g_2, \forall g_1, g_2: x \to a\)。
其含义是:不存在两个a中元素 map 到同一个b中的元素。
\(\forall a_1, a_2 \in A, a_1 \neq a_2 \implies f(a_1) \neq f(a_2)\)code
满态射(epimorphism or epic)
若是\(g_1 \circ f = g_2 \circ f \implies g_1 = g_2, \forall g_1, g_2: b \to x\)。
其含义是:每个b中的元素,都在a中有至少一个 source mapper。orm
双态射(bimorphism)
便是单态射,有时满态射。
同构(isomorphism)
若是存在一个同构\(g:b \to a\),有\(f \circ g = 1_b, g \circ f = 1_a\)。
其含义是:a,b两个对象的元素存在一对一的 map 关系。
同构 = 双态射 + 存在逆态射。
g称为逆态射,也是一个同构,g 的逆态射是 f。
好比:f是加法,g是减法。
自态射(endomorphism)
表示一个态射源对象和目标对象是同一个, \(f: a \to a\)。记为:end(a)。
自同构(automorphism)
若是f既是一种自态射,又是具备同构性。记为:aut(a)。
撤回射(retraction)
若是存在一个f的右逆,也就是说,若是存在: $g : b \to a, f \circ g = 1_b。
f 是另外一个态射g的撤回射,其含义是:g 能够经过f找到 source element。f一定是一个满态射(epimorphism)。
部分射(section)
若是f的左逆是存在的,也就是说,若是存在: $g : b \to a, g \circ f = 1_a。
f 是另外一个态射g的部分射,其含义是:f 肯定了g的同构部分。f一定是一个单态射(monomorphism)。
是否是能够理解为f的g应用的一个条件???
同态(homomorphism)
同态(homomorphism)是一个态射,表示一个数学结构\mathcal{A}(C, , e)到另外一个数学结构\mathcal{B}(C', ', e')的map关系,而且维持了数学结构上的的每一种操做*。
同态(homomorphism) \(f: \mathcal{A} \to \mathcal{B}\),有:
\(f(x * y) = f(x) *' f(y)\)
同一种操做在不一样的数学结构上定义能够不一样。
好比:指数函数是一个同态。
\[ f : \mathbb{R} \to \mathbb{R} \\ f(x) = e^x \\ e^{x + y} = e^x e^y \to f(x * y) = f(x) * f(y) \\ where \\ f \text{ exponential function is a homomorphism} \\ \text{the source is A} = \mathbb{R} \\ \text{the target is B} = \mathbb{R} \\ * = + \text{ in A} \\ * = \times \text{ in B} \]
域(domain)/协域(codomain)
对于一个态射(morphism) \(f : S \to T\)。 域(domain)是这个态射的源,协域(codomain)是这个态射目标。
\[ C = (Ob(C), Hom_C(x,y), id_x, \circ) \\ where \\ Ob(C) \in Set_{object} \\ Hom_C(x, y) \in Set_{morphism} \ | \ x, y \in Ob(C) \\ id_x \in Hom_C(x, x) \text{ : identity morphism of x} \\ \circ : Hom_C(y, z) \times Hom_C(x, y) \to Hom_C(x, z) \text{ : composition formula} \\ \text{Identity Law:} \\ \forall x, y \in Ob(C), f: x \to y \\ f \circ id_x = f \\ id_y \circ f= f \\ \text{Associative Law:} \\ \forall w, x, y, z \in Ob(C), h: w \to x, g: x \to y, f: y \to z \\ (h \circ g) \circ f = h \circ ( g \circ f) \in Hom_C(w, z) \]
函子是范畴之间的map关系。能够理解为范畴之间的态射。
天然转换是两个函子之间的关系。函子描述“天然构造(natural constructions)”,天然转换描述两个这样构造的"天然同态(natural homomorphisms)"。
homomorphism的意思是相同的形状。
通用性质(universal property)
若是,两个数学结构是同构(isomorphism),那么它们之间就存在通用性质。
同构意味着两个数学结构X和Y中的元素是存在一一对应。
那么,Y上的性质(态射)意味着X上存在一个对应的性质(态射)。好比:
X = {A, B, C}
Y = {1, 2, 3}
A --> 1
B --> 2
C --> 3
若是+(1, 2) = 3,咱们也能够认为存在 +(A, B) = C。起点性质。
若是+(1, 2),咱们也能够认为存在 +(C) = (A, B)。起点性质。
通用性质(universal property)要么是一个起点性质(initial property),要么是一个终点性质(terminal property)。
limit/colimit
二元关系(binary relation)
一个基于集合X的二元关系,是一个\(R \subseteq X \times X\)的子集。
幺半群能够表明一个序列或者列表。
List in set
集合X,在X上的List是
\[ (n, f) \\ where \\ n \in \mathbb{N} \text{ : the length of the list} \\ f: \underline{n} \to X \\ \underline{n} = \{ 1,2, \cdots, n\} \]
记作:
\[ (n, f) = [f(1), f(2), \cdots, f(n)] \]
列表单体(free monoid generated by X)
\(M: = (List(X), [], ++)\)
List(X);集合X的元素列表集合。
[]是一个空列表。
++是链接操做(concatenation)。
显示幺半群(presented monoid)
显示幺半群的做用是提供了替换方法。
由有限集合G和等价关系产生的显示幺半群(the monoid presented by generators G and relation $ { (m_i, m'_i) | 1 \le i \le n } $)
\[ M = \{ M, e, \star \} \\ where \\ \{ (xm_iy \sim xm'_iy) | x, y \in List(G), 1 \le i \le n \} \text{ : equivalence relation} \\ M = List(G)/\sim \\ e = [] \\ \star \text{ : concatenating operation} \]
循环(cyclic)幺半群
循环幺半群的做用是提供了一个环形列表的定义方法。
循环(cyclic)幺半群是只有一个等价关系的显示幺半群。
幺半群行动(monoid actions)
在集合S上的幺半群\((M, e, \star)\)的行动为函数:
\[ \hookrightarrow \]
术语 | English | Notation |
---|---|---|
单态射 | monomorphisms | $ \hookrightarrow $ |
满态射 | epimorphisms | $ \twoheadrightarrow $ |
同构 | isomorphisms | $ \overset{\sim}{\to} $ |
group是一个monoid,而且每一个元素都有一个倒数(inverse)。
推论:倒数具备惟一性。
图形(graphs)是由多个顶点(vertex)和顶点之间的箭头(arrow)定义而成。
路径(path)
派系(clique)
派系(clique)中的每两个点都是毗邻的(adjacent)。
\[ clique \doteq S' \\ where \\ (S, \leqslant) \text{ is a preorder}\\ S' \subseteq S \\ a \leqslant b, \forall a,b \in S' \]
meet 和 join
\((S, \leqslant)\)是一个preorder。\(s, t \in S\)
s和t的meet(the biggest thing smaller than both)是一个元素\(w \in S\),
表示为:$ w \cong s \land t $
具备:
\[ w \leqslant s \\ w \leqslant t \\ x \leqslant w \ | \ \forall x \in S, x \leqslant s \ \And \ x \leqslant t \]
s和t的join(the smallest thing bigger than both)是一个元素\(w \in S\),
表示为:$ w \cong s \lor t $
具备:
\[ s \leqslant w \\ t \leqslant w \\ w \leqslant x \ | \ \forall x \in S, s \leqslant x \ \And \ t \leqslant x \]
meet 和 join 不必定是惟一的。任何两个meet必定在同一个派系内。
digraph finite_state_machine { rankdir=LR; size="8,5" node [shape = doublecircle]; S; node [shape = point ]; qi node [shape = circle]; qi -> S; S -> q1 [ label = "a" ]; S -> S [ label = "a" ]; q1 -> S [ label = "a" ]; q1 -> q2 [ label = "ddb" ]; q2 -> q1 [ label = "b" ]; q2 -> q2 [ label = "b" ]; }
反顺序(Opposite order)
\(S := (S, \leqslant)\)是一个预次序(preorder),则反顺序\(S^{op} := (s, \leqslant^{op})\),
有:
$ s \leqslant s' \iff s' \leqslant s $
次序的态射(morphism of orders)
从\(S := (S, \leqslant)\)到\(S' := (S', \leqslant')\)次序的态射f,表示为\(f: S \to S'\)。
\[ \text{if } s_1 \leqslant s_2 \text{, then } f(s_1) \leqslant f(s_2) \]
假设 \(p,q: b \to c\)是路径,而且\(n: b \to c\)。若是 \(p \simeq q\),则\(pn \simeq qn\).
\(\simeq\) 是一个集合,定义了图形上的全部约束。
引理:假设\(p simeq q : a \to b, r \simeq s: b \to c\),则\(pr \simeq qs\)。
Database Schema
Database Schema \(C := (G, \simeq)\),G是一个图形,\(\simeq\)是G上的一致。
Olog = Database Schema
实例(instance)
一个顶点对应的集合,和出入箭头的全部路径上的节点集合。
\[ (PK, FK) : C \to Set \text{ is an instance} \\ where \\ C = (G, \simeq) \\ G = (V, A, src, tgt) \\ PK : V \to Set \text{, one set for one vertex} \\ FK(a) : PK(v) \to PK(w) \ | \ v = src(a), w = tgt(a), \forall a \in A \]
路径法则(Law 1 - Path through a database)
\[ FK(a_m) \circ \dots \circ FK(a_1) (x) = FK(a'_n) \circ \dots \circ FK(a'_1) (x) = PK(w), \forall x \in PK(v) \\ where \\ p = v a_1 a_2 \dots a_m : v \to w \\ q = v a'_1 a'_2 \dots a'_n : v \to w \\ p \simeq q \]