SlideShare a Scribd company logo
Introduction to set theory and to methodology and philosophy of
mathematics and computer programming
Defining and visualizing functions
An overview
by Jan Plaza
c 2017 Jan Plaza
Use under the Creative Commons Attribution 4.0 International License
Version of November 4, 2017
Existence and uniqueness
How to express in first-order logic “there exists unique y s.t. A(y)”
without using the abbreviation ∃!y A(y) ?
Existence and uniqueness
How to express in first-order logic “there exists unique y s.t. A(y)”
without using the abbreviation ∃!y A(y) ?
Existence: ∃y A(y).
Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2).
Existence and uniqueness; Functions
How to express in first-order logic “there exists unique y s.t. A(y)”
without using the abbreviation ∃!y A(y) ?
Existence: ∃y A(y).
Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2).
Definition
A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2),
or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)).
Existence and uniqueness; Functions
How to express in first-order logic “there exists unique y s.t. A(y)”
without using the abbreviation ∃!y A(y) ?
Existence: ∃y A(y).
Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2).
Definition
A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2),
or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)).
This means: if there is y s.t. xfy then such a y is unique.
Existence and uniqueness; Functions
How to express in first-order logic “there exists unique y s.t. A(y)”
without using the abbreviation ∃!y A(y) ?
Existence: ∃y A(y).
Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2).
Definition
A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2),
or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)).
This means: if there is y s.t. xfy then such a y is unique.
Definition. Let f be a function.
1. Let x ∈ domain(f). The value of f at x , f(x) , is the unique y such that xfy.
2. f maps x to y , denoted f : x → y or x
f
→ y , if xfy.
x
Is this a function?
x
Is this a function? Yes.
x
Is this a function?
x
Is this a function? Yes.
x
Is this a function?
x
Is this a function? No. More than one value of y is paired with the same value of x.
Are these functions?
x x
Are these functions?
x
No.
x
Yes.
Are these functions?
{ −1, 1 , 0, 0 , 1, 1 },
i.e.
x y
−1 1
0 0
1 1
{ 1, 0 , 0, 1 , 1, 2 },
i.e.
x y
1 0
0 1
1 2
Are these functions?
{ −1, 1 , 0, 0 , 1, 1 },
i.e.
x y
−1 1
0 0
1 1
Yes.
{ 1, 0 , 0, 1 , 1, 2 },
i.e.
x y
1 0
0 1
1 2
No.
Are these functions?
-1
0
1
-1 0 1
x
0
1
2
0 1
x
Are these functions?
-1
0
1
-1 0 1
x
Yes.
0
1
2
0 1
x
No.
Are these functions?
-1
0
1
0
1
0
1
0
1
2
Are these functions?
-1
0
1
0
1
Yes.
0
1
0
1
2
No.
Are these functions?
0
-1 1
0
1 2
Are these functions?
0
-1 1
Yes.
0
1 2
No.
Terminology: total/partial, on
Definition. Let f be a function.
f is on X or f is a (total) function on X if domain(f) = X.
Definition. f is a partial function on X if there is X ⊆X s.t. f is a function onX .
Fact. If f is a partial function on X, then f is a total function on domain(f).
If f is a function and X ⊇ domain(f), then f is a partial function on X.
Fact. Consider these conditions:
1. f is a binary relation,
2. domain(f) ⊆ X,
3. for every x ∈ X, f maps x to at most one value,
4. for every x ∈ X, f maps x to least one value.
Then:
f is a function on X iff f satisfies conditions 1-4;
f is a partial function on X iff f satisfies conditions 1-3.
Vertical line tests on the Cartesian plane are the following.
Let G be a subset of the Cartesian plane.
G is the graph of a function from R to R
iff every straight line parallel to the y axis intersects G in exactly one point.
G is the graph of a partial function from R to R
iff every straight line parallel to the y axis intersects G in at most one point.
Vertical line tests in discrete Cartesian diagrams are the following.
Let G be a subset of X × Y in a discrete Cartesian diagram.
G is the graph of a function from X to Y
iff every column in the diagram contains exactly one point of G.
G is the graph of a partial function from X to Y
iff every column in the diagram contains at most one point of G.
Terminology: from, to
Definition. Let f be a function.
1. f is to/into Y if range(f) ⊆ Y .
2. f is (a total function) from X to Y , denoted f : X −→ Y or X
f
−→ Y ,
if domain(f)=X and range(f) ⊆ Y .
Definition
f is a partial function from X to Y , denoted f : X −→ Y or X
f
−→ Y ,
if there exists X ⊆ X such that f : X −→ Y .
f : X −→ Y f : X −→ Y
domain(f) ⊆ X domain(f) = X
range(f) ⊆ Y range(f) ⊆ Y
Our definitions imply that the term “to/into Y ” applies to partial functions as well:
for any partial function f, f is to/into Y iff range(f) ⊆ Y .
Exercise
Is this a function on R?
Exercise
Is this a function on R? No.
Exercise
Is this a function on R? No.
Is this a partial function on R?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R? Yes.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R? Yes.
Is it correct to say f : R −→ R?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R? Yes.
Is it correct to say f : R −→ R? Yes.
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R? Yes.
Is it correct to say f : R −→ R? Yes.
Is it correct to say f : R − {0} −→ R?
Exercise
Is this a function on R? No.
Is this a partial function on R? Yes.
What is the domain of this function? R − {0}.
Is this a function on R − {0}? Yes.
Is it correct to say f : R −→ R? No.
Is it correct to say f : R − {0} −→ R? Yes.
Is it correct to say f : R −→ R? Yes.
Is it correct to say f : R − {0} −→ R? Yes.
Example
1. Let f ={ 0, −1 , 1, 0 , 2, 3 }.
f is a function from {0, 1, 2} to Z.
f is also a function from {0, 1, 2} to {−1, 0, 3}.
2. Alternatively we could specify it as:
a function f on {0, 1, 2} s.t. f(0)=−1, f(1)=0, f(2)=3.
3. Alternatively we could specify it as:
a function f on {0, 1, 2} s.t. f : 0 → −1, f : 1 → 0, f : 2 → 3.
4. Alternatively we could specify it as:
a function f on {0, 1, 2} s.t. f(x)=x2 − 1.
5. Let g be a function on {0, 1, 2, 3} s.t. g(x)=x2 − 1.
Although g and f are defined by the same formula,
they are different functions
because they have different domains.
Example
1. Expression y =
√
1 − x2 does not define a function on R,
but it defines a function on [−1, 1].
2. Expression y = ±
√
1 − x2 specifies coordinates of points of a unit circle,
however it does not define a function on [−1, 1].
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R?
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R?
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R?
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R? Yes.
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R? Yes.
4. Does this formula define a function from {u ∈ R : u 0} to Q?
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R? Yes.
4. Does this formula define a function from {u ∈ R : u 0} to Q? No.
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R? Yes.
4. Does this formula define a function from {u ∈ R : u 0} to Q? No.
5. Does this formula define a function from {u ∈ R : u 0} to {u ∈ R : u 0}?
Exercise
Consider the formula y =
√
x.
(Recall that for x = 9 we have just y = 3,
because the definition of square root requires it to be non-negative.)
1. Does this formula define a function from R to R? No.
2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
3. Does this formula define a partial function from R to R? Yes.
4. Does this formula define a function from {u ∈ R : u 0} to Q? No.
5. Does this formula define a function from {u ∈ R : u 0} to {u ∈ R : u 0}?
Yes.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
2. Let R1, R2 be binary relations.
If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
2. Let R1, R2 be binary relations.
If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
2. Let R1, R2 be binary relations.
If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No.
3. Let f1, f2 be partial functions on the same set X.
If f1 ⊆ f2, then f1 = f2.
Exercise
Are the following statements correct?
1. Let f1, f2 be functions.
If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
2. Let R1, R2 be binary relations.
If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No.
3. Let f1, f2 be partial functions on the same set X.
If f1 ⊆ f2, then f1 = f2. No.
Whenever the answer is negative, provide a counter-example.
Note
1. An attempt to define f : Q −→ Z:
f(m
n ) = m + n, where m, n ∈ Z.
This is not correct, because
1
2 = 2
4 but f(1
2) = 1 + 2 = 3=6 = 2 + 4 = f(2
4)
violating ∀x,y1,y2 (xfy1 ∧ xfy2 → y1 =y2).
2. An attempt to define g : Q −→ Z:
let g(0)=1 and
let g(m
n ) = m + n where m, n ∈ Z, m=0, n > 0,
and m and n do not have a common divisor greater than 1.
This is correct.
(We have used a canonical form of rational numbers.)
3. Every rational number has many representations (1
2 = 2
4 = ...).
To be correct, the definition must be
independent of the representation .
Exercise
Let Q+ be the set of all positive rational numbers.
Are these attempts to define a function correct?
1. f : Q −→ Q s.t. f(m
n ) = n
m where m, n ∈ Z.
Exercise
Let Q+ be the set of all positive rational numbers.
Are these attempts to define a function correct?
1. f : Q −→ Q s.t. f(m
n ) = n
m where m, n ∈ Z. No.
Exercise
Let Q+ be the set of all positive rational numbers.
Are these attempts to define a function correct?
1. f : Q −→ Q s.t. f(m
n ) = n
m where m, n ∈ Z. No.
2. f : Q+ −→ Q+ s.t. f(m
n ) = n
m where m, n ∈ Z.
Exercise
Let Q+ be the set of all positive rational numbers.
Are these attempts to define a function correct?
1. f : Q −→ Q s.t. f(m
n ) = n
m where m, n ∈ Z. No.
2. f : Q+ −→ Q+ s.t. f(m
n ) = n
m where m, n ∈ Z. Yes.
Show this by proving:
if m1, n1, m2, n2 ∈ Z and m1
n1
, m2
n2
∈ Q+ and m1
n1
= m2
n2
then n1
m1
= n2
m2
.
Note. An attempt to to model the concept “mother of”:
1. Persons is a non-empty set,
2. Persons is a finite set,
3. motherOf : Persons −→ Persons
(i.e. every person has a unique mother, who is a person),
4. motherOf is a function such that for every p in its domain:
p=motherOf(p),
p=motherOf(motherOf(p)),
p=motherOf(motherOf(motherOf(p))),
etc. (i.e. there are no cycles).
These conditions are contradictory.
(The same problem occurs with theSupervisorOf in employee databases.)
To see why, try drawing directed graphs
showing a function motherOf on a three-element set Persons.

