Discrete Mathematics License Topics Relation
Total Page:16
File Type:pdf, Size:1020Kb
License c 2001-2016 T. Uyar, A. Yayımlı, E. Harmancı Discrete Mathematics You are free to: Relations and Functions I Share – copy and redistribute the material in any medium or format I Adapt – remix, transform, and build upon the material Under the following terms: H. Turgut Uyar Ay¸segul¨ Gen¸cata Yayımlı Emre Harmancı I Attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. I NonCommercial – You may not use the material for commercial purposes. 2001-2016 I ShareAlike – If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. For more information: https://creativecommons.org/licenses/by-nc-sa/4.0/ Read the full license: https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 1 / 79 2 / 79 Topics Relation Relations Introduction Definition Relation Properties relation: α ⊆ A × B × C × · · · × N Equivalence Relations I tuple: element of relation Functions I binary relation: α ⊆ A × B Introduction I aαb :(a, b) ∈ α Pigeonhole Principle Recursion 3 / 79 4 / 79 Relation Example Relation Composition Definition A = {a , a , a , a }, B = {b , b , b } 1 2 3 4 1 2 3 relation composition: α = {(a , b ), (a , b ), (a , b ), (a , b ), (a , b ), (a , b ), (a , b )} 1 1 1 3 2 2 2 3 3 1 3 3 4 1 α ⊆ A × B, β ⊆ B × C αβ = {(a, c) | a ∈ A, c ∈ C, ∃b ∈ B [aαb ∧ bβc]} b b b 1 2 3 1 0 1 a 1 0 1 1 0 1 1 example a 0 1 1 M = 2 α 1 0 1 a 1 0 1 3 1 0 0 a4 1 0 0 5 / 79 6 / 79 Relation Composition Relation Composition Associativity (αβ)γ = α(βγ). I Mαβ = Mα × Mβ I using logical operations: 1 : T 0 : F · : ∧ + : ∨ (a, d) ∈ (αβ)γ example ⇔ ∃c [(a, c) ∈ αβ ∧ (c, d) ∈ γ] ⇔ ∃c [∃b [(a, b) ∈ α ∧ (b, c) ∈ β] ∧ (c, d) ∈ γ] 1 0 0 1 1 0 0 ⇔ ∃b [(a, b) ∈ α ∧ ∃c [(b, c) ∈ β ∧ (c, d) ∈ γ]] 0 0 1 1 1 0 0 0 1 1 0 ⇔ ∃b [(a, b) ∈ α ∧ (b, d) ∈ βγ] Mα = 0 1 1 Mβ = 0 0 1 1 Mαβ = 0 1 1 1 0 1 0 0 1 1 0 0 0 1 1 ⇔ (a, d) ∈ α(βγ) 1 0 1 1 1 1 0 7 / 79 8 / 79 Relation Composition Theorems Converse Relation α(β ∪ γ) = αβ ∪ αγ. (a, c) ∈ α(β ∪ γ) Definition ⇔ ∃b [(a, b) ∈ α ∧ (b, c) ∈ (β ∪ γ)] α−1 = {(b, a) | (a, b) ∈ α} ⇔ ∃b [(a, b) ∈ α ∧ ((b, c) ∈ β ∨ (b, c) ∈ γ)] T M −1 = M ⇔ ∃b [((a, b) ∈ α ∧ (b, c) ∈ β) I α α ∨ ((a, b) ∈ α ∧ (b, c) ∈ γ)] ⇔ (a, c) ∈ αβ ∨ (a, c) ∈ αγ ⇔ (a, c) ∈ αβ ∪ αγ 9 / 79 10 / 79 Converse Relation Theorems Converse Relation Theorems α−1 = α−1. −1 −1 I (α ) = α −1 −1 −1 −1 I (α ∪ β) = α ∪ β (b, a) ∈ α −1 −1 −1 I (α ∩ β) = α ∩ β ⇔ (a, b) ∈ α −1 −1 I α = α ⇔ (a, b) ∈/ α −1 −1 −1 −1 I (α − β) = α − β ⇔ (b, a) ∈/ α ⇔ (b, a) ∈ α−1 11 / 79 12 / 79 Converse Relation Theorems Converse Relation Theorems −1 −1 −1 (α ∩ β) = α ∩ β . (α − β)−1 = α−1 − β−1. (b, a) ∈ (α ∩ β)−1 (α − β)−1 = (α ∩ β)−1 ⇔ (a, b) ∈ (α ∩ β) −1 = α−1 ∩ β ⇔ (a, b) ∈ α ∧ (a, b) ∈ β = α−1 ∩ β−1 ⇔ (b, a) ∈ α−1 ∧ (b, a) ∈ β−1 = α−1 − β−1 ⇔ (b, a) ∈ α−1 ∩ β−1 13 / 79 14 / 79 Relation Composition Converse Relation Properties Theorem (αβ)−1 = β−1α−1 I α ⊆ A × A Proof. n I α : αα ··· α I identity relation: E = {(a, a) | a ∈ A} (c, a) ∈ (αβ)−1 ⇔ (a, c) ∈ αβ I reflexivity ⇔ ∃b [(a, b) ∈ α ∧ (b, c) ∈ β] I symmetry ⇔ ∃b [(b, a) ∈ α−1 ∧ (c, b) ∈ β−1] I transitivity ⇔ (c, a) ∈ β−1α−1 15 / 79 16 / 79 Reflexivity Reflexivity Examples reflexive α ⊆ A × A R1 ⊆ {1, 2} × {1, 2} R2 ⊆ {1, 2, 3} × {1, 2, 3} ∀a ∈ A [aαa] R1 = {(1, 1), (1, 2), (2, 2)} R2 = {(1, 1), (1, 2), (2, 2)} I E ⊆ α I R1 is reflexive I R2 is not reflexive I irreflexive: I also not irreflexive ∀a ∈ A [¬(aαa)] 17 / 79 18 / 79 Reflexivity Examples Reflexivity Examples R ⊆ {1, 2, 3} × {1, 2, 3} R ⊆ Z × Z R = {(1, 2), (2, 1), (2, 3)} R = {(a, b) | ab ≥ 0} I R is irreflexive I R is reflexive 19 / 79 20 / 79 Symmetry Symmetry Examples symmetric R ⊆ {1, 2, 3} × {1, 2, 3} α ⊆ A × A R = {(1, 2), (2, 1), (2, 3)} ∀a, b ∈ A [aαb ↔ bαa] −1 I R is not symmetric I α = α I also not antisymmetric I antisymmetric: ∀a, b ∈ A [aαb ∧ bαa → a = b] 21 / 79 22 / 79 Symmetry Examples Symmetry Examples R ⊆ Z × Z R ⊆ {1, 2, 3} × {1, 2, 3} R = {(a, b) | ab ≥ 0} R = {(1, 1), (2, 2)} R is symmetric and antisymmetric I R is symmetric I 23 / 79 24 / 79 Transitivity Transitivity Examples transitive α ⊆ A × A R ⊆ {1, 2, 3} × {1, 2, 3} ∀a, b, c ∈ A [aαb ∧ bαc → aαc] R = {(1, 2), (2, 1), (2, 3)} α2 ⊆ α I I R is antitransitive I antitransitive: ∀a, b, c ∈ A [aαb ∧ bαc → ¬(aαc)] 25 / 79 26 / 79 Transitivity Examples Converse Relation Properties R ⊆ Z × Z R = {(a, b) | ab ≥ 0} Theorem Reflexivity, symmetry, and transitivity are preserved I R is not transitive in the converse relation. I also not antitransitive 27 / 79 28 / 79 Closures Special Relations I reflexive closure: predecessor - successor r = α ∪ E α R ⊆ Z × Z R = {(a, b) | a − b = 1} I symmetric closure: −1 sα = α ∪ α I irreflexive transitive closure: I I antisymmetric S i 2 3 tα = i=1,2,3,... α = α ∪ α ∪ α ∪ · · · I antitransitive 29 / 79 30 / 79 Special Relations Special Relations adjacency strict order R ⊆ Z × Z R ⊆ Z × Z R = {(a, b) | |a − b| = 1} R = {(a, b) | a < b} I irreflexive I irreflexive I symmetric I antisymmetric I antitransitive I transitive 31 / 79 32 / 79 Special Relations Special Relations partial order preorder R ⊆ × Z Z R ⊆ × R = {(a, b) | a ≤ b} Z Z R = {(a, b) | |a| ≤ |b|} I reflexive I reflexive I antisymmetric I transitive I transitive 33 / 79 34 / 79 Special Relations Special Relations limited difference comparability + R ⊆ Z × Z, m ∈ Z R ⊆ U × U R = {(a, b) | |a − b| ≤ m} R = {(a, b) | (a ⊆ b) ∨ (b ⊆ a)} I reflexive I reflexive I symmetric I symmetric 35 / 79 36 / 79 Special Relations Compatibility Relations Definition I siblings? compatibility relation: γ I reflexive I irreflexive I symmetric I symmetric I transitive I when drawing, lines instead of arrows I matrix representation as a triangle matrix I can a relation be symmetric and transitive, but irreflexive? −1 I αα is a compatibility relation 37 / 79 38 / 79 Compatibility Relation Example Compatibility Relation Example I P: persons, L: languages I P = {p1, p2, p3, p4, p5, p6} A = {a1, a2, a3, a4} 1 1 0 0 I L = {l1, l2, l3, l4, l5} 1 1 0 1 R = {(a1, a1), (a2, a2), I α ⊆ P × L 0 0 1 1 (a3, a3), (a4, a4), 0 1 1 1 1 1 0 0 0 (a1, a2), (a2, a1), 1 1 0 1 0 0 1 1 0 0 0 (a , a ), (a , a ), 1 1 0 0 0 1 2 4 4 2 0 0 1 0 1 1 M = M −1 = 0 0 1 1 0 1 (a3, a4), (a4, a3)} α 1 0 1 1 0 α 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 39 / 79 40 / 79 Compatibility Relation Example Compatibility Block Definition −1 I αα ⊆ P × P compatibility block: C ⊆ A ∀a, b [a ∈ C ∧ b ∈ C → aγb] 1 1 0 1 0 1 1 1 0 1 0 1 I maximal compatibility block: 0 0 1 1 0 1 not a subset of another compatibility block M −1 = αα 1 1 1 1 1 1 I an element can be a member of more than one MCB 0 0 0 1 1 0 1 1 1 1 0 1 I complete cover: Cγ set of all MCBs 41 / 79 42 / 79 Compatibility Block Example Equivalence Relations Definition C = {p , p } I 1 4 6 equivalence relation: I C2 = {p2, p4, p6} I reflexive I C3 = {p1, p2, p4, p6} (MCB) I symmetric I transitive Cγ = {{p1, p2, p4, p6}, I equivalence classes (partitions) {p3, p4, p6}, I every element is a member of exactly one equivalence class {p4, p5}} I complete cover: C 43 / 79 44 / 79 Equivalence Relation Example References Required Reading: Grimaldi R ⊆ Z × Z Chapter 5: Relations and Functions R = {(a, b) | ∃m ∈ Z [a − b = 5m]} I I 5.1. Cartesian Products and Relations I Chapter 7: Relations: The Second Time Around I R partitions Z into 5 equivalence classes I 7.1. Relations Revisited: Properties of Relations I 7.4. Equivalence Relations and Partitions 45 / 79 46 / 79 Functions Subset Image Examples Definition function: f : X → Y ∀x ∈ X ∀y1, y2 ∈ Y [(x, y1), (x, y2) ∈ f → y1 = y2] f : R → R f (x) = x2 I X : domain, Y : codomain (or range) f (Z) = {0, 1, 4, 9, 16,..