9. Relations

9.1 Relations and Their Properties

A **binary relation**(二元关系) 离散数学及其应用 第9章 关系 - 图1 from a set 离散数学及其应用 第9章 关系 - 图2 to a set 离散数学及其应用 第9章 关系 - 图3 is a subset of 离散数学及其应用 第9章 关系 - 图4. 离散数学及其应用 第9章 关系 - 图5
Let 离散数学及其应用 第9章 关系 - 图6 be sets. An **n-ary Relation** on these sets is a subset of 离散数学及其应用 第9章 关系 - 图7. 离散数学及其应用 第9章 关系 - 图8are called the **domains** of relation, and 离散数学及其应用 第9章 关系 - 图9 is called the **degree** of the relation.
A **relation on the set** 离散数学及其应用 第9章 关系 - 图10 is a relation form 离散数学及其应用 第9章 关系 - 图11 to 离散数学及其应用 第9章 关系 - 图12.
There are 离散数学及其应用 第9章 关系 - 图13 binary relations on a set 离散数学及其应用 第9章 关系 - 图14 with 离散数学及其应用 第9章 关系 - 图15 elements

9.2 Representing Relations

📋The Methods of Representing Relations

  • List its all ordered pairs
  • Using a set build notation / specification by predicates
  • 2D table
  • Connection matrix / zero-one matrix
  • Directed graph / Digraph

📋2D table
🌰e.g.
离散数学及其应用 第9章 关系 - 图16, 离散数学及其应用 第9章 关系 - 图17, 离散数学及其应用 第9章 关系 - 图18. Represent the relation 离散数学及其应用 第9章 关系 - 图19 using a **2D table**.
Solution:
离散数学及其应用 第9章 关系 - 图20

2 3 4 5 6
2 × × ×
3 × ×
4 ×

📋Connection Matrices
Let 离散数学及其应用 第9章 关系 - 图21 be a relation from 离散数学及其应用 第9章 关系 - 图22 to 离散数学及其应用 第9章 关系 - 图23. An 离散数学及其应用 第9章 关系 - 图24 **connection matrix** 离散数学及其应用 第9章 关系 - 图25 for 离散数学及其应用 第9章 关系 - 图26 is defined by 离散数学及其应用 第9章 关系 - 图27.
🌰e.g.
The connection matrix for the 2D table above is 离散数学及其应用 第9章 关系 - 图28
📋Directed graph / Digraph
A **directed graph**(有向图) or a **digraph**, consists of a set 离散数学及其应用 第9章 关系 - 图29 of **vertices**(结点) together with a set 离散数学及其应用 第9章 关系 - 图30 of ordered pairs of elements of 离散数学及其应用 第9章 关系 - 图31 called **edges**(or arcs). The vertices 离散数学及其应用 第9章 关系 - 图32 is called the **initial vertices** and **terminal vertices** of the edge 离散数学及其应用 第9章 关系 - 图33.
🌰e.g.
离散数学及其应用 第9章 关系 - 图34, 离散数学及其应用 第9章 关系 - 图35. Show the relation with a directed graph.
image.png

9.3 n-ary Relations and Their Applications

📋 Properties of Binary Relations

  • Reflexive
  • Irreflexive
  • Symmetric
  • Antisymmetric
  • Transitive