More Related Content

PDF
5.1 Defining and visualizing functions. A handout.
PDF
4.4 Set operations on relations
PDF
5.2. Function composition
PDF
1.8 Separation schema
PDF
4.5 Inverse relation
PPT
4.1 derivatives as rates linear motions
PPTX
2.5 computations of derivatives
PDF
03 convexfunctions
5.1 Defining and visualizing functions. A handout.
4.4 Set operations on relations
5.2. Function composition
1.8 Separation schema
4.5 Inverse relation
4.1 derivatives as rates linear motions
2.5 computations of derivatives
03 convexfunctions

What's hot (20)

PPTX
Analytic function
PPTX
4.3 related rates
PPTX
1.3 review on trig functions
PPTX
4.2 more derivatives as rates
PDF
Langrange Interpolation Polynomials
PPTX
3.6 applications in optimization
PPTX
2.3 continuity
PPTX
9 the basic language of functions x
PPTX
4.5 continuous functions and differentiable functions
PPTX
10 rectangular coordinate system x
PPTX
2.2 limits ii
PDF
5.5 Injective and surjective functions. Dynamic slides.
PPTX
Implicit function and Total derivative
PPTX
14 graphs of factorable rational functions x
PDF
2.1 Union, intersection and complement
PPTX
2.4 defintion of derivative
PPTX
Limit and continuity (2)
PPTX
Partial Derivatives
PPTX
11 graphs of first degree functions x
PPTX
application of partial differentiation
Analytic function
4.3 related rates
1.3 review on trig functions
4.2 more derivatives as rates
Langrange Interpolation Polynomials
3.6 applications in optimization
2.3 continuity
9 the basic language of functions x
4.5 continuous functions and differentiable functions
10 rectangular coordinate system x
2.2 limits ii
5.5 Injective and surjective functions. Dynamic slides.
Implicit function and Total derivative
14 graphs of factorable rational functions x
2.1 Union, intersection and complement
2.4 defintion of derivative
Limit and continuity (2)
Partial Derivatives
11 graphs of first degree functions x
application of partial differentiation
Ad

