Copyright © Zeph Grunschlag, 2001-2002. Set Operations Zeph Grunschlag.

Slides:



Advertisements
Similar presentations
Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.
Advertisements

Copyright © Cengage Learning. All rights reserved.
Prof. Johnnie Baker Module Basic Structures: Sets
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Discrete Structures & Algorithms Basics of Set Theory EECE 320 — UBC.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Instructor: Hayk Melikya
(CSC 102) Discrete Structures Lecture 14.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built.
Denoting the beginning
1 Section 1.7 Set Operations. 2 Union The union of 2 sets A and B is the set containing elements found either in A, or in B, or in both The denotation.
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
Analytical Methods in CS (CIS 505)
Sets 1.
Sets 1.
1 Set Operations CS/APMA 202, Spring 2005 Rosen, section 1.7 Aaron Bloomfield.
Rosen 1.6. Approaches to Proofs Membership tables (similar to truth tables) Convert to a problem in propositional logic, prove, then convert back Use.
Operations on Sets – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Operations on Sets Reading: Kolman, Section 1.2.
Set Notation.
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
Chapter 3 – Set Theory  .
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Chapter 7 Logic, Sets, and Counting Section 2 Sets.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Chapter 7 Review Important Terms, Symbols, Concepts 7.1. Logic A proposition is a statement (not a question.
Discrete Structure Sets. 2 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element.
CS201: Data Structures and Discrete Mathematics I
January 30, 2002Applied Discrete Mathematics Week 1: Logic and Sets 1 Let’s Talk About Logic Logic is a system based on propositions.Logic is a system.
CompSci 102 Discrete Math for Computer Science
Section 2.2 Subsets and Set Operations Math in Our World.
Naïve Set Theory. Basic Definitions Naïve set theory is the non-axiomatic treatment of set theory. In the axiomatic treatment, which we will only allude.
Chapter SETS DEFINITION OF SET METHODS FOR SPECIFYING SET SUBSETS VENN DIAGRAM SET IDENTITIES SET OPERATIONS.
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 11 Basic Structure : Sets, Functions, Sequences, and Sums Sets Operations.
2.1 Sets 2.2 Set Operations –Set Operations –Venn Diagrams –Set Identities –Union and Intersection of Indexed Collections 2.3 Functions 2.4 Sequences and.
Chapter 2 With Question/Answer Animations. Section 2.1.
Discrete Mathematics CS 2610 January 27, part 2.
Discrete Mathematics Set.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Set Operations Section 2.2.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Section 6.1 Set and Set Operations. Set: A set is a collection of objects/elements. Ex. A = {w, a, r, d} Sets are often named with capital letters. Order.
Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.
Set. Outline Universal Set Venn Diagram Operations on Sets.
Dr. Ameria Eldosoky Discrete mathematics
Chapter 2 Sets and Functions.
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
Set Operations CS 202, Spring 2008 Epp, chapter 5.
Copyright © Zeph Grunschlag,
Discrete Structures – CNS 2300
Set, Combinatorics, Probability & Number Theory
Sets Section 2.1.
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CS100: Discrete structures
Set Theory A B C.
Set Operations Section 2.2.
L5 Set Operations.
Chapter 7 Logic, Sets, and Counting
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Set Theoretic Operations
Presentation transcript:

Copyright © Zeph Grunschlag, Set Operations Zeph Grunschlag

L52 Announcements HW2 due next time Check homepage for possible announcements over week-end. May change a couple of problems.

L53 Agenda Section 1.5: Set Operations Union  and Disjoint union Intersection  Difference “  ” Complement “  ” Symmetric Difference 

L54 Universe of Reference When talking about a set, a universe of reference (universal set ) needs to be specified. Even though a set is defined by the elements which it contains, those elements cannot be arbitrary. If arbitrary elements are allowed paradoxes can result arising from self reference.

L55 Russel ’ s Paradox If we allow arbitrary elements, we should also allow sets to be elements, and sets of sets, and so on. So it would be perfectly reasonable to consider the following set: S = the set containing all sets which do not contain themselves CLAIM: This set cannot exist. Proof: If it existed, it would either contain itself, or not. Let ’ s consider both cases:

L56 Russel ’ s Paradox 1. S contains itself as an element. Therefore, since the elements of S do not contain themselves as elements, it does not contain S. This contradicts the assumption, so that the first case cannot happen. 2. S doesn ’ t contain itself. Therefore, since S contains all sets not containing themselves, it must contain S. This contradicts the assumption, so that the second case cannot happen. As neither case can happen, S cannot exist. 

L57 Russel ’ s Paradox It is of paramount importance that when a set is specified by stating certain conditions, that it ought to exist as a set. The set could be empty, but that ’ s fine, as long as it actually exists. EG: The set of all pigs which can fly. The condition is not achievable so that this set is the empty set . It is still a set, however. To guarantee set existentiality, a universal set U should always be fixed. Q: Is there a universe of reference in which the set of all sets not containing themselves is well-defined?

L58 Russel ’ s Paradox A: Yes. In fact any universe. For example U ={ {1,2}, {1,2,{1,2}}, {1,2,{1,2},{3}} } Q: What is the set S of all sets not containing themselves in this case?

L59 Russel ’ s Paradox A: S = U

L510 Set Builder Notation Up to now sets have been defined using the curly brace notation “ { … } ” or descriptively “ the set of all natural numbers ”. The set builder notation allows for concise definition of new sets. For example { x | x is an even integer } { 2x | x is an integer } are equivalent ways of specifying the set of all even integers.

L511 Set Builder Notation In general, one specifies a set by writing { f (x ) | P (x ) } Where f (x ) is a function of x (okay we haven ’ t really gotten to functions yet … ) and P (x ) is a propositional function of x. The notation is read as “ the set of all elements f (x ) such that P (x ) holds ” Stuff between “ { “ and “ | ” specifies how elements look Stuff between the “ | ” and “ } ” gives properties elements satisfy Pipe symbol “ | ” is short-hand for “ such that ”.

L512 Set Builder Notation. Shortcuts. To specify a subset of a pre-defined set, f (x ) takes the form x  S. For example {x  N |  y (x = 2y ) } defines the set of all even natural numbers (assuming universe of reference Z). When universe of reference is understood, don ’ t need to specify propositional function EG: { x 3 | } or simply {x 3 } specifies the set of perfect cubes {0,1,8,27,64,125, … } assuming U is the set of natural numbers.

L513 Set Builder Notation. Examples. Q1: U = N. { x |  y (y  x ) } = ? Q2: U = Z. { x |  y (y  x ) } = ? Q3: U = Z. { x |  y (y  R  y 2 = x )} = ? Q4: U = Z. { x |  y (y  R  y 3 = x )} = ? Q5: U = R. { |x | | x  Z } = ? Q6: U = R. { |x | } = ?

L514 Set Builder Notation. Examples. A1: U = N. { x |  y (y  x ) } = { 0 } A2: U = Z. { x |  y (y  x ) } = { } A3: U = Z. { x |  y (y  R  y 2 = x )} = { 0, 1, 2, 3, 4, … } = N A4: U = Z. { x |  y (y  R  y 3 = x )} = Z A5: U = R. { |x | | x  Z } = N A6: U = R. { |x | } = non-negative reals.

L515 Set Theoretic Operations Set theoretic operations allow us to build new sets out of old, just as the logical connectives allowed us to create compound propositions from simpler propositions. Given sets A and B, the set theoretic operators are: Union (  ) Intersection (  ) Difference (  Complement ( “—” ) Symmetric Difference (  ) give us new sets A  B, A  B, A-B, A  B, and  A.

L516 Venn Diagrams Venn diagrams are useful in representing sets and set operations. Various sets are represented by circles inside a big rectangle representing the universe of reference.

L517 Union A  B = { x | x  A  x  B } Elements in at least one of the two sets: AB U ABAB

L518 Intersection A  B = { x | x  A  x  B } Elements in exactly one of the two sets: AB U ABAB

L519 Disjoint Sets DEF: If A and B have no common elements, they are said to be disjoint, i.e. A  B = . AB U

L520 Disjoint Union When A and B are disjoint, the disjoint union operation is well defined. The circle above the union symbol indicates disjointedness. AB U

L521 Disjoint Union FACT: In a disjoint union of finite sets, cardinality of the union is the sum of the cardinalities. I.e.

L522 Set Difference A  B = { x | x  A  x  B } Elements in first set but not second: A B U ABAB

L523 Symmetric Difference AB UABAB A  B = { x | x  A  x  B } Elements in exactly one of the two sets:

L524 Complement  A = { x | x  A } Elements not in the set (unary operator): A U AA

L525 Set Identities Table 1, Rosen p. 49  Identity laws  Domination laws  Idempotent laws  Double complementation  Commutativity  Associativity  Distribuitivity  DeMorgan This table is gotten from the previous table of logical identities (Table 5, p. 17) by rewriting as follows: disjunction “  ” becomes union “  ” conjunction “  ” becomes intersection “  ” negation “  ” becomes complementation “–” false “ F ” becomes the empty set  true “ T ” becomes the universe of reference U

L526 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C )

L527 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.)

