Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Similar documents
CHAPTER 6. Copyright Cengage Learning. All rights reserved.

With Question/Answer Animations. Chapter 2

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Spring

A set is an unordered collection of objects.

The Limits of Computation

1 Predicates and Quantifiers

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

Discrete Mathematical Structures: Theory and Applications

Sets McGraw-Hill Education

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

CHAPTER 1. Preliminaries. 1 Set Theory

Introduction to Proofs

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall Set-builder notation (a more precise way of describing a set)

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

COMP Logic for Computer Scientists. Lecture 16

Sec$on Summary. Definition of sets Describing Sets

CS 173: Discrete Structures. Eric Shaffer Office Hour: Wed. 1-2, 2215 SC

Chapter 2 Sets, Relations and Functions

CSCI3390-Lecture 6: An Undecidable Problem

1 Chapter 1: SETS. 1.1 Describing a set

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

BASIC MATHEMATICAL TECHNIQUES

CHAPTER 1 SETS AND EVENTS

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Chapter 1 : The language of mathematics.

COMP9020 Lecture 3 Session 2, 2014 Sets, Functions, and Sequences. Revision: 1.3

Set Operations. Combining sets into new sets

Sets. Introduction to Set Theory ( 2.1) Basic notations for sets. Basic properties of sets CMSC 302. Vojislav Kecman

Set Theory Basics of Set Theory. 6.2 Properties of Sets and Element Argument. 6.3 Algebraic Proofs 6.4 Boolean Algebras.

5 Set Operations, Functions, and Counting

Logic, Sets, and Proofs

SET THEORY. Disproving an Alleged Set Property. Disproving an Alleged Set. Example 1 Solution CHAPTER 6

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Math 105A HW 1 Solutions

Discrete Basic Structure: Sets

Discrete Mathematics: Lectures 6 and 7 Sets, Relations, Functions and Counting Instructor: Arijit Bishnu Date: August 4 and 6, 2009

CS 2336 Discrete Mathematics

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.

CM10196 Topic 2: Sets, Predicates, Boolean algebras

COMP Logic for Computer Scientists. Lecture 16

Automata Theory and Formal Grammars: Lecture 1

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

ICS141: Discrete Mathematics for Computer Science I

Notes on Sets for Math 10850, fall 2017

Statistical Inference

In N we can do addition, but in order to do subtraction we need to extend N to the integers

CSE 20. Final Review. CSE 20: Final Review

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Analysis I. Classroom Notes. H.-D. Alber

Chapter 2 - Basics Structures

Mathematical Preliminaries. Sipser pages 1-28

Supplementary Material for MTH 299 Online Edition

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

A Universal Turing Machine

Logic. Facts (with proofs) CHAPTER 1. Definitions

Equivalence of Propositions

Chapter 4. Basic Set Theory. 4.1 The Language of Set Theory

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

SETS AND FUNCTIONS JOSHUA BALLEW

Boolean Algebras. Chapter 2

18.S097 Introduction to Proofs IAP 2015 Lecture Notes 1 (1/5/2015)

Preliminaries to the Theory of Computation

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Discrete Mathematics Set Operations

Linear conjunctive languages are closed under complement

Math 109 September 1, 2016

Propositional Logic, Predicates, and Equivalence

Mathematics Review for Business PhD Students Lecture Notes

Intro to Logic and Proofs

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

DEPARTMENT OF MATHEMATICS. MA1301 Discrete Mathematics

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

CS Automata, Computability and Formal Languages

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

CSE 20 DISCRETE MATH. Winter

Exercises for Unit VI (Infinite constructions in set theory)

Statistics for Financial Engineering Session 2: Basic Set Theory March 19 th, 2006

CSE 20 DISCRETE MATH WINTER

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

In this initial chapter, you will be introduced to, or more than likely be reminded of, a

Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

1. SET 10/9/2013. Discrete Mathematics Fajrian Nur Adnan, M.CS

Math Final Exam December 14, 2009 Page 1 of 5

Discrete Mathematics Review

A Guide to Proof-Writing

ASSIGNMENT 1 SOLUTIONS

