Discrete Mathematics in Computer Science October 7, 2020 — B5
Total Page:16
File Type:pdf, Size:1020Kb
Discrete Mathematics in Computer Science October 7, 2020 | B5. Relations Discrete Mathematics in Computer Science B5. Relations B5.1 Relations Malte Helmert, Gabriele R¨oger University of Basel B5.2 Properties of Binary Relations October 7, 2020 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 1 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 2 / 14 B5. Relations Relations B5. Relations Relations Relations: Informally I Informally, a relation is some property that is true or false for an (ordered) collection of objects. I We already know some relations, e. g. I ⊆ relation for sets B5.1 Relations I ≤ relation for natural numbers I These are examples of binary relations, considering pairs of objects. I There are also relations of higher arity, e. g. I \x + y = z" for integers x; y; z. I \The name, address and office number belong to the same person." I Relations are for example important for relational databases, semantic networks or knowledge representation and reasoning. Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 3 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 4 / 14 B5. Relations Relations B5. Relations Relations Relations Relations: Examples Definition (Relation) I ⊆ = f(S; S0) j S and S0 are sets and 0 Let S1;:::; Sn be sets. for every x 2 S it holds that x 2 S g A relation over S1;:::; Sn is a set R ⊆ S1 × · · · × Sn. I ≤ = f(x; y) j x; y 2 N0 and x < y or x = yg The arity of R is n. I R = f(x; y; z) j x; y; z 2 Z and x + y = zg I R0 = f(Gabi; Spiegelgasse 1; 04.005); (Salom´e; Spiegelgasse 1; 04.002); I A relation of arity n is a set of n-tuples. (Florian; Spiegelgasse 1; 04.005); The set contains the tuples I (Augusto; Spiegelgasse 5; 04.001)g for which the informal property is true. Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 5 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 6 / 14 B5. Relations Properties of Binary Relations B5. Relations Properties of Binary Relations Binary Relation A binary relation is a relation of arity 2: Definition (binary relation) B5.2 Properties of Binary Relations A binary relation is a relation over two sets A and B. I Instead of (x; y) 2 R, we also write xRy, e. g. x ≤ y instead of (x; y) 2 ≤ I If the sets are equal, we say\ R is a binary relation over A" instead of\ R is a binary relation over A and A". I Such a relation over a set is also called a homogeneous relation or an endorelation. Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 7 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 8 / 14 B5. Relations Properties of Binary Relations B5. Relations Properties of Binary Relations Reflexivity Irreflexivity A reflexive relation relates every object to itself. A irreflexive relation never relates an object to itself. Definition (reflexive) Definition (irreflexive) A binary relation R over set A is reflexive A binary relation R over set A is irreflexive if for all a 2 A it holds that (a; a) 2 R. if for all a 2 A it holds that (a; a) 2= R. Which of these relations are reflexive? Which of these relations are irreflexive? I R = f(a; a); (a; b); (a; c); (b; a); (b; c); (c; c)g over fa; b; cg I R = f(a; a); (a; b); (a; c); (b; a); (b; c); (c; c)g over fa; b; cg I R = f(a; a); (a; b); (a; c); (b; b); (b; c); (c; c)g over fa; b; cg I R = f(a; a); (a; b); (a; c); (b; b); (b; c); (c; c)g over fa; b; cg I equality relation = on natural numbers I equality relation = on natural numbers I less-than relation ≤ on natural numbers I less-than relation ≤ on natural numbers I strictly-less-than relation < on natural numbers I strictly-less-than relation < on natural numbers Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 9 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 10 / 14 B5. Relations Properties of Binary Relations B5. Relations Properties of Binary Relations Symmetry Asymmetry and Antisymmetry Definition (asymmetric and antisymmetric) Let R be a binary relation over set A. Definition (symmetric) Relation R is asymmetric if A binary relation R over set A is symmetric for all a; b 2 A it holds that if (a; b) 2 R then (b; a) 2= R. if for all a; b 2 A it holds that (a; b) 2 R iff (b; a) 2 R. Relation R is antisymmetric if for all a; b 2 A with a 6= b it holds that if (a; b) 2 R then (b; a) 2= R. Which of these relations are symmetric? R = f(a; a); (a; b); (a; c); (b; a); (c; a); (c; c)g over fa; b; cg I Which of these relations are asymmetric/antisymmetric? I R = f(a; a); (a; b); (a; c); (b; b); (b; c); (c; c)g over fa; b; cg I R = f(a; a); (a; b); (a; c); (b; a); (c; a); (c; c)g over fa; b; cg I equality relation = on natural numbers I R = f(a; a); (a; b); (a; c); (b; b); (b; c); (c; c)g over fa; b; cg I less-than relation ≤ on natural numbers I equality relation = on natural numbers strictly-less-than relation < on natural numbers I I less-than relation ≤ on natural numbers I strictly-less-than relation < on natural numbers How do these properties relate to irreflexivity? Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 11 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 12 / 14 B5. Relations Properties of Binary Relations B5. Relations Properties of Binary Relations Transitivity Special Classes of Relations Definition A binary relation R over set A is transitive if it holds for all a; b; c 2 A that I Some important classes of relations are defined in terms of if (a; b) 2 R and (b; c) 2 R then (a; c) 2 R. these properties. I Equivalence relation: reflexive, symmetric, transitive Partial order: reflexive, antisymmetric, transitive Which of these relations are transitive? I I Strict order: irreflexive, asymmetric, transitive I R = f(a; a); (a; b); (a; c); (b; a); (c; a); (c; c)g over fa; b; cg I ... I R = f(a; a); (a; b); (a; c); (b; b); (b; c); (c; c)g over fa; b; cg I We will consider these and other classes in detail. I equality relation = on natural numbers I less-than relation ≤ on natural numbers I strictly-less-than relation < on natural numbers Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 13 / 14 Malte Helmert, Gabriele R¨oger(University of Basel)Discrete Mathematics in Computer Science October 7, 2020 14 / 14.