Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Similar documents
Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

1. SET 10/9/2013. Discrete Mathematics Fajrian Nur Adnan, M.CS

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

A set is an unordered collection of objects.

With Question/Answer Animations. Chapter 2

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Discrete Basic Structure: Sets

CSE 20 DISCRETE MATH WINTER

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

ICS141: Discrete Mathematics for Computer Science I

Sets McGraw-Hill Education

Chapter 2 - Basics Structures

CHAPTER 1. Preliminaries. 1 Set Theory

CSI30. Chapter 2. Basic Structures: Sets, Functions, Sequences, Sums. 2.1 Sets and subsets 2.2 Sets of sets

SET THEORY. 1. Roster or Tabular form In this form the elements of the set are enclosed in curly braces { } after separating them by commas.

1 Chapter 1: SETS. 1.1 Describing a set

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161

CS 173: Discrete Structures. Eric Shaffer Office Hour: Wed. 1-2, 2215 SC

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

Sets. Introduction to Set Theory ( 2.1) Basic notations for sets. Basic properties of sets CMSC 302. Vojislav Kecman

SETS. JEE-Mathematics

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams

In this initial chapter, you will be introduced to, or more than likely be reminded of, a

SWER ENG 2DM3 Tutorial 2

EECS 1028 M: Discrete Mathematics for Engineers

Finite Math Section 6_1 Solutions and Hints

Sets and Functions. MATH 464/506, Real Analysis. J. Robert Buchanan. Summer Department of Mathematics. J. Robert Buchanan Sets and Functions

Notes on Sets for Math 10850, fall 2017

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

CS 2336 Discrete Mathematics

Chapter 0: Sets and Numbers

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

Notes for Science and Engineering Foundation Discrete Mathematics

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall

Relations Graphical View

Sec$on Summary. Definition of sets Describing Sets

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

Discrete Mathematical Structures: Theory and Applications

Proving simple set properties...

Chapter-2 SETS In Mathematics, Set theory was developed by George Cantor ( ).

Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

1.7 Proof Methods and Strategy

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

1 Predicates and Quantifiers

CISC 1100: Structures of Computer Science

Mathematics Review for Business PhD Students Lecture Notes

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall Set-builder notation (a more precise way of describing a set)

SETS AND FUNCTIONS JOSHUA BALLEW

Math 42, Discrete Mathematics

Set theory. Math 304 Spring 2007

Propositional Logic, Predicates, and Equivalence

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

CM10196 Topic 2: Sets, Predicates, Boolean algebras

Intro to Logic and Proofs

Chapter 1. Logic and Proof

Chapter 1 : The language of mathematics.

conditional expression \LET E2 let x == E1 E2 local definition formulae

A B is shaded A B A B

Mathematics Review for Business PhD Students

Recursion. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

1.1 Introduction to Sets

Introduction to Set Operations

Set Theory. CPT Section D Quantitative Aptitude Chapter 7 Brijeshwar Prasad Gupta

Preparing for the CS 173 (A) Fall 2018 Midterm 1

MTHSC 3190 Section 2.9 Sets a first look

Discrete Mathematics Set Operations

Filters in Analysis and Topology

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Models of Computation. by Costas Busch, LSU

CSCE 222 Discrete Structures for Computing

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Sets. 1.1 What is a set?

CSE 20 DISCRETE MATH. Winter

Automata and Languages

BASIC MATHEMATICAL TECHNIQUES

0 Logical Background. 0.1 Sets

CS Discrete Mathematics Dr. D. Manivannan (Mani)

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

SETS. Chapter Overview

Recall that the expression x > 3 is not a proposition. Why?

Background for Discrete Mathematics

LIN1032 Formal Foundations for Linguistics

{x : P (x)} P (x) = x is a cat

0 Sets and Induction. Sets

Topics in Logic and Proofs

Elementary Point-Set Topology

Section 1: Sets and Interval Notation

HW 4 SOLUTIONS. , x + x x 1 ) 2

Abstract Measure Theory

2.23 Theorem. Let A and B be sets in a metric space. If A B, then L(A) L(B).

COMP9020 Lecture 3 Session 2, 2014 Sets, Functions, and Sequences. Revision: 1.3

HOW TO CREATE A PROOF. Writing proofs is typically not a straightforward, algorithmic process such as calculating

CHAPTER 1 SETS AND EVENTS

Set theory background for probability

