Combinatorial Mathematics Chapter 8 Relations. Outline 8.1 Relations and their properties 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

Relations Relations on a Set. Properties of Relations.
8.6 Partial Orderings. Definition Partial ordering– a relation R on a set S that is Reflexive, Antisymmetric, and Transitive Examples? R={(a,b)| a is.
Chap6 Relations Def 1: Let A and B be sets. A binary relation from A
Applied Discrete Mathematics Week 11: Graphs
Chapter 7 Relations : the second time around
4 第四章 矩阵 学时:  18 学时。 教学手段:  讲授和讨论相结合,学生课堂练习,演练习题与辅导答疑相结合。 基本内容和教学目的:  基本内容: 矩阵的运算,可逆矩阵,初等矩阵及其性质和意义, 分块矩阵。  教学目的:  1 .使学生理解和掌握矩阵等价的相关理论  2 .能熟练地进行矩阵的各种运算.
CSE115/ENGR160 Discrete Mathematics 05/03/11 Ming-Hsuan Yang UC Merced 1.
第 4 章 抽象解释 内容概述 以一种独立于编程语言的方式,介绍抽象解释的 一些本质概念 – 将 “ 程序分析对语言语义是正确的 ” 这个概念公式 化 – 用 “ 加宽和收缩技术 ” 来获得最小不动点的较好的 近似,并使所需计算步数得到限制 – 用 “ 伽罗瓦连接和伽罗瓦插入 ” 来把代价较大的属 性空间用代价较小的属性空间来代替.
例9:例9: 第 n-1 行( -1 )倍加到第 n 行上,第( n-2 ) 行( -1 )倍加到第 n-1 行上,以此类推, 直到第 1 行( -1 )倍加到第 2 行上。
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第三十八讲 ) 离散数学. 第八章 格与布尔代数 §8.1 引 言 在第一章中我们介绍了关于集 合的理论。如果将 ρ ( S )看做 是集合 S 的所有子集组成的集合, 于是, ρ ( S )中两个集合的并 集 A ∪ B ,两个集合的交集.
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第四十八讲 ) 离散数学. 例 设 S 是一个非空集合, ρ ( s )是 S 的幂集合。 不难证明 :(ρ(S),∩, ∪,ˉ, ,S) 是一个布尔代数。 其中: A∩B 表示 A , B 的交集; A ∪ B 表示 A ,
线性代数习题课 吉林大学 术洪亮 第一讲 行 列 式 前面我们已经学习了关 于行列式的概念和一些基本 理论,其主要内容可概括为:
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第二十五讲 ) 离散数学. 定理 群定义中的条件 ( 1 )和( 2 )可以减弱如下: ( 1 ) ’ G 中有一个元素左壹适合 1 · a=a; ( 2 ) ’ 对于任意 a ,有一个元素左逆 a -1 适 合 a -1 ·
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
数 学 系 University of Science and Technology of China DEPARTMENT OF MATHEMATICS 第 3 章 曲线拟合的最小二乘法 给出一组离散点,确定一个函数逼近原函数,插值是这样的一种手段。 在实际中,数据不可避免的会有误差,插值函数会将这些误差也包括在内。
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第三十九讲 ) 离散数学. 例 设 S 是一个集合, ρ ( S )是 S 的幂集合,集合 的交( ∩ ),并(∪)是 ρ ( S )上的两个代数运算, 于是,( ρ ( S ), ∩ ,∪) 是一个格。而由例 知.
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第四十五讲 ) 离散数学 模 格 定义 设( L , ≤ ) 是一个格,对任意 a , b , c ∈ L , 如果 a≤b ,都有 a  ( b×c ) = b× ( a  c ) 则称( L , ≤ )为模格。
数 学 系 University of Science and Technology of China DEPARTMENT OF MATHEMATICS 第 5 章 解线性方程组的直接法 实际中,存在大量的解线性方程组的问题。很多数值方 法到最后也会涉及到线性方程组的求解问题:如样条插值的 M 和.
主讲教师:陈殿友 总课时: 124 第十一讲 极限的运算法则. 第一章 二、 极限的四则运算法则 三、 复合函数的极限运算法则 一 、无穷小运算法则 机动 目录 上页 下页 返回 结束 §5 极限运算法则.
在发明中学习 线性代数 概念的引入 李尚志 中国科学技术大学. 随风潜入夜 : 知识的引入 之一、线性方程组的解法 加减消去法  方程的线性组合  原方程组的解是新方程的解 是否有 “ 增根 ” ?  互为线性组合 : 等价变形  初等变换  高斯消去法.
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第五十三讲 ) 离散数学. 定义 设 G= ( V , T , S , P ) 是一个语法结构,由 G 产生的语言 (或者说 G 的语言)是由初始状态 S 演绎出来的所有终止符的集合, 记为 L ( G ) ={w  T *
平行线的平行公理与判定 九年制义务教育七年级几何 制作者:赵宁睿. 平行线的平行公理与判定 要点回顾 课堂练习 例题解析 课业小结 平行公理 平行判定.
Department of Mathematics 第二章 解析函数 第一节 解析函数的概念 与 C-R 条件 第二节 初等解析函数 第三节 初等多值函数.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Partially Ordered Sets (POSets)
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Discrete Structures – CNS2300
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
1 、如果 x + 5 > 4 ,那么两边都 可得 x >- 1 2 、在- 3y >- 4 的两边都乘以 7 可得 3 、在不等式 — x≤5 的两边都乘以- 1 可得 4 、将- 7x — 6 < 8 移项可得 。 5 、将 5 + a >- 2 a 移项可得 。 6 、将- 8x < 0.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
Discrete Mathematics Chapter 2 Basic Structures : Sets, Functions, Sequences, and Sums 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
§10.2 对偶空间 一、对偶空间与对偶基 二、对偶空间的有关结果 三、例题讲析.
请同学们仔细观察下列两幅图有什么共同特点? 如果两个图形不仅形状相同,而且每组对应点所在的直线 都经过同一点, 那么这样的两个图形叫做位似图形, 这个点叫做位 似中心.
Relations and their Properties
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
力的合成 力的合成 一、力的合成 二、力的平行四边形 上一页下一页 目 录 退 出. 一、力的合成 O. O. 1. 合力与分力 我们常常用 一个力来代替几个力。如果这个 力单独作用在物体上的效果与原 来几个力共同作用在物体上的效 果完全一样,那么,这一个力就 叫做那几个力的合力,而那几个 力就是这个力的分力。
Discrete Mathematics Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Discrete Mathematics Section 3.7 Applications of Number Theory 大葉大學 資訊工程系 黃鈴玲.
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
逻辑设计基础 1 第 7 章 多级与(或)非门电路 逻辑设计基础 多级门电路.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
人 有 悲 欢 离 合, 月有阴晴圆缺。月有阴晴圆缺。 华师大版七年级数学第二册 海口市第十中学 数学组 吴锐.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
1 第三章 数列 数列的概念 考点 搜索 ●数列的概念 ●数列通项公式的求解方法 ●用函数的观点理解数列 高考 猜想 以递推数列、新情境下的 数列为载体, 重点考查数列的通 项及性质, 是近年来高考的热点, 也是考题难点之所在.
目录 上页 下页 返回 结束 二、无界函数反常积分的审敛法 * 第五节 反常积分 无穷限的反常积分 无界函数的反常积分 一、无穷限反常积分的审敛法 反常积分的审敛法  函数 第五章 第五章.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Chapter8 Relations 8.1: Relations and their properties.
Relations and Their Properties
CSE 2813 Discrete Structures
CSE15 Discrete Mathematics 05/03/17
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Equivalence Relations
Relations Chapter 9.
Discrete Mathematics Chapter 7 Relations.
Relations and Digraphs
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Relations: The Second Time Around
Chapter 8 (Part 2): Relations
Presentation transcript:

Combinatorial Mathematics Chapter 8 Relations

Outline 8.1 Relations and their properties 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence Relations 8.6 Partial Orderings Ch8-2

Ch Relations and their properties ※ The most direct way to express a relationship between elements of two sets is to use ordered pairs. For this reason, sets of ordered pairs are called binary relations. Example 1. A : the set of students in your school. B : the set of courses. R = { (a, b) : a  A, b  B, a is enrolled in course b } Def 1 Let A and B be sets. A binary relation from A to B is a subset R of A  B = { (a, b) : a  A, b  B }.

Ch8-4 Def 1’. We use the notation aRb to denote that (a, b)  R, and aRb to denote that (a,b)  R. Moreover, a is said to be related to b by R if aRb a b A B R R  A  B = { (0,a), (0,b), (1,a) (1,b), (2,a), (2,b)} RR RR Example 3. Let A={0, 1, 2} and B={a, b}, then {(0,a),(0,b),(1,a),(2,b)} is a relation R from A to B. This means, for instance, that 0Ra, but that 1Rb.

Ch8-5 Examples: A : 男生, B : 女生, R : 夫妻关系 A : 城市, B : 州, 省 R : 属于 (Example 2) Note. Relations vs. Functions A relation can be used to express a 1-to-many relationship between the elements of the sets A and B. ( function 不可一对多,只可多对一 ) Def 2. A relation R on the set A is a relation from A to A. (i.e., R is a subset of A  A ) Exercise: 1 Properties on a Set

Ch8-6 Example 4. Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = { (a, b)| a divides b }? Sol : R = { (1,1), (1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4) } AA

Ch8-7 Example 5. Consider the following relations on Z. R 1 = { (a, b) | a  b } R 2 = { (a, b) | a > b } R 3 = { (a, b) | a = b or a =  b } R 4 = { (a, b) | a = b } R 5 = { (a, b) | a = b+1 } R 6 = { (a, b) | a + b  3 } Which of these relations contain each of the pairs (1,1), (1,2), (2,1), (1,  1), and (2,2)? Sol : (1,1)(1,2)(2,1) (1,  1) (2,2) R1R1 R2R2 R3R3 R4R4 R5R5 R6R6 ●●● ●● ●●● ● ● ● ● ● ●●

Ch8-8 Example 6. How many relations are there on a set with n elements? Sol : A relation on a set A is a subset of A  A.  A  A has n 2 elements.  A  A has 2 n 2 subsets.  There are 2 n 2 relations.

Ch8-9 Def 3. A relation R on a set A is called reflexive ( 反身性 ) if (a,a)  R for every a  A. Example 7. Consider the following relations on {1, 2, 3, 4} : R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } which of them are reflexive ? Sol : R 3 Properties of Relations

