Sets. Definitions (I) Collection of elements such that: There are no duplicates There is no order Special sets Universe (U or E): all elements under consideration.

Slides:



Advertisements
Similar presentations
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Advertisements

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Instructor: Hayk Melikya
The Engineering Design of Systems: Models and Methods
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Lecture 3 Set Operations & Set Functions. Recap Set: unordered collection of objects Equal sets have the same elements Subset: elements in A are also.
Discussion #25 1/13 Discussion #25 Set Topics & Applications.
Sets 1.
Sets 1.
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
1 Section 1.8 Functions. 2 Loose Definition Mapping of each element of one set onto some element of another set –each element of 1st set must map to something,
1 Set Theory. Notation S={a, b, c} refers to the set whose elements are a, b and c. a  S means “a is an element of set S”. d  S means “d is not an element.
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations.
Discrete Maths Objective to re-introduce basic set ideas, set operations, set identities , Semester 2, Set Basics 1.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Relation, function 1 Mathematical logic Lesson 5 Relations, mappings, countable and uncountable sets.
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
Relations: Operations & Properties. Power Sets Set of all subsets of a set A. –A = {1,2} –P(A) = 2 A = { {}, {1}, {2}, {1,2} } We note that each element.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
ICS 253: Discrete Structures I
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
1 ENM 503 Block 1 Algebraic Systems Lesson 2 – The Algebra of Sets The Essence of Sets What are they?
1.4 Sets Definition 1. A set is a group of objects . The objects in a set are called the elements, or members, of the set. Example 2 The set of positive.
Example Prove that: “IF 3n + 2 is odd, then n is odd” Proof by Contradiction: -p = 3n + 2 is odd, q = n is odd. -Assume that ~(p  q) is true OR -(p 
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Functions Section 2.3. Section Summary Definition of a Function. – Domain, Cdomain – Image, Preimage Injection, Surjection, Bijection Inverse Function.
Language: Set of Strings
What is a set? A set is a collection of objects.
Discrete Mathematics R. Johnsonbaugh
Mathematical Preliminaries
Sets & Set Operations Tuples & Relations. Sets Sets are collections –The things in the collection are called elements or members –Sets have no duplicates.
Basic Structures: Sets, Functions, Sequences, and Sums.
Introduction to Set theory. Ways of Describing Sets.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Review 2 Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by lower.
Discrete Mathematics CS 2610 January 27, part 2.
Discrete Mathematics Set.
CSci 2011 Discrete Mathematics Lecture 9, 10
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
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.
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
FUNCTIONS.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Set. Outline Universal Set Venn Diagram Operations on Sets.
ICS 253: Discrete Structures I
Set, Combinatorics, Probability & Number Theory
Sets Section 2.1.
CS 2210:0001 Discrete Structures Sets and Functions
CSE15 Discrete Mathematics 02/15/17
S1: Prove that: Venn Diagram “Proof” Direct Proof A  (A  B) = A
CSE15 Discrete Mathematics 02/27/17
Lesson 5 Relations, mappings, countable and uncountable sets
Lesson 5 Relations, mappings, countable and uncountable sets
ICS 253: Discrete Structures I
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
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:

Sets

Definitions (I) Collection of elements such that: There are no duplicates There is no order Special sets Universe (U or E): all elements under consideration Empty set ({ } or  ): set with no elements NZR Others: N, Z, R, etc. Notation { } Enumeration: {1, 2, 3}, {1, 2, …}, {1, 2, …, 100}, etc. N Set building: { x | P(x) } all elements in E that satisfy property P (e.g., { x in N | x>5  x<10 } = {6, 7, 8, 9}

Definitions (II) Element of: x  A Cardinality: |A| = size or number of elements in A Set Equality A = B iff A and B have the same elements A = B  x  A  x  B Subset/Superset A  B  x  A  x  B (subset or equal) A  B  A  B   x(x  B  x  A) (proper subset)

Set Operations: Intersection A  B  {x | x  A  x  B} Example: {1, 2, 3}  {2, 3, 4} = {2, 3} Prove: A  B  A By definition, A  B  A  x  A  B  x  A 1. x  Anegate conclusion 2. x  A  Bpremise 3. x  A  x  Bdef of  4. x  A3, simplification 5. x  A  x  A1&4, conjunction 6. F5, contradiction Proof by contradiction AB

Set Operations: Union A  B  {x | x  A  x  B} Example: {1, 2, 3}  {2, 3, 4} = {1, 2, 3, 4} No duplicates! Prove: A  A  B By definition, A  A  B  x  A  x  A  x  B 1. x  A premise 2. x  A  x  B1, law of addition AB

Set Operations: Difference A – B  {x | x  A  x  B} Example: {1, 2, 3} – {2, 3, 4} = {1} Remove elements of B from A Prove: A – B  A By definition, A – B  A  x  A–B  x  A 1. x  A – B premise 2. x  A  x  B definition 3. x  A simplification AB

Set Operations: Complement ~ A  E – A  {x | x  E  x  A} Example: ~{1, 2, 3} = {4} if E = {1, 2, 3, 4} Prove: A  ~A =  A  ~A =   A  ~A      A  ~A set equality  A  ~A    T  is subset of every set  A  ~A   identity  x  A  x  ~A  x   def of  and   x  A  x  E  x  A  x   def of ~  F  x   comm., contradict., dominat.  T A

Basic Set Laws Set AlgebraName A  ~A = E A  ~A =  Complementation law Exclusion law A  E = A A   = A Identity laws A  E = E A   =  Domination laws A  A = A A  A = A Idempotent laws Duals:  and  E

Basic Set Identities (continued…) Set AlgebraName ~(~A) = A Double Compl. A  B = B  A A  B = B  A Commutative laws (A  B)  C = A  (B  C) (A  B)  C = A  (B  C) Associative laws A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) Distributive laws ~ (A  B) = ~A  ~B ~ (A  B) = ~A  ~B De Morgan’s laws

Example: Set Laws Absorption A  (A  B) = A A  (A  B) = A Venn Diagram “Proof” Direct Proof A  (A  B) = (A   )  (A  B)ident. = A  (   B)distrib. = A   dominat. = Aident. AB

Practice Exercises PE1 Prove that if R is a subset of S and S is a subset of T, then R is a subset of T PE2 Prove De Morgan's law for sets (do not use a Venn diagram): ~ (A  B) = ~A  ~B

Tuples Collection of elements, such that: All elements are ordered Notation: ( ) (x 1, x 2, …, x n ) Tuples of 2 elements are known as pairs Typically, elements are taken from known sets x  females, y  males (Mary, Jim) – might mean: Mary and Jim are a married couple x  people, y  cars (Mary, red sports car 17 ) – might mean: Mary owns red sports car 17 x, y, z  integers (3, 4, 7) – might mean: = 7

Cartesian/Cross Product A 1  …  A n = {(x 1, …, x n ) | x  A 1  …  x n  A n } Example: A = {1, 2}, B = {a, b, c} A  B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} A = {1, 2}, B = {a, b, c}, C = { ,  } A  B  C = {(1,a,  ), (1,a,  ), (1,b,  ), (1,b,  ), (1,c,  ), (1,c,  ), (2,a,  ), (2,a,  ), (2,b,  ), (2,b,  ), (2,c,  ), (2,c,  )} |A 1  …  A n | = |A 1 |  …  |A n | Can get large: A = set of students at BYU(30,000) B = set of BYU student addresses(10,000) C = set of BYU student phone#’s(60,000) |A|  |B|  |C| = 1.8  10 13