A relation 离散数学及其应用 第9章 关系 - 图37 on a set 离散数学及其应用 第9章 关系 - 图38 is **reflexive**(自反) if 离散数学及其应用 第9章 关系 - 图39. In matrices representing reflexive relations, all the elements on the main diagonal of 离散数学及其应用 第9章 关系 - 图40 must be 1. In digraphs representing reflexive relations, there is a loop at every vertex.
A relation 离散数学及其应用 第9章 关系 - 图41 on a set 离散数学及其应用 第9章 关系 - 图42 is **irreflexive**(反自反) if 离散数学及其应用 第9章 关系 - 图43. In matrices representing irreflexive relations, all the elements on the main diagonal of 离散数学及其应用 第9章 关系 - 图44 must be 0. In digraphs representing irreflexive relations, there is no loop at any vertex.
⚠️ A relation on a set can be neither reflexive nor irreflexive, for example, 离散数学及其应用 第9章 关系 - 图45.
A relation 离散数学及其应用 第9章 关系 - 图46 on a set 离散数学及其应用 第9章 关系 - 图47 is **symmetric**(对称) if 离散数学及其应用 第9章 关系 - 图48. Matrices representing symmetric relations 离散数学及其应用 第9章 关系 - 图49 must be symmetric. In digraphs representing symmetric relations, if there is an arc 离散数学及其应用 第9章 关系 - 图50 there must be an arc 离散数学及其应用 第9章 关系 - 图51.
A relation 离散数学及其应用 第9章 关系 - 图52 on a set 离散数学及其应用 第9章 关系 - 图53 is **antisymmetric**(反对称) if 离散数学及其应用 第9章 关系 - 图54, or equivalently 离散数学及其应用 第9章 关系 - 图55. In digraphs representing symmetric relations, if there is an arc 离散数学及其应用 第9章 关系 - 图56 connecting two different vertices, there can not be an arc 离散数学及其应用 第9章 关系 - 图57.
⚠️ A relation on a set can be both symmetric and antisymmetric, for example, 离散数学及其应用 第9章 关系 - 图58 again.
A relation 离散数学及其应用 第9章 关系 - 图59 on a set 离散数学及其应用 第9章 关系 - 图60 is **transitive**(传递) if 离散数学及其应用 第9章 关系 - 图61. In matrices representing transitive relations, 离散数学及其应用 第9章 关系 - 图62. In digraphs representing transitive relations, if there is an arc from 离散数学及其应用 第9章 关系 - 图63 to 离散数学及其应用 第9章 关系 - 图64 and one from 离散数学及其应用 第9章 关系 - 图65 to 离散数学及其应用 第9章 关系 - 图66 then there must be one from 离散数学及其应用 第9章 关系 - 图67 to 离散数学及其应用 第9章 关系 - 图68.
🌰 e.g.
Symmetric, Transitive ⇒ Reflexive?
Solution:
Since 离散数学及其应用 第9章 关系 - 图69 and 离散数学及其应用 第9章 关系 - 图70 is symmetric, 离散数学及其应用 第9章 关系 - 图71. Since 离散数学及其应用 第9章 关系 - 图72, 离散数学及其应用 第9章 关系 - 图73 and 离散数学及其应用 第9章 关系 - 图74 is transitive, 离散数学及其应用 第9章 关系 - 图75. But this is valid only for 离散数学及其应用 第9章 关系 - 图76 satisfying 离散数学及其应用 第9章 关系 - 图77. It is still possible that 离散数学及其应用 第9章 关系 - 图78 when 离散数学及其应用 第9章 关系 - 图79.
Since relations from 离散数学及其应用 第9章 关系 - 图80 to 离散数学及其应用 第9章 关系 - 图81 is a subset of 离散数学及其应用 第9章 关系 - 图82, two relations from 离散数学及其应用 第9章 关系 - 图83 to 离散数学及其应用 第9章 关系 - 图84 can be combined in any way two sets can be combined.
📋 Set Operations on Relations and Logical Operations of Matrices
We can solve the set operations on relations using exhaustive method, or logical operations of the matrices of the relations.
The Boolean Sum(布尔和) ∨: 离散数学及其应用 第9章 关系 - 图85
The Boolean Product(布尔积) ∧: 离散数学及其应用 第9章 关系 - 图86
The complement −: 离散数学及其应用 第9章 关系 - 图87
Let 离散数学及其应用 第9章 关系 - 图88, 离散数学及其应用 第9章 关系 - 图89, 离散数学及其应用 第9章 关系 - 图90, 离散数学及其应用 第9章 关系 - 图91, the set operations of two relations are defined by

  • 离散数学及其应用 第9章 关系 - 图92
  • 离散数学及其应用 第9章 关系 - 图93
  • 离散数学及其应用 第9章 关系 - 图94
  • 离散数学及其应用 第9章 关系 - 图95

📋 Composition of Relations
离散数学及其应用 第9章 关系 - 图96, 离散数学及其应用 第9章 关系 - 图97, then the **composite**(复合) of 离散数学及其应用 第9章 关系 - 图98 and 离散数学及其应用 第9章 关系 - 图99, denoted as 离散数学及其应用 第9章 关系 - 图100, is 离散数学及其应用 第9章 关系 - 图101.
To compute 离散数学及其应用 第9章 关系 - 图102, we can either use the definition directly or use the connection matrix.
🌰 e.g.
离散数学及其应用 第9章 关系 - 图103
Solution:
(1) Using the definition directly
离散数学及其应用 第9章 关系 - 图104
(2) Using the connection matrix
image.png
Let 离散数学及其应用 第9章 关系 - 图106 be a relation on the set 离散数学及其应用 第9章 关系 - 图107. The **powers** are defined inductively by 离散数学及其应用 第9章 关系 - 图108are defined inductively by 离散数学及其应用 第9章 关系 - 图109.
📋 The relation 离散数学及其应用 第9章 关系 - 图110 on the set 离散数学及其应用 第9章 关系 - 图111 is transive if and only if 离散数学及其应用 第9章 关系 - 图112, for 离散数学及其应用 第9章 关系 - 图113
image.png
For a relation 离散数学及其应用 第9章 关系 - 图115, the **inverse relation** from 离散数学及其应用 第9章 关系 - 图116 to 离散数学及其应用 第9章 关系 - 图117 is 离散数学及其应用 第9章 关系 - 图118.
📋 Methods to Get 离散数学及其应用 第9章 关系 - 图119

  1. Using the definition directly.
  2. Reverse all the arcs in the digraph representation of 离散数学及其应用 第9章 关系 - 图120.
  3. Take the transpose 离散数学及其应用 第9章 关系 - 图121 of the connection matrix 离散数学及其应用 第9章 关系 - 图122 of 离散数学及其应用 第9章 关系 - 图123.