Logic and Proofs. (A brief summary)

Boolean algebra. Examples of these individual laws of Boolean, rules and theorems for Boolean algebra are given in the following table.

586 Index. vertex, 369 disjoint, 236 pairwise, 272, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws

Logic Synthesis and Verification

Transcription:

Set Theory CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215

Set theory Abstract set theory is one of the foundations of mathematical thought Most mathematical objects (e.g. numbers) can be defined in terms of sets Let S denote a set: a S means that a is an element of S Example: 1 {1,2,3}, 3 {1,2,3} a S means that a is not an element of S Example: 4 {1,2,3} If S is a set and P(x) is a property that elements of S may or may not satisfy: A = {x S P(x)} is the set of all elements x of S such that P(x) 2

Subsets: Proof and Disproof Def.: A B x, if x A then x B (it is a formal universal conditional statement) Negation: A B x such that x A and x B A is a proper subset of B (A B) (1) A B AND (2) there is at least one element in B that is not in A Examples: {1} {1} {1} {1, {1}} {1} {1, 2} {1} {1, {1}} 3

Set Theory Element Argument: The Basic Method for Proving That One Set Is a Subset of Another Let sets X and Y be given. To prove that X Y, 1. Suppose that x is a particular [but arbitrarily chosen] element of X, 2. show that x is also an element of Y. 4

5 Set Theory Example of an Element Argument Proof: A B? A = {m Z m = 6r + 12 for some r Z} B = {n Z n = 3s for some s Z} Suppose x is a particular but arbitrarily chosen element of A. [We must show that x B]. By definition of A, there is an integer r such that x = 6r + 12 x = 3(2r + 4) But, s = 2r + 4 is an integer because products and sums of integers are integers. x=3s. By definition of B, x is an element of B. A B

Set Theory Disprove B A: B A. A = {m Z m = 6r + 12 for some r Z} B = {n Z n = 3s for some s Z} Disprove = show that the statement B A is false. We must find an element of B (x=3s) that is not an element of A (x=6r+12). Let x = 3 = 3 * 1 3 B 3 A? We assume by contradiction r Z, such that: 6r+12=3 (assumption) 2r + 4 = 1 2r = -3 r=-3/2 But r=-3/2 is not an integer( Z).Thus, contradiction 3 A. 3 B and 3 A, so B A. 6

Set Equality A = B, if, and only if, every element of A is in B and every element of B is in A. 7 A = B A B and B A Example: A = {m Z m = 2a for some integer a} B = {n Z n = 2b 2 for some integer b} Proof Part 1: A B Suppose x is a particular but arbitrarily chosen element of A. By definition of A, there is an integer a such that x = 2a Let b = a + 1, 2b 2 = 2(a + 1) 2 = 2a + 2 2 = 2a = x Thus, x B. Proof Part 2: B A (proved in similar manner)

Venn Diagrams A B A B 8

Relations among Sets of Numbers Z, Q, and R denote the sets of integers, rational numbers, and real numbers Z Q because every integer is rational (any integer n can be written in the form n/1) Z is a proper subset of Q: there are rationals that are not integers (e.g., 1/2) Q R because every rational is real Q is a proper subset of R because there are real numbers that are not rational (e.g., 2) 9

Operations on Sets Let A and B be subsets of a universal set U. 1. The union of A and B: A B is the set of all elements that are in at least one of A or B: A B = {x U x A or x B} 2. The intersection of A and B: A B is the set of all elements that are common to both A and B. A B = {x U x A and x B} 3. The difference of B minus A (relative complement of A in B): B A (or B\A) is the set of all elements that are in B and not A. B A = {x U x B and x A} 4. The complement of A: A c is the set of all elements in U that are not in A. A c = {x U x A} 10

Operations on Sets Example: Let U = {a, b, c, d, e, f, g} and let A = {a, c, e, g} and B = {d, e, f, g}. A B = {a, c, d, e, f, g} A B = {e, g} B A = {d, f } A c = {b, d, f } 11

