Module #3 - Sets 10/27/2015Michael P. Frank / Kees van Deemter1 Module #3: The Theory of Sets Rosen...

58
odule #3 - Sets 03/27/22 Michael P. Frank / Kees van Deemter 1 Module #3: The Theory of Sets Rosen 5 Rosen 5 th th ed., §§1.6-1.7 ed., §§1.6-1.7

Transcript of Module #3 - Sets 10/27/2015Michael P. Frank / Kees van Deemter1 Module #3: The Theory of Sets Rosen...

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 1

Module #3:The Theory of Sets

Rosen 5Rosen 5thth ed., §§1.6-1.7 ed., §§1.6-1.7

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 2

Introduction to Set Theory (§1.6)

• A A setset is another type of structure, representing an is another type of structure, representing an unordered unordered collection of zero or more collection of zero or more distinct distinct objects.objects.

• Sets are ubiquitous in computer software systems.Sets are ubiquitous in computer software systems.• Probably all of mathematics can be defined in Probably all of mathematics can be defined in

terms of some form of set theory.terms of some form of set theory.– Relations, functions, etc.Relations, functions, etc.

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 3

Intuition behind sets

• Almost anything you can do with individual Almost anything you can do with individual objects, you can also do with sets of objects. E.g. objects, you can also do with sets of objects. E.g. (informally speaking), you can(informally speaking), you can– refer to them, compare them, combine them, …refer to them, compare them, combine them, …

• You can also do some things to a set that you You can also do some things to a set that you probably cannot do to an individual: E.g., you canprobably cannot do to an individual: E.g., you can– check whether one set is contained in another (?)check whether one set is contained in another (?)– determine how many elements it has (?)determine how many elements it has (?)– quantify over its elements (using it as u.d. for quantify over its elements (using it as u.d. for ,,))

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 4

Basic notations for sets

• For sets, weFor sets, we’’ll use variables ll use variables SS, , TT, , UU, … , … • We can denote a set We can denote a set SS in writing by listing in writing by listing

all of its elements in curly braces: all of its elements in curly braces: – {a, b, c} is the set of whatever 3 objects are {a, b, c} is the set of whatever 3 objects are

denoted by a, b, c.denoted by a, b, c.

• SetSet builder notationbuilder notation: For any proposition : For any proposition PP((xx) over any universe of discourse, ) over any universe of discourse, {{xx||PP((xx)} is )} is the set of all x such that P(x).the set of all x such that P(x).

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 5

Basic properties of sets

• Sets are inherently Sets are inherently unorderedunordered::– No matter what objects a, b, and c denote, No matter what objects a, b, and c denote,

{a, b, c} = {a, c, b} = {b, a, c} = …{a, b, c} = {a, c, b} = {b, a, c} = …

• Multiple listings make no difference:Multiple listings make no difference:– {a, a, c, c, c, c}={a,c}. {a, a, c, c, c, c}={a,c}.

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 6

Basic properties of sets

• There exists a different mathematical There exists a different mathematical construct, called construct, called bag bag oror multiset multiset, where , where this assumption does not hold. Using square this assumption does not hold. Using square brackets, we have brackets, we have – [a,a,c,c,c,c]=[a,c,a,c,c,c] [a,a,c,c,c,c]=[a,c,a,c,c,c] [a,a,a,c][a,a,a,c]

• Notation: if B is a bag then Notation: if B is a bag then countcountBB(e)=(e)=number of occurrences of e in Bnumber of occurrences of e in B

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 7

Definition of Set Equality

• Two sets are equal Two sets are equal if and only ifif and only if they contain they contain exactly the sameexactly the same elements. elements.

• It does not matter It does not matter how the set is definedhow the set is defined• For example:For example:

{1, 2, 3, 4}{1, 2, 3, 4} = = {{xx | | xx is an integer where is an integer where xx>0 and >0 and xx<5 } <5 } == {{xx | | xx is a positive integer whose square is a positive integer whose square is >0 and <25} is >0 and <25}

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 8

Infinite Sets

• Sets may be Sets may be infiniteinfinite ( (i.e., i.e., not not finitefinite, without end, , without end, unending).unending).