📋 The Rroperties of Relation Operations
Suppose that 离散数学及其应用 第9章 关系 - 图124, 离散数学及其应用 第9章 关系 - 图125 are the relations from 离散数学及其应用 第9章 关系 - 图126 to 离散数学及其应用 第9章 关系 - 图127, 离散数学及其应用 第9章 关系 - 图128 is the relation from 离散数学及其应用 第9章 关系 - 图129 to 离散数学及其应用 第9章 关系 - 图130, 离散数学及其应用 第9章 关系 - 图131 is the relation from 离散数学及其应用 第9章 关系 - 图132 to 离散数学及其应用 第9章 关系 - 图133, then

  • 离散数学及其应用 第9章 关系 - 图134
  • 离散数学及其应用 第9章 关系 - 图135
  • 离散数学及其应用 第9章 关系 - 图136
  • 离散数学及其应用 第9章 关系 - 图137
  • 离散数学及其应用 第9章 关系 - 图138
  • 离散数学及其应用 第9章 关系 - 图139
  • 离散数学及其应用 第9章 关系 - 图140
  • 离散数学及其应用 第9章 关系 - 图141
  • 离散数学及其应用 第9章 关系 - 图142

    9.4 Closures of Relations

    The **closure** of a relation 离散数学及其应用 第9章 关系 - 图143 with respect to property 离散数学及其应用 第9章 关系 - 图144 is the relation 离散数学及其应用 第9章 关系 - 图145 with property 离散数学及其应用 第9章 关系 - 图146 containing 离散数学及其应用 第9章 关系 - 图147 such that 离散数学及其应用 第9章 关系 - 图148 is a subset of every relation with property 离散数学及其应用 第9章 关系 - 图149 containing 离散数学及其应用 第9章 关系 - 图150. Which means, 离散数学及其应用 第9章 关系 - 图151 is the smallest relation with property 离散数学及其应用 第9章 关系 - 图152 containing 离散数学及其应用 第9章 关系 - 图153.
    📋Let 离散数学及其应用 第9章 关系 - 图154 be a relation on 离散数学及其应用 第9章 关系 - 图155. The **reflexive closure** of 离散数学及其应用 第9章 关系 - 图156, denoted by 离散数学及其应用 第9章 关系 - 图157, is 离散数学及其应用 第9章 关系 - 图158, where 离散数学及其应用 第9章 关系 - 图159 is called the **diagnal relation** on 离散数学及其应用 第9章 关系 - 图160.
    Corollary: 离散数学及其应用 第9章 关系 - 图161is a reflexive relation.
    Given 离散数学及其应用 第9章 关系 - 图162, to obtain its reflexive closure, we can:

  • Add to 离散数学及其应用 第9章 关系 - 图163 all ordered pairs of the form 离散数学及其应用 第9章 关系 - 图164 with 离散数学及其应用 第9章 关系 - 图165, not already in 离散数学及其应用 第9章 关系 - 图166.

  • Add loops to all vertices on the digraph representation of 离散数学及其应用 第9章 关系 - 图167.
  • Put 1’s on the diagonal of the connection matrix of 离散数学及其应用 第9章 关系 - 图168.

📋Let 离散数学及其应用 第9章 关系 - 图169 be a relation on 离散数学及其应用 第9章 关系 - 图170. The **symmetric closure** of 离散数学及其应用 第9章 关系 - 图171, denoted by 离散数学及其应用 第9章 关系 - 图172, is 离散数学及其应用 第9章 关系 - 图173.
Proof:
Obviously 离散数学及其应用 第9章 关系 - 图174 contains 离散数学及其应用 第9章 关系 - 图175 and is symmetric. Then we need to show it is the smallest symmetric relation which contains 离散数学及其应用 第9章 关系 - 图176.
Suppose that 离散数学及其应用 第9章 关系 - 图177 is a symmetric relation containing 离散数学及其应用 第9章 关系 - 图178, then
image.png
Corollary: 离散数学及其应用 第9章 关系 - 图180 is a symmetric relation.
Given 离散数学及其应用 第9章 关系 - 图181, to obtain its symmetric closure, we can:

  • Add all ordered pairs of the form 离散数学及其应用 第9章 关系 - 图182 where 离散数学及其应用 第9章 关系 - 图183 is in the relation, that are not already in 离散数学及其应用 第9章 关系 - 图184.
  • Add an edge from 离散数学及其应用 第9章 关系 - 图185 to 离散数学及其应用 第9章 关系 - 图186 whenever this edge is not already in directed graph but the edge from 离散数学及其应用 第9章 关系 - 图187 to 离散数学及其应用 第9章 关系 - 图188 is.
  • 离散数学及其应用 第9章 关系 - 图189