Ch8-10 Example 8. Which of the relations from Example 5 are reflexive? R 1 = { (a, b) | a  b } R 2 = { (a, b) | a > b } R 3 = { (a, b) | a = b or a =  b } R 4 = { (a, b) | a = b } R 5 = { (a, b) | a = b+1 } R 6 = { (a, b) | a + b  3 } Sol : R 1, R 3 and R 4 Example 9. Is the “divides” relation on the set of positive integers reflexive? Sol : Yes.

Ch8-11 Def 4. (1) A relation R on a set A is called symmetric if for a, b  A, (a, b)  R  (b, a)  R. (2) A relation R on a set A is called antisymmetric ( 反对称 ) if for a, b  A, (a, b)  R and (b, a)  R  a = b. i.e., a≠b and (a,b)  R  (b, a)  R 若 a=b 则不要求, (a,a)  R or (a, a)  R 皆可

Ch8-12 Example 10. Which of the relations from Example 7 are symmetric or antisymmetric ? R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } Sol : R 2, R 3 are symmetric R 4 are antisymmetric. Example 11. Is the “divides” relation on the set of positive integers symmetric? Is it antisymmetric? Sol : It is not symmetric since 1|2 but 2 | 1. It is antisymmetric since a|b and b|a implies a=b.

Ch8-13 补充 : antisymmetric 跟 symmetric 可并存  (a, b)  R, a≠b sym.  (b, a)  R antisym.  (b,a)  R 故若 R 中没有 (a, b) with a≠b 即可同时满足 eg. Let A = {1,2,3}, give a relation R on A s.t. R is both symmetric and antisymmetric, but not reflexive. Sol : R = { (1,1),(2,2) }