L528 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.) = {x | (x  A  x  B )  x  C } (by def.)

L529 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.) = {x | (x  A  x  B )  x  C } (by def.) = {x | x  A  ( x  B  x  C ) } (logical assoc.)

L530 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.) = {x | (x  A  x  B )  x  C } (by def.) = {x | x  A  ( x  B  x  C ) } (logical assoc.) = {x | x  A  x  B  C ) } (by def.)

L531 Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (A  B )  C = A  (B  C ) Proof : (A  B )  C = {x | x  A  B  x  C } (by def.) = {x | (x  A  x  B )  x  C } (by def.) = {x | x  A  ( x  B  x  C ) } (logical assoc.) = {x | x  A  (x  B  C ) } (by def.) = A  (B  C ) (by def.)  Other identities are derived similarly.

L532 Set Identities via Venn It ’ s often simpler to understand an identity by drawing a Venn Diagram. For example DeMorgan ’ s first law can be visualized as follows.

L533 Visual DeMorgan A:A: B:B:

L534 Visual DeMorgan A:A: B:B: AB :AB :

L535 Visual DeMorgan A:A: B:B: AB :AB :

L536 Visual DeMorgan A:A: B:B:

L537 Visual DeMorgan A:A: B:B: A:A: B:B:

L538 Visual DeMorgan A:A: B:B: A:A: B:B:

L539 Visual DeMorgan =

L540 Sets as Bit-Strings If we order the elements of our universe, we can represent sets by bit-strings. For example, consider the universe U = {ant, beetle, cicada, dragonfly} Order the elements alphabetically. Subsets of U are represented by bit-strings of length 4. Each bit in turn, tells us whether the corresponding element is contained in the set. EG: {ant, dragonfly} is represented by the bit-string Q: What set is represented by 0111 ?

L541 Sets as Bit-Strings A: 0111 represents {beetle, cicada, dragonfly} Conveniently, under this representation the various set theoretic operations become the logical bit-string operators that we saw before. For example, the symmetric difference of {beetle} with {ant, beetle, dragonfly} is represented by: 0100  = {ant, dragonfly}

L542 Example for section 1.5 Principle of Inclusion-Exclusion