Introduction to sets

Download Report

Transcript Introduction to sets

Sets
Introduction to Set Theory
Copyright © 2014 Curt Hill
Introduction
•
•
•
•
•
Fundamental discrete structure
A set is a collection of distinct items
A set has no order
No duplications
An item is in the set or not
– Just as a proposition has two truth values
• Set variables are usually denoted by
capital letters and the items by lower
case
Copyright © 2014 Curt Hill
Terminolgy
• Set:
– A collection of distinct items.
– Set variable is usually a capital letter.
– Braces contain the elements
• Element: aka member
– One of the items in a set.
– Usually denoted by lower case letters.
– Symbol xA, x is member of A.
Copyright © 2014 Curt Hill
Terminology 2
• Empty set:
– A set with zero members
– Symbol is  or { }
• Disjoint set:
– Two sets with no members in common
• Cardinality:
– The number of elements in a set
• Universe of discourse:
– The set of all those elements that under
consideration
– Often the integers or real numbers.
Copyright © 2014 Curt Hill
Subset:
• A set whose members are all
contained in another set
• The empty set is the subset of every
set
• Opposite of superset
• A proper subset has at least one
element that is present in the superset
and not present in the subset
• An improper subset is the set itself
Copyright © 2014 Curt Hill
Notation
• A is a (proper) subset of B (AB)
• A is a (proper or improper) subset of B
(AB)
• A is proper superset of B (A  B)
• A is superset of B (A  B)
Copyright © 2014 Curt Hill
Defining a Set
• There are typically three ways to
define a set
• Enumeration
• Set builder
• Construction using operators
Copyright © 2014 Curt Hill
Enumeration
• Lists each element in the set
– A={1,2,3,4,5}
• AKA Roster method
• May use an ellipsis to show a large or
infinite set
– A={2,4,6,8,…}
– A={2,4,6,8,…98,100}
Copyright © 2014 Curt Hill
Set Builder Notation
• Uses a rule that defines the members
that are present in the set
– {x|xI and x>0 and x<5} or
{x|xI and 0 < x <5}
– The | is read such that
– I is the set of integers
• The expression to the right should give
a Boolean value as to whether this is a
member or not
Copyright © 2014 Curt Hill
Open and Closed
• If the type of number is left out, reals
should be assumed
– {x|0 < x < 5}
• We cannot say which is the highest
and lowest element of this set
– We term of this is open
– Interval notation is (0,5)
• However the following is closed
– {x|0  x  5}
– Interval notation is [0,5]
Copyright © 2014 Curt Hill
Construction
• The third way is to define a set in terms
of others sets using set operations, eg
union, intersection, etc
• We will see this as we investigate the
operators
– Section 1.2 and a different presentation
Copyright © 2014 Curt Hill
Power Sets
• A power set is the set of all subsets
– Useful for testing all combinations of
subsets
• Consider A = { 1, 2, 3}
• The power set would then be:
P(A) = {, {1}, {2}, {3}, {1,2}, {1,3},
{2,3}, {1,2,3} }
Copyright © 2014 Curt Hill
Tuples
• The order of sets is irrelevant
– {1, 2, 3} = {3, 1, 2} = {2, 1, 3}
• In many cases we create ordered
tuples
• For example, we use Cartesian
Coordinates to indicate a point in two
space
• Here order is important
– (2,3) is not the same point as (3,2)
– This is an ordered pair
• Three space would use an ordered
triple
Copyright © 2014 Curt Hill
Cartesian Product
• A Cartesian Product creates a set of
ordered pairs
• Denoted by A ⨯ B
• The resulting set of ordered pairs has
all possible combinations where the
first element is from A and the second
from B
Copyright © 2014 Curt Hill
Example
• Suppose:
– A = {1, 2, 3}
– B = {x, y}
• Then A ⨯ B = { {1,x}, {1,y}, {2,x}, {2,y},
{3,x}, {3,y} }
• Notice that the two sets do not need
the same type of elements
• This can be extended to create ntuples of any size
Copyright © 2014 Curt Hill
Connections
• In the previous chapter we used the “is
an element of” symbol  to show the
domain of quantified expressions
– x(P(x)xx>0)
• This is re-introduced in 2.1 with an
addition
– x(x>0) (P(x))
• The first part restricts the domain to
integers greater than zero
Copyright © 2014 Curt Hill
Truth Sets
• Rosen defines a truth set in a way
similar to a solution set from the
Algebra of Real Numbers
• More formally:
– Given a predicate P and a domain D
– The truth set of P is the set of elements
from D that makes P to be true
Copyright © 2014 Curt Hill
Exercises
• From 2.1
– 3, 9,19, 23,27,43
Copyright © 2014 Curt Hill