Applications of Relations
(関係の応用)
Discrete Mathematics I
10th lecture, December 7, 2018
http://www.sw.it.aoyama.ac.jp/2018/Math1/lecture10.html
Martin J. Dürst
© 2005-18 Martin
J. Dürst Aoyama Gakuin
University
Today's Schedule
- Leftovers, summary, and homework for last lecture
- Composition of relations
- Classification of relations: Reflexive, symmetric, antisymmetric,
transitive
- Equivalence relations, equivalence classes, and partitions
- Partial and total orders
- This week's homework
Leftovers
Summary of Last Lecture
- Definition of a relation: Subset of Cartesian product, set of tuples
- Representations of relations: Denotation, connotation, matrix, table,
graph
- Inverse relations
Last Week's Homework
Examples of Relations
Comment: Homework can also be submitted in Japanese
Sorry, it was removed! :)
A binary relation on A can be:
- Reflexive:
∀x∈A:xRx;
∀x∈A: (x, x) ∈
R
- Symmetric: ∀x, y ∈A: xRy
⇔ yRx;
∀x, y ∈A: (x, y)
∈ R ⇔ (y, x) ∈ R
- Antisymmetric: ∀x, y ∈A:
xRy ∧ yRx ⇒ x=y
- Transitive: ∀x, y, z ∈A:
xRy ∧ yRz ⇒ xRz
Reflexive Relation
- Definition: In a reflexive relation R,
∀x∈A: (x, x) ∈
R
- Examples: =, ≤, ≧, divisible, subset, knows (people know themselves),
...
- How to check: In the matrix representation, check that all entries on the
(main) diagonal are 1
Symmetric Relation
- Definition: In a symmetric relation R, ∀(x,
y)∈R: (y, x) ∈ R;
R = R-1
- Examples: =, sibling (brother or sister), spouse (husband or wife),
friend??, ...
- How to check: The matrix representation is identical with its
transposition.
(The transposition of a matrix is its rotation or mirroring along the
(main) diagonal.)
Antisymmetric Relation
- Definition: A relation R is antisymmetric if ∀x,
y ∈A: xRy ∧ yRx
⇒ x=y.
Alternative: ∀x, y ∈A,
x≠y: (x, y)∈R
→ (y, x)∉R
- Examples: =, <, ≤, >, ≧, divisible, parent, child, anchestor,
descendant, ...
- How to check: In the matrix representation, check that for each entry 1
not on the (main) diagonal, the entry in the opposite position (mirrored
along the (main) diagonal) is 0. In other words, of the two opposite
entries, at most one can be 1.
- Antisymmetric relation is not the
opposite of symmetric relation.
- The opposite of symmetric relation (i.e. a relation that is not
symmetric) is called asymmetric relation.
Transitive Relation
- Definition: If and only if for all x, y, and
z, xRy ∧ yRz ⇒ xRz, then
R is transitive.
(∀x, y, z: xRy ∧
yRz ⇒ xRz) ⇔ R is
transitive
- Examples: =, <, >, ≤, ≥, descendant, anchestor, divisible,
...
- How to check: Compose R with itself. If the result is in
R (i.e. if R∘R ⊂ R), then
R is transitive.
Additional Observations
- A relation for which R∘R = R is called
idempotent
- All idempotent relations are transitive
- Relations that are reflexive and transitive are idempotent
- There are some idempotent relations that are not reflexive
Transitive Closure
- The transitive closure of a relation R is the result
of repeatedly concatenating R with itself until the result does
not change anymore
R∘R∘R∘...
- "Repetition until there is no change anymore" is a frequent concept in
Information Technology
- In the programming language C, this is the general structure:
int change = 1;
while (change) {
change = 0;
/* process data */
if (/* data changed */)
change = 1;
}
Cautions about Transitive Closure
Calculating the transitive closure of a relation may not be possible.
The calculation may not converge to a fixpoint.
Relations on sets of size 2:
- 11 relations are transitive
- 4 relations reach transitive closure at R∘R
- 1 relation alternates between two states [R = (0 1, 1 0) =
R2n+1; (1, 0, 0, 1) =
R2n)]
Relations and Functions
- An n-ary relation is a function f from n
arguments to a Boolean value (T/F)
R = {(x, y, z) |
f(x, y, z)=T }
- A function returns only one result for each input
- An n-ary relation can be seen as a function g with
n-1 arguments and a set as a return value
g(x, y) = {z | (x,
y, z) ∈ R}
- A function with n-1 arguments can be expressed as an
n-ary relation
f(x, y) = z ⇒ R =
{(x, y, z) | f(x,
y) = z}
Relations and Predicates
- Example of function: parent (x) = y (the parent of
x is y)
- Example of predicate: parent (y, x) (y
is the parent of x)
- Predicates express properties (mainly predicates with 1 argument) and
relations (predicates with 2 or more arguments)
- Relations and predicates are very closely related concepts
- The difference is mostly in field of use:
predicates: logic
relations: structure, databases
Equivalence Relation
- Examples: People with the same birthday, the same month of birth, the
same year of birth, the same zodiac sign; people from the same
prefecture/country, cities in the same prefecture/country
- An equivalence relation is a relation that is reflexive,
symmetric, and transitive
- An equivalece relation allows to define the set of all elements related
to a given element a
- Such sets are called equivalence classes, and written
[a]
([a] = {x|xRa})
- a is a representative (element) of
[a]
- An equivalence relation creates a partition of the original set
A
- A partition is a set of sets so that:
- The union of these sets is the original set A
- The intersection of any two distinct sets in the partition is {}
(∀a, b: a∈[b]
∨[a]∩[b]={})
- The Cartesian product is also an equivalence relation
(where the partition consists of a single set, namely A itself)
Partial Order
- If a relation is reflexive, antisymmetric, and transitive, then it is
called a partial order relation
- This is also often just called an order relation
- The set on which the relation is defined is called a partially
ordered set or just an ordered set
- The symbol ≤ is often used for order relations
- For any order relation ≤, the order relation ≥ and the relations >
and < are also defined
- In any order relation, two elements x and y can be
in any of four mutually exclusive relationships:
- x < y
- x = y
- x > y
- There is no relationship between x and y
Examples of Order Relations
- The divisible by relation on the set of integers ≥1, or a
subset thereof
- The subset relation on a set of sets
Some examples need a careful definition:
- The relation on a set of tasks, where some tasks need be done before
or at the same time as others
- The relation "stronger than or as strong as" in a Tennis
tournament, defined by (the transitive closure of) the tournament
results
Hasse Diagram
An order relation can be represented by a Hasse diagram.
How to convert a directed graph of an order relation to a Hasse diagram:
- Remove arrows that indicate reflexivity
- Rearange the vertices of the graph so that all arrows point upwards (or
downwards)
- Remove the arrows that can be reconstructed using transitive closure
- Remove the arrowheads
Example: The relation "divisible by" on the set {12, 6, 4, 3, 2, 1}
Equivalence Relations and Order Relations in Matrix Representation
- The elements in a set A are not ordered
- Therefore, we can exchange (permute) the rows and the columns in the
matrix representation of a relation on A if and only if we use
the same permutation for both rows and columns.
- A relation on a set A is an equivalence relation if and only
if we can permute the rows and columns so that we obtain the following:
- The areas of 1s form squares
- The centers of the squares are on the (main) diagonal of the
matrix
- The squares do not overlap
- The entries on the (main) diagonal are all 1
- A relation on a set A is an order relation only if we can
permute the rows and columns so that we obtain the following:
- All entries below the (main) diagonal [or above] are 0
- All entries on the (main) diagonal are 1
- The relation is transitive (separate check needed)
Total Order
If for all elements b and c in a set A,
if either b≥c or
c≥b, then
≥ is a total order (relation) or linear order
(relation)
(∀b, c ∈ A: b≥c
∨ c≥b ⇔ ≥ is a total order on A)
The Hasse diagram of a total order is a single line, without branches
Examples: ≥ for integers or rational; dates or time; order of words in a
dictionary
Summary
- Binary relations on a set can be: Reflexive, symmetric, antisymmetric,
transitive
- Transitive closure is an operation often used in Information
Technology
- Equivalence relations define a partition into equivalence classes
- (Partial) order relations can be represented with Hasse diagrams
This Week's Homework
Deadline: December 12, 2018 (Thursday), 19:00.
Format: A4 single page (using both sides is okay; NO cover page), easily
readable handwriting (NO printouts), name (kanji and kana) and student number
at the top right
Where to submit: Box in front of room O-529 (building O, 5th floor)
Investigate all combinations of the four properties of relations introduced
in this lecture (reflexive, symmetric, antisymmetric, transitive). For each
combination, give a minimal example or explain why such a combination is
impossible.
Hint: There are 16 combinations. Two combinations are impossible. One
combination needs a set of four elements for a minimal example. Three
combinations need a set of two elements for a minimal example. Two combinations
need a set of one element for a minimal example. The other combinations need a
set of three elements for a minimal example.
Hint: Use {a, b, c} for a set with three
elements.
Hint: Start with small sets and check properties.
Hint: Present the 16 combinations in a table similar to the tables used in
the homework of lecture 4.
Additional homework: Bring some small scissors to the next lecture.
Glossary
- reflexive relation
- 反射的関係
- (main) diagonal
- (主) 対角線
- symmetric relation
- 対称的関係
- (matrix) transposition
- (行列) 転置
- sibling
- 兄弟 (姉妹も含む)
- antisymmetric relation
- 反対称的関係
- opposite
- 反対
- asymmetric relation
- 非対称的関係
- transitive relation
- 推移的関係
- descendant
- 子孫
- anchestor
- 先祖
- transitive closure
- 推移的閉包
- converge
- 収束
- fixpoint
- 不動点
- equivalence relation
- 同値関係
- equivalence class
- 同値類
- representative (element)
- 代表元
- partition
- 分割
- partial order
- 半順序
- partial order relation
- 半順序関係
- order relation
- 順序関係
- partially ordered set
- 半順序集合
- ordered set
- 順序集合
- mutually exclusive
- 相互排他的な
- Hasse diagram
- ハッセ図
- vertex (plural vertices)
- (グラフの) 節、頂点
- reconstruct
- 復元する
- square
- 正方形
- overlap
- 重なる、重複する
- total order (relation)
- 全順序 (関係)、線形順序 (関係)