Ch8-14 Def 5. A relation R on a set A is called transitive( 传递 ) if for a, b, c  A, (a, b)  R and (b, c)  R  (a, c)  R. Example 15. Is the “divides” relation on the set of positive integers transitive? Sol : Suppose a|b and b|c  a|c  transitive

Ch8-15 Example 13. Which of the relations in Example 7 are transitive ? R 2 = { (1,1), (1,2), (2,1) } R 3 = { (1,1), (1,2), (1,4), (2,1), (2,2), (3,3), (4,1), (4,4) } R 4 = { (2,1), (3,1), (3,2), (4,1), (4,2), (4,3) } Sol : R 2 is not transitive since (2,1)  R 2 and (1,2)  R 2 but (2,2)  R 2. R 3 is not transitive since (2,1)  R 3 and (1,4)  R 3 but (2,4)  R 3. R 4 is transitive.

Ch8-16 Example 16. How many reflexive relation are there on a set with n elements? Sol : A relation R on a set A is a subset of A  A.  A  A has n 2 elements  R contains (a,a)  a  A since R is reflexive  There are 2 n 2  n reflexive relations. Exercise: 7, 43

Ch8-17 Example 17. Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relation R 1 = {(1,1), (2,2), (3,3)} and R 2 = {(1,1), (1,2), (1,3), (1,4)} can be combined to obtain R 1 ∪ R 2 = {(1,1), (2,2), (3,3), (1,2), (1,3), (1,4)} R 1 ∩ R 2 = {(1,1)} R 1 - R 2 = {(2,2), (3,3)} R 2 - R 1 = {(1,2), (1,3), (1,4)} R 1  R 2 = {(2,2), (3,3), (1,2), (1,3), (1,4)} symmetric difference, 即 ( R 1  R 2 ) – ( R 1  R 2 ) Combining Relations