• Symbols for some special infinite sets:Symbols for some special infinite sets:NN = {0, 1, 2, …} The = {0, 1, 2, …} The NNatural numbers.atural numbers.ZZ = {…, -2, -1, 0, 1, 2, …} The integers. = {…, -2, -1, 0, 1, 2, …} The integers.RR = The = The ““RRealeal”” numbers, such as numbers, such as 374.1828471929498181917281943125…374.1828471929498181917281943125…

• ““Blackboard BoldBlackboard Bold”” or double-struck font ( or double-struck font (ℕℕ,,ℤℤ,,ℝℝ) ) is also often used for these special number sets.is also often used for these special number sets.

• Infinite sets come in different sizes!Infinite sets come in different sizes!

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 9

Venn/Euler Diagrams

John Venn1834-1923

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 10

• Warning: such diagrams come in different Warning: such diagrams come in different flavours (e.g., Venn or Euler). We will ‘mix flavours (e.g., Venn or Euler). We will ‘mix and match’ flavours – This is ok as long as and match’ flavours – This is ok as long as it’s clear what we mean.it’s clear what we mean.

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 11

Basic Set Relations: Member of

• xxS S ((““xx is in is in SS””)) is the proposition that is the proposition that object object xx is an is an lementlement or or membermember of set of set SS..– e.g.e.g. 3 3NN, , ““aa””{{x x | | xx is a letter of the alphabet} is a letter of the alphabet}

• Set equality is defined in terms of Set equality is defined in terms of ::SS==T T ::defdef xx: : xxSS xxTT““Two sets are equal iff they have Two sets are equal iff they have the same members.the same members.””

• Notation: xNotation: xS S ::defdef ((xxSS))

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 12

A set can be empty

• Suppose we call a set S Suppose we call a set S emptyempty iff it has no elements: iff it has no elements: xx((xxS).S).