12 Subsets of real numbers Given real numbers a and b with a b: (a, b) = {x R a < x < b} (a, b] = {x R a < x b} [a, b) = {x R a x < b} [a, b] = {x R a x b} The symbols and are used to indicate intervals that are unbounded either on the right or on the left: (a, )={x R a < x} [a, ) ={x R a x} (, b)={x R x < b} (, b]={x R x b}

Subsets of real numbers Example: Let A = ( 1, 0] = {x R 1 < x 0} B = [0, 1) = {x R 0 x < 1} A B = {x R x ( 1, 0] or x [0, 1)} = {x R x ( 1, 1)} = ( 1, 1) A B = {x R x ( 1, 0] and x [0, 1)} = {0}. B A={x R x [0, 1) and x ( 1, 0]}= (0, 1) 13 A c = {x R it is not the case that x ( 1, 0]} = (, 1] (0, )

Set theory Unions and Intersections of an Indexed Collection of Sets Given sets A 0, A 1, A 2,... that are subsets of a universal set U and given a nonnegative integer n (set sequence) A i = {x U x A i for at least one i = 0, 1, 2,..., n} A i ={x U x A i for at least one nonnegative integer i } A i = {x U x A i for all i = 0, 1, 2,..., n} A i = {x U x A i for all nonnegative integers i } 14

Indexed Sets Example: for each positive integer i, A i = {x R 1/i <x< 1/i} = ( 1/i, 1/i) A 1 A 2 A 3 ={x R x is in at least one of the intervals ( 1,1), ( 1/2, 1/2), ( 1/3, 1/3) } = ( 1, 1) A 1 A 2 A 3 ={x R x is in all of the intervals ( 1,1), ( 1/2,1/2), ( 1/3, 1/3) } = ( 1/3, 1/3) A i ={x R x is in at least one of the intervals ( 1/i,1/i) where i is a positive integer} = ( 1, 1) A i ={x R x is in all of the intervals ( 1/i,1/i), where i is a positive integer} = {0} 15

The Empty Set ({}) = {} a set that has no elements Examples: {1,2} {3,4}= {x R 3 < x < 2} = 16

Partitions of Sets A and B are disjoint A B = the sets A and B have no elements in common Sets A 1, A 2, A 3,... are mutually disjoint (pairwise disjoint or non-overlapping) no two sets A i and A j (i j) have any elements in common i,j = 1,2,3,..., i j A i A j = A finite or infinite collection of nonempty sets{a 1,A 2, A 3,...} is a partition of a set A 1. A = A i 2. A 1,A 2, A 3,... are mutually disjoint 17

18 Partitions of Sets Examples: A = {1, 2, 3, 4, 5, 6} A 1 = {1, 2} A 2 = {3, 4} A 3 = {5, 6} {A 1,A 2, A 3 }is a partition of A: - A = A 1 A 2 A 3 - A 1,A 2 and A 3 are mutually disjoint: A 1 A 2 =A 1 A 3 =A 2 A 3 = T 1 = {n Z n = 3k, for some integer k} T 2 = {n Z n = 3k + 1, for some integer k} T 3 = {n Z n = 3k + 2, for some integer k} {T 1,T 2, T 3 }is a partition of Z

Power Set Given a set A, the power set of A, P(A), is the set of all subsets of A Examples: P({x, y}) = {, {x}, {y}, {x, y}} P( ) = { } P({ }) = {, { }} 19

Cartesian Product An ordered n-tuple (x 1,x 2,...,x n ) consists of the elements x 1,x 2,...,x n together with the ordering: first x 1, then x 2, and so forth up to x n Two ordered n-tuples (x 1,x 2,...,x n ) and (y 1,y 2,...,y n ) are equal: (x 1,x 2,...,x n )=(y 1,y 2,...,y n ) x 1 =y 1 and x 2 =y 2 and... x n =y n The Cartesian product of A 1,A 2,...,A n : A 1 A 2... A n ={(a 1, a 2,..., a n ) a 1 A 1, a 2 A 2,..., a n A n } Example: A={1,2}, B={3,4} A B ={(1,3), (1,4), (2,3), (2,4)} 20

