Sets 2/36 We will not give a precise definition of what is a set, but we will say precisely what you can do with it. (Think of a set as a collection of things of which order and multiplicity Sets do not matter.) Lectures 7 and 8 (Chapter 16) Examples: ◮ { 0 , 1 , 2 , 3 } = { 3 , 1 , 0 , 2 } = { 3 , 1 , 1 , 1 , 0 , 0 , 2 } . ◮ { 6 } is the singleton set (NB: { 6 } � = 6 ). ◮ ∅ denotes the empty set (i.e., the set without elements). ◮ N , Z : standard set-theoretic notations for sets of numbers. / department of mathematics and computer science / department of mathematics and computer science Specifying sets, membership Subset, universe 3/36 4/36 We write t ∈ X for “ t is an element of the set X ”. A is a subset of B (notation: A ⊆ B ) A ⊆ B def = ∀ x [ x ∈ A : x ∈ B ] Specifying a set using a predicate if every element of A is also an { x ∈ D | P ( x ) } : the set of all x ∈ D such that P ( x ) . element of B Property of ⊆ : Examples val ( A ⊆ B ) ∧ t ∈ A | = t ∈ B = ◮ { n ∈ N | n > 10 } is the set of all natural numbers greater than 10 ; ◮ { x ∈ Z | x 2 + x ≤ 0 } = {− 1 , 0 } . The universe, denoted by U , is a set of which all U A sets in a particular context are subsets. Membership B The element-of predicate ∈ is a binary predicate. C D Property of U : E Property of ∈ : val t ∈ U = = True val t ∈ { x ∈ D | P ( x ) } = = t ∈ D ∧ P ( t ) / department of mathematics and computer science / department of mathematics and computer science
Equality of sets Intersection 6/36 7/36 The intersection of A and B is the set of A B Two sets are equal if they have exactly the same elements. everything that is both in A and in B Example A ∩ B def = { x ∈ U | x ∈ A ∧ x ∈ B } { x ∈ Z | x > 0 } = { n ∈ N | n � = 0 } A ∩ B A = B def Example = A ⊆ B ∧ B ⊆ A { n ∈ N | n > 5 } ∩ { n ∈ N | n < 10 } = { 6 , 7 , 8 , 9 } Property of = : Leibniz for = : val = ∀ x [ x ∈ A ⇔ x ∈ B ] A = B = Property of ∩ : A = B val A = B ∧ t ∈ A | = = t ∈ B val t ∈ A ∩ B = t ∈ A ∧ t ∈ B = · · · A · · · = · · · B · · · val A = B ∧ t ∈ B | = = t ∈ A / department of mathematics and computer science / department of mathematics and computer science Commutativity and associativity of ∩ and ∪ Union 8/36 9/36 The union of A and B is the set of everything A B that is in A or in B ◮ ∩ and ∪ are commutative: A ∪ B def = { x ∈ U | x ∈ A ∨ x ∈ B } A ∩ B = B ∩ A , and A ∪ B A ∪ B = B ∪ A ; Example ◮ ∩ and ∪ are associative: { n ∈ N | n > 5 } ∪ { n ∈ N | n < 10 } = N ( A ∩ B ) ∩ C = A ∩ ( B ∩ C ) , and ( A ∪ B ) ∪ C = A ∪ ( B ∪ C ) . Property of ∪ : val t ∈ A ∪ B = = t ∈ A ∨ t ∈ B / department of mathematics and computer science / department of mathematics and computer science
Example Reasoning with the subset predicate 10/36 11/36 ( A ∩ B ) ∪ C = A ∩ ( B ∪ C ) does not hold for all sets A , B and C ! ⊆ -introduction: ⊆ -elimination: �� { Assume: } A B A B 2 2 ( k ) var x ; x ∈ A ( k ) A ⊆ B 1 3 3 1 5 5 . . 4 6 4 6 �� . 8 8 7 7 ( ℓ ) t ∈ A C C ( ℓ − 2) x ∈ B ( A ∩ B ) ∪ C A ∩ ( B ∪ C ) �� { ∀ -intro on ( k ) and ( ℓ − 2) : } { Property of ⊆ on ( k ) Counterexample: ( ℓ − 1) ∀ x [ x ∈ A : x ∈ B ] and ( ℓ ) : } Let A = { 1 , 2 , 4 , 5 } , B = { 2 , 3 , 5 , 6 } and C = { 4 , 5 , 6 , 7 } . { Definition of ⊆ on ( ℓ − 1) : } ( m ) t ∈ B Then A ∩ B = { 2 , 5 } , ( A ∩ B ) ∪ C = { 2 , 4 , 5 , 6 , 7 } , ( ℓ ) A ⊆ B B ∪ C = { 2 , 3 , 4 , 5 , 6 , 7 } , and A ∩ ( B ∪ C ) = { 2 , 4 , 5 } . ( ↓ ) So ( A ∩ B ) ∪ C = { 2 , 4 , 5 , 6 , 7 } � = { 2 , 4 , 5 } = A ∩ ( B ∪ C ) . ( ↑ ) / department of mathematics and computer science / department of mathematics and computer science Example Complement 12/36 15/36 The complement A C of A is the set of U A A B A B everything not in A A C def = { x ∈ U | ¬ ( x ∈ A ) } A C C C ( A ∩ B ) ∪ C A ∩ ( B ∪ C ) Example Property of C : val (Suppose that U = Z ) t ∈ A C = = ¬ ( t ∈ A ) { x ∈ Z | x ≥ 0 } C = { x ∈ Z | x < 0 } Fact NB: For computing C it is important to know what is the universe: A ∩ ( B ∪ C ) ⊆ ( A ∩ B ) ∪ C does hold. ◮ If U = N , then { 0 , 1 } C = { n ∈ N | n ≥ 2 } [Proof on blackboard] ◮ If U = Z , then { 0 , 1 } C = { x ∈ Z | x < 0 ∨ x ≥ 2 } . / department of mathematics and computer science / department of mathematics and computer science
Difference Equality of sets (reasoning) 16/36 17/36 The difference of A and B is the set of A B = -introduction: = -elimination: everything that is in A , but not also in B . . �� . A \ B def = { x ∈ U | x ∈ A ∧ ¬ ( x ∈ B ) } A \ B ( k ) A ⊆ B ( k ) A = B . . . �� Example ( ℓ − 2) B ⊆ A { Definition of = on ( k ) : } { n ∈ N | n > 5 } \ { n ∈ N | n < 10 } = { n ∈ N | n ≥ 10 } { ∧ -intro on ( k ) and ( ℓ − 2) : } ( ℓ ) A ⊆ B ∧ B ⊆ A ( ℓ − 1) A ⊆ B ∧ B ⊆ A ( ↓ ) Property of \ : { Definition of = on ( ℓ − 1) : } val t ∈ A \ B = t ∈ A ∧ ¬ ( t ∈ B ) = ( ℓ ) A = B ( ↑ ) / department of mathematics and computer science / department of mathematics and computer science Examples Notation 18/36 24/36 Assume U = Z . ◮ Prove that A \ B C = A ∩ B for all sets A and B . 0 �∈ {{ 0 }} 0 �⊆ {{ 0 }} [Proof on blackboard] { 0 } ∈ {{ 0 }} { 0 } �⊆ {{ 0 }} ∅ �∈ {{ 0 }} ∅ ⊆ {{ 0 }} ◮ Determine for each of the following formulas whether it holds for all sets A and B . If so, then give a proof; if not, then give a {{ 0 }} �∈ {{ 0 }} {{ 0 }} ⊆ {{ 0 }} counterexample: • A \ B = A ⇒ A = B C ; • A = B C ⇒ A \ B = A . / department of mathematics and computer science / department of mathematics and computer science
Empty set Alternative property of empty set 26/36 27/36 The empty set ∅ is the unique set without elements. From previous slide: val val ∅ = { x ∈ U | False } (*) ∅ ⊆ A = = True (**) A ⊆ ∅ = = ∀ x [ x ∈ A : False ] Property of ∅ : val t ∈ ∅ = = False So: A = ∅ val val ∅ ⊆ A = = True A ⊆ ∅ = = ∀ x [ x ∈ A : False ] val = = { Definition of = } ∅ ⊆ A A ⊆ ∅ ∧ ∅ ⊆ A A ⊆ ∅ val val val = = { Definition ⊆ } = = { Definition of ⊆ } = = { (*) + True / False -elimination } ∀ x [ x ∈ ∅ : x ∈ A ] ∀ x [ x ∈ A : x ∈ ∅ ] A ⊆ ∅ val val = { Property of ∅ } = = { Property of ∅ } = val = = { (**) } Property of ∅ : ∀ x [ False : x ∈ A ] ∀ x [ x ∈ A : False ] ∀ x [ x ∈ A : False ] val A = ∅ = = ∀ x [ x ∈ A : False ] val = = { Empty domain } True / department of mathematics and computer science / department of mathematics and computer science Example Powerset 28/36 29/36 The powerset P ( A ) of A is the set of all subsets of A . Examples Prove that A ∪ B = A ⇒ B \ A = ∅ for all sets A and B . ◮ P ( { 4 , 6 } ) = {∅ , { 4 } , { 6 } , { 4 , 6 }} ◮ P ( { 1 , 2 , 3 } ) = {∅ , { 1 } , { 2 } , { 3 } , { 1 , 2 } , { 1 , 3 } , { 2 , 3 } , { 1 , 2 , 3 }} [Proof on blackboard. (Also available as detailed example of a ◮ ∅ ∈ P ( R ) , [0 , 5] ∈ P ( R ) derivation-style proof of a set-theoretic property from Course Material ◮ 1 �∈ P ( R ) , { 1 } ∈ P ( R ) , { 2 , 5 , 7 } ∈ P ( R ) section of the website)] ◮ N ∈ P ( R ) , R ∈ P ( R ) ◮ P ( {∅ , {∅}} ) = {∅ , {∅} , {{∅}} , {∅ , {∅}}} If # A = n , then # P ( A ) = 2 n . / department of mathematics and computer science / department of mathematics and computer science
P ( A ) \ P ( B ) �⊆ P ( A \ B ) Powerset in proofs 30/36 31/36 Property of P : X ∈ P ( A ) \ P ( B ) X ∈ P ( A \ B ) val C ∈ P ( A ) = = C ⊆ A val val = = { Property of \ } = = { Property of P } X ∈ P ( A ) ∧ ¬ ( X ∈ P ( B )) X ⊆ A \ B Examples val = = { Property of P ( 2 × ) } ◮ Prove that P ( A ) ⊆ P ( A ∪ B ) for all sets A and B . X ⊆ A ∧ ¬ ( X ⊆ B ) [Exercise] Counterexample: A B Let A = { 1 , 2 } , B = { 2 } and X = { 1 , 2 } . ◮ Does P ( A ) \ P ( B ) ⊆ P ( A \ B ) hold for all sets A and B ? X Then X ⊆ A , so X ∈ P ( A ) . 1 2 And ¬ ( X ⊆ B ) , so ¬ ( X ∈ P ( B )) . [Answer on next slide] Hence, X ∈ P ( A ) \ P ( B ) . On the other hand, A \ B = { 1 } , so ¬ ( X ⊆ A \ B ) . Hence, X �∈ P ( A \ B ) . / department of mathematics and computer science / department of mathematics and computer science Cartesian product Cartesian product in proofs 32/36 33/36 The Cartesian product A × B is the set of pairs ( a, b ) with Property of × : a ∈ A and b ∈ B . val ( a, b ) ∈ A × B = = a ∈ A ∧ b ∈ B Examples Example ◮ { 0 , 1 } × { 3 , 5 , 7 } = { (0 , 3) , (0 , 5) , (0 , 7) , (1 , 3) , (1 , 5) , (1 , 7) } Prove that A ⊆ B ⇒ A 2 ⊆ A × B for all sets A and B . ◮ N × Z = { ( n, x ) | n ∈ N ∧ x ∈ Z } ◮ (3 , − 2) ∈ N × Z [See Section 16.9 of the book for the construction of a very similar ◮ ( − 2 , 3) �∈ N × Z proof.] NB: A 2 = A × A , A 3 = A × A × A , etc. / department of mathematics and computer science / department of mathematics and computer science
Recommend
More recommend