• Prove that Prove that xyxy((empty(((empty(x)x) empty(y) empty(y) x=y) x=y)

• Note: this formula quantifies over sets!Note: this formula quantifies over sets!

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 13

There’s only one empty set

Prove that Prove that xyxy((empty(((empty(x)x) empty(y)) empty(y)) x=y) x=y) Proof by Reductio ad Absurdum:Proof by Reductio ad Absurdum:• Suppose there existed a and b Suppose there existed a and b

such that empty(a) and empty(b). such that empty(a) and empty(b). • Thus, Thus, xx((xxa) a) xx((xxb)b)• Suppose aSuppose ab.b. This would mean that either This would mean that either

xx((xxaa xxb) or b) or xx((xxbb xxa) a) • But the first case cannot hold, for But the first case cannot hold, for xx((xxa).a). The The

second case cannot hold, for second case cannot hold, for xx((xxb)b)• ContradictionContradiction, so QED, so QED

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 14

The Empty Set

• We have seen that there exists exactly one We have seen that there exists exactly one empty set, so we can give it a name:empty set, so we can give it a name:

((““the empty setthe empty set””) is the unique set that ) is the unique set that contains no elements whatsoever.contains no elements whatsoever.

= {} = {= {} = {x|xx|xxx} = ... = {} = ... = {x|x|FalseFalse}}

• Any set containing exactly one element is Any set containing exactly one element is called a called a singletonsingleton

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 15

Subset and Superset Relations

• SSTT ( (““SS is a subset of is a subset of TT””) means that every ) means that every element of element of SS is also an element of is also an element of TT..

• SST T ::defdef x x ((xxSS xxTT))

• What do you think about these?What do you think about these? S ?S ?– SSS ?S ?

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 16

Subset and Superset Relations

• SSTT ( (““SS is a subset of is a subset of TT””) means that every ) means that every element of element of SS is also an element of is also an element of TT..

• SST T ::defdef x x ((xxSS xxTT))

• What do you think about these?What do you think about these? SS ? Yes ? Yes– SSS ? YesS ? Yes

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 17

Subset and Superset Relations

• More notation:More notation:

• SSTT ( (““SS is a superset of is a superset of TT””) :) :defdef TTSS..

Note Note S=TS=T SSTT SST.T.

• ::defdef ((SSTT), ), i.e.i.e. xx((xxSS xxTT))TS /

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 18

Proper (Strict) Subsets & Supersets

• SST T ((““SS is a proper subset of is a proper subset of TT””) means that ) means that SST T butbut . .

Example:{1,2} {1,2,3}

We have {1,2,3} {1,2,3}, {1,2,3},

but but notnot {1,2,3} {1,2,3}

ST /

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 19

Sets Are Objects, Too!

• The elements of a set may The elements of a set may themselvesthemselves be be sets.sets.

• E.g. E.g. let let SS={={x x | | x x {1,2,3}} {1,2,3}}then then S = …S = …

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 20

Sets Are Objects, Too!

• The objects that are elements of a set may The objects that are elements of a set may themselvesthemselves be sets. be sets.

• E.g. E.g. let let SS={={x x | | x x {1,2,3}} {1,2,3}}then then SS={={, , {1}, {2}, {3}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2}, {1,3}, {2,3}, {1,2,3}} {1,2,3}}

• Note that 1 Note that 1 {1} {1} {{1}} {{1}}

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 21

Cardinality and Finiteness

• ||SS| (read | (read ““the the cardinalitycardinality of of SS””) is a measure ) is a measure of how many different elements of how many different elements SS has. has.

• E.g.E.g., |, ||=0, |{1,2,3}| = 3, |{a,b}| = 2,|=0, |{1,2,3}| = 3, |{a,b}| = 2, |{{1,2,3},{4,5}}| = ____ |{{1,2,3},{4,5}}| = ____

• If |If |SS||NN, then we say , then we say SS is is finitefinite..Otherwise, we say Otherwise, we say SS is is infiniteinfinite..

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 22

The Power Set Operation

• The The power setpower set P( P(SS) of a set ) of a set SS is the set of all is the set of all subsets of subsets of SS. . P(P(SS) :) :≡ ≡ {{x x | | xxSS}.}.

• EE..g.g. P({a,b}) = { P({a,b}) = {, {a}, {b}, {a,b}}., {a}, {b}, {a,b}}.

• Sometimes P(Sometimes P(SS) is written ) is written 22SS, , becausebecause |P(|P(SS)| = 2)| = 2||SS||..

• It turns out It turns out SS:|P(:|P(SS)|>|)|>|SS||, , e.g.e.g. |P(|P(NN)| > |)| > |NN||..There are different sizes of infinite setsThere are different sizes of infinite sets!!

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 23

Review: Set Notations So Far

• Set enumeration {a, b, c} Set enumeration {a, b, c}

and set-builder {and set-builder {xx||PP((xx)}.)}. relation, and the empty set relation, and the empty set ..

• Set relations =, Set relations =, , , , , , , , , , etc., etc.

• Venn diagrams.Venn diagrams.

• Cardinality |Cardinality |SS| and infinite sets | and infinite sets NN, , ZZ, , RR..

• Power sets P(Power sets P(SS).).

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 24

Ordered n-tuples

• These are like sets, except that duplicates These are like sets, except that duplicates matter, and the order makes a difference.matter, and the order makes a difference.

• For For nnNN, an , an ordered n-tupleordered n-tuple or a or a sequencesequence ofof length nlength n is written ( is written (aa11, , aa22, …, , …, aann). Its ). Its firstfirst

element is element is aa11, , etc.etc.

• Note that (1, 2) Note that (1, 2) (2, 1) (2, 1) (2, 1, 1). (2, 1, 1).

• Empty sequence, singlets, pairs, triples, …, Empty sequence, singlets, pairs, triples, …, nn-tuples.-tuples.

Contrast withsets: {...}

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 25

• n-tuples have many applications. For n-tuples have many applications. For example,example,

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 26

• Relations are often spelled out by means of n-tuples. E.g., here are two 2-place relations:< = { (0,1), (1,2), (0,2), …) }Like-to-watch = {(John,news),(Mary,soap),

(Ellen,movies)}

• The first and second argument of a relation may come from different sets, e.g. first: element of the set of persons

second: element of the set of TV-programs

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 27

Cartesian Products of Sets

