Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

Similar documents
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

CSC Discrete Math I, Spring Sets

SET DEFINITION 1 elements members

Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

CS100: DISCRETE STRUCTURES

Today s Topics. What is a set?

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

2.1 Sets 2.2 Set Operations

1.1 - Introduction to Sets

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Sets. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

What is Set? Set Theory. Notation. Venn Diagram

Discrete Mathematics

Set and Set Operations

Chapter 3. Set Theory. 3.1 What is a Set?

c) the set of students at your school who either are sophomores or are taking discrete mathematics

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

11 Sets II Operations

2 Review of Set Theory

9.5 Equivalence Relations


Summary of Course Coverage

The Language of Sets and Functions

CSE 20 DISCRETE MATH. Fall

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

Discrete Mathematics Lecture 4. Harper Langston New York University

2/18/14. Uses for Discrete Math in Computer Science. What is discrete? Why Study Discrete Math? Sets and Functions (Rosen, Sections 2.1,2.2, 2.

CSE 20 DISCRETE MATH. Winter

Comparing sizes of sets

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Sets and set operations

Sets. Margaret M. Fleck. 15 September 2010

LECTURE 8: SETS. Software Engineering Mike Wooldridge

Computer Science and Mathematics. Part I: Fundamental Mathematical Concepts Winfried Kurth

Topology Homework 3. Section Section 3.3. Samuel Otten

Generell Topologi. Richard Williamson. May 6, 2013

2 Sets. 2.1 Notation. last edited January 26, 2016

Power Set of a set and Relations

Lecture : Topological Space

Solution: It may be helpful to list out exactly what is in each of these events:

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

Slides for Faculty Oxford University Press All rights reserved.

Open and Closed Sets

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

2.1 Symbols and Terminology

Introduction to Sets and Logic (MATH 1190)

Lecture 15: The subspace topology, Closed sets

Lecture-12: Closed Sets

LECTURE NOTES ON SETS

Sets and set operations. Lecture 5 ICOM 4075

Definition. A set is a collection of objects. The objects in a set are elements.

COMP Logic for Computer Scientists. Lecture 17

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Introduction. Sets and the Real Number System

Sets. {1, 2, 3, Calvin}.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

Introduction III. Graphs. Motivations I. Introduction IV

4 Mathematical Data Types

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3.

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Topology notes. Basic Definitions and Properties.

Johns Hopkins Math Tournament Proof Round: Point Set Topology

Figure 1.1: This is an illustration of a generic set and its elements.

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

CSE 20 DISCRETE MATH WINTER

Notes on metric spaces and topology. Math 309: Topics in geometry. Dale Rolfsen. University of British Columbia

Chapter 1. Preliminaries

Lecture 1. 1 Notation

Algorithm. Algorithm Analysis. Algorithm. Algorithm. Analyzing Sorting Algorithms (Insertion Sort) Analyzing Algorithms 8/31/2017

Sets. Sets. Subset, universe. Specifying sets, membership. Examples: Specifying a set using a predicate. Examples

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

Topology and Topological Spaces

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

1 Introduction CHAPTER ONE: SETS

Notes on Topology. Andrew Forrester January 28, Notation 1. 2 The Big Picture 1

EDAA40 At home exercises 1

Topology 550A Homework 3, Week 3 (Corrections: February 22, 2012)

Functions. How is this definition written in symbolic logic notation?

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p.

DISCRETE MATHEMATICS

Problem One: A Quick Algebra Review

What is a Set? Set Theory. Set Notation. Standard Sets. Standard Sets. Part 1.1. Organizing Information

Paul Gartside. March 2, 2013

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Math 395: Topology. Bret Benesh (College of Saint Benedict/Saint John s University)

1.2 Venn Diagrams and Partitions

Some basic set theory (and how it relates to Haskell)

Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets

r=1 The Binomial Theorem. 4 MA095/98G Revision

Lectures on Order and Topology

CS 1200 Discrete Math Math Preliminaries. A.R. Hurson 323 CS Building, Missouri S&T

= [ U 1 \ U 2 = B \ [ B \ B.

A GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

MAT 090 Brian Killough s Instructor Notes Strayer University

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Transcription:

Sets Slides by Christopher M. ourke Instructor: erthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 1.6 1.7 of Rosen cse235@cse.unl.edu Introduction I We ve already implicitly dealt with sets (integers, Z; rationals (Q) etc.) but here we will develop more fully the definitions, properties and operations of sets. set is an unordered collection of (unique) objects. Sets are fundamental discrete structures that form the basis of more complex discrete structures like graphs. Contrast this definition with the one in the book (compare bag, multi-set, tuples, etc). Introduction II Terminology I The objects in a set are called elements or members of a set. set is said to contain its elements. Recall the notation: for a set, an element x we write Two sets, and are equal if they contain the same elements. In this case we write =. if contains x and otherwise. Latex notation: \in, \neg\in. x x {2, 3, 5, 7} = {3, 2, 7, 5} since a set is unordered. lso, {2, 3, 5, 7} = {2, 2, 3, 3, 5, 7} since a set contains unique elements. However, {2, 3, 5, 7} {2, 3}. Terminology II Terminology III We ve already seen set builder notation: multi-set is a set where you specify the number of occurrences of each element: {m 1 a 1, m 2 a 2,..., m r a r } is a set where m 1 occurs a 1 times, m 2 occurs a 2 times, etc. Note in CS (Databases), we distinguish: a set is w/o repetition a bag is a set with repetition O = {x (x Z) (x = 2k for some k Z)} should be read O is the set that contains all x such that x is an integer and x is even. set is defined in intension, when you give its set builder notation. O = {x (x Z) (x 8)} set is defined in extension, when you enumerate all the elements. O = {0, 2, 6, 8}

Venn Diagram set can also be represented graphically using a Venn diagram. More Terminology & Notation I x y z set that has no elements is referred to as the empty set or null set and is denoted. singleton set is a set that has only one element. We usually write {a}. Note the different: brackets indicate that the object is a set while a without brackets is an element. a C The subtle difference also exists with the empty set: that is { } The first is a set, the second is a set containing a set. Figure: Venn Diagram More Terminology & Notation II More Terminology & Notation III is said to be a subset of and we write if and only if every element of is also an element of. That is, we have an equivalence: x(x x ) Theorem For any set S, S and S S (Theorem 1, page 81.) The proof is in the book note that it is an excellent example of a vacuous proof! Latex notation: \emptyset, \subset, \subseteq. More Terminology & Notation IV More Terminology & Notation V set that is a subset of is called a proper subset if. That is, there is some element x such that x. In this case we write or to be even more definite we write Let = {2}. Let = {x (x 100) (x is prime)}. Then. Sets can be elements of other sets. {, {a}, {b}, {a, b}} and {{1}, {2}, {3}} are sets with sets for elements. Latex notation: \subsetneq.

More Terminology & Notation VI More Terminology & Notation VII If there are exactly n distinct elements in a set S, with n a nonnegative integer, we say that S is a finite set and the cardinality of S is n. Notationally, we write S = n set that is not finite is said to be infinite. Recall the set = {x (x 100) (x is prime)}, its cardinality is = 25 since there are 25 primes less than 100. Note the cardinality of the empty set: = 0 The sets N, Z, Q, R are all infinite. Proving Equivalence I Proving Equivalence II You may be asked to show that a set is a subset, proper subset or equal to another set. To do this, use the equivalence discussed before: x(x x ) To show that it is enough to show that for an arbitrary (nonspecific) element x, x implies that x is also in. ny proof method could be used. To show that you must show that is a subset of just as before. ut you must also show that Logically speaking this is showing the following quantified statements: ( x(x a x ) ) ( x(x x ) ) We ll see an example later. x((x ) (x )) Finally, to show two sets equal, it is enough to show (much like an equivalence) that and independently. The Power Set I The Power Set II The power set of a set S, denoted P(S) is the set of all subsets of S. Let = {a, b, c} then the power set is P(S) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} The power set is a fundamental combinatorial object useful when considering all possible combinations of elements of a set. Fact Let S be a set such that S = n, then P(S) = 2 n Note that the empty set and the set itself are always elements of the power set. This follows from Theorem 1 (Rosen, p81).

Tuples I Cartesian Products I Sometimes we may need to consider ordered collections. The ordered n-tuple (a 1, a 2,..., a n ) is the ordered collection with the a i being the i-th element for i = 1, 2,..., n. Two ordered n-tuples are equal if and only if for each i = 1, 2,..., n, a i = b i. For n = 2, we have ordered pairs. Let and be sets. The Cartesian product of and denoted, is the set of all ordered pairs (a, b) where a and b : = {(a, b) (a ) (b )} The Cartesian product is also known as the cross product. subset of a Cartesian product, R is called a relation. We will talk more about relations in the next set of slides. Cartesian Products II Cartesian Products III Cartesian products can be generalized for any n-tuple. Note that unless = or = or =. Can you find a counter example to prove this? The Cartesian product of n sets, 1, 2,..., n, denoted 1 2 n is 1 2 n = {(a 1, a 2,..., a n ) a i i for i = 1, 2,..., n} Notation With Quantifiers Set Operations Whenever we wrote xp (x) or xp (x), we specified the universe of discourse using explicit English language. Now we can simplify things using set notation! x R(x 2 0) x Z(x 2 = 1) Or you can mix quantifiers: Just as arithmetic operators can be used on pairs of numbers, there are operators that can act on sets to give us new sets. a, b, c R x C(ax 2 + bx + c = 0)

Set Operators nion Set Operators Intersection The union of two sets and is the set that contains all elements in, or both. We write = {x (x ) (x )} The intersection of two sets and is the set that contains all elements that are elements of both and We write = {x (x ) (x )} Latex notation: \cup. Latex notation: \cap. Set Operators Venn Diagram Set Operators Venn Diagram : nion Sets and nion, Set Operators Venn Diagram : Intersection Disjoint Sets Two sets are said to be disjoint if their intersection is the empty set: = Intersection, Figure: Two disjoint sets and.

Set Difference The difference of sets and, denoted by \ (or ) is the set containing those elements that are in but not in. Set Complement The complement of a set, denoted Ā, consists of all elements not in. That is, the difference of the universal set and ; \. Ā = {x x } Figure: Set Difference, \ Latex notation: \setminus. Set Identities Latex notation: \overline. Proving Set Equivalences Figure: Set Complement, There are analogs of all the usual laws for set operations. gain, the Cheat Sheet is available on the course web page. http://www.cse.unl.edu/cse235/files/ LogicalEquivalences.pdf Let s take a quick look at this Cheat Sheet Recall that to prove such an identity, one must show that 1. The left hand side is a subset of the right hand side. 2. The right hand side is a subset of the left hand side. 3. Then conclude that they are, in fact, equal. The book proves several of the standard set identities. We ll give a couple of different examples here. Proving Set Equivalences I Let = {x x is even} and = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that Proof. = C ( C): Let x. Then x is a multiple of 2 and x is a multiple of 3, therefore we can write x = 2 3 k for some integer k. Thus x = 6k and so x is a multiple of 6 and x C. (C ): Let x C. Then x is a multiple of 6 and so x = 6k for some integer k. Therefore x = 2(3k) = 3(2k) and so x and x. It follows then that x by definition of intersection, thus C. We conclude that = C Proving Set Equivalences II n alternative prove uses membership tables where an entry is 1 if it a chosen (but fixed) element is in the set and 0 otherwise. (Exercise 13, p95): Show that C = Ā C

Proving Set Equivalences II Continued C C C Ā C Ā C 0 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 under a set indicates that an element is in the set. Since the columns are equivalent, we conclude that indeed, C = Ā C Generalized nions & Intersections I In the previous example we showed that De Morgan s Law generalized to unions involving 3 sets. Indeed, for any finite number of sets, De Morgan s Laws hold. Moreover, we can generalize set operations in a straightforward manner to any finite number of sets. The union of a collection of sets is the set that contains those elements that are members of at least one set in the collection. n i = 1 2 n i=1 Generalized nions & Intersections II Computer Representation of Sets I Latex notation: \bigcup. The intersection of a collection of sets is the set that contains those elements that are members of every set in the collection. n i = 1 2 n i=1 Latex notation: \bigcap. There really aren t ways to represent infinite sets by a computer since a computer is has a finite amount of memory (unless of course, there is a finite representation). If we assume that the universal set is finite, however, then we can easily and efficiently represent sets by bit vectors. Specifically, we force an ordering on the objects, say = {a 1, a 2,..., a n } For a set, a bit vector can be defined as { 0 if ai b i = 1 if a i for i = 1, 2,..., n. Computer Representation of Sets II Let = {0, 1, 2, 3, 4, 5, 6, 7} and let = {0, 1, 6, 7} Then the bit vector representing is 1100 0011 What s the empty set? What s? Set operations become almost trivial when sets are represented by bit vectors. In particular, the bit-wise Or corresponds to the union operation. The bit-wise nd corresponds to the intersection operation. Computer Representation of Sets III Let and be as before and let = {0, 4, 5} Note that the bit vector for is 1000 1100. The union, can be computed by 1100 0011 1000 1100 = 1100 1111 The intersection, can be computed by What sets do these represent? 1100 0011 1000 1100 = 1000 0000 Note: If you want to represent arbitrarily sized sets, you can still do it with a computer how?

Conclusion Questions?