Ch8-18 Def 6. Let R be a relation from a set A to a set B and S a relation from B to a set C. The composite ( 合成 ) of R and S is the relation consisting of ordered pairs ( a, c ), where a  A, c  C, and for which there exists an element b  B such that ( a, b )  R and ( b, c )  S. We denote the composite of R and S by S  R. Example 20. What is the composite of relations R and S, where R is the relation from {1, 2, 3} to {1, 2, 3, 4} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S is the relation from {1, 2, 3, 4} to {0, 1, 2} with S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)} ? Sol. S  R is the relation from {1, 2, 3} to {0, 1, 2} with S  R = {(1, 0), (1,1), (2, 1), (2, 2), (3, 0), (3, 1)}.

Ch8-19 Def 7. Let R be a relation on the set A. The powers R n, n = 1, 2, 3, …, are defined recursively by R 1 = R and R n+1 = R n  R. Sol. R 2 = R  R = {(1, 1), (2, 1), (3, 1), (4, 2)}. Example 22. Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find the powers R n, n=2, 3, 4,…. R 3 = R 2  R = {(1, 1), (2, 1), (3, 1), (4, 1)}. R 4 = R 3  R = {(1, 1), (2, 1), (3, 1), (4, 1)} = R 3. Therefore R n = R 3 for n=4, 5, …. Thm 1. The relation R on a set A is transitive if and only if R n  R for n = 1, 2, 3, …. Exercise: 54

Ch Representing Relations Suppose that R is a relation from A={a 1, a 2, …, a m } to B = {b 1, b 2,…, b n }. The relation R can be represented by the matrix M R = [m ij ], where m ij = 1, if (a i,b j )  R 0, if (a i,b j )  R Representing Relations using Matrices

Ch8-21 Example 1. Suppose that A = {1, 2, 3} and B = {1, 2} Let R = {(a, b) | a > b, a  A, b  B}. What is the matrix M R representing R ? Sol : A B R = {(2, 1), (3, 1), (3, 2)} Note. 不同的 A,B 的元素顺序会制造不同的 M R 。 若 A=B, 行列应使用相同的顺序。 Exercise: 1

