Main derivation
S01 · definition
Before
\text{rule }x\mapsto x^2After
f:X\to Y,\ X=\{-2,-1,0,1,2\},\ Y=\{0,1,2,3,4,5\},\ f(x)=x^2Conditions: none
Rule: def_intro · Uses: G1, G2
Leaf basis: def_intro + mko_function_def
Declaring f:X→Y supplies three pieces of data: the domain X, the codomain Y, and the rule x↦x². By the MKO, the core of a function is the rule that every allowed input has exactly one output, not a drawn curve; X and Y are explicit sets (assumption a1).
S02 · equivalent
Before
f:X\to Y\ \text{is a function}After
\forall x\in X:\ x^2\in Y\ \land\ \forall y,y'\ (y=x^2\land y'=x^2\Rightarrow y=y')
Conditions: none
Rule: mko_function_def · Uses: S01, mko_function_def
Leaf basis: mko_function_def + function_def + def_unfold
By the MKO's definition, f:X→Y is a function exactly when every input in X has an output in Y (existence) and only one (uniqueness). For the rule x↦x², existence means x²∈Y, and uniqueness means that if y and y′ both equal x², then y=y′.
S03 · implies
Before
(-2)^2,\ (-1)^2,\ 0^2,\ 1^2,\ 2^2
After
4,\ 1,\ 0,\ 1,\ 4
Conditions: none
Rule: numeric_evaluation · Uses: G1, G2
Leaf basis: numeric_evaluation + neg_mul
Square each of the five inputs of X: (−2)²=4, (−1)²=1, 0²=0, 1²=1, 2²=4. The square of a negative number is positive, so −2 and 2 give the same value.
S04 · implies
Before
f(x)\in\{4,1,0,1,4\}After
\forall x\in X:\ f(x)\in Y
Conditions: none
Rule: finite_forall · Uses: S03, G1
Leaf basis: finite_forall + numeric_evaluation
4, 1 and 0 all appear in the list Y={0,1,2,3,4,5}. X is a finite list and all five inputs have been checked, so by finite_forall every input has an output in Y. This is an exhaustive check of all of X, not a sample; for an infinite X a general argument would be needed.
S05 · implies
Before
y=x^2,\ y'=x^2
After
y=y'
Conditions: none
Rule: eq_refl_symm_trans · Uses: S02
Leaf basis: eq_refl_symm_trans + forall_intro
Suppose that for the same x, both y and y′ are outputs of f, that is y=x² and y′=x². By symmetry and transitivity of equality, y=y′. x² is a definite number determined by x, so one input cannot have two different outputs. This argument holds for every x without a case-by-case check.
S06 · implies
Before
\text{existence (S04)},\ \text{uniqueness (S05)}After
f:X\to Y\ \text{is a function}Conditions: none
Rule: mko_function_def · Uses: S02, S04, S05
Leaf basis: mko_function_def + and_intro_elim
Existence (S04) and uniqueness (S05) both hold, so by the equivalence S02, f:X→Y is a function, satisfying assumption a2.
S07 · equivalent
Before
f(X)=\{f(x)\mid x\in X\}After
f(X)=\{0,1,4\}Conditions: none
Rule: image_preimage_def · Uses: S03, S06
Leaf basis: image_preimage_def + finite_forall + set_extensionality
The range (image) is the set of actual outputs f(X)={f(x) ∣ x∈X}. By S03 the outputs are 4, 1, 0, 1, 4 in order; repeated outputs count once in a set, so f(X)={0,1,4}.
S08 · implies
Before
f(X)=\{0,1,4\}\subseteq Y,\ 2\in YAfter
2\notin f(X),\ f(X)\neq Y
Conditions: none
Rule: L_no_root_2 · Uses: S04, S07
Leaf basis: quantifier_negation + finite_forall + set_extensionality + injective_surjective_def
f(X)⊆Y (every output is in Y, S04). By Lemma L_no_root_2 (proved in S08.1 and S08.2), no x in X has x²=2, so 2∉f(X); but 2∈Y. Hence f(X)≠Y: the codomain is not the range, and f:X→Y is not surjective. This is the MKO's point that the codomain Y need not equal the actual range. Likewise 3 and 5 are not in f(X).
S09 · equivalent
Before
\Gamma_f=\{(x,f(x))\mid x\in X\}After
\Gamma_f=\{(-2,4),(-1,1),(0,0),(1,1),(2,4)\}\subseteq X\times YConditions: none
Rule: graph_def · Uses: S03, S06
Leaf basis: graph_def + cartesian_product_def + finite_counting_basics + numeric_evaluation
By the definition of the graph, substituting the values of S03 gives five ordered pairs. Γ_f is a subset of X×Y: X×Y has 5·6=30 ordered pairs, and Γ_f takes 5 of them, exactly one per input. Compare the three objects: the codomain Y has 6 numbers, the range f(X) has 3 numbers, and the graph Γ_f has 5 ordered pairs. The first two are subsets of Y, the graph is a subset of X×Y; they are different mathematical objects.
S10 · implies
Before
f(-1)=1,\ f(1)=1
After
f(-1)=f(1),\ -1\neq 1:\ f\ \text{not injective}Conditions: none
Rule: injective_surjective_def · Uses: S03
Leaf basis: injective_surjective_def + numeric_evaluation
f(−1)=1=f(1) but −1≠1, so f is not injective: different inputs may share an output. This does not violate the definition of a function, which requires each input to have a unique output, not each output to come from a single input.
S11 · implies
Before
f_1:X\to\{0,1,4\},\ f_1(x)=x^2After
f_1\ \text{is a surjective function},\ f_1\neq fConditions: none
Rule: function_def · Uses: S03, S05, S08
Leaf basis: function_def + injective_surjective_def + set_extensionality
Declare f₁:X→{0,1,4} with the same rule. S11.1 to S11.3 prove that f₁ is a function, that it is surjective, and that f₁≠f. f₁ and f share the rule, the graph and the range and differ only in the codomain; by function_def the codomain is part of the data of a function.
S12 · implies
Before
y=1:\ \{x\in X\mid x^2=1\}After
\{-1,1\}:\ \text{two candidate outputs}Conditions: none
Rule: mko_function_def · Uses: G3, S03
Leaf basis: mko_function_def + finite_forall + numeric_evaluation
Consider the reverse rule s: for y∈Y, s(y) is the x in X with x²=y. For y=1, both x=−1 and x=1 qualify (S03), and −1≠1: one input has two candidate outputs, uniqueness fails, so s is not a function Y→X. This is directly linked to the failure of injectivity in S10.
S13 · implies
Before
y=2:\ \{x\in X\mid x^2=2\}After
\varnothing:\ \text{no output}Conditions: none
Rule: mko_function_def · Uses: G3, S08
Leaf basis: mko_function_def + quantifier_negation + finite_forall
For y=2, by Lemma L_no_root_2 no x in X has x²=2: this input has no output, so existence fails as well. S12 and S13 each suffice to show that s is not a function Y→X; s commits both errors, 'several outputs' and 'no output'.
S14 · implies
Before
g(2)=2+4
After
g(2)=6\notin Y:\ g\ \text{is not a function }X\to YConditions: none
Rule: mko_function_def · Uses: G1, G3
Leaf basis: mko_function_def + numeric_evaluation
The rule g(x)=x+4 gives 6 at the input 2, and 6∉Y (the largest element of Y is 5), so the input 2 has no output in Y and g is not a function X→Y. Declared as g:X→ℤ, the same rule gives a unique integer x+4 for every x and is a function. Whether a rule is a function depends on the declared codomain, not only on the formula.
S15 · implies
Before
f,\ f_1,\ s,\ g
After
f,f_1\ \text{functions};\ f(X)=\{0,1,4\}\neq Y;\ s,g\ \text{not functions as declared}Conditions: none
Rule: and_intro_elim · Uses: S06, S07, S08, S09, S11, S12, S13, S14
Leaf basis: and_intro_elim
Collect the results: f:X→Y is a function (S06); its range {0,1,4} is not the codomain Y (S07, S08); its graph has 5 ordered pairs (S09); changing the codomain gives a different, surjective function f₁ (S11); s is not a function Y→X (S12, S13); g is not a function X→Y (S14).
Substeps and lemmas
S08.1 · equivalent
Before
\neg\exists x\in X:\ x^2=2
After
\forall x\in X:\ x^2\neq 2
Conditions: none
Rule: quantifier_negation · Uses: image_preimage_def
Leaf basis: quantifier_negation + image_preimage_def
By the definition of image, 2∈f(X) means ∃x∈X, x²=2. By negating the quantifier, 'there is no such x' is equivalent to 'every x∈X has x²≠2'.
S08.2 · implies
Before
x^2\in\{4,1,0,1,4\}\ (x\in X)After
\forall x\in X:\ x^2\neq 2
Conditions: none
Rule: finite_forall · Uses: S03, S08.1
Leaf basis: finite_forall + numeric_evaluation
By S03, the squares of the five inputs of X are 4, 1, 0, 1, 4, and none equals 2. By finite_forall, ∀x∈X, x²≠2; by S08.1, no x in X has x²=2. S08.1 and S08.2 together prove Lemma L_no_root_2.
S11.1 · implies
Before
f_1(x)\in\{4,1,0,1,4\}After
f_1:X\to\{0,1,4\}\ \text{is a function}Conditions: none
Rule: finite_forall · Uses: S03, S05
Leaf basis: finite_forall + mko_function_def
By S03 all five outputs lie in {0,1,4}, so existence holds by finite_forall; uniqueness is as in S05. So f₁ is a function.
S11.2 · implies
Before
0=f_1(0),\ 1=f_1(1),\ 4=f_1(2)
After
f_1\ \text{is surjective}Conditions: none
Rule: injective_surjective_def · Uses: S03, S11.1
Leaf basis: injective_surjective_def + finite_forall + exists_intro
Every element of the codomain {0,1,4} has a preimage: 0=f₁(0), 1=f₁(1), 4=f₁(2). By finite_forall and the definition of surjective, f₁ is surjective.
S11.3 · implies
Before
\text{codomain of }f_1=\{0,1,4\},\ \text{codomain of }f=YAfter
f_1\neq f
Conditions: none
Rule: function_def · Uses: S08, S11.1
Leaf basis: function_def + set_extensionality
2∈Y but 2∉{0,1,4}, so the two codomains differ. By function_def, equal functions need the same domain, codomain and values at every point, so f₁≠f, even though the two agree at every point.
Error controls and negative controls
Codomain, range and graph are three different objects
The MKO names the mistake of treating codomain, range and graph as one object. Here the codomain Y={0,1,2,3,4,5} is part of the declaration; the range f(X)={0,1,4} is the set of actual outputs; the graph Γ_f is the subset of X×Y consisting of 5 ordered pairs (S07 to S09). Changing the codomain changes the function (S11) but not the range or the graph.
A program function is not automatically a total mathematical function
The MKO also warns against equating program functions, with side effects or failure states, with pure total mathematical functions. For example, a program that searches −2, −1, 0, 1, 2 in order and returns the first number whose square is y returns −1 for y=1 (the search order replaces uniqueness) and fails for y=2. The program runs, but it does not turn s into a function Y→X (S12, S13); it is a different object, with an added choice rule and undefined at y=2 and elsewhere.
Uniqueness is per input
A common error is to confuse these two conditions: a function requires each input to have only one output (S05), not each output to come from only one input. f(−1)=f(1) does not stop f from being a function (S10); conversely, s violates the definition because the input y=1 has two outputs (S12).
- The codomain of f is {0,1,4} →
reject — The declared codomain is Y={0,1,2,3,4,5}; {0,1,4} is the range (S07, S08). - f(−1)=f(1), so f is not a function →
reject — A function only needs each input's output to be unique; f is merely not injective (S06, S10). - s(y)='the x in X with x²=y' defines a function Y→X →
reject — y=1 has the two candidates −1 and 1, and y=2 has none (S12, S13). - g(x)=x+4 is a function X→Y →
reject — g(2)=6∉Y (S14). - f and f₁ have the same graph, so f=f₁ →
reject — Their codomains differ (2∈Y but 2∉{0,1,4}), so by function_def they are different (S11.3).