Relations Relation Subset of the cross product Examples: A = {1, 2} & B = {a, b, c} R = {(1, a), (2, b), (2, c)} A = {1, 2} & B = {a, b, c} & C = { ,  } R = {(1, a,  ), (2, c,  )} Marriage: subset of the cross product of males and females If 2 sets, the relation is binary

Functions

A function is a special kind of binary relation A binary relation f  A  B is a function if for each a  A there is a unique b  B Function Definition α β γ x y

NOT Functions α β γ f = {(1, α), (2, β)} “For each” violated Some x’s do not have corresponding y’s x y

NOT Functions Uniqueness violated for some x’s x y α β γ f = {(1, α), (2, β), (3, β), (3, γ)} uniqueness violated for 3  appears twice

Functions with N-Dimensional Domains An (n+1)-ary relation f  A 1  A 2  …  A n  B is a function if for each  A 1  A 2  …  A n there is a unique b  B. α β γ

We can use various notation for functions: for f = {(1, α),(2, β),(3, β)} Notation for Functions Notation (x, y)  f f : x→yy = f(x) Example (2, β)  f f : 2→ββ = f(2) In the notation, x is the argument or preimage and y is the image. For functions with n-ary domains, use in place of x.

Function Domain and Range f : A → B A is the domain space same as the domain (since all elements participate) dom f, dom(f), or domain(f) B is the range space may or may not be the same as the range, which is: {y |  x(y=f(x))} All rhs values in pairs (all that get “hit”)  B f ran f, ran(f), range(f) f : D 1  D 2  …  D n → Z f : D n → Z (when all domains are the same)

Remove the requirement that each a  A must participate. Retain the uniqueness requirement. Partial Functions Partial Function: α β γ f = {(, β),(, β),(, γ)} not unique α β γ NOT a Partial Function: α β γ Partial Function: (A Total Function is also a Partial Function.)

