Top Banner
Lecture 1 Discrete Structures 1 1 Introduction to sets and set notation (5.1, 5.3) Visualizing sets: Venn diagrams (5.1) Axiom of extension (5.1) Equivalence relations (10.2, 10.3) Relations between sets: set equality (5.1) Relations between sets: set containment (5.1) Operations on sets: union and intersection (5.1) Operations on sets: difference and complement (5.1) Operations on sets: more examples (5.1) Disjoint sets (5.1) Lecture Outline Lecture Outline
58

Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Mar 26, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

1

Introduction to sets and set notation (5.1, 5.3)Visualizing sets: Venn diagrams (5.1)Axiom of extension (5.1)Equivalence relations (10.2, 10.3)Relations between sets: set equality (5.1)Relations between sets: set containment (5.1) Operations on sets: union and intersection (5.1)Operations on sets: difference and complement (5.1)Operations on sets: more examples (5.1)Disjoint sets (5.1)Partitions of sets (5.1)Power Sets (5.1)Cartesian products (5.1)

Lecture OutlineLecture Outline

Page 2: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

2

Application: alphabets, strings and languages (5.1)Properties of sets: subset relations (5.2)Properties of sets: set identities (5.2)Summary of set identities (5.2)Disproofs (5.3)Number of subsets of a given set (5.3)Algebraic Proofs (5.3)Boolean Algebra (5.3)Russell’s paradox (5.4)The Halting Problem (5.4)

Lecture OutlineLecture Outline

Page 3: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

3

Georg Cantor was the first to suggest that the study of sets, themselves, might be as important and valuable as the study of the elements, and the properties thereof, which comprise sets.There is no formal definition for set or element, but we can all agree, for the purpose of discussion, on the following:

A set is any collection of objects; andIndividual objects within a set are called elements.

Introduction to Sets and Set NotationIntroduction to Sets and Set Notation

Page 4: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

4

Set Notation 1. Sets are typically represented by capital letters

A, B, C, … while elements are represented by lower case letters a, b, c, …

2. The symbols and are used to indicate whether an element belongs (e.g. a A) or doesn’t belong (e.g. b C) to a set.

3. Sets may be defined by verbal description (e.g. A = {all integers which are multiples of 4}), by listing elements (e.g. A = {…,-8 -4, 0, 4, 8, 12, …}), or by a defining property (e.g. A = {n Z n = 4k, where k Z}).

Introduction to SetsIntroduction to Setsand Set Notation (cont’d)and Set Notation (cont’d)

Page 5: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

5

Set Notation 4. Specific letters reserved for specific sets include

Z (integers), Z+ (positive integers), Q (rational numbers), and R (real numbers).

5. The symbol is especially reserved for the empty set (a collection containing no objects, i.e. { }). Such a set may seem strange or unnecessary, but in fact it is both important and useful. For example, the fact that there are no real number solutions to the equation x2 = -1 may be expressed {x R x2 = -1} = .

6. Likewise, the symbol U is especially reserved for the universal set, which is the largest possible set of objects under discussion in a particular context.

Introduction to SetsIntroduction to Setsand Set Notation (cont’d)and Set Notation (cont’d)

Page 6: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

6

Introduction to SetsIntroduction to Setsand Set Notation (cont’d)and Set Notation (cont’d)

Let U = {1, 2, 3,…….}, the set of positive integers. Let,

A = {1, 4, 9, 16…..64, 81}

= { x² | x U , x² 100}

= { x² | x U x² 100}

= {x² U | x² 100}

C = {2, 4, 6, 8, …} = {2k | k U }

The set A is a finite set, C is an infinite set. For a finite set | A|

Denotes the number of elements of A or the cardinality of A,

| A| = 9.

Page 7: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

7

It was John Venn who first introduced the idea of representing sets and their associated relations and operations, using diagrams. These diagrams now bear his name.In Venn diagrams, the universal set U is normally represented as a rectangle, with other subsets A, B, etc. represented by circles.In the examples which follow, the universal set U will appear in red, with the subsets A and B coloured blue and green, respectively.

VisualizingSets: Venn DiagramsVisualizingSets: Venn Diagrams

