© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.

Slides:



Advertisements
Similar presentations
Propositional Equivalences
Advertisements

Section 1.3. More Logical Equivalences Constructing New Logical Equivalences We can show that two expressions are logically equivalent by developing.
Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.
Predicates and Quantifiers
Prof. Johnnie Baker Module Basic Structures: Sets
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
(CSC 102) Discrete Structures Lecture 14.
2.1 Sets ‒Sets ‒Common Universal Sets ‒Subsets 2.2 Set Operations 2.3 Functions 2.4 Sequences and Summations 1.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Sets 1.
Sets 1.
Discrete Mathematics Math 6A Instructor: M. Welling.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Discrete Math 6A Max Welling. Recap 1. Proposition: statement that is true or false. 2. Logical operators: NOT, AND, OR, XOR, ,  3. Compound proposition:
Rosen 1.6. Approaches to Proofs Membership tables (similar to truth tables) Convert to a problem in propositional logic, prove, then convert back Use.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
The Foundations: Logic and Proofs
Discrete Maths Objective to introduce predicate logic (also called the predicate calculus) , Semester 2, Predicate Logic 1.
Logical Equivalence & Predicate Logic
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sifth Edition, Mc Graw-Hill, 2007 Chapter 2: Basic Structures: Sets, Functions, Sequences.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Review I Rosen , 3.1 Know your definitions!
Propositional Equivalences
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Chapter 1, Part II With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Chapter 7 Review Important Terms, Symbols, Concepts 7.1. Logic A proposition is a statement (not a question.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Lecture 1.2: Equivalences, and Predicate Logic* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren, Zeph.
DISCRETE COMPUTATIONAL STRUCTURES
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
Section Predicates & Quantifiers. Open Statement 2 x > 8 p < q -5 x = y + 6 Neither true nor false.
CS201: Data Structures and Discrete Mathematics I
January 30, 2002Applied Discrete Mathematics Week 1: Logic and Sets 1 Let’s Talk About Logic Logic is a system based on propositions.Logic is a system.
2.1 Sets ‒Sets ‒Common Universal Sets ‒Subsets 2.2 Set Operations 2.3 Functions 2.4 Sequences and Summations 1.
CompSci 102 Discrete Math for Computer Science
Lecture 4: Predicates and Quantifiers; Sets.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
Section 1.2: Propositional Equivalences In the process of reasoning, we often replace a known statement with an equivalent statement that more closely.
Discrete Mathematics CS 2610 September Equal Boolean Functions Two Boolean functions F and G of degree n are equal iff for all (x 1,..x n )  B.
1 Sections 1.3 and 1.4 Predicates & Quantifiers. 2 Propositional Functions In a mathematical assertion, such as x < 3, there are two parts: –the subject,
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
Discrete Structures – CNS 2300
Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication.
Chapter 2 With Question/Answer Animations. Section 2.1.
Review 2 Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by lower.
CSci 2011 Recap ^Propositional operation summary not andorconditionalBi-conditional pq ppqqpqpqpqpqpqpqpqpq TTFFTTTT TFFTFTFF FTTFFTTF FFTTFFTT.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Lecture 1.2: Equivalences, and Predicate Logic CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
1 Introduction to Abstract Mathematics Chapter 3: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 3.1.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Sets (2.1) A set is a collection or group of objects or elements or members. (Cantor 1895) A set is said to contain its elements. There must be an underlying.
CSE15 Discrete Mathematics 01/23/17
Discussion #10 Logical Equivalences
Chapter 1 The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Discrete Mathematics CS 2610
CS201: Data Structures and Discrete Mathematics I
Propositional Equivalences
CS201: Data Structures and Discrete Mathematics I
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs Propositional Equivalence Propositional Equivalence (Section 1.2) (Section 1.2) Predicates & Quantifiers Predicates & Quantifiers (Section 1.3) (Section 1.3)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 1 Propositional Equivalences (1.2) A tautology is a proposition which is always true. A tautology is a proposition which is always true. Classic Example: P V  P A contradiction is a proposition which is always false. A contradiction is a proposition which is always false. Classic Example: P   P A contingency is a proposition which neither a tautology nor a contradiction. A contingency is a proposition which neither a tautology nor a contradiction. Example: (P V Q)   R

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 2 Propositional Equivalences (1.2) (cont.) Two propositions P and Q are logically equivalent if Two propositions P and Q are logically equivalent if P  Q is a tautology. We write: P  Q

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 3 Propositional Equivalences (1.2) (cont.) Example: Example: (P  Q)  (Q  P)  (P  Q) Proof: Proof: The left side and the right side must have the same truth values independent of the truth value of the component propositions. The left side and the right side must have the same truth values independent of the truth value of the component propositions. To show a proposition is not a tautology: use an abbreviated truth table To show a proposition is not a tautology: use an abbreviated truth table try to find a counter example or to disprove the assertion. try to find a counter example or to disprove the assertion. search for a case where the proposition is false search for a case where the proposition is false

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 4 Propositional Equivalences (1.2) (cont.) Case 1: Try left side false, right side true Case 1: Try left side false, right side true Left side false: only one of P  Q or Q  P need be false. 1a. Assume P  Q = F. Then P = T, Q = F. But then right side P  Q = F. Wrong guess. 1b. Try Q  P = F. Then Q = T, P = F. Then P  Q = F. Another wrong guess.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 5 Propositional Equivalences (1.2) Case 2. Try left side true, right side false Case 2. Try left side true, right side false If right side is false, P and Q cannot have the same truth value. 2a. Assume P =T, Q = F. Then P  Q = F and the conjunction must be false so the left side cannot be true in this case. Another wrong guess. 2b. Assume Q = T, P = F. Again the left side cannot be true. We have exhausted all possibilities and not found a counterexample. The two propositions must be logically equivalent. Note: Because of this equivalence, if and only if or iff is also stated as is a necessary and sufficient condition for.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 6EquivalenceName P  T  P P V F  P Identity Laws P V T  T P  F  F Domination Laws P V P  P P  P  P Idempotent Laws  (  P)  P Double Negation Law P V Q  Q V P P  Q  Q  P Commutative Law

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 7EquivalenceName (P V Q) V R  P V (Q V R) Associative Law P V (Q  R)  (P V Q)  (P V R) Distributive Law Distributive Law  (P  Q)   P V  Q  (P V Q)   P   Q De Morgan ’ s Laws P  Q   P V Q Implication Equivalence P  Q   Q   P Contrapositive Law Note: equivalent expressions can always be substituted for each other in a more complex expression - useful for simplification.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 8 Propositional Equivalences (1.2) (cont.) Normal or Canonical Forms Normal or Canonical Forms Unique representations of a proposition Unique representations of a proposition Examples: Construct a simple proposition of two variables which is true only when Examples: Construct a simple proposition of two variables which is true only when P is true and Q is false: P   Q P is true and Q is false: P   Q P is true and Q is true: P  Q P is true and Q is true: P  Q P is true and Q is false or P is true and Q is true: (P   Q) V (P  Q) P is true and Q is false or P is true and Q is true: (P   Q) V (P  Q)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 9 Propositional Equivalences (1.2) (cont.) A disjunction of conjunctions where A disjunction of conjunctions where every variable or its negation is represented once in each conjunction (a minterm) every variable or its negation is represented once in each conjunction (a minterm) each minterms appears only once each minterms appears only once Disjunctive Normal Form (DNF) Important in switching theory, simplification in the design of circuits. Important in switching theory, simplification in the design of circuits.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 10 Propositional Equivalences (1.2) (cont.) Method: To find the minterms of the DNF. Method: To find the minterms of the DNF. Use the rows of the truth table where the proposition is 1 or True Use the rows of the truth table where the proposition is 1 or True If a zero appears under a variable, use the negation of the propositional variable in the minterm If a zero appears under a variable, use the negation of the propositional variable in the minterm If a one appears, use the propositional variable. If a one appears, use the propositional variable.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 11 Propositional Equivalences (1.2) (cont.) Example: Find the DNF of (P V Q)   R Example: Find the DNF of (P V Q)   R PQR (P V Q)   R

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 12 Propositional Equivalences (1.2) (cont.) There are 5 cases where the proposition is true, hence 5 minterms. Rows 1,2,3, 5 and 7 produce the following disjunction of minterms: There are 5 cases where the proposition is true, hence 5 minterms. Rows 1,2,3, 5 and 7 produce the following disjunction of minterms: (P V Q)   R  (  P   Q   R) V (  P   Q  R) V (  P  Q   R) V (P   Q   R) V (P  Q   R) Note that you get a Conjunctive Normal Form (CNF) if you negate a DNF and use DeMorgan ’ s Laws. Note that you get a Conjunctive Normal Form (CNF) if you negate a DNF and use DeMorgan ’ s Laws.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 13 Predicates & Quantifiers (1.3) A generalization of propositions - propositional functions or predicates: propositions which contain variables A generalization of propositions - propositional functions or predicates: propositions which contain variables Predicates become propositions once every variable is bound- by Predicates become propositions once every variable is bound- by assigning it a value from the Universe of Discourse U assigning it a value from the Universe of Discourse U or or quantifying it quantifying it

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 14 Predicates & Quantifiers (1.3) (cont.) Examples: Examples: Let U = Z, the integers = {... -2, -1, 0, 1, 2, 3,...} Let U = Z, the integers = {... -2, -1, 0, 1, 2, 3,...} P(x): x > 0 is the predicate. It has no truth value until the variable x is bound. P(x): x > 0 is the predicate. It has no truth value until the variable x is bound. Examples of propositions where x is assigned a value: Examples of propositions where x is assigned a value: P(-3) is false, P(-3) is false, P(0) is false, P(0) is false, P(3) is true. P(3) is true. The collection of integers for which P(x) is true are the positive integers. The collection of integers for which P(x) is true are the positive integers.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 15 Predicates & Quantifiers (1.3) (cont.) P(y) V  P(0) is not a proposition. The variable y has not been bound. However, P(3) V  P(0) is a proposition which is true. P(y) V  P(0) is not a proposition. The variable y has not been bound. However, P(3) V  P(0) is a proposition which is true. Let R be the three-variable predicate R(x, y z): x + y = z Let R be the three-variable predicate R(x, y z): x + y = z Find the truth value of Find the truth value of R(2, -1, 5), R(3, 4, 7), R(x, 3, z)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 16 Predicates & Quantifiers (1.3) (cont.) Quantifiers Quantifiers Universal Universal P(x) is true for every x in the universe of discourse. Notation: universal quantifier  x P(x) ‘ For all x, P(x) ’, ‘ For every x, P(x) ’ The variable x is bound by the universal quantifier producing a proposition.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 17 Predicates & Quantifiers (1.3) (cont.) Example: U = {1, 2, 3} Example: U = {1, 2, 3}  x P(x)  P(1)  P(2)  P(3)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 18 Predicates & Quantifiers (1.3) (cont.) Quantifiers (cont.) Quantifiers (cont.) Existential Existential P(x) is true for some x in the universe of discourse. P(x) is true for some x in the universe of discourse. Notation: existential quantifier  x P(x) ‘ There is an x such that P(x), ’ ‘ For some x, P(x) ’, ‘ For at least one x, P(x) ’, ‘ I can find an x such that P(x). ’ Example: U={1,2,3}  x P(x)  P(1) V P(2) V P(3)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 19 Predicates & Quantifiers (1.3) (cont.) Quantifiers (cont.) Quantifiers (cont.) Unique Existential Unique Existential P(x) is true for one and only one x in the universe of discourse. Notation: unique existential quantifier  !x P(x) ‘ There is a unique x such that P(x), ’ ‘ There is one and only one x such that P(x), ’ ‘ One can find only one x such that P(x). ’

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 20 Predicates & Quantifiers (1.3) (cont.) Example: U = {1, 2, 3, 4} Example: U = {1, 2, 3, 4} P(1)P(2)P(3)  !xP(x) How many minterms are in the DNF?

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 21 Predicates & Quantifiers (1.3) (cont.) REMEMBER! A predicate is not a proposition until all variables have been bound either by quantification or assignment of a value!

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 22 Predicates & Quantifiers (1.3) (cont.) Equivalences involving the negation operator Equivalences involving the negation operator  (  x P(x ))   x  P(x)  (  x P(x))   x  P(x) Distributing a negation operator across a quantifier changes a universal to an existential and vice versa. Distributing a negation operator across a quantifier changes a universal to an existential and vice versa.  (  x P(x))   (P(x 1 )  P(x 2 )  …  P(x n ))   P(x 1 ) V  P(x 2 ) V … V  P(x n )   x  P(x)  (  x P(x))   (P(x 1 )  P(x 2 )  …  P(x n ))   P(x 1 ) V  P(x 2 ) V … V  P(x n )   x  P(x)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 23 Predicates & Quantifiers (1.3) (cont.) Multiple Quantifiers: read left to right... Multiple Quantifiers: read left to right... Example: Let U = R, the real numbers, Example: Let U = R, the real numbers, P(x,y): xy= 0  x  y P(x, y)  x  y P(x, y)  x  y P(x, y)  x  y P(x, y) The only one that is false is the first one. What ’ s about the case when P(x,y) is the predicate x/y=1?

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 24 Predicates & Quantifiers (1.3) (cont.) Multiple Quantifiers: read left to right... Multiple Quantifiers: read left to right... Example: Let U = {1,2,3}. Find an expression equivalent to  x  y P(x, y) where the variables are bound by substitution instead: Example: Let U = {1,2,3}. Find an expression equivalent to  x  y P(x, y) where the variables are bound by substitution instead: Expand from inside out or outside in. Outside in:  y P(1, y)   y P(2, y)   y P(3, y)  [P(1,1) V P(1,2) V P(1,3)]  [P(2,1) V P(2,2) V P(2,3)]  [P(3,1) V P(3,2) V P(3,3)]

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 25 Predicates & Quantifiers (1.3) (cont.) Converting from English (Can be very difficult!) Converting from English (Can be very difficult!) “ Every student in this class has studied calculus ” transformed into: “ For every student in this class, that student has studied calculus ” calculus ” C(x): “ x has studied calculus ”  x C(x) This is one way of converting from English!

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 26 Predicates & Quantifiers (1.3) (cont.) Multiple Quantifiers: read left to right... (cont.) Multiple Quantifiers: read left to right... (cont.) Example: Example: F(x): x is a fleegle S(x): x is a snurd T(x): x is a thingamabob U={fleegles, snurds, thingamabobs} (Note: the equivalent form using the existential quantifier is also given)

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 27 Predicates & Quantifiers (1.3) (cont.) Everything is a fleegle Everything is a fleegle  x F( x)   (  x  F(x)) Nothing is a snurd. Nothing is a snurd.  x  S(x)   (  x S( x)) All fleegles are snurds. All fleegles are snurds.  x [F(x)  S(x)]   x [  F(x) V S(x)]   x  [F(x)   S(x)]   (  x [F(x) V  S(x)])

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 28 Predicates & Quantifiers (1.3) (cont.) Some fleegles are thingamabobs. Some fleegles are thingamabobs.  x [F(x)  T(x)]   (  x [  F(x) V  T(x)]) No snurd is a thingamabob. No snurd is a thingamabob.  x [S(x)   T(x)]   (  x [S(x )  T(x)]) If any fleegle is a snurd then it's also a thingamabob If any fleegle is a snurd then it's also a thingamabob  x [(F(x)  S(x))  T(x)]   (  x [F(x)  S(x)   T( x)])

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 29 Predicates & Quantifiers (1.3) (cont.) Extra Definitions: Extra Definitions: An assertion involving predicates is valid if it is true for every universe of discourse. An assertion involving predicates is valid if it is true for every universe of discourse. An assertion involving predicates is satisfiable if there is a universe and an interpretation for which the assertion is true. Else it is unsatisfiable. An assertion involving predicates is satisfiable if there is a universe and an interpretation for which the assertion is true. Else it is unsatisfiable. The scope of a quantifier is the part of an assertion in which variables are bound by the quantifier The scope of a quantifier is the part of an assertion in which variables are bound by the quantifier

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 30 Predicates & Quantifiers (1.3) (cont.) Examples: Examples: Valid:  x  S(x)   [  x S( x)] Not valid but satisfiable:  x [F(x)  T(x)] Not satisfiable:  x [F(x)   F(x)] Scope:  x [F(x) V S( x)] vs.  x [F(x)] V  x [S(x)]

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 31 Predicates & Quantifiers (1.3) (cont.) Dangerous situations: Dangerous situations: Commutativity of quantifiers Commutativity of quantifiers  x  y P(x, y)  y  x P( x, y)? YES! YES!  x  y P(x, y)   y  x P(x, y)? NO! NO! DIFFERENT MEANING! Distributivity of quantifiers over operators Distributivity of quantifiers over operators  x [P(x)  Q(x)]   x P( x)   x Q( x)? YES! YES!  x [P( x)  Q( x)]  [  x P(x)   x Q( x)]? NO! NO!

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 32 Sets (1.6) A set is a collection or group of objects or elements or members. (Cantor 1895) A set is a collection or group of objects or elements or members. (Cantor 1895) A set is said to contain its elements. A set is said to contain its elements. There must be an underlying universal set U, either specifically stated or understood. There must be an underlying universal set U, either specifically stated or understood.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 33 Sets (1.6) (cont.) Notation: Notation: list the elements between braces: list the elements between braces: S = {a, b, c, d}={b, c, a, d, d} (Note: listing an object more than once does not change the set. Ordering means nothing.) specification by predicates: specification by predicates: S= {x| P(x)}, S contains all the elements from U which make the predicate P true. brace notation with ellipses: brace notation with ellipses: S = {..., -3, -2, -1}, the negative integers.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 34 Sets (1.6) (cont.) Common Universal Sets Common Universal Sets R = reals R = reals N = natural numbers = {0,1, 2, 3,... }, the counting numbers N = natural numbers = {0,1, 2, 3,... }, the counting numbers Z = all integers = {.., -3, -2, -1, 0, 1, 2, 3, 4,..} Z = all integers = {.., -3, -2, -1, 0, 1, 2, 3, 4,..} Z + is the set of positive integers Z + is the set of positive integers Notation: Notation: x is a member of S or x is an element of S: x  S. x is not an element of S: x  S.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 35 Sets (1.6) (cont.) Subsets Subsets Definition: The set A is a subset of the set B, denoted A  B, iff Definition: The set A is a subset of the set B, denoted A  B, iff  x [x  A  x  B] Definition: The void set, the null set, the empty set, denoted , is the set with no members. Definition: The void set, the null set, the empty set, denoted , is the set with no members. Note: the assertion x   is always false. Hence  x [x    x  B] is always true(vacuously). Therefore,  is a subset of every set. Note: A set B is always a subset of itself.

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 36 Sets (1.6) (cont.) Definition: If A  B but A  B the we say A is a proper subset of B, denoted A  B (in some texts). Definition: If A  B but A  B the we say A is a proper subset of B, denoted A  B (in some texts). Definition: The set of all subset of a set A, denoted P(A), is called the power set of A. Definition: The set of all subset of a set A, denoted P(A), is called the power set of A. Example: If A = {a, b} then Example: If A = {a, b} then P(A) = { , {a}, {b}, {a,b}}

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 37 Sets (1.6) (cont.) Definition: The number of (distinct) elements in A, denoted |A|, is called the cardinality of A. Definition: The number of (distinct) elements in A, denoted |A|, is called the cardinality of A. If the cardinality is a natural number (in N), then the set is called finite, else infinite. Example: A = {a, b}, Example: A = {a, b}, |{a, b}| = 2, |P({a, b})| = 4. A is finite and so is P(A). Useful Fact: |A|=n implies |P(A)| = 2 n

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 38 Sets (1.6) (cont.) N is infinite since |N| is not a natural number. It is called a transfinite cardinal number. N is infinite since |N| is not a natural number. It is called a transfinite cardinal number. Note: Sets can be both members and subsets of other sets. Note: Sets can be both members and subsets of other sets. Example: Example: A = { ,{  }}. A has two elements and hence four subsets: , {  }, {{  }}. { ,{  }} Note that  is both a member of A and a subset of A! Russell's paradox: Let S be the set of all sets which are not members of themselves. Is S a member of itself? Russell's paradox: Let S be the set of all sets which are not members of themselves. Is S a member of itself? Another paradox: Henry is a barber who shaves all people who do not shave themselves. Does Henry shave himself? Another paradox: Henry is a barber who shaves all people who do not shave themselves. Does Henry shave himself?

CS 210, Ch.1 (part 2): The foundations: Logic & Proof, Sets, and Functions 39 Sets (1.6) (cont.) Definition: The Cartesian product of A with B, denoted Definition: The Cartesian product of A with B, denoted A x B, is the set of ordered pairs { | a  A  b  B} Notation: Note: The Cartesian product of anything with  is . (why?) Example: Example: A = {a,b}, B = {1, 2, 3} AxB = {,,,,, } What is BxA? AxBxA? If |A| = m and |B| = n, what is |AxB|? If |A| = m and |B| = n, what is |AxB|?