Title: Functions and infinite sets
1Functions and infinite sets
- (Approx 2-3 lectures. Initial sections adapted
from slides for a course by Michael P. Frank)
2Reading relevant chapters of any book on
Discrete Maths. For example, Rosen 5th ed., 1.8
3Functions
- From calculus, you know the concept of a
real-valued function f, which assigns to each
number x?R one particular value yf(x), where
y?R. - Example f defined by the rule f(x)x2
- Roughly, functions say the so-and-so of
- Functions are also called operations, mappings,
etc.
4Functions
- To understand functions more precisely, one needs
the mathematical notion of a set - We assume you are familiar with naïve set
theory (as opposed to axiomatic set theory). - In a nutshell
5Reminder of main set concepts
- ?, ?, ?, ?, ?,
- , ?, ?, ?, ?, ?, etc.
- a,b,... (def. of a set by enumeration)x
P(x) (def. by set builder notation) - x?S, S?T, ST, S?T.
- P(S) (power set of S),
- A?B (Cartesian product of A and B)
6Reminder of main set concepts
- Important sets of numbers N, Z, Q, R
- A relation on A is a subset of AxA. E.g.,
- on, N, the relation lt is (0,1),(0,2), (1,2),
- Set equality proof techniques
- E.g., to prove AB, prove each of
- A?B
- B?A
7Function Formal Definition
- A function f from (or mapping) A to B (fA?B)
is an assignment of exactly one element f(x)?B to
each element x?A. - Generalisations
- Functions of n arguments f (A1 x A2... x An) ?
B. - A partial (non-total) function f assigns zero or
one elements of B to each element x?A.
8Functions precisely
- We can represent a function fA?B as a set of
ordered pairs f (a,f(a)) a?A. - This makes f a relation between A and Bf is a
subset of A x B. But functions are special - for every a?A, there is at least one pair (a,b).
Formally ?a?A?b?B((a,b)?f) - for every a?A, there is at most one pair (a,b).
Formally ??a,b,c((a,b)?f ? (a,c)?f ? b?c) - A relation over numbers can be represent as a set
of points on a plane. (A point is a pair (x,y).) - A function is then a curve (set of points), with
only one y for each x.
9Useful diagrams
- Functions can be represented graphically in
several ways
A
B
f
f
y
a
b
x
A
Bipartite Graph
B
Plot
Like Venn diagrams
10Functions that youve seen before
- A set S over universe U can be viewed as a
function from the elements of U to -
11Still More Functions
- A set S over universe U can be viewed as a
function from the elements of U to - T, F, saying for each element of U
whether it is in S. (This is called the
characteristic function of S) - Suppose U0,1,2,3,4. Then
- S1,3? S(0)S(2)S(4)F, S(1)S(3)T.
12Still More Functions
- A set operator, such as ? or ?, can be viewed as
a function from to
13Still More Functions
- A set operator such as ? or ? can be viewed as a
function from (ordered) pairs of sets, to
sets. - Example ?((1,3,3,4)) 3
14A new notation
- YX is the set F of all possible functions f X?Y.
- Thus, f ? YX is another way of saying f X?Y.
- (This notation is especially appropriate, because
for finite X, Y, we have F YX. )
15Some Function Terminology
- If fA?B, and f(a)b (where a?A b?B), then we
say - A is the domain of f.
- B is the codomain of f.
- b is the image of a under f.
- a is a pre-image of b under f.
- In general, b may have more than 1 pre-image.
- The range R?B of f is Rb ?a f(a)b .
We also saythe signatureof f is A?B.
16Range versus Codomain
- The range of a function may not be its whole
codomain. - The codomain is the set that the function is
declared to map all domain values into. - The range is the particular set of values in the
codomain that the function actually maps elements
of the domain to.
17Choosing the right (co)domain
- Consider the function f such that f (x) 100/x
- Is f a (total) function from Int to R?
- f is a partial function from Int to R
- f is a (total) function from Int-0 to R
- Consider the function g such that g(x) vx
- Is g a (total) function from R to R?
- g is a total function from R to RxR
- e.g. g(4) (2,-2)
18Images of Sets under Functions
- Given fA?B, and S?A,
- The image of S under f is the set of all images
(under f) of the elements of S. f(S) ? f(s)
s?S ? b ?s?S f(s)b. - The range of f equalsthe image (under f) of ...
19Images of Sets under Functions
- Given fA?B, and S?A,
- The image of S under f is the set of all images
(under f) of the elements of S. f(S) ? f(s)
s?S ? b ?s?S f(s)b. - The range of f equalsthe image (under f) of fs
domain.
20One-to-One Functions
- A function is one-to-one (1-1), or injective, or
an injection, iff every element of its range has
only 1 pre-image. - Formally given fA?B,f is injective ?
(??x,y x?y ? f(x)?f(y)). - In other words only one element of the domain is
mapped to any given one element of the range. - In this case, domain range have same
cardinality. What about codomain?
21 22One-to-One Illustration
- Are these relations one-to-one functions?
23One-to-One Illustration
- Are these relations one-to-one functions?
One-to-one
24One-to-One Illustration
- Are these relations one-to-one functions?
Not one-to-one
One-to-one
25One-to-One Illustration
- Are these relations one-to-one functions?
Not even a function!
Not one-to-one
One-to-one
26Sufficient Conditions for 1-1ness
- For functions f over numbers, we say
- f is strictly increasing iff xgty ? f(x)gtf(y) for
all x,y in domain - f is strictly decreasing iff xgty ? f(x)ltf(y) for
all x,y in domain - If f is either strictly increasing or strictly
decreasing, then f must be one-to-one. - Does the converse hold?
27Onto (Surjective) Functions
- A function fA?B is onto or surjective or a
surjection iff its range is equal to its codomain
(?b?B, ?a?A f(a)b). - Consider country of birth of A?B,where
Apeople, Bcountries. Is this a function? Is
it an injection? Is it a surjection?
28Onto (Surjective) Functions
- A function fA?B is onto or surjective or a
surjection iff its range is equal to its codomain
- Consider country of birth of A?B,where
Apeople, Bcountries. Is this a function? Yes
(always 1 c.o.b.) Is it an injection? No (many
have same c.o.b.) Is it a surjection? Probably
yes ..
29Onto (Surjective) Functions
- A function fA?B is onto or surjective or a
surjection iff its range is equal to its codomain - In predicate logic
30Onto (Surjective) Functions
- A function fA?B is onto or surjective or a
surjection iff its range is equal to its
codomain. - In predicate logic
- ?b?B?a?A f(a)b
31Onto (Surjective) Functions
- A function fA?B is onto or surjective or a
surjection iff its range is equal to its codomain
(?b?B?a?A f(a)b). - E.g., for domain codomain Z, the function
?x.x1 is injective and surjective.
32- Claim if fZ?Z and f(x) x1 then
- f is 1-to-1 and also onto.
- (Z is the set
of all integers) - Proof that f is onto Consider any arbitrary
element a of Z. We have f(a-1)a, where a ? Z. - Proof that f is 1-to-1 Suppose f(u)f(w)a. In
other words, u1a and w1a. It follows that uw.
33Onto/surjective functions
- Are these functions onto their depicted
co-domains?
34Onto/surjective functions
- Are these functions onto?
35Onto/surjective functions
- Are these functions onto?
onto
not onto
onto
not onto
361-1/injective functions
onto
not onto
onto
not onto
371-1/injective functions
not 1-1onto
not 1-1not onto
1-1onto
1-1not onto
38Bijections
- A function is said to be a one-to-one
correspondence, or a bijection iff it is both
one-to-one and onto.
39Two terminologies for talking about functions
- injection one-to-one
- surjection onto
- bijection one-to-one correspondence
- 3 12
40Bijections
- For bijections fA?B, there exists a function
that is the inverse of f, written f ?1 B?A - Intuitively, this is the function that undoes
everything that f does - Formally, its the unique function such that
- ...
41Bijections
- For bijections fA?B, there exists an inverse of
f, written f ?1 B?A - Intuitively, this is the function that undoes
everything that f does - Formally, its the unique function such that
-
- (the identity function on A)
42Bijections
- Example 1 Let f Z?Z be defined as f(x) x1.
What is f?1 ? - Example 2 Let g Z?N be defined as g(x) x.
What is g?1 ?
43Bijections
- Example 1 Let f Z?Z be defined as f(x)x1.
What is f?1 ? - f?1 is the function (lets call it h) h Z?Z
defined as h(x)x-1. - Proof
h(f(x)) (x1)-1 x
44Bijections
- Example 2 Let g Z?N be defined as g(x)x.
What is g?1 ? - This was a trick question there is no such
function, since g is not a bijectionThere is no
function h such that h(x)x and h(x)?x - (NB There is a relation h for which this is
true.)
45Cardinality (informal)
- The cardinality of a finite set is its number of
elements - E.g., card(a,b,c) card(e,f,g) 3
- Note for finite sets X and Y, card(X)card(Y)
if and only if there exists a bijection between X
and Y
46infinity
- This is straightforward if a set has 0 or 1 or 2
or n (any natural number) elements - But what if the set has more elements than that?
Some examples - The set of all natural numbers itself
- The set of all even natural numbers
- L(1) 1, 11,111,1111,11111, etc.
- L(01) 01,001,011,0001,0011, etc
47The Diagonalisation Method
- Georg Cantor (1873) Whats the size of an
infinite set? - E.g., is card(L(1)) card(L(01))?
- Both are infinite
- But is one larger than the other?
- Cantors idea
- The size (cardinality) of a set should not depend
on the identity of its elements - Two finite sets A and B have the same size if we
can pair the elements of A with elements of B - Formally there exists a bijection between A and B
48Correspondences (Contd)
- Example Let
- N be the set of pos. natural numbers 1, 2, 3,
- E the set of even pos. natural numbers 2, 4, 6,
- Using Cantors definition of size, we can show
that N and E have the same size - Bijection (!) f (n) 2n
- Intuitively, E is smaller than N, but
- Pairing each element of N with its corresponding
element in E is possible, - So we declare these two set to be the same size
- This even though E ? N (E is a real subset of
N )
49Countable sets
- A set X is finite if it has n elements, for some
n in N. - A set is countable if either
- It is finite or
- It has the same size as N, the natural numbers
- For example,
- N is countable, and so are all its subsets
- E is countable
- 0,1,2,3 is countable
- ? is countable
- How about supersets of N ?
50An Even Stranger Example
- Let Q be the set of positive rational numbers
- Q m/n m,n ? N
- Just like E, the set Q has the same size as N !
- We show this giving a bijection from Q to N
- Q is thus countable
- One way is to enumerate (i.e., to list) Qs
elements. - Pair the first element of Q with 1 (first elt. of
N ) - And so on, making sure every member of Qappears
only once in the list
51An Even Stranger Example (Contd)
- To build a list with the elements of Q
- make inf. matrix with all positive rational
numbers - i -th row contains all numbers with numerator i
- j -th column has all numbers with denominator j
- i /j is in i -th row and j -th column
52An Even Stranger Example (Contd)
- Now we turn the previous matrix into a list
- A bad way begin list with first row
- Since rows are infinite, we will never get to 2nd
row!
53An Even Stranger Example (Contd)
- Instead, we list the elements along diagonals
We should, however, eliminate repeated elements
54An Even Stranger Example (Contd)
- We list elements along diagonals w/o repetitions
?1/1, 2/1, 1/2, 3/1, 1/3, ?
55Uncountable sets
- Some sets have no correspondence with N
- These sets are simply too big!
- They are not countable we say uncountable
- Theorem
- The set of real numbers between 0 and 1(e.g.,
0.244, 0.3141592323....) is uncountableCall this
set R0,1 - (Some sets are even larger. Serious set
theory is all about theorems that concern
infinite sets. Most of this is irrelevant for
this course.)
56- Theorem R0,1 gt N. Proof strategy
- R0,1 gtN. Suppose R0,1 N and derive a
contradiction Each member of R0,1 can be written
as a zero followed by a dot and a countable
sequence of digits. Suppose there existed a
complete enumeration of R, (using whatever order)
lte1,e2,e3,...gt.
57- showing how an arbitrary list might start
- e1. 0.0000000000000000000000....
- e2. 0.0100000000000000000000....
- e3. 0.8200000000000000000000....
- e4. 0.1710000000000000000000....
- ...
-
58Now construct a Real number n thats not in the
enumeration
- ns first digit (after the dot) e1s first
digit 1 - ns second digit e2s second digit 1 ...
- General ns i-th difit e-is i-th digit 1
- ?i n differs from e-i in its i-th digit
- Contradiction lte1,e2,e3,...gt is not a (complete)
enumeration after all. QED
59- This proof of the non-countability of the set of
Real numbers is known as Cantors diagonalisation
argument - It proved to be the start of a large new area of
set theory, involving the cardinalities of
infinite sets
60The Russell Paradox
- For example, read Rosen 5th ed., 1.6especially
ex. 30 on p. 86
61Basic Set Notations
- Set enumeration a, b, c
- and set-builder xP(x).
- ? relation, and the empty set ?.
- Set relations , ?, ?, ?, ?, ?, etc.
- Venn diagrams.
- Cardinality S and infinite sets N, Z, R.
- Power sets P(S).
62Axiomatic set theory
- Various axioms, e.g., saying that the union of a
set of sets is a set the intersection of a set
of sets is a set etc. - One key axiom Given a Predicate P, one can
construct a set. It consists of all those
elements x such that P(x) is true. - But, the resulting theory turns out to be
logically inconsistent! - This means, there exists set theory proposition p
such that both p and ?p follow logically from
the axioms of the theory! - ? The conjunction of the axioms is a
contradiction - This makes the theory is fundamentally
uninteresting, because any possible statement in
it can be (very trivially) proven!
63Prove
- Theorem Given a contradiction, any statement can
be proven
64Prove
- Theorem Given a contradiction, any statement can
be proven - Proof Let your contradiction be p ?p
(the assumption is youve proven it before) - Suppose you want to prove q
- (p ?p) --gt q is a tautology of propositional
logic(Check truth table of the formula, given p
?p is false) - Youve proven p ?p
- q follows with Modus Ponens. Note that q is
arbitrary!
65This version of Set Theory is inconsistent
- Russells paradox
- Consider the set that corresponds with the
predicate x ? x - S x x?x .
-
- Now ask is S?S?
66Russells paradox
- Let S x x?x . Is S?S?
- If S?S, then S is one of those x for which x?x.
In other words, S?SWith Proof by Contradiction,
we have S?S - If S?S, then S is not one of those x for which
x?x. In other words, S?SWith Proof by
Contradiction, we have S?S - We conclude that both S?S nor S?S
- Paradox!
67- To avoid inconsistency, set theory had to somehow
change
Bertrand Russell1872-1970
68One technique to avoid the problem
- Given a set S and a predicate P, construct a new
set, consisting of those elements x of S such
that P(x) is true. - Youll seen this technique in use when we get to
the programming language Haskell, where we can
write - x x ? 1.. , even x, but not x even x.
69Another technique to avoid the problem
- Russells paradox arises from the fact that we
can write funny things like x?x (or x?x, for
that matter). One solutionforbid such
expressions using types. - Youll seen this technique in use as well
Haskells use of typing.
70Our focus computability
- We shall not worry about saving set theory from
paradoxes like Russells - Instead, we shall use the Russell paradox in a
different setting - But first we need to talk about Formal Languages,
Haskell, and Turing Machines
71(No Transcript)