Page 8: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

8

Examples (U, A, B)

A = B A B

VisualizingSets:VisualizingSets:Venn Diagrams (cont’d) Venn Diagrams (cont’d)

Page 9: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

9

Examples (U, A, B)

A B A B

VisualizingSets: Venn Diagrams (cont’d)VisualizingSets: Venn Diagrams (cont’d)

Page 10: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

10

Examples (U, A, B)

B A Ac

VisualizingSets: Venn Diagrams (cont’d) VisualizingSets: Venn Diagrams (cont’d)

Page 11: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

11

A better understanding of what are the essential characteristics of a set is provided by the axiom of extension.Definition (Axiom of Extension) A set is completely determined when all of its

elements have been clearly specified.In particular, the order in which the elements are listed is irrelevant, as is listing an element more than once.

Examples {…, -2, -1, 0, 1, 2, 3, …} = Z = {0, 1, -1, 2, -2, 3, -3, …} {b, a, n, a, n, a} = {letters in “banana”} = {a, b, n}

Axiom of ExtensionAxiom of Extension

Page 12: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

12

Definition Let R be a relation on a set A. Then R is an equivalence relation on A provided: 1. for any a A, a R a (reflexive property); 2. for any a, b A, if a R b, then b R a (symmetric property);

and 3. For any a, b, c A, if a R b and b R c, then a R c (transitive property).Examples of Equivalence Relations on Sets A = Z R = “=” (“is identical to”) A = {all straight lines} R = “” (“is parallel to”) A = Q R = “=” (“is equal to, when

reduced to lowest terms”) A = {all people} R = “has the same birthdate as”

Equivalence RelationsEquivalence Relations

Page 13: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

13

Note that the elements of a set can themselves be sets. For example, a set S could be defined as

S = {{a, b}, {a, c}, {b, a}, {b, c}},where each element of S is itself a 2-element set.It follows that any relation defined on S would specify how elements of S are (or are not) related to one another, thereby establishing relations between sets. Definition (Set Equality) Let A and B be any two sets. A and B are said to

be equal, denoted A = B, if and only if every element of A is in B, and every element of B is in A.

In other words, equal sets are identical sets.

Relations Between Sets:Relations Between Sets:Set EqualitySet Equality

Page 14: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

14

For example, in the case ofS = {{a, b}, {a, c}, {b, a}, {b, c}},{a, b} = {b, a} but {a, b} {a, c}.

Clearly, set equality is an equivalence relation. That is:1. For each set A, A = A; 2. For any two sets A and B, if A = B, then

B = A; and3. For any three sets A, B and C, if A = B and

B = C, then A = C.

Relations Between Sets:Relations Between Sets:Set Equality (cont’d)Set Equality (cont’d)

Page 15: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

15

DefinitionLet A and B be any two sets. A is said to be contained in B (or B contains A, or A is a subset of B), denoted A B, if and only if every element of A is also an element of B.

Clearly, set containment is at least a partial ordering relation. That is:

1. For each set A, A A; 2. For any two sets A and B, if A B and

B A , then A = B; and3. For any three sets A, B and C, if A B and

B C, then A C.

Relations Between Sets:Relations Between Sets:Set ContainmentSet Containment

Page 16: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

16

Comparing the definitions of set equality and set containment, it is clear that

if A = B, then A B and B A.Likewise, by the antisymmetric property for “”,

if A B and B A , then A = B.It follows that

A = B is logically equivalent to A B and B A.For this reason, one technique used in proving that two sets are equal is to prove that each is a subset of the other.

Relations Between Sets:Relations Between Sets:Set Containment (cont’d)Set Containment (cont’d)

Page 17: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

17

DefinitionLet A and B be any two sets. A is said to be a proper subset of B, denoted A B, if and only if every element of A is in B, but there is at least one element of B that is not in A.Equivalently, A B means that A B but A B.

Relations Between Sets:Relations Between Sets:Set Containment (cont’d)Set Containment (cont’d)

Page 18: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

18

DefinitionLet A and B be any two subsets of a universal set U.1. The union of A and B, denoted A B, is defined by