• For sets For sets AA, , BB, their , their Cartesian productCartesian productAAB B :: {( {(aa, , bb) | ) | aaAA bbB B }}..

• E.g.E.g. {a,b} {a,b}{1,2} = {(a,1),(a,2),(b,1),(b,2)}{1,2} = {(a,1),(a,2),(b,1),(b,2)}

• {John,Mary,Ellen}x{News,Soap}={John,Mary,Ellen}x{News,Soap}=

René Descartes (1596-1650)

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 28

Cartesian Products of Sets

• For sets For sets AA, , BB, their , their Cartesian productCartesian productAAB B :: {( {(aa, , bb) | ) | aaAA bbB B }}..

• E.g.E.g. {a,b} {a,b}{1,2} = {(a,1),(a,2),(b,1),(b,2)}{1,2} = {(a,1),(a,2),(b,1),(b,2)}• {John,Mary,Ellen}x{News,Soap}={John,Mary,Ellen}x{News,Soap}=

{(John,News),(Mary,News),(Ellen,News), {(John,News),(Mary,News),(Ellen,News), (John,Soap),(Mary,Soap),(Ellen,Soap)} (John,Soap),(Mary,Soap),(Ellen,Soap)}

• If R is a relation between A and B then If R is a relation between A and B then RRAxBAxB

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 29

Cartesian Products of Sets

• Note that Note that – for finite for finite AA, , BB, , ||AABB| = || = |AA|.||.|BB||– the Cartesian product is the Cartesian product is notnot commutative: commutative: i.e.i.e., ,

ABAB: : AAB=BB=BAA..

– notation extends naturally to notation extends naturally to AA11 AA22 … … AAnn

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 30

Review of §1.6

• Sets Sets SS, , TT, , UU… Special sets … Special sets NN, , ZZ, , RR..

• Set notations {a,b,...}, {Set notations {a,b,...}, {xx||PP((xx)}…)}…

• Set relation operators Set relation operators xxSS, , SSTT, , SSTT, , SS==TT, , SSTT, , SSTT. (These form propositions.). (These form propositions.)

• Finite vs. infinite sets.Finite vs. infinite sets.

• Set operations |Set operations |SS|, P(|, P(SS), ), SST.T.

• Next up: §1.5: More set ops: Next up: §1.5: More set ops: , , , , ..

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 31

Start §1.7: The Union Operator

• For sets For sets AA, , BB, their, theirnionnion AABB is the set is the set containing all elements that are either in containing all elements that are either in AA, , oror ( (““””) in ) in BB (or, of course, in both). (or, of course, in both).

• Formally, Formally, AA,,BB: : AABB = { = {x x | | xxAA xxBB}.}.

• Note that Note that AAB B is a is a supersetsuperset of both of both AA and and B B (in fact, it is the smallest such superset):(in fact, it is the smallest such superset):

AA, , BB: (: (AAB B AA) ) ( (AAB B BB))

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 32

• {a,b,c}{a,b,c}{2,3} = {a,b,c,2,3}{2,3} = {a,b,c,2,3}

• {2,3,5}{2,3,5}{3,5,7}{3,5,7} = { = {2,3,52,3,5,,3,5,73,5,7} =} ={2,3,5,7} {2,3,5,7}

Union Examples

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 33

The Intersection Operator

• For sets For sets AA, , BB, their , their intersectionintersection AABB is the is the set containing all elements that are set containing all elements that are simultaneously in simultaneously in A A andand ( (““””) in ) in BB..

• Formally, Formally, AA,,BB: : AABB={={x x | | xxAA xxBB}}..

• Note that Note that AAB B is a is a subsetsubset of both A and B of both A and B (in fact it is the largest such subset):(in fact it is the largest such subset):

AA, , BB: (: (AAB B AA) ) ( (AAB B BB))

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 34

• {a,b,c}{a,b,c}{2,3} = ___{2,3} = ___

• {2,4,6}{2,4,6}{3,4,5}{3,4,5} = ______ = ______

Intersection Examples

Think “The intersection of University Ave. and W 13th St. is just that part of the road surface that lies on both streets.”

{4}

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 35

Disjointness

