Basic Structures: Sets, Functions, Sequences and Sums
Basic Structures: Sets, Functions, Sequences and Sums
Basic Structures: Sets, Functions, Sequences and Sums
Sets (2.1)
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
2
Notation:
specification by predicates:
S= {x| P(x)},
S contains all the elements from U which make the predicate P
true.
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.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
4
Subsets
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.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
6
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
7
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?
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
8
Example:
A = {a,b}, B = {1, 2, 3}
AxB = {<a, 1>, <a, 2>, <a, 3>, <b, 1>, <b, 2>, <b, 3>}
What is BxA? AxBxA?
Boolean Algebra.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
10
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
11
Set Operations (2.2) (cont.)
Definitions:
The union of A and B, denoted A U B, is the set {x | x A x B}
AB = {1, 2, 3, 4, 5, 6, 7, 8}
A B = {4, 5}
A = {0, 6, 7, 8, 9, 10}
B = {0, 1, 2, 3, 9, 10}
A - B = {1, 2, 3}
B - A = {6, 7, 8}
AB = {1, 2, 3, 6, 7, 8}
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
13
U U
A B
A B
C
Example:
The complement of the union is the intersection of the
complements:
A B = A B
Proof: To show:
x [x A B x A B ]
To show two sets are equal we show for all x that x is a
member of one set if and only if it is a member of the
other.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
15
Universal Instantiation
In a proof we can eliminate the universal quantifier
which binds a variable if we do not assume anything
about the variable other than it is an arbitrary member of
the Universe. We can then treat the resulting predicate
as a proposition.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
We say 16
'Let x be arbitrary.'
Then we can treat the predicates as propositions:
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
17
is a tautology.
Since
• x was arbitrary
• we have used only logically equivalent assertions and
definitions
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
18
Universal Generalization
We can apply a universal quantifier to bind a variable if we
have shown the predicate to be true for all values of the
variable in the Universe.
x [x A B x A B ]
Example:
Show A (B - A) =
A (B - A) or x [xA (B - A) x ]
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
21
Example (cont.)
Q. E. D.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
22
Let Ai [ iA, ), 1 i
[ i , ),1 i
i
n n
Ai [ 1 , )
Ai i n1 [ 1 , )
i 1 Ai [ n , )
i 1
n
Ai [ n , )
i 1
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
24
Functions (2.3)
Definition:
x [x A y [y B < x, y > f ]]
and
[< x, y1 > f < x, y2 > f ] y1 = y2
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
25
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
26
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
27
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
28
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
29
A B A B
a a
V V
b b
W W
c c
X X
d d
Y Y
Injection & a surjection,
Z hence a bijection
Injection but not a surjection
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
30
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
31
• f(x) = x,
• f(x) = x2,
• f(x) = x3,
• f(x) = x + sin(x),
• f(x) = |x|
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
32
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
33
Definition:
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
34
A f B A f-1 B
a a
V V
b b
W W
c c
X X
d d
Y Y
A B
a
X
b f-1({Z}) = {c, d}
Y f-1({X, Y}) = {a, b}
c
Z
d
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
36
Definition:
f g(x) = f(g(x))
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
37
A g B f C
a V h
Examples: b W i
c X j
d
Y
A fg C
a
h
b
i
c
j
d
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
38
Definition:
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
39
Example:
Suppose f: B C, g: A B and f g is injective.
What can we say about f and g?
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
40
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
42
k
Given a sequence a i 0 we can add together a subset
of the sequence by using the summation and function
notation
n
a g ( m ) a g ( m 1 ) ... a g ( n ) a g( j )
j m
or more generally
aj
jS
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
43
if S {2,5,7,10} then a j a 2 a 5 a7 a 10
jS
n
Similarity for the product notation: a j am am 1 ...an
j m
44
Cardinality
Definition:
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
46
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
47
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
48
Theorem:
If | A | | B | and | B | | A | then | A | = | B |.
This implies
if there is an injection from A to B
then
there must be a bijection from A to B
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
49
0 2 5
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
50
0 2 4 6 8 10 12 …
Z+, the set of positive integers is countably infinite.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
51
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
52
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
53
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
54
etc.
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
55
For example:
Let A = {a, b, c}.
{ , a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc, aaa, aab,
aac, aba, ....} = {f(0), f(1), f(2), f(3), f(4), . . . .}
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
56
Hence, there cannot exist a list and therefore the set is not
countable CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
58
(Note: choosing 0 and 9 is not a good idea because of the non uniqueness
of decimal expansions.)
Example:
CSE 504, Ch.1 (part 3): The foundations: Logic & Proof, Sets, and Functions
61