A B = {x U x A or x B}.2. The intersection of A and B, denoted A B, is defined

by A B = {x U x A and x B}.

ExamplesSuppose U = {1, 2, 3, 4, 5, 6} and let

A = {1, 3, 5} B = {2, 4, 6} C = {1, 2, 3}.Then A B = {1, 2, 3, 4, 5, 6} = U A B =

A C = {1, 2, 3, 5} A C = {1, 3}B C = {1, 2, 3, 4, 6} B C = {2}

Operations on Sets:Operations on Sets:Union and IntersectionUnion and Intersection

Page 19: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

19

DefinitionLet A and B be any two subsets of a universal set U.1. The difference B minus A (or relative complement of A in B), denoted B A, is defined by

B A = {x U x B and x A}.2. The complement of A, denoted Ac, is defined by

Ac = {x U x A}.ExamplesAgain, suppose U = {1, 2, 3, 4, 5, 6} and let

A = {1, 3, 5} B = {2, 4, 6} C = {1, 2, 3}Then B A = {2, 4, 6} = B A B = {1, 3, 5} = A

C A = {2} A C = {5}Ac = {2, 4, 6} = B Bc = A Cc = {4, 5, 6}

Operations on Sets:Operations on Sets:Difference and ComplementDifference and Complement

Page 20: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

20

Operations on Sets:Operations on Sets:Symmetric DifferenceSymmetric Difference

Symmetric Difference: A B = { x | ( x A x B)

x A B}

Also written A B

Page 21: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

21

Example 1 (Intervals of Real Numbers)Let U = R, and suppose

A = {x R -1 x 2} and B = {x R -2 x 1}.1. A B= {x R -1 x 2 or -2 x 1}

= {x R -2 x 2}.2. A B= {x R -1 x 2 and -2 x 1}

= {x R -1 x 1}. 3. B A = {x R -2 x 1 and (-1 x 2)}

= {x R -2 x 1 and (x -1 or x 2)}= {x R (-2 x 1 and x -1) or

(-2 x 1 and x 2)}= {x R -2 x -1}.

Operations on Sets:Operations on Sets:More ExamplesMore Examples

Page 22: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

22

Example 1 (cont’d)Again, let U = R and suppose

A = {x R -1 x 2} and B = {x R -2 x 1}.4. Ac = {x R (-1 x 2)}

= {x R x -1 or x 2}Graphically, these sets may be represented as follows:

A B -2 -1 0 1 2 A B

-2 -1 0 1 2B A

-2 -1 0 1 2Ac

-2 -1 0 1 2

Operations on Sets:Operations on Sets:More Examples (cont’d)More Examples (cont’d)

Page 23: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

23

Example 2 (Proving Equality of Sets)Given a universal set U with a subset A, prove that

Ac = U A. ProofWe will prove that each set is contained in the other.First, assume an arbitrarily-chosen x Ac. By the definition of complement, it follows that x U and x A. But then, by the definition of difference, x U A. This proves that Ac U A. Now, assume an arbitrarily-chosen x U A. By the definition of difference, it follows that x U and x A. But then, by the definition of complement, x Ac. This proves that U A Ac. Since each set is contained in the the other, the two are equal.

Operations on Sets:Operations on Sets:More Examples (cont’d)More Examples (cont’d)

Page 24: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

24

Definition Two sets A and B are said to be disjoint if they have no elements in common, i.e.

A and B are disjoint if, and only if, A B = . To prove any two sets are disjoint, it is therefore sufficient to show that their intersection is empty. This is sometimes done by assuming that there exists a common element in both sets, and then obtaining a contradiction.Example Show that A B and A B are disjoint.Solution: Assume an element x common to both sets. Since x A B, then x B. But, since x A B, x B. This contradiction means that (A B) (A B) = .

Disjoint Sets Disjoint Sets

Page 25: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

25

Definition The sets A1, A2, …, An are said to be mutually disjoint (also called pairwise disjoint or nonoverlapping) if, and only if,