Then we go on to the **transive closure**(传递闭包), denoted by 离散数学及其应用 第9章 关系 - 图190. It can not be computed so simply as the two kinds of closures above. Firstly we need to introduce some terminologies.
A **path** of **length** 离散数学及其应用 第9章 关系 - 图191 in a digraph 离散数学及其应用 第9章 关系 - 图192 means a sequence of edges 离散数学及其应用 第9章 关系 - 图193, denoted as 离散数学及其应用 第9章 关系 - 图194. It is called a **cycle** or **circuit** if 离散数学及其应用 第9章 关系 - 图195.
The term “path” also applies to relations. We say there is a path of length 离散数学及其应用 第9章 关系 - 图196 from 离散数学及其应用 第9章 关系 - 图197 to 离散数学及其应用 第9章 关系 - 图198 in 离散数学及其应用 第9章 关系 - 图199 if 离散数学及其应用 第9章 关系 - 图200 such that 离散数学及其应用 第9章 关系 - 图201.
📋Let 离散数学及其应用 第9章 关系 - 图202 be a relation on 离散数学及其应用 第9章 关系 - 图203. There is a path of length 离散数学及其应用 第9章 关系 - 图204 from 离散数学及其应用 第9章 关系 - 图205 to 离散数学及其应用 第9章 关系 - 图206 if and only if 离散数学及其应用 第9章 关系 - 图207.
Proof: Using MI.
The **connectivity relation** denoted by 离散数学及其应用 第9章 关系 - 图208, is the set of ordered pairs 离散数学及其应用 第9章 关系 - 图209 such that there is a path (in 离散数学及其应用 第9章 关系 - 图210) from 离散数学及其应用 第9章 关系 - 图211 to 离散数学及其应用 第9章 关系 - 图212: 离散数学及其应用 第9章 关系 - 图213.
📋离散数学及其应用 第9章 关系 - 图214.
Proof:
Obviously 离散数学及其应用 第9章 关系 - 图215 contains 离散数学及其应用 第9章 关系 - 图216 and is a transitive relation by its definition. Then we need to show that 离散数学及其应用 第9章 关系 - 图217 is the smallest transitive relation which contains 离散数学及其应用 第9章 关系 - 图218.
Now suppose that 离散数学及其应用 第9章 关系 - 图219 is any transitive relation which contains 离散数学及其应用 第9章 关系 - 图220. We need to show 离散数学及其应用 第9章 关系 - 图221 contains 离散数学及其应用 第9章 关系 - 图222.
Since 离散数学及其应用 第9章 关系 - 图223 is transitive, 离散数学及其应用 第9章 关系 - 图224 is also transitive and 离散数学及其应用 第9章 关系 - 图225. It follows that 离散数学及其应用 第9章 关系 - 图226. If 离散数学及其应用 第9章 关系 - 图227, then 离散数学及其应用 第9章 关系 - 图228, because any path in 离散数学及其应用 第9章 关系 - 图229 is also a path in 离散数学及其应用 第9章 关系 - 图230. So 离散数学及其应用 第9章 关系 - 图231.
Corollary: 离散数学及其应用 第9章 关系 - 图232 is transitive.
💡 In fact, we need only consider paths of length 离散数学及其应用 第9章 关系 - 图233 or less, where 离散数学及其应用 第9章 关系 - 图234 is the cardinality of 离散数学及其应用 第9章 关系 - 图235.
📋If 离散数学及其应用 第9章 关系 - 图236, then any path of length 离散数学及其应用 第9章 关系 - 图237 must contain a cycle.
Proof: Using the Pigeon Hole Principle.
📋If 离散数学及其应用 第9章 关系 - 图238, 离散数学及其应用 第9章 关系 - 图239 is a relation on 离散数学及其应用 第9章 关系 - 图240, then 离散数学及其应用 第9章 关系 - 图241.
Corollary: If 离散数学及其应用 第9章 关系 - 图242 then 离散数学及其应用 第9章 关系 - 图243.
Corollary: 离散数学及其应用 第9章 关系 - 图244.
📋A Basic Procedure for Computing t(R)
image.png
📋 Warshall’s Algorithm for Computing t(R)

别以为这个不会考!

If 离散数学及其应用 第9章 关系 - 图246 is a path, its **interior vertices** are 离散数学及其应用 第9章 关系 - 图247, that is, all the vertices of the path that occur somewhere other than as the first and last vertices in the path. Warshall’s algorithm is based on the efficient construction of a sequence of zero–one matrices. These matrices are 离散数学及其应用 第9章 关系 - 图248, where 离散数学及其应用 第9章 关系 - 图249 is the zero–one matrix of relation 离散数学及其应用 第9章 关系 - 图250, and 离散数学及其应用 第9章 关系 - 图251, where 离散数学及其应用 第9章 关系 - 图252 if there is a path from 离散数学及其应用 第9章 关系 - 图253 to 离散数学及其应用 第9章 关系 - 图254 such that all the interior vertices of this path are in the set 离散数学及其应用 第9章 关系 - 图255 (the first 离散数学及其应用 第9章 关系 - 图256 vertices in the list) and is 0 otherwise. Note that 离散数学及其应用 第9章 关系 - 图257, because the (i, j)th entry of 离散数学及其应用 第9章 关系 - 图258 is 1 if and only if there is a path from 离散数学及其应用 第9章 关系 - 图259 to 离散数学及其应用 第9章 关系 - 图260, with all interior vertices in the set 离散数学及其应用 第9章 关系 - 图261.
We can compute 离散数学及其应用 第9章 关系 - 图262 directly from 离散数学及其应用 第9章 关系 - 图263: There is a path from vi to vj with no vertices other than v1, v2, … , vk as interior vertices if and only if either there is a path from 离散数学及其应用 第9章 关系 - 图264 to 离散数学及其应用 第9章 关系 - 图265 with its interior vertices among the first 离散数学及其应用 第9章 关系 - 图266 vertices in the list, or there are paths from 离散数学及其应用 第9章 关系 - 图267 to 离散数学及其应用 第9章 关系 - 图268 and from 离散数学及其应用 第9章 关系 - 图269 to 离散数学及其应用 第9章 关系 - 图270 that have interior vertices only among the first 离散数学及其应用 第9章 关系 - 图271 vertices in the list. That is, either a path from 离散数学及其应用 第9章 关系 - 图272 to 离散数学及其应用 第9章 关系 - 图273 already existed before 离散数学及其应用 第9章 关系 - 图274 was permitted as an interior vertex, or allowing 离散数学及其应用 第9章 关系 - 图275 as an interior vertex produces a path that goes from 离散数学及其应用 第9章 关系 - 图276 to 离散数学及其应用 第9章 关系 - 图277 and then from 离散数学及其应用 第9章 关系 - 图278 to 离散数学及其应用 第9章 关系 - 图279.
image.png
The first type of path exists if and only if 离散数学及其应用 第9章 关系 - 图281, and the second type of path exists if
and only if both 离散数学及其应用 第9章 关系 - 图282 and 离散数学及其应用 第9章 关系 - 图283 are 1. Hence, 离散数学及其应用 第9章 关系 - 图284 whenever i, j and k are positive integers not exceeding n.
image.png
The complexity of Warshall’s algorithm is 离散数学及其应用 第9章 关系 - 图286.