Cartesian Product Example: let A = {x, y}, B = {1, 2, 3}, and C = {a, b} A B C = {(u,v,w) u A, v B, and w C} = {(x, 1, a), (x, 2, a), (x, 3, a), (y, 1, a), (y, 2, a), (y, 3, a), (x, 1, b), (x, 2, b), (x, 3, b), (y, 1, b), (y, 2, b), (y, 3, b)} (A B) C = {(u,v) u A B and v C} = {((x, 1), a), ((x, 2), a), ((x, 3), a), ((y, 1), a), ((y, 2), a), ((y, 3), a), ((x, 1), b), ((x, 2), b), ((x, 3), b), ((y, 1), b), ((y, 2), b), ((y, 3), b)} 21

Supplemental: Algorithm to Check Subset 22 Input: m, n [positive integers], a,b [one-dimensional arrays] Algorithm Body: i := 1, answer := A B while (i m and answer = A B ) j := 1, found := no end while while (j n and found = no ) end while if a[i] = b[j] then found := yes j := j + 1 if found = no then answer := A B i := i + 1 Output: answer [a string]: A B or A B

Properties of Sets Inclusion of Intersection: A B A and A B B Inclusion in Union: A A B and B A B Transitive Property of Subsets: 23 A B and B C A C x A B x A or x B x A B x A and x B x B A x B and x A x A c x A (x, y) A B x A and y B

24 Proof of a Subset Relation For all sets A and B, A B A. The statement to be proved is universal: sets A and B, A B A Suppose A and B are any (particular but arbitrarily chosen) sets. A B A, we must show x, x A B x A Suppose x is any (particular but arbitrarily chosen) element in A B. By definition of A B, x A and x B. Therefore, x A Q.E.D.

Set Identities For all sets A, B, and C: 25 Commutative Laws: A B = B A and A B = B A Associative Laws: (A B) C=A (B C) and (A B) C=A (B C) Distributive Laws: A (B C)=(A B) (A C),A (B C)=(A B) (A C) Identity Laws: A = A and A U = A Complement Laws: A A c = U and A A c = Double Complement Law: (A c ) c = A Idempotent Laws: A A = A and A A = A Universal Bound Laws: A U = U and A = De Morgan s Laws: (A B) c = A c B c and (A B) c = A c B c Absorption Laws: A (A B) = A and A (A B) = A Complements of U and : U c = and c = U Set Difference Law: A B = A B c

Proof of a Set Identity 26 For all sets A, B, and C, A (B C)=(A B) (A C) Suppose A, B, and C are arbitrarily chosen sets. 1. A (B C) (A B) (A C) Show: x, if x A (B C) then x (A B) (A C) Suppose x A (B C), arbitrarily chosen. (1) We must show x (A B) (A C). From (1), by definition of union, x A or x B C Case 1.1: x A. By definition of union: x A B and x A C By definition of intersection: x (A B) (A C). (2) Case 1.2: x B C. By definition of intersection: x B and x C By definition of union: x A B and x A C. And (2) again. 2. (A B) (A C) A (B C) (proved in similar manner)

Proof of a De Morgan s Law for Sets For all sets A and B: (A B) c = A c B c Suppose A and B are arbitrarily chosen sets. ( ) Suppose x (A B) c. By definition of complement: x A B it is false that (x is in A or x is in B) By De Morgan s laws of logic: x is not in A and x is not in B. Hence x A c and x B c x A c B c ( ) Proved in similar manner. x A and x B 27

Intersection and Union with a Subset For any sets A and B, if A B, then A B=A and A B=B A B=A (1) A B A and (2) A A B (1) A B A is true by the inclusion of intersection property (2) Suppose x A (arbitrary chosen). From A B, then x B (by definition of subset relation). From x A and x B, thus x A B (by definition of ) A A B A B = B (3) A B B and (4) B A B (3) and (4) proved in similar manner to (1) and (2) 28

The Empty Set A Set with No Elements Is a Subset of Every Set: If E is a set with no elements and A is any set, then E A Proof (by contradiction): Suppose there exists an empty set E with no elements and a set A such that E A. By definition of : there is an element of E (x E) that is not an element of A (x A). Contradiction with E was empty, so x E. Q.E.D. Uniqueness of the Empty Set: There is only one set with no elements. Proof: Suppose E 1 and E 2 are both sets with no elements. By the above property: E 1 E 2 and E 2 E 1 E 1 =E 2 Q.E.D. 29