Ai Aj = for any i, j Z+ such that 1 i n, 1 j n and i j.Examples1. The sets A0 = {…, -6, -3, 0, 3, 6, 9, …}, A1 = {…, -5, -2, 1, 4, 7, 10, …}, and

A2 = {…, -4, -1, 2, 5, 8, 11, …} are mutually disjoint subsets of Z.

Disjoint Sets (cont’d) Disjoint Sets (cont’d)

Page 26: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

26

Examples (cont’d)2. The sets A B, A B and B A are mutually disjoint.

Disjoint Sets (cont’d)Disjoint Sets (cont’d)

Page 27: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

27

Definition A collection of nonempty subsets {A1, A2, …, An} is a partition of a set A if, and only if

(i) A = A1 A2 … An, and(ii) the sets A1, A2, …, An are mutually disjoint.

A2

A1 A3

A4

A2

A1 A3

A4

Partitions of SetsPartitions of Sets

Page 28: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

28

Examples1. The collection of sets {A0, A1, A2} from the earlier example, i.e. A0 = {…, -6, -3, 0, 3, 6, 9, …} = {3k k Z}, A1 = {…, -5, -2, 1, 4, 7, 10, …} = {3k + 1k Z} and

A2 = {…, -4, -1, 2, 5, 8, 11, …} = {3k + 2k Z} is a partition of Z.2. If Q and I represent the rational and irrational numbers, then {Q, I} is a partition of the real numbers R.3. {Z+, Z} is not a partition of Z (since 0 belongs to neither set).4. {{2, 4, 6}, {2, 3, 5}} is not a partition of {2, 3, 4, 5, 6} (since the sets are not mutually disjoint).

Partitions of Sets (cont’d)Partitions of Sets (cont’d)

Page 29: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

29

Recall the definition of an equivalence relation.Definition Let R be a relation on a set A. Then R is an equivalence relation on A provided: 1. for any a A, a R a (reflexive property); 2. for any a, b A, if a R b, then b R a (symmetric property);

and 3. For any a, b, c A, if a R b and b R c, then a R c

(transitive property).It turns out that an equivalence relation on A gives rise to a natural partition of A into subsets A1, A2, …, An called equivalence classes.

Partitions and Equivalence ClassesPartitions and Equivalence Classes

Page 30: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

30

Definition Let R be an equivalence relation on a set A. Then, for each element a A, there is an associated equivalence class (denoted

[a], and containing the element a) defined by[a] = {x Ax R a}.

Examples1. If A is Z and R is “=” (signifying equality of integers), then

[n]= {x Zx = n} = {n}, i.e. each equivalence class contains exactly one element.

2. If A is Q and R is “=” (signifying equality of fractions), then, for example, [1/3] = {m/n Qm/n = 1/3}

= {…, -3/-9, -2/-6, -1/-3, 1/3, 2/6, 3/9, 4/12,…}, i.e. each equivalence class contains infinitely many elements.

Partitions and Equivalence Partitions and Equivalence Classes (cont’d)Classes (cont’d)

Page 31: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

31

Definition For any given set A, the power set of A, denoted P(A), is the set of all subsets of A.Examples1. If A = {a, b}, then P(A) = {, {a}, {b}, {a, b}}2. If A = {1, 2, 3}, then

P(A) = {, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}Theorem For any sets A and B, if A B, then P(A) P(B).Proof: Let X be any element of P(A). It follows that X A. But A B,

and, by the transitivity of “”, X B. Since X is a subset of B, then X belongs to P(B). This proves that P(A) P(B), as required.

Power SetsPower Sets

Page 32: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

32

In a previous slide we saw that if A contains 2 elements, then P(A) contains 4 = 22 elements, and if A contains 3 elements, then P(A) contains 8 = 23 elements.This suggests the general result that if A contains n elements, then P(A) contains 2n elements. Indeed, the latter can be proved as a theorem using mathematical induction. However, we will postpone a proof until we can do so using the Binomial Theorem.The number of elements in a set A is often denoted n(A). For example, if A = {a, b}, then

n(A) = 2 and n(P(A)) = 22 = 4.

Number of Subsets Number of Subsets of a Given Setof a Given Set

Page 33: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

33