• Two sets Two sets AA, , BB are called are calleddisjointdisjoint ( (i.e.i.e., not joined), not joined)iff their intersection isiff their intersection isempty. (empty. (AABB==))

• Example: the set of evenExample: the set of evenintegers is disjoint withintegers is disjoint withthe set of odd integers.the set of odd integers.

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 36

Inclusion-Exclusion Principle

• How many elements are in How many elements are in AABB??Can you think of a general formula?Can you think of a general formula?

(Express in terms of (Express in terms of |A| |A| andand |B| |B| andandwhatever else you need.) whatever else you need.)

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 37

Inclusion-Exclusion Principle

• How many elements are in How many elements are in AABB?? ||AABB|| = |A| = |A| |B| |B| | |AABB||

• Example: How many students are on our Example: How many students are on our class email list? Consider set class email list? Consider set E E I I MM, , II = { = {ss | | ss turned in an information sheet} turned in an information sheet}MM = { = {ss | | s s sent the TAs their email address}sent the TAs their email address}

• Some students may have done both!Some students may have done both! ||EE| = || = |IIMM|| = |I| = |I| |M| |M| | |IIMM||

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 38

Set Difference

• For sets For sets AA, , BB, the , the differencedifference of A and Bof A and B, , written written AABB, is the set of all elements that , is the set of all elements that are in are in AA but not but not BB. Formally:. Formally:

A A B B :: x x x xA A x xBB

• Also called: Also called: The The complementcomplement ofof BB with respect towith respect to AA..

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 39

Set Difference Examples

• {1,2,3,4,5,6} {1,2,3,4,5,6} {2,3,5,7,9,11} = {2,3,5,7,9,11} = ___________ ___________