Ch8-22 ※ The relation R is symmetric iff (a i,a j )  R  (a j,a i )  R. This means m ij = m ji ( 即 M R 是对称矩阵 ). ※ Let A={a 1, a 2, …,a n }. A relation R on A is reflexive iff ( a i, a i )  R,  i. i.e., a1a1 …a2a2 … a1a1 anan : anan : a2a2 对角在线全为 1

Ch8-23 ※ The relation R is antisymmetric iff (a i,a j )  R and i  j  (a j,a i )  R. This means that if m ij =1 with i≠j, then m ji =0. i.e., ※ transitive 性质不易从矩阵直接判断出来,需做运算

Ch8-24 Example 3. Suppose that the relation R on a set is represented by the matrix Is R reflexive, symmetric, and/or antisymmetric ? Sol : reflexive symmetric not antisymmetric

Ch8-25 eg. Suppose that S={0, 1, 2, 3}. Let R be a relation containing (a, b) if a  b, where a  S and b  S. Is R reflexive, symmetric, antisymmetric ? Sol : ∴ R is reflexive and antisymmetric, not symmetric. Exercise: 7 Def. irreflexive( 非反身性 ) : ( a, a )  R,  a  A

Ch8-26 Example 4. Suppose the relations R 1 and R 2 on a set A are represented by the matrices Sol : What are the matrices representing R 1  R 2 and R 1  R 2 ?

Ch8-27 Example 5. Find the matrix representing the relation S  R, where the matrices representing R and S are Sol :  M R  M S ( 矩阵乘法 ) 之后将 >1 的数字改为 1

Ch8-28 Example 6. Find the matrix representing the relation R 2, where the matrix representing R is Sol : Exercise: 14

Ch8-29 Example 8. Show the digraph of the relation R={(1,1),(1,3),(2,1),(2,3),(2,4), (3,1),(3,2),(4,1)} on the set {1,2,3,4}. Sol : vertex( 点 ) : 1, 2, 3, 4 edge( 边 ) : (1,1), (1,3), (2,1), (2,3), (2,4), (3,1), (3,2), (4,1) Representing Relations using Digraphs Def 1. A directed graph (digraph) consists of a set V of vertices (or nodes) together with a set E of ordered pairs of elements of V called edges (or arcs) Exercise: 26,27

Ch8-30 ※ The relation R is reflexive iff for every vertex, ( 每个点上都有 loop ) ※ The relation R is symmetric iff for any vertices x ≠ y, either 两点间若有边,必只有一条边 ※ The relation R is antisymmetric iff for any x ≠ y, ( 两点间若有边,必为一对不同方向的边 ) or xy x y x y xyxy

Ch8-31 ※ The relation R is transitive iff for a, b, c  A, (a, b)  R and (b, c)  R  (a, c)  R. This means:  ( 只要点 x 有路径走到点 y , x 必定有边直接连向 y ) a b dc a b dc

Ch8-32 Example 10. Determine whether the relations R and S are reflexive, symmetric, antisymmetric, and/or transitive Sol : R : irreflexive( 非反身性 ) 的定义在 p.528 即 ( a, a )  R,  a  A not reflexive, symmetric not antisymmetric not transitive ( b → a, a → c, b → c ) Exercise: 31 a b c reflexive, not symmetric, not antisymmetric, not transitive ( a → b, b → c, a → c ) a b cd S

Ch Closures of Relations The relation R={(1,1), (1,2), (2,1), (3,2)} on the set A={1, 2, 3} is not reflexive. Q: How to construct a smallest reflexive relation R r such that R  R r ? ※ Closures Sol: Let R r = R  {(2,2), (3,3)}. i. e., R r = R  , where  ={(a, a)| a  A}. R r is a reflexive relation containing R that is as small as possible. It is called the reflexive closure of R.

Ch8-34 Example 1. What is the reflexive closure of the relation R={(a,b) | a < b} on the set of integers ? Sol : R r = R ∪  = {(a,b) | a < b}  ∪ { (a, a) | a  Z } = { (a, b) | a  b, a, b  Z } Example : The relation R={ (1,1),(1,2),(2,2),(2,3),(3,1),(3,2) } on the set A={1,2,3} is not symmetric. Find a smallest symmetric relation R s containing R. Sol : Let R  1 ={ (b, a) | (a, b)  R } Let R s = R ∪ R  1 ={ (1,1),(1,2),(2,1),(2,2),(2,3), (3,1),(1,3),(3,2) } R s is called the symmetric closure of R.