It is worth noting that the concept of the number of elements in a set (i.e. the “size” of a set) can also be extended to the case where A is an infinite set. A set which is infinite but which can be placed in a one-to-one correspondence with Z+ = {1, 2, 3, …} is said to be countably infinite, whereas when no such one-to-one correspondence is possible, we say the set is uncountably infinite. Countably infinite sets include (countability proofs not included):

Z+; Z; {4k + 1k Z}; all prime integers; Q and Q+. Uncountably infinite sets include (uncountability proofs not included):

R; {r R0 < r < 1}; irrational numbers; P(Z+) and P(Q).

Infinite Sets and Power SetsInfinite Sets and Power Sets

Page 34: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

34

Definition Let A and B be any sets (which could be equal). The Cartesian product of A and B, denoted A B, is the set of all ordered pairs (a, b), where a A and b B. That is, A B = {(a, b)a A and b B}. Likewise, the Cartesian product of the (not necessarily distinct) sets A1, A2, …, An is defined by A1 A2 … An

= {(a1, a2, …, an) a1 A1, a2 A2, …, an An}.

Cartesian ProductsCartesian Products

Page 35: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

35

Examples 1. Let A = {a, b} and B = {1, 2, 3}. Then

A B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)}, A A = A2 = {(a, a), (a, b), (b, a), (b, b)}.

2. Let A = R (real numbers). ThenR3 = R R R = {(x, y, z)x, y, z R}, which

represents all points in 3-dimensional space.

Cartesian Products (cont’d)Cartesian Products (cont’d)

Page 36: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

36