The Element Method To prove that a set X =, prove that X has no elements by contradiction: suppose X has an element and derive a contradiction. Example 1: For any set A, A =. Proof: Let A be a particular (arbitrarily chosen) set. A = A has no elements Proof by contradiction: suppose there is x such that x A. By definition of intersection, x A and x Contradiction since has no elements Q.E.D. 30

The Element Method Example 2: For all sets A, B, and C, if A B and B C c, then A C =. Proof: Suppose A, B, and C are any sets such that A B and B C c Suppose there is an element x A C. By definition of intersection, x A and x C. From x A and A B, by definition of subset, x B. From x B and B C c, by definition of subset, x C c. By definition of complement x C (contradiction with x C). 31 Q.E.D.

Disproofs Disproving an alleged set property amounts to finding a counterexample for which the property is false. Example: Disprove that for all sets A,B, and C, (A B) (B C) = A C? The property is false there are sets A, B, and C for which the equality does not hold Counterexample 1: A={1,2,4,5},B={2,3,5,6},C={4,5,6,7} (A B) (B C)={1,4} {2,3}={1,2,3,4} {1,2}=A C Counterexample 2: A=,B={1},C= 32

Cardinality of a set The cardinality of a set A: N(A) or A is a measure of the "number of elements of the set" Example: {2, 4, 6} = 3 For any sets A and B, A B + A B = A + B If A and B are disjoint sets, then A B = A + B 33

The Size of the Power Set 34 For all int. n 0, X has n elements P(X) has 2 n elements. Proof (by mathematical induction): Q(n): Any set with n elements has 2 n subsets. Q(0): Any set with 0 elements has 2 0 subsets: The power set of the empty set is the set P( ) = { }. P( ) has 1=2 0 element: the empty set. For all integers k 0, if Q(k) is true then Q(k+1) is also true. Q(k): Any set with k elements has 2 k subsets. We show Q(k+1): Any set with k +1elements has 2 k+1 subsets. Let X be a set with k+1 elements and z X (since X has at least one element). X {z} has k elements, so P(X {z}) has 2 k elements. Any subset A of X {z} is a subset of X: A P(X). Any subset A of X {z}, can also be matched with {z}: A {z} P(X) All subsets A and A {z} are all the subsets of X P(X) has 2*2 k =2 k+1 elements

Algebraic Proofs of Set Identities Algebraic Proofs = Use of laws to prove new identities 35 1. Commutative Laws: A B = B A and A B = B A 2. Associative Laws: (A B) C=A (B C) and (A B) C=A (B C) 3. Distributive Laws: A (B C)=(A B) (A C) and A (B C)=(A B) (A C) 4. Identity Laws: A = A and A U = A 5. Complement Laws: A A c = U and A A c = 6. Double Complement Law: (A c ) c = A 7. Idempotent Laws: A A = A and A A = A 8. Universal Bound Laws: A U = U and A = 9. De Morgan s Laws: (A B) c = A c B c and (A B) c = A c B c 10. Absorption Laws: A (A B) = A and A (A B) = A 11. Complements of U and : U c = and c = U 12. Set Difference Law: A B = A B c

Algebraic Proofs of Set Identities Example: for all sets A,B,and C,(A B) C=(A C) (B C). Algebraic proof: (A B) C = (A B) C c by the set difference law = C c (A B) by the commutative law for = (C c A) (C c B) by the distributive law = (A C c ) (B C c ) by the commutative law for = (A C) (B C) by the set difference law. 36

Algebraic Proofs of Set Identities Example: for all sets A and B, A (A B) = A B. A (A B) = A (A B) c by the set difference law = A (A c B c ) by De Morgan s laws = (A A c ) (A B c ) by the distributive law = (A B c ) by the complement law = (A B c ) by the commutative law for = A B c by the identity law for = A B by the set difference law. 37

Correspondence between logical equivalences and set identities 38