Transcription:

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 1 / 42 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 2.1, 2.2 of Rosen

Introduction I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers 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. Definition A set is an unordered collection of (unique) objects. 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). 2 / 42

Introduction II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition The objects in a set are called elements or members of a set. A set is said to contain its elements. Recall the notation: for a set A, an element x we write if A contains x and x A x A otherwise. Latex notation: \in, \notin. 3 / 42

I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition Two sets, A and B are equal if they contain the same elements. In this case we write A = B. Example {2, 3, 5, 7} = {3, 2, 7, 5} since a set is unordered. Also, {2, 3, 5, 7} = {2, 2, 3, 3, 5, 7} since a set contains unique elements. However, {2, 3, 5, 7} {2, 3}. 4 / 42

II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers A 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 5 / 42

III Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers We ve already seen set builder notation: 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. A set is defined in intension, when you give its set builder notation. O = {x (x Z) (0 x 8) (x = 2k for some k Z)} A set is defined in extension, when you enumerate all the elements. O = {0, 2, 4, 6, 8} 6 / 42

Venn Diagram Example A set can also be represented graphically using a Venn diagram. Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers U x A y z B a C Figure: Venn Diagram 7 / 42

More & Notation I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers A set that has no elements is referred to as the empty set or null set and is denoted. A 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. The subtle difference also exists with the empty set: that is { } The first is a set, the second is a set containing a set. 8 / 42

More & Notation II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition A is said to be a subset of B and we write A B if and only if every element of A is also an element of B. That is, we have an equivalence: A B x(x A x B) 9 / 42

More & Notation III Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Theorem For any set S, S and S S (Theorem 1, page 115.) The proof is in the book note that it is an excellent example of a vacuous proof! Latex notation: \emptyset, \subset, \subseteq. 10 / 42

More & Notation IV Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition A set A that is a subset of B is called a proper subset if A B. That is, there is some element x B such that x A. In this case we write A B or to be even more definite we write Example A B Let A = {2}. Let B = {x (x N) (x 100) (x is prime)}. Then A B. Latex notation: \subsetneq. 11 / 42

More & Notation V Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers can be elements of other sets. Example {, {a}, {b}, {a, b}} and {{1}, {2}, {3}} are sets with sets for elements. 12 / 42

More & Notation VI Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition 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 Definition A set that is not finite is said to be infinite. 13 / 42

More & Notation VII Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Example Recall the set B = {x (x 100) (x is prime)}, its cardinality is B = 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. 14 / 42

Proving Equivalence I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers 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: A B x(x A x B) To show that A B it is enough to show that for an arbitrary (nonspecific) element x, x A implies that x is also in B. Any proof method could be used. To show that A B you must show that A is a subset of B just as before. But you must also show that x((x B) (x A)) 15 / 42

Proving Equivalence II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Finally, to show two sets equal, it is enough to show (much like an equivalence) that A B and B A independently. Logically speaking this is showing the following quantified statements: ( x(x A x B) ) ( x(x B x A) ) We ll see an example later. 16 / 42

The Power I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition The power set of a set S, denoted P(S) is the set of all subsets of S. Example Let A = {a, b, c} then the power set is P(S) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}} Note that the empty set and the set itself are always elements of the power set. This follows from Theorem 1 (Rosen, p115). 17 / 42

The Power II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers 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 18 / 42

Tuples I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Sometimes we may need to consider ordered collections. Definition 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. 19 / 42

Cartesian Products I Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Definition Let A and B be sets. The Cartesian product of A and B denoted A B, is the set of all ordered pairs (a, b) where a A and b B: A B = {(a, b) (a A) (b B)} The Cartesian product is also known as the cross product. Definition A subset of a Cartesian product, R A B is called a relation. We will talk more about relations in the next set of slides. 20 / 42 Note that A B B A unless A = or B = or A = B. Can you find a counter example to prove this?

Cartesian Products II Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers Cartesian products can be generalized for any n-tuple. Definition The Cartesian product of n sets, A 1, A 2,..., A n, denoted A 1 A 2 A n is A 1 A 2 A n = {(a 1, a 2,..., a n ) a i A i for i = 1, 2,..., n} 21 / 42

Notation With Quantifiers Introduction Venn Diagrams More Proving Equivalences Power Tuples Cartesian Products Quantifiers 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! Example Or you can mix quantifiers: x R(x 2 0) x Z(x 2 = 1) a, b, c R x C(ax 2 + bx + c = 0) 22 / 42