Examples 3. Let A = {a, b}, B = {1, 2} and C = {#, &}. Then: (a) A B = {(a, 1), (a, 2), (b, 1), (b, 2)} and B C = {(1, #), (1, &), (2, #), (2, &)} (b) (A B) C = {((a, 1), #), ((a, 1), &), ((a, 2), #), ((a, 2), &), ((b, 1), #), ((b, 1), &), ((b, 2), #), ((b, 2), &)} and

A (B C) = {(a, (1, #)), (a, (1, &)), (a, (2, #)), (a, (2, &)), (b, (1, #)), (b, (1, &)), (b, (2, #)), (b, (2, &))} It follows that (A B) C A (B C), despite some obvious similarities.

Cartesian Products (cont’d)Cartesian Products (cont’d)

Page 37: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

37

In computer programming, the finite set of characters used to construct program statements may be considered an alphabet, denoted . These would typically include letters, digits, and other special symbols such as +, , and *.A combination of characters from an alphabet is called a string. For example, if the alphabet is {a, b, 1, 2, 3, +, }, then the following are all strings: ab, 112233, a+b3. Because the order of characters in a string matters, a string is essentially an ordered n-tuple (without the brackets and commas).The number of characters in a string is called the length of the string. Thus, the length of ab is 2 and the length of a+b3 is 5.

Application: Alphabets, Application: Alphabets, Strings and Languages Strings and Languages

Page 38: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

38

The set of all strings of length n is thus the set of all ordered n-tuples of characters from the alphabet. In other words, it is the Cartesian product n = ... (n times). For example, if the alphabet is = {a, b}, then 3 = {aaa, aab, aba, baa, abb, bab, bba, bbb}.Of course, not all character strings are permitted in computer programs. The rules of programming will ultimately determine which strings are acceptable, and these strings may be said to form the programming language. For example, assuming = {0, 1, +}, and that only standard (infix) addition notation is permitted, the only acceptable strings would 0+0, 0+1, 1+0 and 1+1. Strings like +01, 11+ and 101 would thus be excluded from this particular language.

Application: Alphabets, Application: Alphabets, Strings and Languages (cont’d)Strings and Languages (cont’d)

Page 39: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

39

There are several relations satisfied by subsets under the the set containment relation “”. These are all obvious from Venn diagrams, though they may also be formally proved.Theorem1. Inclusion of Intersection For all sets A and B,

A B A and A B B. 2. Inclusion in Union For all sets A and B,

A A B and B A B.3. Transitive Property For all sets A, B and C,

if A B and B C, the A C.

Properties of Sets:Properties of Sets:Subset Relations Subset Relations

Page 40: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

40

The transitive property is clearly satisfied, since it is one of three properties which define a partial order relation.A formal proof the inclusion of intersection property is given below.Proof (Inclusion of Intersection)Let x be an arbitrarily chosen element of A B. According to the definition of A B, it follows that x A and x B. Therefore, if x A B, then x A and x B, i.e.

A B A and A B B, as required.A similar proof will formally prove the inclusion in union property.

Properties of Sets:Properties of Sets:Subset Relations (cont’d)Subset Relations (cont’d)

Page 41: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

41

An identity is an equation which is true for all values of the variables within it. In this case, the set identities which follow involve the operations of union, intersection, difference and complement, and hold for all subsets of a given universal set.In each case, formally proving a set identity requires showing that the two given sets are equal, i.e. that each set is contained in the other. In some cases, we will include a formal proof, while in other cases, the identity is merely supported by means of a Venn diagram.Compare the various set identities in Theorems 5.2.2 and 5.3.3 with the logical equivalences in Theorem 1.1.1!

Properties of Sets: Set IdentitiesProperties of Sets: Set Identities

Page 42: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

42

Theorem 5.2.2/5.3.3 (Set Identities)Let A, B, and C be any subsets of a universal set U. Then the following set identities hold: 1. Commutative Laws (a) A B = B A (b) A B = B A Proof (of (a); proof is similar for (b)) Let x be an arbitarily chosen element of A B. Then, by definition, x A and x B. But then x B and x A, so that x B A. This proves that A B B A. Similarly, let x be an arbitarily chosen element of B A. Then, by definition, x B and x A. But then x A and x B, so that x A B. This proves that B A A B, as required.

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 43: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

43

Theorem 5.2.2/5.3.3 (cont’d)2. Associative Laws (a) (A B) C = A (B C)

(b) (A B) C = A (B C) Venn Diagrams for (a)

Properties of Sets:Properties of Sets: Set Identities (cont’d) Set Identities (cont’d)

Page 44: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

44

Theorem 5.2.2/5.3.3 (cont’d)3. Distributive Laws (a) A (B C) = (A B) (A C)

(b) A (B C) = (A B) (A C) Venn Diagrams for (a)

Properties of Sets:Properties of Sets: Set Identities (cont’d) Set Identities (cont’d)

Page 45: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

45

Theorem 5.2.2/5.3.3 (cont’d)4. Identity Laws (a) A U = A (b) A = A Proof (a) Consider any x A U. Then x A and x U, so x A. Therefore, A U A. Likewise, take any x A. But A is a subset of U, so x U. It follows that x A U, i.e. A A U. Therefore, A U = A, as required. (b) Consider any x A . Then x A or x . But x , so x A. Thus, A A. Now, take any x A. It follows that x A or x , and hence x A , i.e. A A . Therefore, A = A, as required.

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 46: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

46

Theorem 5.2.2/5.3.3 (cont’d)5. Complement Laws (a) A Ac = U (b) A Ac =

Venn diagrams for (a) and (b)

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 47: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

47

Theorem 5.2.2/5.3.3 (cont’d)6. Double Complement Law (Ac)c = A Proof Consider any x (Ac)c. Then x U and x Ac. It follows that x A, and therefore, (Ac)c A. Now, take any x A. It follows that x Ac, and hence x (Ac)c. Thus, A (Ac)c. This proves that (Ac)c = A, as required.

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 48: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

48

Theorem 5.2.2/5.3.3 (cont’d)7. Idempotent Laws (proofs trivial, so omitted) (a) A A = A (b) A A = A8. Universal Bound Laws (a) A U = U (b) A = Proof (a) Every set is a subset of U, so A U U. Now, take any x U. Then it is true that x U or x A, and hence x A U. Therefore, U A U, and thus A U = U, as required. (b) If there is an x A , then x . But contains no elements, so there is no such x, i.e. A = , as required.

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 49: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

49

Theorem 5.2.2/5.3.3 (cont’d)9. De Morgan’s Laws (a) (A B)c = Ac Bc (b) (A B)c = Ac Bc

Venn diagrams for (a)

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 50: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

50

Theorem 5.2.2/5.3.3 (cont’d)9. De Morgan’s Laws

(a) (A B)c = Ac Bc (b) (A B)c = Ac Bc Proof (of (b)) Consider any x (A B)c. It follows that x U and x A B, and hence that either x U and x A or x U and x B. But this means x Ac or x Bc, i.e. x Ac Bc. Therefore, (A B)c Ac Bc. Now take any x Ac Bc. Then x Ac or x Bc, and hence

either x U and x A or x U and x B. But this means that x U and x A B, i.e. x (A B)c. It follows that Ac Bc (A B)c. Thus, (A B)c = Ac Bc, as required.

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 51: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

51

Theorem 5.2.2/5.3.3 (cont’d)10. Absorption Laws (a) A (A B) = A

(b) A (A B) = A Venn diagrams for (a) and (b)

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 52: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

52

Theorem 5.2.2/5.3.3 (cont’d)11. Complements of U and (proofs trivial, so omitted) (a) Uc = (b) c = U 12. Alternate Representation for Set Difference

A B = A Bc Venn diagrams

Properties of Sets: Set Identities (cont’d)Properties of Sets: Set Identities (cont’d)

Page 53: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

53

Let A, B, and C be any subsets of a universal set U. Then the following set identities hold:

1. Commutative Laws (a) A B = B A (b) A B = B A2. Associative Laws (a) (A B) C = A (B C)

(b) (A B) C = A (B C)3. Distributive Laws (a) A (B C) = (A B) (A C)

(b) A (B C) = (A B) (A C)4. Identity Laws (a) A U = A (b) A = A

Summary of Set IdentitiesSummary of Set Identities

Page 54: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

54

Let A, B, and C be any subsets of a universal set U. Then the following set identities hold:

5. Complement Laws (a) A Ac = U (b) A Ac = 6. Double Complement Law (Ac)c = A7. Idempotent Laws (a) A A = A (b) A A = A8. Universal Bound Laws (a) A U = U (b) A =

Summary of Set Identities (cont’d)Summary of Set Identities (cont’d)

Page 55: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

55

Let A, B, and C be any subsets of a universal set U. Then the following set identities hold:

9. De Morgan’s Laws (a) (A B)c = Ac Bc (b) (A B)c = Ac Bc

10. Absorption Laws (a) A (A B) = A

(b) A (A B) = A11. Complements of U and (a) Uc = (b) c = U 12. Alternate Representation for Set Difference

A B = A Bc

Summary of Set Identities (cont’d)Summary of Set Identities (cont’d)

Page 56: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

56

•Find a counter example for a Set Identity•Algebraic Proof that the Set Identity is True / False

DisproofsDisproofs

Page 57: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

57

There exist any number of other set identities which may be derived from the previous list of 12. (For that matter, identities 6 through 12 are derivable from the first 5, which are the defining properties of a Boolean algebra.) Example Use the given list of set identities to show that

(A B) (A B) = A. Solution: (A B) (A B)

= (A B) (A Bc) [Alt. Rep’n] = A (B Bc) [Dist’ve Law] = A U [Compl. Law] = A, as required. [Ident. Law]

Algebraic Proofs of Set IdentitiesAlgebraic Proofs of Set Identities

Page 58: Lecture 1Discrete Structures 1 1 u Introduction to sets and set notation (5.1, 5.3) u Visualizing sets: Venn diagrams (5.1) u Axiom of extension (5.1)

Lecture 1Discrete Structures 1

58

Of course, the previous example could also be proved from first principles, by showing that each set is contained in the other.Proof First, assume any x (A B) (A B). Then

x A and x B or x A and x B. In both of these cases, x A, and hence

(A B) (A B) A. Now, take any x A. Since B is another subset of the universal set U, either x B or x B. It follows that x A and x B or x A and x B, i.e. that

x (A B) (A B). This proves that A (A B) (A B), as required.

Algebraic Proofs of Set Identities Algebraic Proofs of Set Identities (cont’d) (cont’d)