Similar to 5.1 Defining and visualizing functions. Dynamic slides. (20)

PDF
5.6 Function inverse. A handout.
PPTX
Functions
PPT
Calc 5.3
PDF
5.6 Function inverse. Dynamic slides.
PPT
PPTX
Complex analysis
PDF
4.1 Inverse Functions
PPTX
Domain-and-Range-of-a-Function
PPS
Functions and graphs
PDF
Inverse function
PPTX
Relations & functions
PPTX
CMSC 56 | Lecture 9: Functions Representations
PDF
4.1 Inverse Functions
DOCX
237654933 mathematics-t-form-6
PDF
5.5 Injective and surjective functions. A handout.
PPTX
function
PPTX
Inverse.pptx
PDF
Class 12 Mathematics Topic Wise Line by Line Chapter 2 Relations, Functions a...
PDF
5.6 Function inverse. A handout.
Functions
Calc 5.3
5.6 Function inverse. Dynamic slides.
Complex analysis
4.1 Inverse Functions
Domain-and-Range-of-a-Function
Functions and graphs
Inverse function
Relations & functions
CMSC 56 | Lecture 9: Functions Representations
4.1 Inverse Functions
237654933 mathematics-t-form-6
5.5 Injective and surjective functions. A handout.
function
Inverse.pptx
Class 12 Mathematics Topic Wise Line by Line Chapter 2 Relations, Functions a...
Ad

