COT 3100, Spring 2001 Applications of Discrete Structures Section #1089X - MWF 4th period Dr. Michael P. Frank Lecture #7 Wed., Jan. 23, 2001 1/24/01 Lecture #7
Administrivia Today: Returning graded Quiz #1 papers. Thursday 6:30pm in E121: ACM & Nortel Networks on “The Path to a Wireless Internet” Friday 3pm in E121: Distinguished lecturer Christos Papadimitriou on “Algorithmic Problems Related to the Internet.” Today: Finish §1.3, Predicate Logic; §1.4, Sets. 1/24/01 Lecture #7
Review: Predicate Logic (§1.3) Objects x, y, z, … Predicates P, Q, R, … are functions mapping objects x to propositions P(x). Multi-argument predicates P(x, y). Quantifiers: (x P(x)) =“For all x’s, P(x).” (x P(x))=“There is an x such that P(x).” 1/24/01 Lecture #7
Some Number Theory Examples Let u.d. = the natural numbers 0, 1, 2, … “A number x is even, E(x), if and only if it is equal to 2 times some other number.” x (E(x) (y x=2y)) “A number is prime, P(x), iff it isn’t the product of two non-unity numbers.” x (P(x) (yz x=yz y1 z1)) 1/24/01 Lecture #7
Calculus Example Precisely defining the concept of a limit using quantifiers: 1/24/01 Lecture #7
Deduction Example Definitions: s = Socrates; H(x) = “x is human”; M(x) = “x is mortal”. Premises: H(s) Socrates is human. x H(x)M(x) All humans are mortal. 1/24/01 Lecture #7
Deduction Example Continued Some valid conclusions: H(s)M(s) [Instantiate universal.] If Socrates is human then he is mortal. H(s) M(s) Socrates is inhuman or mortal. H(s) (H(s) M(s)) He’s human, and inhuman or mortal. (H(s) H(s)) (H(s) M(s)) [Distributive law.] F (H(s) M(s)) [Trivial contradiction.] H(s) M(s) [False is the identity for OR.] M(s) Socrates is mortal. 1/24/01 Lecture #7
Another Example Definitions: H(x) = “x is human”; M(x) = “x is mortal”; G(x) = “x is a god” Premises: x H(x)M(x) and x G(x)M(x). Show that x (H(x) G(x)). 1/24/01 Lecture #7
The Derivation x H(x)M(x) and x G(x)M(x). x M(x)H(x) [Contrapositive.] x (G(x)M(x)) (M(x)H(x)) x G(x)H(x) x G(x) H(x) [Definition of .] x (G(x) H(x)) [DeMorgan’s law.] x G(x) H(x) [An equivalence law.] 1/24/01 Lecture #7
End of §1.3 Predicate Logic From this section you should have learned: Predicate logic notation & conventions Conversions: predicate logic clear English Meaning of quantifiers, equivalences Simple reasoning with quantifiers Next topic: Set theory - a language for talking about collections of objects. 1/24/01 Lecture #7
Intro. to Set Theory (§1.4) A set is an unordered collection/group/ plurality of distinct (different) objects. Set theory deals with operations between, relations among, and statements about sets. Ubiquitous in computer software systems. All math can be defined in terms of some form of set theory (with predicate logic). 1/24/01 Lecture #7
Naïve set theory Basic premise: Any described collection or class of objects (elements) forms a set. Resulting theory turns out to be logically inconsistent: There exist naïve set theory propositions p such that you can prove that both p and p are true. Therefore the theory itself cannot be true to begin with! More sophisticated set theories fix this. 1/24/01 Lecture #7
Basic notations for sets For sets, we’ll use variables S, T, U, … You can denote a set S by listing its elements in curly braces: {a, b, c} is the set of whatever 3 objects are denoted by a, b, c. Set builder notation: For any proposition P(x) over any universe of discourse, {x|P(x)} is the set of all x such that P(x). 1/24/01 Lecture #7
Basic properties of sets Sets are unordered: No matter what a, b, c denote, {a, b, c} = {a, c, b} = {b, a, c} = {b, c, a} = {c, a, b} = {c, b, a} All elements are distinct (unequal); multiple listings make no difference! If a=b, then {a, b, c} = {a, c} = {b, c} = {a, a, b, a, b, c, c, c, c}. Only 2 elements! 1/24/01 Lecture #7
Definition of Set Equality Two sets are equal if and only if they contain all the same elements. In particular, it does not matter how the set is defined or denoted. {1, 2, 3, 4} = {x | x is an integer where x>0 and x<5 } = {x | x is the set of positive integers whose squares are >0 and <25} 1/24/01 Lecture #7
Infinite Sets Conceptually, sets may be infinite (i.e., not finite, without end, unending). Symbols for some special infinite sets: N = {0, 1, 2, …} The Natural numbers. Z = {…, -2, -1, 0, 1, 2, …} The Zntegers. R = The Real numbers, such as 374.1828471929498181917281943125… Infinite sets come in different sizes! 1/24/01 Lecture #7
Positive integers less than 10 Venn Diagrams 2 4 6 8 -1 1 Even integers from 2 to 9 3 5 7 9 Odd integers from 1 to 9 Positive integers less than 10 Primes <10 Integers from -1 to 9 1/24/01 Lecture #7
Basic Set Relations: Member of xS (“x is in S”) is the proposition that object x is an lement or member of set S. e.g. 3N, “a”{x| x is a letter of the alphabet} Can define set equality in terms of relation: S,T: S=T (x: xS xT) “Two sets are equal iff they have all the same members.” xS (xS) “x is not in S” 1/24/01 Lecture #7
The Empty Set (“null”, “the empty set”) is the unique set with no elements. ={}={x|False} No matter the domain of discourse, x:x. 1/24/01 Lecture #7
Subset and Superset Relations ST (“S is a subset of T”) means that every element of S is also an element of T. ST x (xS xT) S, SS. ST (“S is a superset of T”) means TS. Note S=T ST ST. means (ST), i.e. x(xS xT) 1/24/01 Lecture #7
Proper Subsets & Supersets ST (“S is a proper subset of T”) means that ST but . Similar for ST. Example: {1,2} {1,2,3} S T Venn Diagram equivalent of ST 1/24/01 Lecture #7
Sets Are Objects, Too! The objects that are elements of a set may themselves be sets. E.g. let S={x | x {1,2,3}} then S={, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} Note that {1} {{1}} !!!! 1/24/01 Lecture #7
Cardinality and Finiteness |S| (read “the cardinality of S”) is a measure of how many different elements are in S. E.g., ||=0, |{1,2,3}| = 3, |{a,b}| = 2, |{{1,2,3},{4,5}}| = ____ If |S|N, then S is finite. Otherwise, S is infinite. What are some infinite sets we’ve seen? 2 N Z R 1/24/01 Lecture #7
The Power Set Operation The power set P(S) of a set S is the set of all subsets of S. P(S) = {x | xS}. E.g. P({a,b}) = {, {a}, {b}, {a,b}}. Sometimes P(S) is written 2S. Note that for finite S, |P(S)| = 2|S|. It turns out that |P(N)| > |N|. There are different sizes of infinite sets! 1/24/01 Lecture #7
Naïve Set Theory is Inconsistent Some naïve descriptions of sets lead to structures that are not well-defined. (That do not have consistent properties.) These “sets” mathematically cannot exist. E.g. let S = {x | xx }. Is SS? Consistent set theories must restrict the language that can be used to describe sets. For purposes of this class, don’t worry about it! 1/24/01 Lecture #7
Ordered n-tuples Like sets, but duplicates matter and the order makes a difference. For nN, an ordered n-tuple or a sequence of length n is written (a1, a2, …, an). The first element is a1, etc. Note (1, 2) (2, 1) (2, 1, 1). Empty sequence, singlets, pairs, triples, quadruples, quintuples, …, n-tuples. 1/24/01 Lecture #7
Cartesian Products of Sets For sets A, B, their Cartesian product AB {(a, b) | aA bB }. E.g. {a,b}{1,2} = {(a,1),(a,2),(b,1),(b,2)} Note that for finite A, B, |AB|=|A||B|. Note that the Cartesian product is not commutative: AB: AB=BA. Extends to A1 A2 … An... 1/24/01 Lecture #7
End of §1.4 Sets S, T, U… Special sets N, Z, R. Set notations {a,b,...}, {x|P(x)}… Set relation operators xS, ST, ST, S=T, ST, ST. (These form propositions.) Finite vs. infinite sets. Set operations |S|, P(S), ST. 1/24/01 Lecture #7