Boolean Algebra (or) corresponds to (union) (and) corresponds to (intersection) (negation) corresponds to c (complementation) t (a tautology) corresponds to U (a universal set) c (a contradiction) corresponds to (the empty set) Logic and sets are special cases of the same general structure Boolean algebra. 39

Boolean Algebra A Boolean algebra is a set B together with two operations + and, such that for all a and b in B both a + b and a b are in B and the following properties hold: 1. Commutative Laws: For all a and b in B, a+b=b+a and a b=b a 2. Associative Laws: For all a,b, and c in B, (a+b)+c=a+(b+c) and (a b) c=a (b c) 3. Distributive Laws: For all a, b, and c in B, a+(b c)=(a+b) (a+c) and a (b+c)=(a b)+(a c) 4. Identity Laws: There exist distinct elements 0 and 1 in B such that for all a in B, a+0=a and a 1=a 5. Complement Laws: For each a in B, there exists an element in B, a, complement or negation of a, such that a+a=1 and a a=0 40

Properties of a Boolean Algebra Uniqueness of the Complement Law: For all a and x in B, if a+x=1 and a x=0 then x=a Uniqueness of 0 and 1: If there exists x in B such that a+x=a for all a in B, then x=0, and if there exists y in B such that a y=a for all a in B, then y=1. Double Complement Law: For all a B, ( a ) = a Idempotent Law: For all a B, a+a=a and a a=a. Universal Bound Law: For all a B, a+1=1 and a 0 = 0. De Morgan s Laws: For all a and b B, a+b=a b and a b=a+b Absorption Laws: For all a and b B,(a+b) a=a and (a b)+a=a Complements of 0 and 1: 0 = 1 and 1 = 0. 41

42 Properties of a Boolean Algebra Uniqueness of the Complement Law: For all a and x in B, if a+x=1 and a x=0 then x=a Proof: Suppose a and x are particular (arbitrarily chosen) in B that satisfy the hypothesis: a+x=1 and a x=0. x = x 1 because 1 is an identity for = x (a + a) by the complement law for + = x a + x a by the distributive law for over + = a x + x a by the commutative law for = 0 + x a by hypothesis = a a + x a by the complement law for = (a a) + (a x) by the commutative law for = a (a + x) by the distributive law for over + = a 1 by hypothesis = a because 1 is an identity for

Russell s Paradox Most sets are not elements of themselves. Imagine a set A being an element of itself A A. Let S be the set of all sets that are not elements of themselves: S = {A A is a set and A A} Is S an element of itself? Yes&No contradiction. If S S, then S does not satisfy the defining property for S: S S. If S S, then satisfies the defining property for S, which implies that: S S. 43

The Barber Puzzle In a town there is a male barber who shaves all those men, and only those men, who do not shave themselves. Question: Does the barber shave himself? If the barber shaves himself, he is a member of the class of men who shave themselves. The barber does not shave himself because he doesn t shave men who shave themselves. If the barber does not shave himself, he is a member of the class of men who do not shave themselves. The barber shaves every man in this class, so the barber must shave himself. Both Yes&No derive contradiction! 44

Russell s Paradox One possible solution: except powersets, whenever a set is defined using a predicate as a defining property, the set is a subset of a known set. Then S (form Russell s Paradox) is not a set in the universe of sets. 45

46 The Halting Problem There is no computer algorithm that will accept any algorithm X and data set D as input and then will output halts or loops forever to indicate whether or not X terminates in a finite number of steps when X is run with data set D. Proof sketch (by contradiction): Suppose there is an algorithm CheckHalt such that for any input algorithm X and a data set D, it prints halts or loops forever. A new algorithm Test(X) loops forever if CheckHalt(X, X) prints halts or stops if CheckHalt(X, X) prints loops forever. Test(Test) =? If Test(Test) terminates after a finite number of steps, then the value of CheckHalt(Test, Test) is halts and so Test(Test) loops forever. Contradiction! If Test(Test) does not terminate after a finite number of steps, then CheckHalt(Test, Test) prints loops forever and so Test(Test) terminates. Contradiction! So, CheckHalt doesn t exist.