EDAA40 Discrete Structures in Computer Science Seminar 2 A recap: sets, relations, functions Jörn W. Janneck, Dept. of Computer Science, Lund University sets • • • • • how to specify them, incl. recursive definition elementhood, extension, subsets operations, set algebra, generalized union/intersection extensionality, cardinality, how to compare cardinals power sets 2 specifying sets enumeration of its elements set builder notation / set comprehensions flavor 1 flavor 2 bad flavor 3 operations on sets A B A B A B union all elements that are in A or B or both intersection all elements that are both in A and B difference all elements that are in A and not in B 4 generalized union & intersection Let S be a set of sets. Often, S is a family of sets. Then we write... Note: Here be dragons! 5 extensionality, cardinality A set is defined by the elements it contains (its extension). The number of elements in a set A is called its cardinality. alternative syntax For any two sets A and B, if there is an injection then For any two sets A and B, if there is a bijection then A and B are equinumerous. We write Cantor-Schröder-Bernstein (CSB) theorem: If there are two injections then there exists a bijection and 6 power sets The power set of a set A is the set of all its subsets. alternative syntax 7 relations • • • • • • ordered pairs, tuples, Cartesian products, relations source, target, domain, range operations on relations properties of relations equivalence relations order relations 8 ordered pairs, tuples, relations ordered pair n-tuple The (cartesian) product of a pair of sets, or more generally a finite family of sets, is the set of all ordered pairs or n-tuples. An n-place relation R over A1 x … x An is a subset of that product: Special case: (binary, dyadic) relation R from A to B : 9 source, target, domain, range actual values, left domain actual values, right range A source B target 10 operations on relations For a binary relation its converse (inverse) is the relation For a binary relation its complement is the relation Given two binary relations and their composition is a binary relation on Given a binary relation from A to B, for any its image under R, written R(a), is defined as Can be “lifted” to subsets : 11 properties A binary relation is reflexive iff for all A binary relation such that is irreflexive iff there is no A binary relation is transitive iff for all A binary relation is symmetric iff for all A binary relation is asymmetric iff for all A binary relation is antisymmetric iff for all 12 equivalence relations A binary relation 1. reflexive is an equivalence relation iff it is 2. symmetric 3. transitive Given a set A, a partition of A is a set of pairwise disjoint sets , such that Given a set A and an equivalence relation define the equivalence class of a as on A, for any we Given a set A and an equivalence relation is defined as on A, the quotient (set) 13 order relation, poset A binary relation order iff it is 1. reflexive is an ( inclusive or non-strict) (partial) 2. antisymmetric A pair where A is a set and called a partially ordered set or poset. A binary relation 1. irreflexive 3. transitive a partial order on A is is a strict (partial) order iff it is 2. transitive A binary relation is a ( non-strict) total (or linear) order iff it is 1. reflexive 2. antisymmetric 3. transitive 4. total (complete): 14 transitive closure The transitive closure defined as follows: of a binary relation is Note: This is a union of infinitely many sets, so: dragon warning! 15 functions • functions as special relations • operations on functions • properties of functions – injections, surjections, bijections 16 functions, terminology is a function iff A relation We then also write actual values, left domain domain actual values, right range range A source domain B target codomain 17 operations on/with functions , its restriction to a set Given a function is defined as alternative syntax Given a function and a set the image of X under f is defined as Given an endofunction the closure of X under f such that Given functions and a set , is defined as the smallest and defined as: , their composition 18 injection, surjection, bijection is injective (and thus an injection) iff A function Notation: is surjective (and thus an surjection) iff A function Notation: A function is bijective (and thus an bijection) iff it is both injective and surjective. Notation: A a b c B 1 2 3 4 injection, one-to-one A a b c d B 1 2 3 surjection, onto A a b c d B 1 2 3 4 bijection 19 infinity • infinite sets • countable sets, transfinite cardinals • comparing the number of elements in infinite sets 20 infinite sets A is infinite if it is equinumerous to a proper subset of itself. That is, there is some S such that A is denumerable (countable) if it is equinumerous to the natural numbers, i.e. The cardinality of the natural numbers (and thus all denumerable sets) has a name: 21
© Copyright 2026 Paperzz