More from Jan Plaza (20)

PDF
6.3 Equivalences versus partitions
PDF
6.1 Partitions
PDF
6.2 Reflexivity, symmetry and transitivity (dynamic slides)
PDF
6.2 Reflexivity, symmetry and transitivity (handout)
PDF
5.8 Permutations (handout)
PDF
5.8 Permutations (dynamic slides)
PDF
5.7 Function powers
PDF
5.3 Basic functions. A handout.
PDF
5.3 Basic functions. Dynamic slides.
PDF
1.4 Abstract objects and expressions
PDF
1.2 Axiom of pair
PDF
1.11 Mathematical induction
PDF
1.7 The sets of numbers
PDF
1.6 Subsets
PDF
1.1 Notions of set and membership
PDF
4.7 Powers of binary relations
PDF
4.6 Relative product and composition
PDF
4.1 Defining and visualizing binary relations
PDF
3.7 Indexed families of sets
PDF
3.6 Families ordered by inclusion
6.3 Equivalences versus partitions
6.1 Partitions
6.2 Reflexivity, symmetry and transitivity (dynamic slides)
6.2 Reflexivity, symmetry and transitivity (handout)
5.8 Permutations (handout)
5.8 Permutations (dynamic slides)
5.7 Function powers
5.3 Basic functions. A handout.
5.3 Basic functions. Dynamic slides.
1.4 Abstract objects and expressions
1.2 Axiom of pair
1.11 Mathematical induction
1.7 The sets of numbers
1.6 Subsets
1.1 Notions of set and membership
4.7 Powers of binary relations
4.6 Relative product and composition
4.1 Defining and visualizing binary relations
3.7 Indexed families of sets
3.6 Families ordered by inclusion

Recently uploaded (20)

