Quick viewing(Text Mode)

Definitions of Sets Set Notation Membership Examples of Common

Definitions of Sets Set Notation Membership Examples of Common

Definitions of sets CSCI 1900 Discrete Structures •A is any well-defined collection of objects • The elements or members of a set are the Sets and objects contained in the set Reading: Kolman, Section 1.1 • Well-defined means that it is possible to decide if a given object belongs to the collection or not.

CSCI 1900 – Discrete Structures Sets and Subsets – Page 1 CSCI 1900 – Discrete Structures Sets and Subsets – Page 2

Set notation Membership

of sets are represented with • ∈ -- “is an of” (Note that it is a list of elements in curly brackets – shaped like an “E” as in element) example: {1, 2, 3} • ∉ -- “is not an element of” • Set labels are uppercase letters in italics – • Example: If A = {1, 3, 5, 7}, then 1 ∈ A, but example: A, B, C 2 ∉ A. • Element labels are lowercase letters – example: a, b, c • ∅ is the label for the , i.e., ∅ = { }

CSCI 1900 – Discrete Structures Sets and Subsets – Page 3 CSCI 1900 – Discrete Structures Sets and Subsets – Page 4

Specifying sets with their Examples of Common Sets properties: A set can be represented or defined by the •Z+ = {x | x is a positive integer} rules classifying whether an object • N = {x | x is a positive integer or zero} belongs to a collection or not. •Z = {x | x is an integer} A = {a | a is ______} The above notation translates to “the set A •Q = {x | x is a rational } is comprised of elements a where a Q consists of the that can be satisfies ______.” written a/b, where a and b are integers and b ≠ 0. •R = {x | x is a }

CSCI 1900 – Discrete Structures Sets and Subsets – Page 5 CSCI 1900 – Discrete Structures Sets and Subsets – Page 6

1 Examples of sets used in Subsets programming • If every element of A is also an element of • unsigned int B, that is, if whenever x ∈ A, then x ∈ B, •int we say that A is a of B or that A is • float contained in B. • enum • A is a subset of B if for every x, x ∈ A means that x ∈ B.

CSCI 1900 – Discrete Structures Sets and Subsets – Page 7 CSCI 1900 – Discrete Structures Sets and Subsets – Page 8

Subset Notation Subset Examples

• ⊆ -- “is contained in” (Note that it is • vowels ⊆ alphabet shaped like a “C” as in contained in) • letters that spell “see” ⊆ letters that spell “yes” ⊆ -- “is not contained in” • letters that spell “yes” ⊆ letters that spell “easy” • “Is not contained in” does not mean that • letters that spell “say” ⊆ letters that spell “easy” there aren’t some elements that can be in • positive integers ⊆ integers both sets. It just means that not all of the • odd integers ⊆ integers elements of A are in B • integers ⊆ floating point values (real numbers)

CSCI 1900 – Discrete Structures Sets and Subsets – Page 9 CSCI 1900 – Discrete Structures Sets and Subsets – Page 10

Venn Diagrams Examples • A ⊆ B • Named after British logician John Venn B • Graphical depiction of the relationship of A sets. • Does not represent the individual elements of the sets, rather it implies their existence • A ⊆ B A B B or A

CSCI 1900 – Discrete Structures Sets and Subsets – Page 11 CSCI 1900 – Discrete Structures Sets and Subsets – Page 12

2 More Venn Diagram Examples on Sets

a ∈ A, b ∈ B, and c ∈ A and c ∈ B •A ⊆ B and B ⊆ C implies A ⊆ C • Example: –A = {x | letters that spell “see”} = {e, } A B –B = {x | letters that spell “yes”} = {e, s, y} c a b –C = {x | letters that spell “easy”} = {a, e, s, y}

CSCI 1900 – Discrete Structures Sets and Subsets – Page 13 CSCI 1900 – Discrete Structures Sets and Subsets – Page 14

Theorems on Sets (continued) Theorems on Sets (continued)

• If A ⊆ B and B ⊆ C, then A ⊆ C. • If A is any set, then A ⊆ A. That is, every • If A ⊆ B and C ⊆ B, that doesn’t mean we set is a subset of itself. can say anything at all about the • Since ∅ contains no elements, then every relationship between A and C. It could be element of ∅ is contained in every set. any of the following three cases: Therefore, if A is any set, the statement ∅⊆A is always true. B A C B A CCB A • If A ⊆ B and B ⊆ A, then A = B

CSCI 1900 – Discrete Structures Sets and Subsets – Page 15 CSCI 1900 – Discrete Structures Sets and Subsets – Page 16

Universal Set (continued)

• There must be some all-encompassing • It’s desirable for the all-encompassing set of elements from which the to make sense. elements of each set are considered to be • Example: Although it is true that students members of or not. enrolled in this can be taken from the universal set of all mammals that roam the • For example, to create the set of integers, earth, it makes more sense for the we must take elements from the universal universal set to be people enrolled at set of all numbers. ETSU or at least limit the universal set to humans.

CSCI 1900 – Discrete Structures Sets and Subsets – Page 17 CSCI 1900 – Discrete Structures Sets and Subsets – Page 18

3 Universal Set (continued) Final set of terms

• The Universal Set U is the set containing all • Finite – A set A is called finite if it has n objects for which the discussion is meaningful. distinct elements, where n ∈ N. (e.g., examining whether a sock is an integer is • n is called the of A and is a meaningless exercise.) denoted by |A|, e.g., n = |A| • Any set is a subset of the universal set from • Infinite – A set that is not finite is called which it derives its meaning infinite. • In Venn diagrams, the universal set is denoted • The of A is the set of all with a rectangle. U subsets of A including ∅ and is denoted A P(A)

CSCI 1900 – Discrete Structures Sets and Subsets – Page 19 CSCI 1900 – Discrete Structures Sets and Subsets – Page 20

4