
Today’s topics Introduction to Set Theory (§1.6) • Sets • A set is a new type of structure, representing an unordered – Indirect, by cases, and direct collection (group, plurality) of zero or more distinct – Rules of logical inference (different) objects. – Correct & fallacious proofs • Set theory deals with operations between, relations among, and statements about sets. • Reading: Sections 1.6-1.7 • Sets are ubiquitous in computer software systems. • Upcoming • All of mathematics can be defined in terms of some form – Functions of set theory (using predicate logic). CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.1 4.2 Naïve set theory Basic notations for sets • Basic premise: Any collection or class of objects • For sets, we’ll use variables S, T, U, … (elements) that we can describe (by any means whatsoever) constitutes a set. • We can denote a set S in writing by listing • But, the resulting theory turns out to be logically all of its elements in curly braces: inconsistent! – {a, b, c} is the set of whatever 3 objects are – This means, there exist naïve set theory propositions p such that you can prove that both p and ¬p follow logically from the denoted by a, b, c. axioms of the theory! • Set builder notation: For any proposition – The conjunction of the axioms is a contradiction! – This theory is fundamentally uninteresting, because any possible P(x) over any universe of discourse, statement in it can be (very trivially) “proved” by contradiction! {x|P(x)} is the set of all x such that P(x). • More sophisticated set theories fix this problem. CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.3 4.4 Basic properties of sets Definition of Set Equality • Sets are inherently unordered: • Two sets are declared to be equal if and only if they contain exactly the same elements. – No matter what objects a, b, and c denote, • In particular, it does not matter how the set is defined or {a, b, c} = {a, c, b} = {b, a, c} = denoted. {b, c, a} = {c, a, b} = {c, b, a}. • For example: The set {1, 2, 3, 4} = • All elements are distinct (unequal); {x | x is an integer where x>0 and x<5 } = multiple listings make no difference! {x | x is a positive integer whose square multiple listings make no difference! is >0 and <25} – If a=b, then {a, b, c} = {a, c} = {b, c} = {a, a, b, a, b, c, c, c, c}. – This set contains (at most) 2 elements! CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.5 4.6 Infinite Sets Venn Diagrams • Conceptually, sets may be infinite (i.e., not finite, John Venn without end, unending). 1834-1923 • 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… • “Blackboard Bold” or double-struck font (,,) is also often used for these special number sets. • Infinite sets come in different sizes! More on this after module #4 (functions). CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.7 4.8 Basic Set Relations: Member of The Empty Set • xS (“x is in S”) is the proposition that • (“null”, “the empty set”) is the unique object x is an lement or member of set S. set that contains no elements whatsoever. – e.g. 3N, “a”{x | x is a letter of the alphabet} • = {} = {x|False} – Can define set equality in terms of relation: • No matter the domain of discourse, S,T: S=T ( x: x S x T) we have the axiom ¬x: x. “Two sets are equal iff they have all the same members.” • xS : ¬(xS) “x is not in S” CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.9 4.10 Subset and Superset Relations Proper (Strict) Subsets & Supersets • ST (“S is a subset of T”) means that every • ST (“S is a proper subset of T”) means element of S is also an element of T. that ST but T / S . Similar for ST. • ST x (xS xT) Example: • S, SS. {1,2} {1,2,3} • ST (“S is a superset of T”) means TS. S • Note S=T ST ST. T • S / T means ¬(ST), i.e. x(xS xT) Venn Diagram equivalent of ST CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.11 4.12 Sets Are Objects, Too! Cardinality and Finiteness • The objects that are elements of a set may • |S| (read “the cardinality of S”) is a measure themselves be sets. of how many different elements S has. • E.g. let S={x | x {1,2,3}} • E.g., ||=0, |{1,2,3}| = 3, |{a,b}| = 2, then S={, |{{1,2,3},{4,5}}| = ____ {1}, {2}, {3}, • If |S|N, then we say S is finite. {1,2}, {1,3}, {2,3}, Otherwise, we say S is infinite. {1,2,3}} {1,2,3}} • What are some infinite sets we’ve seen? • Note that 1 {1} {{1}} !!!! CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.13 4.14 The Power Set Operation Review: Set Notations So Far • The power set P(S) of a set S is the set of • Variable objects x, y, z; sets S, T, U. all subsets of S. P(S) : {x | xS}. • Literal set {a, b, c} and set-builder {x|P(x)}. • E.g. P({a,b}) = {, {a}, {b}, {a,b}}. • relational operator, and the empty set . S • Sometimes P(S) is written 2S. • Set relations =, , , , , , etc. Note that for finite S, |P(S)| = 2|S|. Note that for finite S, |P(S)| = 2 . • Venn diagrams. • It turns out S:|P(S)|>|S|, e.g. |P(N)| > |N|. • Cardinality |S| and infinite sets N, Z, R. There are different sizes of infinite sets! • Power sets P(S). CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.15 4.16 Naïve Set Theory is Inconsistent Ordered n-tuples • There are some naïve set descriptions that lead to pathological structures that are not well-defined. • These are like sets, except that duplicates – (That do not have self-consistent properties.) matter, and the order makes a difference. • These “sets” mathematically cannot exist. • For nN, an ordered n-tuple or a sequence • E.g. let S = {x | x x }. Is S S? • E.g. let S = {x | xx }. Is SS? or list of length n is written (a , a , …, a ). • Therefore, consistent set theories must restrict the 1 2 n language that can be used to describe sets. Its first element is a1, etc. Contrast with • For purposes of this class, don’t worry about it! • Note that (1, 2) (2, 1) (2, 1, 1). sets’ {} • Empty sequence, singlets, pairs, triples, Bertrand Russell quadruples, quintuples, …, n-tuples. 1872-1970 CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.17 4.18 Cartesian Products of Sets Review of §1.6 • For sets A, B, their Cartesian product • Sets S, T, U… Special sets N, Z, R. AB : {(a, b) | aA bB }. • Set notations {a,b,...}, {x|P(x)}… • E.g. {a,b}{1,2} = {(a,1),(a,2),(b,1),(b,2)} • Set relation operators xS, S T, ST, S=T, • Note that for finite A, B, |AB|=|A||B|. ST, ST. (These form propositions.) • Note that the Cartesian product is not • Finite vs. infinite sets. commutative: i.e., ¬AB: AB=BA. • Set operations |S|, P(S), ST. • Extends to A1 A2 … An... • Next up: §1.5: More set ops: , , . René Descartes CompSci 102 © Michael Frank CompSci 102 © Michael Frank (1596-1650)4.19 4.20 Start §1.7: The Union Operator Union Examples • For sets A, B, theirnion AB is the set • {a,b,c}{2,3} = {a,b,c,2,3} containing all elements that are either in A, • {2,3,5}{3,5,7} = {2,3,5,3,5,7} ={2,3,5,7} or (“”) in B (or, of course, in both). Think “The United • Formally, A,B: AB = {x | xA xB}. States of America • Note that AB is a superset of both A and includes every person who worked B (in fact, it is the smallest such superset): in any U.S. state A, B: (AB A) (AB B) last year.” (This is how the IRS sees it...) CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.21 4.22 The Intersection Operator Intersection Examples • For sets A, B, their intersection AB is the • {a,b,c}{2,3} = ___ set containing all elements that are • {2,4,6}{3,4,5} = ______{4} simultaneously in A and (“”) in B. Think “The • Formally, A,B: AB={x | xA xB}. intersection of • Note that AB is a subset of both A and B University Ave. and W 13th St. is just (in fact it is the largest such subset): that part of the road A, B: (AB A) (AB B) surface that lies on both streets.” CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.23 4.24 Disjointedness Inclusion-Exclusion Principle Help, I’ve • Two sets A, B are called been • How many elements are in AB? disjointed! disjoint (i.e., unjoined) |AB| = |A| + |B| |AB| iff their intersection is • Example: How many students are on our empty. (AB=) class email list? Consider set E = I M, • Example: the set of even I = {s | s turned in an information sheet} integers is disjoint with M = {s | s sent the TAs their email address} the set of odd integers. • Some students did both! |E| = |IM| = |I| + |M| |IM| CompSci 102 © Michael Frank CompSci 102 © Michael Frank 4.25 4.26 Set Difference Set Difference Examples • For sets A, B, the difference of A and B, • {1,2,3,4,5,6} {2,3,5,7,9,11} = written AB, is the set of all elements that ___________{1,4,6} are in A but not B.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-