Identity Function I A : A → A I A = {(x, x) | x  A} Constant Function C : A → B C = {(x, c) | x  A  c  B } Often A and B are the same C : A → A C= {(x, c) | x  A  c  A} Special Functions

Composition of Functions Composition is written “°” Range space of f = domain space of g a c f g b α β 3 f(a) = 2g(2) = αg(f(a)) = α g ° f(a) = α f(b) = 2g(2) = αg(f(b)) = α g ° f(b) = α f(c) = 4g(4) = βg(f(c)) = β g ° f(c) = β

Injection: “one-to-one” or “1-1”  x  y(f(x) = f(y)  x = y) For f : A → B, the elements in B are “ hit ” at most once Injection a b d c Injective a b d c NOT Injective x y x y

Surjection: “onto”  y  x(y = f(x)) For f : A → B, the elements in B are all “ hit ” at least once Surjection a b c 3 SurjectiveNOT Surjective x y x y a b c 3 { not “hit”

Bijection: “one-to-one and onto” or “1-1 correspondence”  x  y(f(x) = f(y)  x = y)   y  x(y = f(x)) For f : A → B, every B element is “ hit ” once and only once Bijection 1 2 a b c 3 BijectiveNOT Bijective x y x y a b c 3 NOT Surjective NOT injective

Notes on Bijection 1.|A| = |B| An “extra” B cannot be “hit” (not a surjection) An “extra” A requires that at least one B must be “hit” twice (not an injection) 2.If f is a bijection, swapping the elements of the ordered pairs is a function Called the inverse Denoted f -1 Is also a bijection f -1 (f(x)) is the identity function, i.e. f -1 (f(x)) = x.

Practice Exercises PE1 If A={a,b,c,d}, are the following functions from A to A injective, surjective or bijective? {(d, a), (d, c), (b, b), (b, d)} {(a, b), (b, b), (c, d), (d, d)} PE2 If f(x)=2x+3 and g(x)=x-3, what is g°f? PE3 Which is the larger set? E (even numbers)vs.O (odd numbers) N (natural numbers)vs.Z (integers) N (natural numbers)vs.[0,1] (real numbers between 0 and 1)

NZ Which is bigger? N or Z? f(x) = x odd: (x+1)/−2 x even: x/2 y negative: −2x−1 y positive: 2x g(y) = { { x y − −2 4 2 NZNZ Since g = f −1, there is a bijection from N to Z and thus |N| = |Z|

N[0,1] Which is bigger? N or [0,1]? N[0,1] Assume |N| = |[0,1]|, then there exists a bijection, e.g., … …diagonalization … [0,1] But now, there exists a number in [0,1] such that d 1 = not 3, d 2 = not 4, d 3 = not 0, etc. Hence, not surjective and thus not bijective

ALL THAT THE FATHER HATH A Functional “Proof”

Language

Power Set Set of all subsets of a set A A = {1,2} P(A) = 2 A = { {}, {1}, {2}, {1,2} } Each element of A is either present (1) or not present (0) Treat the elements of A as a sequence (e.g., A={a,b,c,d}) Use bit-string representation to say which elements are present (e.g., 0110 means {b,c}) Can represent all subsets of A, from  = 0000 to A = 1111 Number of subsets in power set | 2 A | = 2 · 2 · … · 2(|A| times) = 2 |A| Motivates the notation 2 A for the power set

Bit-String Operations With bit string representations Set intersection:  = pairwise  Set union:  = pairwise  Set complement: ~ = bit complement Set minus: – = mask out using 1’s = complement 2 nd operand and do pairwise  E.g. using {a,b,c,d} 1011  1101 = 1001i.e. {a,c,d}  {a,b,d} = {a,d} 1011  1101 = 1111i.e. {a,c,d}  {a,b,d} = {a,b,c,d} ~1011 = 0100i.e. ~{a,c,d} = {b} 1010 – 1100 = 0010i.e. {a,c} – {a,b} = {c}

Practice Exercises PE1 What is the power set of {a, 1, x, 2} ? PE2 What is the power set of  (i.e., the empty set)? PE3 What is the power set of {  } (i.e., the set containing the empty set) ? PE4 What is the power set of { a, {  } } ?

Language Let V be a set of symbols, known as an alphabet or a vocabulary A string is any finite sequence of symbols from V Strings have length V n denotes the set of all strings of length n V * denotes the set of all strings, or sentences, over V A language L is a subset of V *, i.e., L  V * Programming language Set of all possible programs (valid, very long string)

Language Representation Finite –Enumerate all sentences Infinite language –Cannot be specified by enumeration –Use a generative device, i.e., a grammar Specifies the set of all legal sentences Defined recursively (or inductively)