Ch8-35 Example 2. What is the symmetric closure of the relation R={(a, b) | a > b } on the set of positive integers ? Sol : R ∪ { (b, a) | a > b } = { (c, d) | c  d } Exercise: 1,9

Ch8-36 Def : 1.(reflexive closure of R on A ) R r =the smallest reflexive relation containing R. R r = R ∪ { (a, a) | a  A, (a, a)  R} 2.(symmetric closure of R on A ) R s =the smallest symmetric relation containing R. R s =R ∪ { (b, a) | (a, b)  R and (b, a)  R} 3.(transitive closure of R on A ) ( 后面再详细说明 ) R t =the smallest transitive relation containing R. R t =R ∪ {(a, c) | (a, b)  R t and (b, c)  R t, but (a, c)  R t }(repeat) Note. There is no antisymmetric closure ,因若不是 antisymmetric , 表示有 a≠b, 且 (a, b) 及 (b, a) 都  R ,此时加任何 pair 都不可能变成 antisymmetric.

Ch8-37 Paths in Directed Graphs Def 1. A path from a to b in the digraph G is a sequence of edges ( x 0, x 1 ), ( x 1, x 2 ), …, ( x n-1, x n ) in G, where n  Z +, and x 0 = a, x n = b. This path is denoted by x 0, x 1, x 2, …, x n and has length n Ex. A path from 1 to 5 of length 4 Theorem 1 Let R be a relation on a set A. There is a path of length n, where n  Z +, from a to b if and only if ( a, b )  R n.

Ch8-38 Transitive Closures Def 2. Let R be a relation on a set A. The connectivity relation R* consists of pairs ( a, b ) such that there is a path of length at least one from a to b in R. i.e., Theorem 2 The transitive closure of a relation R equals the connectivity relation R*. Lemma 1 Let R be a relation on a set A with |A|=n. then

Ch8-39 Example. Let R be a relation on a set A, where A={1,2,3,4,5}, R={(1,2),(2,3),(3,4),(4,5)}. What is the transitive closure R t of R ? Sol : ∴ R t = R  R 2  R 3  R 4  R 5 = {(1,2),(2,3),(3,4),(4,5), (1,3), (2,4), (3,5), (1,4), (2,5), (1,5)}

Theorem 3 Let M R 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 Example 7. Find the zero-one matrix of the transitive closure of the relation R where Sol : Exercise: 25 Ch8-40

Ch Equivalence Relations ( 等价关系 ) Def 1. A relation R on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. Example 1. Let R be the relation on the set of integers such that aRb if and only if a=b or a=  b. Then R is an equivalence relation. Example 2. Let R be the relation on the set of real numbers such that aRb if and only if a  b is an integer. Then R is an equivalence relation.

Ch8-42 Example 3. (Congruence Modulo m ) Let m  Z and m > 1. Show that the relation R={ (a,b) | a≡b (mod m) } is an equivalence relation on the set of integers. Note that a≡b(mod m) iff m | (a  b). ∵  a≡a (mod m)  (a, a)  R  reflexive  If a≡b(mod m), then a  b=km, k  Z  b  a= (  k)m  b≡a (mod m)  symmetric  If a≡b(mod m), b≡c(mod m) then a  b=km, b  c=lm  a  c=(k+l)m  a≡c(mod m)  transitive ∴ R is an equivalence relation. Sol : ( a is congruent to b modulo m, a 与 b 除以 m 后余数相等 )

Ch8-43 Example 4. Let l(x) denote the length of the string x. Suppose that the relation R={(a,b) | l(a)=l(b), a,b are strings of English letters } Is R an equivalence relation? Sol :  (a,a)  R  string a  reflexive  (a,b)  R  (b,a)  R  symmetric  (a,b)  R, (b,c)  R  (a,c)  R  transitive Yes.