9.5 Equivalence Relation

A relation 离散数学及其应用 第9章 关系 - 图287 on a set 离散数学及其应用 第9章 关系 - 图288 is an **equivalence relation**(等价关系) if 离散数学及其应用 第9章 关系 - 图289 is reflexive, symmetric and transitive. If elements 离散数学及其应用 第9章 关系 - 图290 and 离散数学及其应用 第9章 关系 - 图291 are related by an equivalence relation 离散数学及其应用 第9章 关系 - 图292, then we say 离散数学及其应用 第9章 关系 - 图293 and 离散数学及其应用 第9章 关系 - 图294 are equivalent, denoted by 离散数学及其应用 第9章 关系 - 图295. In an equivalence relation 离散数学及其应用 第9章 关系 - 图296, the set of all elements that are related to an element 离散数学及其应用 第9章 关系 - 图297 of 离散数学及其应用 第9章 关系 - 图298 is called the **equivalence class**(等价类) of 离散数学及其应用 第9章 关系 - 图299, denoted by 离散数学及其应用 第9章 关系 - 图300 or 离散数学及其应用 第9章 关系 - 图301. 离散数学及其应用 第9章 关系 - 图302
Let 离散数学及其应用 第9章 关系 - 图303 be a collection of subsets of 离散数学及其应用 第9章 关系 - 图304. Then the collection forms a **partition**(分割) of 离散数学及其应用 第9章 关系 - 图305 if and only if

  • 离散数学及其应用 第9章 关系 - 图306
  • 离散数学及其应用 第9章 关系 - 图307
  • 离散数学及其应用 第9章 关系 - 图308

denoted by 离散数学及其应用 第9章 关系 - 图309. 就是说这一系列 Ai 的无交并为 A。
📋 Let 离散数学及其应用 第9章 关系 - 图310 be an equivalence relation on a set 离散数学及其应用 第9章 关系 - 图311. The following statements are equivalent

  • 离散数学及其应用 第9章 关系 - 图312
  • 离散数学及其应用 第9章 关系 - 图313
  • 离散数学及其应用 第9章 关系 - 图314

📋 Let 离散数学及其应用 第9章 关系 - 图315 be an equivalence relation on a set 离散数学及其应用 第9章 关系 - 图316. Then the equivalence classes of 离散数学及其应用 第9章 关系 - 图317 form a partition of 离散数学及其应用 第9章 关系 - 图318. Conversely, given a partition 离散数学及其应用 第9章 关系 - 图319 of the set 离散数学及其应用 第9章 关系 - 图320, there is an equivalence relation 离散数学及其应用 第9章 关系 - 图321 that has the sets 离散数学及其应用 第9章 关系 - 图322, as its equivalence classes.
In short, an equivalence relation on a set 离散数学及其应用 第9章 关系 - 图323 ↔ a partition of 离散数学及其应用 第9章 关系 - 图324.
📋 Congruence modulo 离散数学及其应用 第9章 关系 - 图325 forms a partition of all integers.
离散数学及其应用 第9章 关系 - 图326
离散数学及其应用 第9章 关系 - 图327
🌰e.g.
离散数学及其应用 第9章 关系 - 图328. Show that 离散数学及其应用 第9章 关系 - 图329 is an equivalence relation, and find its equivalence class.
Proof:
离散数学及其应用 第9章 关系 - 图330 if and only if 离散数学及其应用 第9章 关系 - 图331.
离散数学及其应用 第9章 关系 - 图332 is reflexive because 离散数学及其应用 第9章 关系 - 图333. We can also show it is symmetric and transitive using the qualities of division.
The equivalence classes are 离散数学及其应用 第9章 关系 - 图334, 离散数学及其应用 第9章 关系 - 图335 and 离散数学及其应用 第9章 关系 - 图336.
🌰e.g.
Find the partition of the set 离散数学及其应用 第9章 关系 - 图337 from 离散数学及其应用 第9章 关系 - 图338.
离散数学及其应用 第9章 关系 - 图339
离散数学及其应用 第9章 关系 - 图340
image.png
📋 If 离散数学及其应用 第9章 关系 - 图342 are equivalence relations on 离散数学及其应用 第9章 关系 - 图343, then 离散数学及其应用 第9章 关系 - 图344 is also an equivalence relation on 离散数学及其应用 第9章 关系 - 图345.
Proof:

  1. It is reflexive. 离散数学及其应用 第9章 关系 - 图346, so 离散数学及其应用 第9章 关系 - 图347.
  2. It is symmetric. If 离散数学及其应用 第9章 关系 - 图348, then 离散数学及其应用 第9章 关系 - 图349 and 离散数学及其应用 第9章 关系 - 图350, then 离散数学及其应用 第9章 关系 - 图351 and 离散数学及其应用 第9章 关系 - 图352, so 离散数学及其应用 第9章 关系 - 图353.
  3. It is transitive.

