1. Relations 关系 (2) | 离散数学

864 阅读6分钟

9 Relations 关系

《离散数学及其应用 第八版》(Discrete Mathematics and Its Application 8th Edition)第九章

2022.9.13

这是离散数学下的第二次课,主要介绍了三种关系闭包,等价关系

9.4 Closures of Relations 关系闭包

Definition 1 If R is a relation on a set A, then the closure of R with respect to P, if it exists, is the relation S on A with property P that contains R and is a subset of every subset of A × A containing R with property P.

闭包三要素:

  • 闭包包含 R
  • 闭包具有性质 P
  • 闭包是具有上述 2 点的所有关系中最小的

9.4.1 Different Types of Closures 三种闭包

Reflexive closure 自反闭包

The reflexive closure of R can be formed by adding to R all pairs of the form (a, a) with a ∈ A, not already in R. The addition of these pairs produces a new relation that is reflexive, contains R, and is contained within any reflexive relation containing R. We see that the reflexive closure of R equals R∪Δ, where Δ = {(a, a) ∣ a ∈ A} is the diagonal relation on A.

R=r(R)=RIAR' = r(R) = R\cup I_A

定理 1 :设 R 是 A 上的二元关系,则 r(R) 是包含 R 且具有自反性的最小关系

推论 1 :R 是自反闭包当且仅当 R 是自反的

生成自反闭包的方法

  • R 的有向关系图中,结点加自环
  • 关系矩阵中,对角线位置 0 换成 1

Symmetric closure 对称闭包

The symmetric closure of a relation can be constructed by taking the union of a relation with its inverse (defined in the preamble of Exercise 26 in Section 9.1); that is, R ∪ R−1 is the symmetric closure of R, where R−1 = {(b, a) ∣ (a, b) ∈ R}

R=s(R)=RR1R' = s(R) = R \cup R^{-1}

定理 2 :设 R 是 A 上的二元关系,则 R ∪ R−1 是对称的,包含 R 的最小关系

推论 2 :R 是对称闭包当且仅当 R 是对称的

  • 求自反闭包只需要把 R 并上单位矩阵即可(加自环)

  • 求对称闭包只需要把 R 并上其逆关系即可

Transitive closure 传递闭包

Paths in Directed Graphs 有向图路径

Definition 2 A path from a to b in the directed graph G is a sequence of edges (x0, x1), (x1, x2), (x2, x3),…, (xn−1, xn) in G, where n is a nonnegative integer, and x0 = a and xn = b, that is, a sequence of edges where the terminal vertex of an edge is the same as the initial vertex in the next edge in the path. This path is denoted by x0, x1, x2,…, xn−1, xn and has length n. We view the empty set of edges as a path of length zero from a to a. A path of length n ≥ 1 that begins and ends at the same vertex is called a circuit or cycle.

路径由单向边相连的结点构成

Theorem 1 Let R be a relation on a set A. There is a path of length n, where n is a positive integer, from a to b if and only if (a, b) ∈ Rn.

定理:设 a 到 b 有长度为 n 的路径,n 为正整数,当且仅当 (a, b) ∈ Rn

Definition 3 Let R be a relation on a set A. The connectivity relation R* consists of the pairs (a, b) such that there is a path of length at least one from a to b in R.

Thereom 2 Let R be a relation on a set A. The connectivity relation R* consists of the pairs (a, b) such that there is a path of length at least one from a to b in R.

R=t(R)=RR2R3...=i=1RiR^{*} = t(R) = R\cup R^{2} \cup R^{3} \cup ... = \bigcup\limits_{i=1}^{\infty}R^{i}

事实上计算有限集合 A 的传递闭包并不需要求无穷次并运算,最后会成为循环

Lama 1 Let A be a set with n elements, and let R be a relation on A. If there is a path of length at least one in R from a to b, then there is such a path with length not exceeding n. Moreover, when a ≠ b, if there is a path of length at least one in R from a to b, then there is such a path with length not exceeding n − 1.

Theorem 3 LetMR be the zero–one matrix of the relation R on a set with n elements. Then the zero–one matrix of the transitive closure R∗ is MR∗ = MR ∨M[2] R ∨M[3] R ∨⋯∨M[n] R .

t(R)=RR2R3...Rnt(R) = R\cup R^{2}\cup R^{3}\cup ...\cup R^{n}

