Slide 1

Slide 1 text

cs2102: Discrete Mathematics Class 7: Sets, SAT problem David Evans, Mohammad Mahmoody University of Virginia

Slide 2

Slide 2 text

Plan • Sets (as a Data Type) • Review: SAT problem and its importance Thursday: continue other data types..

Slide 3

Slide 3 text

Type Operations

Slide 4

Slide 4 text

Data Types Mathematical • Defines a set of possible values and operations on those values • Finite or infinite Programming Languages • Defines a set of possible values and operations on those values • Finite (in practice), but often “viewed” as infinite

Slide 5

Slide 5 text

Sets as Data Type Unordered collection of objects Infinite or finite Objects may be of any type not necessarily the same including sets 4 2102 { 1, 2, 3, …} Each object only counts once (multiset has count for each object)

Slide 6

Slide 6 text

Membership (∈) ∈ is true iff is in the set 4 2102 { 1, 2, 3, …}

Slide 7

Slide 7 text

Not being a member (∉) ∉ is true iff is not in the set 4 2102 { 1, 2, 3, …}

Slide 8

Slide 8 text

Subset (⊆) ⊆ iff every element of A is an element of B. 4 2102 { 1, 2, 3, …}

Slide 9

Slide 9 text

Set Equality How should we define = for sets? 4 2102 { 1, 2, 3, …}

Slide 10

Slide 10 text

Set Equality = ⟺ ⊆ ∧ ⊆ 4 2102 { 1, 2, 3, …} How should we define = for sets?

Slide 11

Slide 11 text

More Set Operations Union: ∪ Intersection: ∩ Difference: − A B

Slide 12

Slide 12 text

Defining Union Union: ∪ A B

Slide 13

Slide 13 text

Defining Intersection A B Intersection: ∩

Slide 14

Slide 14 text

Defining Difference A B Difference: −

Slide 15

Slide 15 text

Complement Complement: ҧ A ∀ ∈ . ∈ ⟺ ∉ ҧ . D = “domain of discourse” (Universe) B U 4 2102 { 1, 2, 3, …}

Slide 16

Slide 16 text

∈ ⟺ is in the set Membership ∉ ⟺ ¬( ∈ ) ∈ ҧ ⟺ ( ∈ ∧ ∉ ) Complement ∀. [ ∈ − ⟺ ∈ ∧ ∉ ] Difference ∀. [ ∈ ∩ ⟺ ∈ ∧ ∈ ] Intersection ∀. [ ∈ ∪ ⟺ ∈ ∨ ∈ ] Union ⊆ ⟺ ∀ ∈ . ∈ Subset Equality = ⟺ ⊆ ∧ ⊆ Non-membership Which ones are necessary?

Slide 17

Slide 17 text

B Exchanging Union wtith Intersection? A B U

Slide 18

Slide 18 text

Self-Membership ? Is there any set where ∈ ? Is it even meaningful to ask ∈ ?

Slide 19

Slide 19 text

Conundrum notself = the set of all sets that are not members of themselves Is notself ∈ notself ? all = the set of all sets notself is a subset of all .

Slide 20

Slide 20 text

notself = the set of all sets that are not members of themselves Is notself ∈ notself ? Slack break…

Slide 21

Slide 21 text

notself = the set of all sets that are not members of themselves Is notself ∈ notself ? Russell’s Paradox! IF Yes, it means notself ∈ notself , so notself is a member of itself and should not be in notself . IF No, it means notself ∉ notself , so notself is not a member of itself and should be in notself .

Slide 22

Slide 22 text

Where did we make a mistake?

Slide 23

Slide 23 text

Conundrum notself = the set of all sets that are not members of themselves Is notself ∈ notself ? all = the set of all sets notself is a well-defined subset of all .

Slide 24

Slide 24 text

Sets as data type Unordered collection of objects Infinite or finite Objects may be of any type... 4 2102 { 1, 2, 3, …} Apple

Slide 25

Slide 25 text

Charge • PS3 Due this Friday (6:29pm) start early • Next session: Other Data Types – Sequences, Functions, etc. – Read MCS Chapter 4