Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 6 Set Theory.

Similar presentations


Presentation on theme: "Lecture 6 Set Theory."— Presentation transcript:

1 Lecture 6 Set Theory

2 Plan of lecture Algebra of sets Laws of the algebra of sets
Proofs with algebra of sets Cardinality of sets Principle of inclusion and exclusion Ordered pairs and Cartesian product

3 Algebra of sets (aka Mathematic Structure)
Various properties of sets can be derived using the operations such as union, intersection, etc. Some are obvious, some aren’t They all need proofs, though! Proofs exploit correspondence between logic/sets Set Logic not or and

4 Example Solution Prove that for any sets A and B, (A  B) = A  B
(A  B) = {x : x  (A  B)} = {x : not(x  (A  B))} = {x : not((x  A) and (x  B))} = {x : not(P and Q)} A  B = {x : (x  A) or (x  B)} = {x : (not(x  A)) or (not(x  B))} = {x : (not(P)) or (not(Q))} P Q not P not Q P and Q not (P and Q) (not P) or (not Q) T F

5 Example (2) Since the predicates defining (A  B) and A  B are equivalent, we have (A  B) = A  B The logical expressions show one of “De Morgan’s Laws”. The set expressions follow the same pattern. Fundamental properties of sets Principles of the algebra of sets In the following tables, notice left- and right-hand sides for union and intersection. Augustus De Morgan

6 Laws of the algebra of sets (1)
Associativity Laws A  (B  C) = (A  B)  C A  (B  C) = (A  B)  C Commutative Laws A  B = B  A A  B = B  A Identity Laws A   = A A  U = A A  U = U A   = 

7 Laws of the algebra of sets (2)
Idempotent Laws A  A = A A  A = A Distributive Laws A(BC) = (AB)(AC) A(BC) = (AB)(AC) Complement Laws A  A = U A  A =  U =   = U (A) = A Universe of Discourse. Universe of Discourse. De Morgan’s Laws (A  B) = A  B (A  B) = A  B

8 Proofs with laws of algebra (1)
We can use the laws to prove further results Prove that for any sets A and B, A  B = (A  B)  (A  B)

9 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) The claim

10 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) The claim [De Morgan’s Laws]

11 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) The claim [De Morgan’s Laws] [Distributive Laws]

12 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws]

13 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws]

14 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws]

15 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws]

16 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) = (B  (A))  ((A  (B)) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws] [Identity Laws]

17 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) = (B  (A))  ((A  (B)) = ((A  (B))  (B  (A)) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws] [Identity Laws]

18 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) = (B  (A))  ((A  (B)) = ((A  (B))  (B  (A)) = (A  B)  (B  A) The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws] [Identity Laws] clean up extra brackets

19 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) = (B  (A))  ((A  (B)) = ((A  (B))  (B  (A)) = (A  B)  (B  A) = definition above The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws] [Identity Laws] clean up extra brackets

20 Proofs with laws of algebra (2)
Solution By definition, A  B = (A  B)  (B  A), now (A  B)  (A  B) = (A  B)  ((A)  (B)) = ((A  B)  (A))  ((A  B)  (B)) = ((A)  (A  B))  ((B)  (A  B)) = (((A)  A)  ((A)  B)))  (((B)  A)  ((B)  B))) = ((A  (A))  (B  (A)))  ((A  (B))  (B  (B))) = (  (B  (A)))  ((A  (B))  ) = (B  (A))  ((A  (B)) = ((A  (B))  (B  (A)) = (A  B)  (B  A) is the definition above Hence A  B = (A  B)  (A  B) as claimed!! The claim [De Morgan’s Laws] [Distributive Laws] [Commutative Laws] [Complement Laws] [Identity Laws] clean up extra brackets

21 Proofs with laws of algebra (3)
We started from the claim, and obtained definition We can start from definition, and work towards claim We can start from both ends, and meet “in the middle” Whichever way, we must use the laws at each step Notice that A, B in the laws may be sets with operations, not necessarily a set: ((A  B)  (C  D))   = E   =  (A  (B – C))  (A  (B – C)) = D  D = D = (A  (B – C))

22 Cardinality of sets We sometimes need to count elements of sets
For instance, we might need to make provisions for their implementation, so we need to consider how much space needed... The cardinality of a finite set S is the number of elements in S, represented as |S| Examples: A = {1, 2, 34, 3}; |A| = 4 B = {bob, sue, 3, sue} = {bob, sue, 3}; |B| = 3 || = 0: the cardinality of the empty set is zero

23 Principle of inclusion & exclusion (1)
Counting rule for the union of two sets: |A  B| = |A| + |B| – |A  B| Venn diagram: A  B = (A – B)  (A  B)  (B – A) Proof: suppose that |A – B|= m |A  B| = n |B – A|= p Then, |A  B| = |A – B| + |A  B| + |B – A| = m + n + p = (m + n) + (n + p) – n = |A| + |B| – |A  B| (add the sections and see for yourself) To avoid double counting. A B A–B AB B–A

24 Principle of inclusion & exclusion (2)
Example: 63 first-year students choose optional courses 16 chose Accounting 37 chose Business 5 chose both Accounting and Business How many took neither Accounting or Business? Solution: U = {all first-year students who chose optional courses} A = {students who took Accounting} B = {students who took Business} Then |A| = 16, |B| = 37 and |A  B| = 5. |U| = 63. So |A  B| = |A| + |B| – |A  B| = – 5 = 48 Hence, 63 – 48 = 15 students took neither A B A–B AB B–A

25 Ordered pairs & Cartesian product (1)
An ordered pair is (a, b), where a is an element of a set A (a  A) b is an element of a set B (b  B) The set of all ordered pairs of sets A and B is called the Cartesian product of A and B, denoted by A  B Formally: A  B = {(a, b) : (a  A) and (b  B)} Important operation for Functions & relations (very important for computing) Information modelling

26 Ordered pairs & Cartesian product (2)
Let A = {coffee, tea} and B = {cake, muffin, donut} A  B = {(coffee,cake),(coffee,muffin),(coffee,donut), (tea,cake),(tea,muffin),(tea,donut)} B  A = {(cake,coffee),(muffin,coffee),(donut,coffee), (cake,tea),(muffin,tea),(donut,tea)} B  B = {(cake,cake),(cake,muffin),(cake,donut), (muffin,cake),(muffin,muffin),(muffin,donut), (donut,cake),(donut,muffin),(donut,donut)}

27 Ordered pairs & Cartesian product (3)
if A  B, then A  B  B  A If |A| m and |B| n, then |A  B| mn Let R be the set of real numbers The set R  R or R2 are all pairs of real numbers (x, y) The elements of R2 can be displayed as coordinates of a two-dimensional space R2 is called the Cartesian plane y x (3,2)

28 Ordered pairs & Cartesian product (4)
Given a collection of sets A1, A2,..., An We can define its Cartesian product as A1  A2  ...  An = {(a1, a2, ..., an) : ai  Ai, i = 1, 2, ..., n} If A1 = A2 = ... = An (the same set) then we write An for the Cartesian product of n copies of A Example: Let B = {0,1}; describe the set Bn Solution: the elements of Bn are lists of zeros and ones of length n There are also called bit strings of size n

29 Summary You should now know: Laws of the algebra of sets
How to use the laws when proving claims Cardinality of sets Principle of inclusion and exclusion Cartesian product Cartesian plane Bit strings

30 Further reading R. Haggarty. “Discrete Mathematics for Computing”. Pearson Education Ltd (Chapter 3) Wikipedia’s entry Wikibooks entry


Download ppt "Lecture 6 Set Theory."

Similar presentations


Ads by Google