📋 If 离散数学及其应用 第9章 关系 - 图354 are equivalence relations on 离散数学及其应用 第9章 关系 - 图355, then 离散数学及其应用 第9章 关系 - 图356 is reflexive and symmetric relation on 离散数学及其应用 第9章 关系 - 图357. Not necessarily transitive.
📋 If 离散数学及其应用 第9章 关系 - 图358 are equivalence relations on 离散数学及其应用 第9章 关系 - 图359, then 离散数学及其应用 第9章 关系 - 图360is also an equivalence relation on 离散数学及其应用 第9章 关系 - 图361.

9.6 Partial Orderings

Let 离散数学及其应用 第9章 关系 - 图362 be a relation on 离散数学及其应用 第9章 关系 - 图363. Then 离散数学及其应用 第9章 关系 - 图364 is a **partial ordering**(偏序关系) or partial order if 离散数学及其应用 第9章 关系 - 图365 is reflexive, antisymmetric and transitive, denoted by 离散数学及其应用 第9章 关系 - 图366. 离散数学及其应用 第9章 关系 - 图367 is called a partially ordered set or a **poset**(偏序集).
🌰e.g.
离散数学及其应用 第9章 关系 - 图368
离散数学及其应用 第9章 关系 - 图369
离散数学及其应用 第9章 关系 - 图370
We use the notation 离散数学及其应用 第9章 关系 - 图371 to represent the partial orderings including 离散数学及其应用 第9章 关系 - 图372, 离散数学及其应用 第9章 关系 - 图373and 离散数学及其应用 第9章 关系 - 图374. 离散数学及其应用 第9章 关系 - 图375 is read as “离散数学及其应用 第9章 关系 - 图376 is less than or equal to 离散数学及其应用 第9章 关系 - 图377“. 离散数学及其应用 第9章 关系 - 图378means 离散数学及其应用 第9章 关系 - 图379 and 离散数学及其应用 第9章 关系 - 图380, read as “离散数学及其应用 第9章 关系 - 图381 is less than 离散数学及其应用 第9章 关系 - 图382“.
The elements 离散数学及其应用 第9章 关系 - 图383 and 离散数学及其应用 第9章 关系 - 图384 of a poset 离散数学及其应用 第9章 关系 - 图385 are called **comparable** if either 离散数学及其应用 第9章 关系 - 图386 or 离散数学及其应用 第9章 关系 - 图387. When 离散数学及其应用 第9章 关系 - 图388 and 离散数学及其应用 第9章 关系 - 图389 are elements of 离散数学及其应用 第9章 关系 - 图390 such that neither 离散数学及其应用 第9章 关系 - 图391 nor 离散数学及其应用 第9章 关系 - 图392, 离散数学及其应用 第9章 关系 - 图393 and 离散数学及其应用 第9章 关系 - 图394 are called **incomparable**.
If 离散数学及其应用 第9章 关系 - 图395 is a poset and every two elements of 离散数学及其应用 第9章 关系 - 图396 are comparable, 离散数学及其应用 第9章 关系 - 图397 is called a **totally ordered set**(全序集) or a **linearly ordered set**, 离散数学及其应用 第9章 关系 - 图398 is called a **total order** or **linear order**. In this case 离散数学及其应用 第9章 关系 - 图399 is called a **chain**(链). 想象一下,全序集中的所有元素都可比较大小,因此它们可以按照大小顺序排成一条链,像数轴那样。
🌰e.g.
离散数学及其应用 第9章 关系 - 图400 is a poset and is a chain. 离散数学及其应用 第9章 关系 - 图401 and 离散数学及其应用 第9章 关系 - 图402 are posets but not totally ordered sets.
离散数学及其应用 第9章 关系 - 图403 is a **well-ordered** set if it is a poset such that 离散数学及其应用 第9章 关系 - 图404 is a total order and every nonempty subset of 离散数学及其应用 第9章 关系 - 图405 has a least element.
📋 The Principle of Well-Ordered Induction
Suppose that 离散数学及其应用 第9章 关系 - 图406 is a well-ordered set. Then 离散数学及其应用 第9章 关系 - 图407, if:
Inductive Step: for every 离散数学及其应用 第9章 关系 - 图408, if 离散数学及其应用 第9章 关系 - 图409 is true for all 离散数学及其应用 第9章 关系 - 图410 with 离散数学及其应用 第9章 关系 - 图411, then 离散数学及其应用 第9章 关系 - 图412.
Proof:
Suppose it is not the case that 离散数学及其应用 第9章 关系 - 图413 is true for all 离散数学及其应用 第9章 关系 - 图414. Then there is an element 离散数学及其应用 第9章 关系 - 图415
such that 离散数学及其应用 第9章 关系 - 图416 is false. Consequently, the set 离散数学及其应用 第9章 关系 - 图417 is nonempty. Because 离散数学及其应用 第9章 关系 - 图418 is well-ordered, A has a least element 离散数学及其应用 第9章 关系 - 图419. By the choice of 离散数学及其应用 第9章 关系 - 图420 as a least element of 离散数学及其应用 第9章 关系 - 图421, we know that 离散数学及其应用 第9章 关系 - 图422 is true for all 离散数学及其应用 第9章 关系 - 图423 with 离散数学及其应用 第9章 关系 - 图424. This implies by the inductive step 离散数学及其应用 第9章 关系 - 图425 is true. This contradiction shows that 离散数学及其应用 第9章 关系 - 图426 must be true for all 离散数学及其应用 第9章 关系 - 图427.
The **lexicographic order** 离散数学及其应用 第9章 关系 - 图428 on 离散数学及其应用 第9章 关系 - 图429 is defined as following: given two posets 离散数学及其应用 第9章 关系 - 图430 and 离散数学及其应用 第9章 关系 - 图431, we construct an induced partial order 离散数学及其应用 第9章 关系 - 图432 on 离散数学及其应用 第9章 关系 - 图433: 离散数学及其应用 第9章 关系 - 图434 if 离散数学及其应用 第9章 关系 - 图435or 离散数学及其应用 第9章 关系 - 图436. The definition of lexicographic order extends naturally to multiple Cartesian products of partially ordered sets.
🌰e.g. Lexicographic Order of String
The string 离散数学及其应用 第9章 关系 - 图437 is less than 离散数学及其应用 第9章 关系 - 图438 if and only if 离散数学及其应用 第9章 关系 - 图439.
discredit ≺ discreet ≺ discrete ≺ discreteness ≺ discretion
**Hasse diagram**(哈塞图) is a method used to represent a partial ordering clearly.
📋 To construct a Hasse diagram:

  1. Construct a digraph representation of the poset (A, R) so that all arcs point up (except the loops).
  2. Eliminate all loops.
  3. Eliminate all arcs that are redundant because of transitivity.
  4. Eliminate the arrows at the ends of arcs since everything points up.

