(Mathematical basis) sets, relations, and languages
集合
函数关系
Assume that we have sets A and B and a function from to.
- is one-to-one / injective(一对一映射 / 单射)
whenever
- is onto / surjective(满射)
For every , there is an such that .
- is both one-to-one and onto is correspondence / bijective(双射)
- A and B are the same size if there is a correspondence function
- A set is countable if either it is finite or it has the same size as
有向图
- Use ordered pairs to represent the above relationship , we write the ordered pair of two objects a and b as ; a and b are called the components of the ordered pair.
- The ordered pair is not the same as the set {a, b}
- is different from , whereas
- The two components of an ordered pair need not be distinct.
Let be a set, and be be a relation on . The relation can be represented by a directed graph.
Each element of is represented by a small circle what we call a node of the directed graph and an arrow is drawn from a to b if and only if .
- The relation is represented by the graph.
- The less-than-or-equal-to relation defined on the natural numbers is illustrated in the figure.
证明方法
数学归纳法
Mathematical induction is a mathematical proof method that is usually used to prove that a given proposition is true within the entire (or partial) range of natural numbers.
可以看作一种解决问题的“多米诺骨牌法”,一块块地将问题击倒。
首先,证明当问题是某个特定值时是正确的,然后证明如果问题在某个值上成立,它在下一个值上也成立,通过一直推倒,从而证明了问题对于所有可能的值都成立。
鸽巢原理
The pigeonhole principle
设 和 是两个有穷集合且 ,则不存在从 到 的一对一的函数。
二元关系
Special Types of Binary Relations
如果元素 与元素 存在关系 ,可以写为
自反
A relation is reflexive if for each .
The directed graph representing a reflexive relation has a loop from each node to itself.
对称
A relation is symmetric(对称)if whenever .
- In the corresponding directed graph, whenever there is an arrow between two nodes, there are arrows between those nodes in both directions.
If a directed graph satisfies a symmetric relationship, the above symmetric relationship can be expressed as an undirected graph.
A relation is antisymmetric(反对称) if whenever and are distinct, then .
- Some relations are both symmetrical and antisymmetric, such as "equal to";
- Some relations are not symmetrical but antisymmetric, such as "less than".
传递
A binary relation is transitive if whenever and ,then
等价
A relation that is reflexive, symmetric and transitive is called an equivalence relation.
The representation of an equivalence relation by an undirected graph consists of a number of clusters; within each clusters, each pair of nodes is connected by a line. The "clusters" of an equivalence relation are called its equivalence classes.
- normally write for the equivalence class containing an element
偏序
A relation that is reflexive, antisymmetric, and transitive is called a partial order.
- 定义了元素之间的偏序关系,表示元素之间的一种有序关系,但并不要求所有元素之间都有可比性。
A partial order is a total order(全序), if for all all a,b∈A, either or .
- 全序关系是偏序关系的一种特殊情况,满足全面性(completeness)的要求,即集合中的任意两个元素都可以进行比较。
- 也就是说,对于任意两个元素 a 和 b,要么 a 小于等于 b,要么 b 小于等于 a。
- Maximum(最大元素):如果对于集合中的所有其他元素b,都有a ≥ b,则a是集合中的一个上界,即没有其他元素大于等于a。最大元素在偏序集合中可能不存在,但如果存在,它是唯一的。
- Maximal(极大元素):如果不存在比a大的元素,也就是说,如果b ≥ a,则b = a。极大元素是相对于偏序关系中的某个子集而言的,可能不是整个集合的最大元素。
- Minimum(最小元素):如果对于集合中的所有其他元素b,都有a ≤ b,也就是说,a是集合中的一个下界,没有其他元素小于等于a。
- Minimal(极小元素):如果不存在比a小的元素,也就是说,如果a ≥ b,则a = b。
闭包算法
Closure(Lab 1-2)
设 是 上的二元关系,如果 不具有自反性,但我们希望 具有自反性,则可以通过在 中添加一部分有序对来改造,得到新的关系 。但不希望 和 相差太多,即添加的有序对要尽可能少,满足这些要求的 就称作 的自反闭包。类似还有对称闭包和传递闭包等。