Ch8-44 Example 7. Let R be the relation on the set of real numbers such that xRy if and only if x and y differ by less than 1, that is |x  y| < 1. Show that R is not an equivalence relation. Sol :  xRx  x since x  x =0  reflexive  xRy  |x  y| < 1  |y  x| < 1  yRx  symmetric  xRy, yRz  |x  y| < 1, |y  z| < 1  |x  z| < 1  Not transitive Exercise: 3, 23 

Ch8-45 Def 3. Let R be an equivalence relation on a set A. The equivalence class of the element a  A is [a] R = { s | (a, s)  R } For any b  [a] R, b is called a representative of this equivalence class. Note: If (a, b)  R, then [a] R =[b] R. Equivalence Classes

Ch8-46 Example 9. What are the equivalence class of 0 and 1 for congruence modulo 4 ? Sol : Let R={ (a,b) | a≡b (mod 4) } Then [0] R = { s | (0,s)  R } = { …,  8,  4, 0, 4, 8, … } [1] R = { t | (1,t)  R } = { …,  7,  3, 1, 5, 9,…} Exercise: 25, 29

Ch8-47 Def. A partition ( 分割 ) of a set S is a collection of disjoint nonempty subsets A i of S that have S as their union. In other  words, we have A i ≠ ,  i, A i ∩ A j = , for any i≠j, and ∪ A i = S. Equivalence Classes and Partitions Example 12. Suppose that S={1, 2, 3, 4, 5, 6}. The collection of sets A 1 ={1, 2, 3}, A 2 ={4, 5}, and A 3 ={6} form a partition of S.

Ch8-48 Thm 2. Let R be an equivalence relation on a set A. Then the equivalence classes of R form a partition of A. Sol : R={ (a, b) | a, b  A 1 }  { (a, b) | a, b  A 2 }  { (a, b) | a, b  A 3 } ={(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3), (4,4), (4, 5), (5,4), (5, 5), (6, 6)} Exercise: 47 Example 13. List the ordered pairs in the equivalence relation R produced by the partition A 1 ={1, 2, 3}, A 2 ={4, 5}, and A 3 ={6} of S={1, 2, 3, 4, 5, 6}.

Ch8-49 Example 14. The equivalence classes of the congruence modulo 4 relation form a partition of the integers. Sol : [0] 4 = { …,  8,  4, 0, 4, 8, … } [1] 4 = { …,  7,  3, 1, 5, 9, … } [2] 4 = { …,  6,  2, 2, 6, 10, … } [3] 4 = { …,  5,  1, 3, 7, 11, … }

Ch Partial Orderings Def 1. A relation R on a set S is called a partial ordering ( 偏序 ) or partial order if it is reflexive, antisymmetric, and transitive. A set S together with a partial ordering R is called a partially ordered set, or poset, and is denoted by ( S, R ). Example 1. Show that the “greater than or equal” (  ) is a partial ordering on the set of integers. Sol :  x  x  x  Z  reflexive  If x  y and y  x then x = y.  antisymmetric  x  y, y  z  x  z  transitive Exercise: 1, 5, 9

Ch8-51 Def 2. The elements a and b of a poset ( S, ) are called comparable if either a b or b a. When a and b are elements of S such that neither a b or b a, a and b are called incomparable. Example 5. In the poset (Z +, |), are the integers 3 and 9 comparable? Are 5 and 7 comparable? Sol : 3|9  comparable 5 | 7 and 7 | 5  incomparable Exercise: 14

Ch8-52 Def 3. If ( S, ) is a poset and every two elements of S are comparable, S is called a totally ordered or linearly ordered set, and is called a total order ( 全序 ) or a linear order. A totally ordered set is also called a chain. Example 6. The poset (Z, ≤) is totally ordered, because a ≤ b or b ≤ a whenever a and b are integers. Example 7. The poset (Z +, |) is not totally ordered.

Ch8-53 Lexicographic Order ( 词汇编纂的 ) The words in a dictionary are listed in alphabetic, or lexicographic, order, which is based on the ordering of the letters in the alphabet. Def. Let ( A 1, 1 ) and ( A 2, 2 ) be two posets. The lexicographic ordering on A 1  A 2 is defined as (a 1, a 2 ) (b 1, b 2 ) either if a 1 1 b 1 or if both a 1 = b 1 and a 2 2 b 2 We obtain a partial ordering by adding equality to the ordering on A 1  A 2.