Identities Just as arithmetic operators can be used on pairs of numbers, there are operators that can act on sets to give us new sets. 23 / 42

Operators Union Identities Definition The union of two sets A and B is the set that contains all elements in A, B or both. We write A B = {x (x A) (x B)} Latex notation: \cup. 24 / 42

Operators Identities Definition The intersection of two sets A and B is the set that contains all elements that are elements of both A and B We write A B = {x (x A) (x B)} Latex notation: \cap. 25 / 42

Operators Venn Diagram Example Identities U A B A and B 26 / 42

Operators Venn Diagram Example: Union Identities U A B Union, A B 27 / 42

Operators Venn Diagram Example: Identities U A B, A B 28 / 42

Disjoint Identities Definition Two sets are said to be disjoint if their intersection is the empty set: A B = U A B Figure: Two disjoint sets A and B. 29 / 42

Difference Definition The difference of sets A and B, denoted by A \ B (or A B) is the set containing those elements that are in A but not in B. Identities U A B Figure: Difference, A \ B 30 / 42 Latex notation: \setminus.

Complement Identities Definition The complement of a set A, denoted Ā, consists of all elements not in A. That is, the difference of the universal set and A; U \ A. Ā = {x x A} U A A Figure: Complement, A 31 / 42

Identities Identities There are analogs of all the usual laws for set operations. Again, 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 32 / 42

Proving Equivalences Identities 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. 33 / 42

Proving Equivalences Example I Identities Let A = {x x is even} and B = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that Proof. A B = C 34 / 42

Proving Equivalences Example I Identities Let A = {x x is even} and B = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that Proof. A B = C (A B C): Let x A B. 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. 34 / 42

Proving Equivalences Example I Identities Let A = {x x is even} and B = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that Proof. A B = C (A B C): Let x A B. 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 A B): 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 A and x B. It follows then that x A B by definition of intersection, thus C A B. 34 / 42

Proving Equivalences Example I Identities Let A = {x x is even} and B = {x x is a multiple of 3} and C = {x x is a multiple of 6}. Show that Proof. A B = C (A B C): Let x A B. 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 A B): 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 A and x B. It follows then that x A B by definition of intersection, thus C A B. We conclude that A B = C 34 / 42

Proving Equivalences Example II Identities An alternative prove uses membership tables where an entry is 1 if it a chosen (but fixed) element is in the set and 0 otherwise. Example (Exercise 13, p95): Show that A B C = Ā B C 35 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1 1 0 0 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B C 0 0 0 0 1 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 0 0 0 0 1 under a set indicates that an element is in the set. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B 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. If the columns are equivalent, we can conclude that indeed, A B C = Ā B C 36 / 42

Proving Equivalences Example II Continued Identities A B C A B C A B C Ā B C Ā B 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, A B C = Ā B C 36 / 42

Generalized Unions & s I Identities 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. Definition 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 A i = A 1 A 2 A n i=1 Latex notation: \bigcup. 37 / 42

Generalized Unions & s II Identities Definition The intersection of a collection of sets is the set that contains those elements that are members of every set in the collection. n A i = A 1 A 2 A n i=1 Latex notation: \bigcap. 38 / 42

Computer Representation of I Identities 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 U is finite, however, then we can easily and efficiently represent sets by bit vectors. Specifically, we force an ordering on the objects, say U = {a 1, a 2,..., a n } For a set A U, a bit vector can be defined as { 0 if ai A b i = 1 if a i A 39 / 42 for i = 1, 2,..., n.

Computer Representation of II Identities Example Let U = {0, 1, 2, 3, 4, 5, 6, 7} and let A = {0, 1, 6, 7} Then the bit vector representing A is 1100 0011 What s the empty set? What s U? 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 And corresponds to the intersection operation. 40 / 42

Computer Representation of III Identities Example Let U and A be as before and let B = {0, 4, 5} Note that the bit vector for B is 1000 1100. The union, A B can be computed by 1100 0011 1000 1100 = 1100 1111 The intersection, A B can be computed by 1100 0011 1000 1100 = 1000 0000 What sets do these represent? Note: If you want to represent arbitrarily sized sets, you can still do it with a computer how? 41 / 42

Conclusion Identities Questions? 42 / 42