重要结论

定理:设 RA×AR\subseteq A\times AAA \neq \varnothing

  • R 自反 等价于 r(R) = R

  • R 对称 等价于 s(R) = R

  • R 传递 等价于 t(R) = R

定理:设 R1R2A×AR_{1}\subseteq R_{2}\subseteq A\times AAA \neq \varnothing

  • r(R1)r(R2)r(R_{1})\subseteq r(R_{2})

  • s(R1)s(R2)s(R_{1})\subseteq s(R_{2})

  • t(R1)t(R2)t(R_{1})\subseteq t(R_{2})


9.4.2 Warshall's Algorithm Warshall 算法

Interior vertices 内点

离散复习资料之一(Warshall算法)

Warshall算法(用法详解,并转换成代码的形式)


9.5 Equivalence Relations 等价关系

9.5.1 Equivalence Relations 等价关系

定义:R 是 A 上的二元关系,如果 R 是

  • 自反的

  • 对称的

  • 传递的

则称 R 为等价关系。(a,b)R(a, b)\in R 称 a 与 b 等价

完全关系(全域关系):

每个结点都有自环,且两两之间有双向边

Pasted image 20220913222308.png


9.5.2 Equivalence Classes and Partitions 等价类和划分

Equivalence Classes 等价类

[a]R={bbAaRb}[a]_{R} = \{b|b\in A \land aRb\}

If b ∈ [a], then b is called a representative 代表元 of this equivalence class

例如同余关系。

如何根据等价类关系图求等价类:

  • 每个独立子图上的结点构成一个等价类

  • 独立子图个数 = 不同等价类个数

等价类性质:

  • 同一个等价类中的元素,彼此有等价关系

  • 同一关系的两个不同等价类交集为空

  • 两个等价类相等,当且仅当他们的代表元有等价关系

  • 等价关系的所有等价类构成的集合是原集合的一个划分

Parition 划分

集合的划分:

  • 若干子集非空(划分里不能有空集)

  • 两个子集交集为空

  • 所有子集并集为原集合

平凡划分:

  • 最粗的划分(只有一个子集)

  • 最细的划分(每个元素都构成一个子集)

可以通过划分 P 确定一个集合的等价关系

可以通过等价关系确定划分 P


9.5.3 Quotient 商集

商集

等价关系 R 确定 A 上的等价类,等价类的集合称为 A 上关于 R 的商集

有限集合划分的判断:

  • 等价关系,用穷举法很难判别

  • 用关系图比较直观,明确

  • 用集合的划分来研究等价关系

相容关系

定义:给定集合 X 上的关系 R ,若 R 是自反的、对称的(不传递),则 R 是 A 上相容关系

相容关系的关系图:

简化:(1)不画环;(2)简化双向边:两条对称边用一条无向边代替

相容类及最大相容类

相容类:设 RR 是集合 XX 上的相容关系,CXC\subseteq X ,如果对于 CC 中任意元素 x,yx, y ,有 (x,y)R(x, y)\in R ,称 CCRR 的一个相容类。

最大相容类:设 RR 是集合 XX 上的相容关系,CCRR 的一个相容类,如果 CC 不能被其它相容类所真包含,则称 CC 是一个最大相容类。

从简化图找最大相容类:

找最大完全多边形,即含有结点最多,每个结点都与其它所有结点相连的多边形

在相容关系的简化图中,每个最大完全多边形的结点集合构成一个最大相容类

最大相容类的完全覆盖

定义:R 是 X 中的相容关系,由 R 的所有最大相容类为元素构成的集合,称之为 X 的完全覆盖。记作 Cr(X)C_{r}(X)

9.5.4 等价关系的运算

定理:

  • R1,R2R_{1}, R_{2} 是 A 上的等价关系,则 R1R2R_{1}\cap R_{2} 也是等价关系

  • R1,R2R_{1}, R_{2} 是 A 上的等价关系,则 R1R2R_{1}\cup R_{2}相容关系


家庭作业:

9.4

Pasted image 20220913230525.png

Pasted image 20220913230548.png

Pasted image 20220913230604.png

9.5

Pasted image 20220913230640.png

Pasted image 20220913230703.png

Pasted image 20220913230727.png

Pasted image 20220913230741.png