Ch8-54 Example 9. In the poset (Z  Z, ), where is the lexicographic ordering constructed from the usual ≤ relation on Z. (3, 5) (4, 8), (3, 8) (4, 5), (4, 9) (4, 11) Exercise: 17 Hasse Diagrams ( 用来描述 poset 中元素的大小关系 ) 将 poset 用图形表示,若 a, b 是 comparable 且 a b , 则将 ab 间连一条边,并将 b 节点放在 a 节点的上面, 但若 a b c ,则不画 ac 间的边。

Ch8-55 Example 12. Draw the Hasse diagram representing the partial ordering {(a, b) | a divides b} on {1, 2, 3, 4, 6, 8, 12}. Sol :

Ch8-56 Example 13. Draw the Hasse diagram for the partial ordering {(A, B) | A  B} on the power set P(S) where S={a, b, c}. Sol : Exercise: 23  {a}{a} {b, c} {c}{c} {b}{b} {a, c} {a, b} {a, b, c}

Ch8-57 Maximal and Minimal Elements Def. An element a  S is maximal in the poset (S, ) if there is no b  S such that a b. Similarly, an element a  S is minimal if there is no b  S such that b a. a is the greatest element of the poset (S, ) if b a for all b  S. a is the least element of (S, ) if a b for all b  S. Example 12 中 8, 12 是 maximal , 1 是 least 也是 minimal , 没有 greatest element

Ch Ex A={2, 6} upper bound of A : 6, 12 lower bound of A : 1, 2 Def. Let A be a subset of a poset ( S, ). If u is an element of S such that a u for all elements a  A, then u is called an upper bound of A. If l is an element of S such that l a for all elements a  A, then l is called an lower bound of A.

Ch8-59 Ex A 1 ={d, e}, A 2 ={b, c} least upper bound of A 1 = f A 1 has no greatest lower bound A 2 has no least upper bound greatest lower bound of A 2 = a b a c d f e g z Def. Let A be a subset of a poset ( S, ). An element x is called the least upper bound of A if x is an upper bound of A and x z whenever z is an upper bound of A. Let A be a subset of a poset ( S, ). An element x is called the greatest lower bound of A if x is a lower bound of A and y x whenever y is a lower bound of A.

Ch8-60 Lattices Def. A partially ordered set in which every pair of elements has both a least upper bound and a greatest lower bound is called a lattice. Example 21. Determine whether the following posets are lattices. (a) (b) (c) a cd e f b b a c d e f a dc g h b ef yes ( b,c ) 没有 l.u.b.  no

Ch8-61 Example 22. Is the poset ( Z +, |) a lattice? Sol : For any a, b  Z +, gcd(a,b) is the greatest lower bound of a, b. lcm(a,b) is the least upper bound of a, b.  Yes Example 23. Determine whether the posets ({1, 2, 3, 4, 5}, |) and ({1, 2, 4, 8, 16}, |) are lattices. Sol : In ({1, 2, 3, 4, 5}, |), 2 and 3 has no l.u.b.  No. In ({1, 2, 4, 8, 16}, |), any a, b has l.u.b. and g.l.b.  Yes. Exercise: 43

Ch8-62 Topological Sorting Suppose that a project is made up of 20 different tasks. Some tasks can be completed only after others have been finished. How can an order be found for these tasks? Def. A total ordering is said to be compatible ( 相容 ) with the partial ordering R if a b whenever aRb. Constructing a compatible total ordering from a partial ordering is called topological sorting. Lemma 1. Every finite nonempty poset ( S, ) has at least one minimal element.

Ch8-63 Exercise: 62 Example 26. Find a compatible total ordering for the poset ({1, 2, 4, 5, 12, 20}, | ). Sol : Topological sorting 的方式: 逐次 output minimal element , 即得到由小到大的 compatible total ordering 跟 5 的顺序可交换, 12 跟 20 也是