• Z Z N N {… , {… , −−1, 0, 1, 2, … } 1, 0, 1, 2, … } {0, 1, … } {0, 1, … } = { = {x x | | xx is an integer but not a nat. #} is an integer but not a nat. #} = { = {xx | | x x is a negative integer} is a negative integer} = {… , = {… , −−3, 3, −−2, 2, −−1}1}

{1,4,6}

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 40

Set Difference - Venn Diagram

• AA−−BB is what is what’’s left after s left after BB““takes a bite out of takes a bite out of AA””

Set A Set B

SetAB

Chomp!

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 41

Set Complements

• The The universe of discourseuniverse of discourse can itself be can itself be considered a set, call it considered a set, call it UU..

• When the context clearly defines When the context clearly defines UU, we say , we say that for any set that for any set AAUU, the , the complementcomplement of of AA, , written , is the complement of written , is the complement of AA w.r.t. w.r.t. UU, , i.e.i.e.,, it is it is UUA.A.

• E.g., E.g., If If UU==NN, ,

A

,...}7,6,4,2,1,0{}5,3{

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 42

Set Identities

• AA

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 43

Set Identities

• AA = = AA

• AAU =U =

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 44

Set Identities

• AA = = AA

• AAU = AU = A

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 45

Set Identities

• AA = = AA = = AAUU

• AAU U = = UUAA = =

)(A

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 46

Set Identities

• AA = = AA = = AAUU• AAU U = = UU

AA = = • AAAA = = A A = = AAAA• AAB B = = BBA A

AAB B = = BBAA• AA((BBCC)=()=(AABB))C C

AA((BBCC)=()=(AABB))CC

AA )(

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 47

Have you seen similar patterns before?

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 48

Read: := , := , :=F, U:=T

• AA = = AA = = AAUU

• AAU U = = U U ,, A A = = • AAAA = = A A = = AAAA

• AAB B = = BBA A , , A AB B = = BBAA

• AA((BBCC)=()=(AABB))C C ,,AA((BBCC)=()=(AABB))CC

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 49

Set Identities (don’t worry about their names)

• Identity: Identity: AA = = AA = = AAUU

• Domination: Domination: AAU U = = U U ,, A A = = • Idempotent: Idempotent: AAAA = = A A = = AAAA

• Double complement: Double complement:

• Commutative: Commutative: AAB B = = BBA A , , A AB B = = BBAA

• Associative: Associative: AA((BBCC)=()=(AABB))C C ,, A A((BBCC)=()=(AABB))CC

AA )(

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 50

DeMorgan’s Law for Sets

• Exactly analogous to (and provable from) Exactly analogous to (and provable from) DeMorganDeMorgan’’s Law for propositions.s Law for propositions.

BABA

BABA

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 51

Proving Set Identities

To prove statements about sets, of the form To prove statements about sets, of the form EE11 = = EE22 (where the (where the EEs are set expressions), s are set expressions),

here are three useful techniques:here are three useful techniques:

1. Use equivalence laws1. Use equivalence laws

2. Prove 2. Prove EE11 EE22 and and EE22 EE11 separately. separately.

3. Use a 3. Use a membership tablemembership table..

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 52

Method 2: Mutual subsets

Example: Show Example: Show AA((BBCC)=()=(AABB))((AACC).).

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 53

Method 2: Mutual subsets

Example: Show Example: Show AA((BBCC)=()=(AABB))((AACC).).• Part 1: Show Part 1: Show AA((BBCC))((AABB))((AACC).).

– Assume Assume xxAA((BBCC), & show ), & show xx((AABB))((AACC).).– We know that We know that xxAA, and either , and either xxBB or or xxC.C.

• Case 1: Case 1: xxBB. Then . Then xxAABB, so , so xx((AABB))((AACC).).• Case 2: Case 2: xxC. C. Then Then xxAAC C , so , so xx((AABB))((AACC).).

– Therefore, Therefore, xx((AABB))((AACC).).– Therefore, Therefore, AA((BBCC))((AABB))((AACC).).

• Part 2: Show (Part 2: Show (AABB))((AACC) ) AA((BBCC). ). ((analogousanalogous))

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 54

Mutual subsets

• A variant of this method: translate into A variant of this method: translate into propositional logic, then reason within propositional logic, then reason within propositional logic, then translate back into propositional logic, then translate back into set theory. E.g.,set theory. E.g.,

• Show Show AA((BBCC))((AABB))((AACC).).Suppose Suppose xxAA ( (xxBB xxC). C). Prove (Prove (xxAA xxB)B) ( (xxAA xxC). C).

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 55

Review of §1.6-1.7

• Sets Sets SS, , TT, , UU… Special sets … Special sets NN, , ZZ, , RR..

• Set notations {a,b,...}, {Set notations {a,b,...}, {xx||PP((xx)}…)}…

• Relations Relations xxSS, , SSTT, , SSTT, , SS==TT, , SSTT, , SSTT. .

• Operations |Operations |SS|, P(|, P(SS), ), , , , , , , , , • Set equality proof techniquesSet equality proof techniques

S

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 56

Generalized Unions & Intersections

• Since union & intersection are commutative Since union & intersection are commutative and associative, we can extend them from and associative, we can extend them from operating on operating on ordered pairsordered pairs of sets ( of sets (AA,,BB) to ) to operating on sequences of sets (operating on sequences of sets (AA11,…,,…,AAnn), or ), or even on unordered even on unordered setssets of sets, of sets,XX={={A | PA | P((AA)} (for some property P).)} (for some property P).

(This is just like using (This is just like using when adding up when adding up large or variable numbers of numbers)large or variable numbers of numbers)

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 57

Generalized Union

• Binary union operator: Binary union operator: AABB

• nn-ary union:-ary union:AA11AA22……AAnn : : ((…(( ((…((AA11 AA22)) …)…) AAnn))

(grouping & order is irrelevant)(grouping & order is irrelevant)

• ““Big UBig U”” notation: notation:

• Or for infinite sets of sets:Or for infinite sets of sets:

n

iiA

1

XA

A

Module #3 - Sets

04/20/23 Michael P. Frank / Kees van Deemter 58

Generalized Intersection

• Binary intersection operator: Binary intersection operator: AABB

• nn-ary intersection:-ary intersection:AA11AA22……AAnn((…((((…((AA11AA22))…)…)AAnn))

(grouping & order is irrelevant)(grouping & order is irrelevant)

• ““Big ArchBig Arch”” notation: notation:

• Or for infinite sets of sets:Or for infinite sets of sets:

n

iiA

1

XA

A