PDF
Basic Mud Logging Guide for educational purpose
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Business Ethics Teaching Materials for college
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Classroom Observation Tools for Teachers
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
Basic Mud Logging Guide for educational purpose
VCE English Exam - Section C Student Revision Booklet
Module 4: Burden of Disease Tutorial Slides S2 2025
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
Business Ethics Teaching Materials for college
human mycosis Human fungal infections are called human mycosis..pptx
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study
PPH.pptx obstetrics and gynecology in nursing
Classroom Observation Tools for Teachers
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
2.FourierTransform-ShortQuestionswithAnswers.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
TR - Agricultural Crops Production NC III.pdf

5.1 Defining and visualizing functions. Dynamic slides.

  • 1. Introduction to set theory and to methodology and philosophy of mathematics and computer programming Defining and visualizing functions An overview by Jan Plaza c 2017 Jan Plaza Use under the Creative Commons Attribution 4.0 International License Version of November 4, 2017
  • 2. Existence and uniqueness How to express in first-order logic “there exists unique y s.t. A(y)” without using the abbreviation ∃!y A(y) ?
  • 3. Existence and uniqueness How to express in first-order logic “there exists unique y s.t. A(y)” without using the abbreviation ∃!y A(y) ? Existence: ∃y A(y). Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2).
  • 4. Existence and uniqueness; Functions How to express in first-order logic “there exists unique y s.t. A(y)” without using the abbreviation ∃!y A(y) ? Existence: ∃y A(y). Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2). Definition A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2), or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)).
  • 5. Existence and uniqueness; Functions How to express in first-order logic “there exists unique y s.t. A(y)” without using the abbreviation ∃!y A(y) ? Existence: ∃y A(y). Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2). Definition A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2), or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)). This means: if there is y s.t. xfy then such a y is unique.
  • 6. Existence and uniqueness; Functions How to express in first-order logic “there exists unique y s.t. A(y)” without using the abbreviation ∃!y A(y) ? Existence: ∃y A(y). Uniqueness: ∀y1,y2 (A(y1) ∧ A(y2) → y1 =y2). Definition A function is any binary relation f such that ∀x ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2), or equivalently, ∀x (∃y xfy → ∀y1,y2 (xfy1 ∧ xfy2 → y1 =y2)). This means: if there is y s.t. xfy then such a y is unique. Definition. Let f be a function. 1. Let x ∈ domain(f). The value of f at x , f(x) , is the unique y such that xfy. 2. f maps x to y , denoted f : x → y or x f → y , if xfy.
  • 7. x Is this a function?
  • 8. x Is this a function? Yes.
  • 9. x Is this a function?
  • 10. x Is this a function? Yes.
  • 11. x Is this a function?
  • 12. x Is this a function? No. More than one value of y is paired with the same value of x.
  • 15. Are these functions? { −1, 1 , 0, 0 , 1, 1 }, i.e. x y −1 1 0 0 1 1 { 1, 0 , 0, 1 , 1, 2 }, i.e. x y 1 0 0 1 1 2
  • 16. Are these functions? { −1, 1 , 0, 0 , 1, 1 }, i.e. x y −1 1 0 0 1 1 Yes. { 1, 0 , 0, 1 , 1, 2 }, i.e. x y 1 0 0 1 1 2 No.
  • 17. Are these functions? -1 0 1 -1 0 1 x 0 1 2 0 1 x
  • 18. Are these functions? -1 0 1 -1 0 1 x Yes. 0 1 2 0 1 x No.
  • 22. Are these functions? 0 -1 1 Yes. 0 1 2 No.
  • 23. Terminology: total/partial, on Definition. Let f be a function. f is on X or f is a (total) function on X if domain(f) = X. Definition. f is a partial function on X if there is X ⊆X s.t. f is a function onX . Fact. If f is a partial function on X, then f is a total function on domain(f). If f is a function and X ⊇ domain(f), then f is a partial function on X. Fact. Consider these conditions: 1. f is a binary relation, 2. domain(f) ⊆ X, 3. for every x ∈ X, f maps x to at most one value, 4. for every x ∈ X, f maps x to least one value. Then: f is a function on X iff f satisfies conditions 1-4; f is a partial function on X iff f satisfies conditions 1-3.
  • 24. Vertical line tests on the Cartesian plane are the following. Let G be a subset of the Cartesian plane. G is the graph of a function from R to R iff every straight line parallel to the y axis intersects G in exactly one point. G is the graph of a partial function from R to R iff every straight line parallel to the y axis intersects G in at most one point. Vertical line tests in discrete Cartesian diagrams are the following. Let G be a subset of X × Y in a discrete Cartesian diagram. G is the graph of a function from X to Y iff every column in the diagram contains exactly one point of G. G is the graph of a partial function from X to Y iff every column in the diagram contains at most one point of G.
  • 25. Terminology: from, to Definition. Let f be a function. 1. f is to/into Y if range(f) ⊆ Y . 2. f is (a total function) from X to Y , denoted f : X −→ Y or X f −→ Y , if domain(f)=X and range(f) ⊆ Y . Definition f is a partial function from X to Y , denoted f : X −→ Y or X f −→ Y , if there exists X ⊆ X such that f : X −→ Y . f : X −→ Y f : X −→ Y domain(f) ⊆ X domain(f) = X range(f) ⊆ Y range(f) ⊆ Y Our definitions imply that the term “to/into Y ” applies to partial functions as well: for any partial function f, f is to/into Y iff range(f) ⊆ Y .
  • 26. Exercise Is this a function on R?
  • 27. Exercise Is this a function on R? No.
  • 28. Exercise Is this a function on R? No. Is this a partial function on R?
  • 29. Exercise Is this a function on R? No. Is this a partial function on R? Yes.
  • 30. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function?
  • 31. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}.
  • 32. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}?
  • 33. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes.
  • 34. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R?
  • 35. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No.
  • 36. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R?
  • 37. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R? Yes.
  • 38. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R? Yes. Is it correct to say f : R −→ R?
  • 39. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R? Yes. Is it correct to say f : R −→ R? Yes.
  • 40. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R? Yes. Is it correct to say f : R −→ R? Yes. Is it correct to say f : R − {0} −→ R?
  • 41. Exercise Is this a function on R? No. Is this a partial function on R? Yes. What is the domain of this function? R − {0}. Is this a function on R − {0}? Yes. Is it correct to say f : R −→ R? No. Is it correct to say f : R − {0} −→ R? Yes. Is it correct to say f : R −→ R? Yes. Is it correct to say f : R − {0} −→ R? Yes.
  • 42. Example 1. Let f ={ 0, −1 , 1, 0 , 2, 3 }. f is a function from {0, 1, 2} to Z. f is also a function from {0, 1, 2} to {−1, 0, 3}. 2. Alternatively we could specify it as: a function f on {0, 1, 2} s.t. f(0)=−1, f(1)=0, f(2)=3. 3. Alternatively we could specify it as: a function f on {0, 1, 2} s.t. f : 0 → −1, f : 1 → 0, f : 2 → 3. 4. Alternatively we could specify it as: a function f on {0, 1, 2} s.t. f(x)=x2 − 1. 5. Let g be a function on {0, 1, 2, 3} s.t. g(x)=x2 − 1. Although g and f are defined by the same formula, they are different functions because they have different domains.
  • 43. Example 1. Expression y = √ 1 − x2 does not define a function on R, but it defines a function on [−1, 1]. 2. Expression y = ± √ 1 − x2 specifies coordinates of points of a unit circle, however it does not define a function on [−1, 1].
  • 44. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R?
  • 45. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No.
  • 46. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R?
  • 47. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes.
  • 48. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R?
  • 49. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R? Yes.
  • 50. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R? Yes. 4. Does this formula define a function from {u ∈ R : u 0} to Q?
  • 51. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R? Yes. 4. Does this formula define a function from {u ∈ R : u 0} to Q? No.
  • 52. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R? Yes. 4. Does this formula define a function from {u ∈ R : u 0} to Q? No. 5. Does this formula define a function from {u ∈ R : u 0} to {u ∈ R : u 0}?
  • 53. Exercise Consider the formula y = √ x. (Recall that for x = 9 we have just y = 3, because the definition of square root requires it to be non-negative.) 1. Does this formula define a function from R to R? No. 2. Does this formula define a function from {u ∈ R : u 0} to R? Yes. 3. Does this formula define a partial function from R to R? Yes. 4. Does this formula define a function from {u ∈ R : u 0} to Q? No. 5. Does this formula define a function from {u ∈ R : u 0} to {u ∈ R : u 0}? Yes.
  • 54. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2.
  • 55. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes.
  • 56. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes. 2. Let R1, R2 be binary relations. If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2.
  • 57. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes. 2. Let R1, R2 be binary relations. If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No.
  • 58. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes. 2. Let R1, R2 be binary relations. If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No. 3. Let f1, f2 be partial functions on the same set X. If f1 ⊆ f2, then f1 = f2.
  • 59. Exercise Are the following statements correct? 1. Let f1, f2 be functions. If domain(f1) = domain(f2) and f1 ⊆ f2, then f1 = f2. Yes. 2. Let R1, R2 be binary relations. If domain(R1) = domain(R2) and R1 ⊆ R2, then R1 = R2. No. 3. Let f1, f2 be partial functions on the same set X. If f1 ⊆ f2, then f1 = f2. No. Whenever the answer is negative, provide a counter-example.
  • 60. Note 1. An attempt to define f : Q −→ Z: f(m n ) = m + n, where m, n ∈ Z. This is not correct, because 1 2 = 2 4 but f(1 2) = 1 + 2 = 3=6 = 2 + 4 = f(2 4) violating ∀x,y1,y2 (xfy1 ∧ xfy2 → y1 =y2). 2. An attempt to define g : Q −→ Z: let g(0)=1 and let g(m n ) = m + n where m, n ∈ Z, m=0, n > 0, and m and n do not have a common divisor greater than 1. This is correct. (We have used a canonical form of rational numbers.) 3. Every rational number has many representations (1 2 = 2 4 = ...). To be correct, the definition must be independent of the representation .
  • 61. Exercise Let Q+ be the set of all positive rational numbers. Are these attempts to define a function correct? 1. f : Q −→ Q s.t. f(m n ) = n m where m, n ∈ Z.
  • 62. Exercise Let Q+ be the set of all positive rational numbers. Are these attempts to define a function correct? 1. f : Q −→ Q s.t. f(m n ) = n m where m, n ∈ Z. No.
  • 63. Exercise Let Q+ be the set of all positive rational numbers. Are these attempts to define a function correct? 1. f : Q −→ Q s.t. f(m n ) = n m where m, n ∈ Z. No. 2. f : Q+ −→ Q+ s.t. f(m n ) = n m where m, n ∈ Z.
  • 64. Exercise Let Q+ be the set of all positive rational numbers. Are these attempts to define a function correct? 1. f : Q −→ Q s.t. f(m n ) = n m where m, n ∈ Z. No. 2. f : Q+ −→ Q+ s.t. f(m n ) = n m where m, n ∈ Z. Yes. Show this by proving: if m1, n1, m2, n2 ∈ Z and m1 n1 , m2 n2 ∈ Q+ and m1 n1 = m2 n2 then n1 m1 = n2 m2 .
  • 65. Note. An attempt to to model the concept “mother of”: 1. Persons is a non-empty set, 2. Persons is a finite set, 3. motherOf : Persons −→ Persons (i.e. every person has a unique mother, who is a person), 4. motherOf is a function such that for every p in its domain: p=motherOf(p), p=motherOf(motherOf(p)), p=motherOf(motherOf(motherOf(p))), etc. (i.e. there are no cycles). These conditions are contradictory. (The same problem occurs with theSupervisorOf in employee databases.) To see why, try drawing directed graphs showing a function motherOf on a three-element set Persons.