Relations

71 downloads 796 Views 56KB Size Report
From names to ID numbers. From zip codes to cities. From countries to leaders. From years to events. CS 2233 Discrete Mathematical Structures. Relations – 3.
Relations

2

Relations

Relations

A relation on a set A is a subset of A × A. A relation from A to B is a subset of A × B.

In Greek, the mappings between orthography and phonology are highly consistent, whereas in English the relationship between letters and sounds is much more variable. (Maria Ktori, Nicola Pitchford)

P (x, y) is a predicate with domain A implies {(a, b) | P (a, b) is true} is a relation on A. R1 and R2 are relations from A to B implies R1 ∪ R2 , R1 ∩ R2 , R1 − R2, and R1 are also. f is a function from A to B implies {(a, b) | a ∈ A ∧ f (a) = b} is a relation from A to B.

Politics have no relation to morals. (Niccolo Machiavelli)

A has n elements implies a relation on A has between 0 and n2 elements, 2 and implies 2n possible relations on A. CS 2233 Discrete Mathematical Structures

Relations Relations. . . . . . . . . . . . . . . . . . . . Examples of Relations . . . . . . . . . . . Types of Relations on A . . . . . . . . . Composite of Two Relations . . . . . . Transitivity and Composite Relations . Closures of Relations. . . . . . . . . . . . Transitive Closures and Paths. . . . . . A Transitive Closure Algorithm . . . . . Warshall’s Algorithm. . . . . . . . . . . . Other Types of Relations . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . .

2 2 3 4 5 6 7 8 9 10 11

Relations – 2

Examples of Relations Numeric comparisons: =, , 6= {(0, 0), (1, 1), (−1, −1), (2, 2), (−2, −2), . . .} √ Functions: log2 n, n, n2, 2n {(0, 0), (1, 1), (4, 2), (9, 3), (16, 4), . . .} Sequences: {(0, a0), (1, a1), . . .} {(0, 0), (1, 1), (2, 1), (3, 2), (4, 3), . . .} From From From From

names to ID numbers. zip codes to cities. countries to leaders. years to events.

CS 2233 Discrete Mathematical Structures

1

Relations – 3

2

Types of Relations on A

Transitivity and Composite Relations

R is reflexive iff (x ∈ A implies (x, x) ∈ R) Examples: =, ≤

R is transitive implies Rn ⊆ R for all n ≥ 1. Basis: R1 = R ⊆ R.

R is symmetric iff ((x, y) ∈ R implies (y, x) ∈ R) Examples: =, 6=

Induction: Assume k ≥ 1 and Rk ⊆ R. Show Rk+1 ⊆ R.

R is antisymmetric iff ((x, y) ∈ R implies x = y ∨ (y, x) 6∈ R) Examples: =, < R is transitive iff ((x, y) ∈ R ∧ (y, z) ∈ R implies (x, z) ∈ R) Examples: =,