🌰e.g.
离散数学及其应用 第9章 关系 - 图440, and represent it using a Hasse diagram.
image.png离散数学及其应用 第9章 关系 - 图442image.png
Let 离散数学及其应用 第9章 关系 - 图444 be a poset. 离散数学及其应用 第9章 关系 - 图445, if 离散数学及其应用 第9章 关系 - 图446 is a totally ordered set, then 离散数学及其应用 第9章 关系 - 图447 is called a **chain** of 离散数学及其应用 第9章 关系 - 图448. 离散数学及其应用 第9章 关系 - 图449 is called the **length** of chain. Otherwise, if 离散数学及其应用 第9章 关系 - 图450, then 离散数学及其应用 第9章 关系 - 图451 is called an **antichain** of 离散数学及其应用 第9章 关系 - 图452.
Let 离散数学及其应用 第9章 关系 - 图453 be a poset, then 离散数学及其应用 第9章 关系 - 图454 is a **maximal element**(极大元) if there does not exist an element 离散数学及其应用 第9章 关系 - 图455 in 离散数学及其应用 第9章 关系 - 图456 such that 离散数学及其应用 第9章 关系 - 图457. Similarly for a **minimal element**(极小元). Maximal and minimal elements are the “top” and “bottom” elements in the Hasse diagram.
⚠️ There can be more than one minimal and maximal element in a poset.
Let 离散数学及其应用 第9章 关系 - 图458 be a poset. Then an element 离散数学及其应用 第9章 关系 - 图459 in 离散数学及其应用 第9章 关系 - 图460 is a **greatest element**(最大元) of 离散数学及其应用 第9章 关系 - 图461 if 离散数学及其应用 第9章 关系 - 图462 for every 离散数学及其应用 第9章 关系 - 图463 in 离散数学及其应用 第9章 关系 - 图464, and 离散数学及其应用 第9章 关系 - 图465 is a **least element**(最小元) of 离散数学及其应用 第9章 关系 - 图466 if 离散数学及其应用 第9章 关系 - 图467 for every 离散数学及其应用 第9章 关系 - 图468 in 离散数学及其应用 第9章 关系 - 图469.
📋 The greatest and least element are unique when they exist.
Proof:
就是假设有两个最大元 / 最小元,然后证明它们必须是相等的,相当于只有一个。Suppose that 离散数学及其应用 第9章 关系 - 图470 is a greatest element in 离散数学及其应用 第9章 关系 - 图471. It follows that 离散数学及其应用 第9章 关系 - 图472 for every element in 离散数学及其应用 第9章 关系 - 图473. Suppose that 离散数学及其应用 第9章 关系 - 图474 is also a greatest element in 离散数学及其应用 第9章 关系 - 图475. It follows that 离散数学及其应用 第9章 关系 - 图476 for every element in 离散数学及其应用 第9章 关系 - 图477. It implies that 离散数学及其应用 第9章 关系 - 图478 and 离散数学及其应用 第9章 关系 - 图479. That is 离散数学及其应用 第9章 关系 - 图480.
Let 离散数学及其应用 第9章 关系 - 图481 be a subset of 离散数学及其应用 第9章 关系 - 图482 in the poset 离散数学及其应用 第9章 关系 - 图483. If there exists an element 离散数学及其应用 第9章 关系 - 图484 in 离散数学及其应用 第9章 关系 - 图485 such that 离散数学及其应用 第9章 关系 - 图486 for all 离散数学及其应用 第9章 关系 - 图487 in 离散数学及其应用 第9章 关系 - 图488, then 离散数学及其应用 第9章 关系 - 图489 is called an **upper bound**(上界) of 离散数学及其应用 第9章 关系 - 图490. Similarly for **lower bounds**(下界).
⚠️ Mind the differences of “maximal element”, “greatest element” and “upper bound”. “极大元”只要能比较大小的都小于等于它就行,“最大元”要所有元素都能和它比大小且都小于等于它,“上界”甚至可以不在子集离散数学及其应用 第9章 关系 - 图491里面但子集离散数学及其应用 第9章 关系 - 图492里所有元素必须小于等于它。
If 离散数学及其应用 第9章 关系 - 图493 is an upper bound for 离散数学及其应用 第9章 关系 - 图494 which is less than every other upper bounds, then it is the **least upper bound**(上确界), denoted by 离散数学及其应用 第9章 关系 - 图495. Similarly for the **greatest lower bound**(下确界), 离散数学及其应用 第9章 关系 - 图496.
A poset is called a **lattice** (格) if every pair of elements has a lub and a glb.
60U4NGIT8Z4~HJJEWWA]_1J.jpg
🌰e.g.
离散数学及其应用 第9章 关系 - 图498 is not a lattice because there is no multiple of both 6 and 9 in these numbers. If we add 36 into these numbers then it will form a lattice.
📋 Every totally ordered set is a lattice.
⚙️ The Lattices Model of Information Flow
The Lattices Model can be used to represent different information flow policies. For example, the multilevel security policy:
Each pieces of information is assigned to a security class. Each security class is represented by a pair 离散数学及其应用 第9章 关系 - 图499, where 离散数学及其应用 第9章 关系 - 图500 is an authority level and 离散数学及其应用 第9章 关系 - 图501 is a category. Order security classes by specifying that 离散数学及其应用 第9章 关系 - 图502 iff 离散数学及其应用 第9章 关系 - 图503. For example, the typical authority levels used in the U.S. government is A={ unclassified(0), confidential(1), secret(2), top secret(3) }. If C={ spies, moles, double agents }, then their are 2|C| = 8 different categories.
Information is permitted to flow from security classes 离散数学及其应用 第9章 关系 - 图504 into 离散数学及其应用 第9章 关系 - 图505 iff 离散数学及其应用 第9章 关系 - 图506. Then the set of all security classes forms a lattice.
A total ordering 离散数学及其应用 第9章 关系 - 图507 is said to be **compatible**(共生) with the partial ordering 离散数学及其应用 第9章 关系 - 图508 if 离散数学及其应用 第9章 关系 - 图509 whenever 离散数学及其应用 第9章 关系 - 图510. Constructing a compatible total ordering from a partial ordering is called **topological sorting**(拓扑排序).
📋 Every finite nonempty poset 离散数学及其应用 第9章 关系 - 图511 has at least one minimal element.
Proof:
Choose an element 离散数学及其应用 第9章 关系 - 图512 of 离散数学及其应用 第9章 关系 - 图513. If 离散数学及其应用 第9章 关系 - 图514 is not minimal, then there is an element 离散数学及其应用 第9章 关系 - 图515 with 离散数学及其应用 第9章 关系 - 图516. If 离散数学及其应用 第9章 关系 - 图517 is not minimal, there is an element 离散数学及其应用 第9章 关系 - 图518 with 离散数学及其应用 第9章 关系 - 图519. Continue this process, so that if 离散数学及其应用 第9章 关系 - 图520 is not minimal, there is an element 离散数学及其应用 第9章 关系 - 图521 with 离散数学及其应用 第9章 关系 - 图522.
Since there are only finite number of elements in the poset, this process must end with a minimal element.
📋 According to this lemma, to sort a poset 离散数学及其应用 第9章 关系 - 图523:
Basic Step: Select a (any) minimal element and put it in the list. Delete it from 离散数学及其应用 第9章 关系 - 图524.
Inducive Step: Continue until all elements appear in the list and 离散数学及其应用 第9章 关系 - 图525 is void.
🌰e.g.
Find a compatible total ordering for the poset 离散数学及其应用 第9章 关系 - 图526.
Solution:
image.png
Delete one minimal element in each step. If there are more than one minimal element in one step, just choose a random one. This produces the total ordering 1 ≺ 5 ≺ 2 ≺ 4 ≺ 20 ≺ 12.
⚙️ Topological sorting has an application to the scheduling of projects. The Hasse diagram means the order of completing a series of projects, where the less project need to be finished before the greater project is finished. By producing a total ordering, we can find a feasible order to finish all the projects.