Main derivation
S01 · definition
Before
n!
After
F(0)=1,\ \ F(n+1)=(n+1)F(n)\ \ (n\in\mathbb{N})Conditions: 0\in\mathbb{N}
Rule: mko_factorial_def · Uses: G1, G2, mko_factorial_def
Leaf basis: mko_factorial_def + def_unfold
By the MKO, n! means F(n), and F is fixed by two equations only: the start F(0)=1, and 'next value = the new factor n+1 times the previous value'. From here on the guide uses only these two equations and no formula remembered in advance.
S02 · definition
Before
G:\mathbb{N}\to\mathbb{N},\ G(0)=1,\ G(n+1)=(n+1)G(n)After
Q(n):\ G(n)=F(n)
Conditions: none
Rule: def_intro · Uses: S01
Leaf basis: def_intro
To prove uniqueness, take an arbitrary function G:ℕ→ℕ assumed only to satisfy the same two equations. For each n, name the statement 'G(n)=F(n)' as Q(n); the aim is Q(n) for every n.
S03 · induction_base
Before
G(0),\ F(0)
After
G(0)=1=F(0)
Conditions: none
Rule: eq_refl_symm_trans · Uses: S01, S02
Leaf basis: eq_refl_symm_trans
Base case: G(0)=1 by the assumption on G and F(0)=1 by definition, so symmetry and transitivity of equality give G(0)=F(0), that is Q(0).
S04 · induction_step
Before
G(n)=F(n)
After
G(n+1)=F(n+1)
Conditions: n\in\mathbb{N}\ \text{arbitrary}
Rule: eq_replace · Uses: S01, S02
Leaf basis: eq_replace + eq_refl_symm_trans + forall_elim
Suppose G(n)=F(n) for some n. Then G(n+1)=(n+1)G(n) by the recursion for G, =(n+1)F(n) by replacing equals using the induction hypothesis, =F(n+1) by the recursion for F. So Q(n)⇒Q(n+1).
S05 · implies
Before
Q(0),\ \ Q(n)\Rightarrow Q(n+1)
After
G=F\ \text{for every such}\ GConditions: n_0=0
Rule: nat_induction · Uses: S03, S04, nat_induction, function_def
Leaf basis: nat_induction + function_def + forall_intro
By induction from n₀=0, G(n)=F(n) for every n∈ℕ. G and F both have domain ℕ and codomain ℕ and agree at every point, so G=F by function_def. Since G was arbitrary, generalization shows that at most one function satisfies the two equations. This is the content of 'uniquely' in the MKO.
S06 · definition
Before
P(n)=\prod_{k=1}^{n} kAfter
P:\mathbb{N}\to\mathbb{N}Conditions: none
Rule: prod_def · Uses: prod_def, nat_closure
Leaf basis: prod_def + nat_closure + nat_induction
With a_k=k, let P(n)=∏_{k=1}^{n} k. Each P(n) is a natural number: P(0)=1∈ℕ, and if P(n)∈ℕ then P(n+1)=P(n)·(n+1)∈ℕ by nat_closure, so by induction this holds for every n. Hence P is a function ℕ→ℕ.
S07 · equivalent
Before
P(0)=\prod_{k=1}^{0} kAfter
P(0)=1
Conditions: none
Rule: prod_def · Uses: S06
Leaf basis: prod_def + def_unfold
A product with no factors is 1 (the empty product), the first clause of prod_def; so P starts with the same value as F(0)=1.
S08 · equivalent
Before
P(n+1)=P(n)\cdot(n+1)
After
P(n+1)=(n+1)P(n)
Conditions: none
Rule: mul_comm · Uses: S06
Leaf basis: prod_def + mul_comm
The second clause of prod_def gives P(n+1)=P(n)·(n+1); commutativity of multiplication rewrites this as (n+1)P(n), exactly the form of the recursion for F.
S09 · theorem_application
Before
P(0)=1,\ \ P(n+1)=(n+1)P(n)
After
F(n)=\prod_{k=1}^{n} k\ \text{for every}\ n\in\mathbb{N}Conditions: P:\mathbb{N}\to\mathbb{N}
Rule: forall_elim · Uses: S05, S06, S07, S08
Leaf basis: forall_elim + function_def + def_unfold
P is a function ℕ→ℕ (S06) satisfying both equations of F (S07, S08). S05 holds for every such function, so taking G=P gives P=F, that is n!=∏_{k=1}^{n} k. For n>0 this is the product of all integers from 1 to n, for example 5!=1·2·3·4·5.
S10 · theorem_application
Before
F(n)
After
F(n)\geq 1\ \text{for every}\ n\in\mathbb{N};\ \text{in particular}\ 0!=1\neq 0Conditions: none
Rule: L_pos · Uses: S01, L_pos
Leaf basis: nat_induction + order_basics
By Lemma L_pos every factorial is at least 1, so no n! equals 0; in particular 0!=1. The lemma is proved by induction in sub-steps S10.1 and S10.2.
S11 · implies
Before
F(0)=1
After
F(1)=1,\ F(2)=2,\ F(3)=6
Conditions: none
Rule: forall_elim · Uses: S01
Leaf basis: forall_elim + eq_replace + numeric_evaluation
Substitute into the recursion one step at a time: n=0 gives F(1)=1·F(0)=1; n=1 gives F(2)=2·F(1)=2; n=2 gives F(3)=3·F(2)=6. Each step multiplies by the new factor n+1, not by n.
S12 · implies
Before
F(3)=6
After
F(4)=24,\ F(5)=120
Conditions: none
Rule: forall_elim · Uses: S01, S11
Leaf basis: forall_elim + eq_replace + numeric_evaluation
Continue: n=3 gives F(4)=4·F(3)=4·6=24, and n=4 gives F(5)=5·F(4)=5·24=120. So 5!=120.
S13 · implies
Before
\prod_{k=1}^{5} kAfter
1\cdot 2\cdot 3\cdot 4\cdot 5=120=F(5)
Conditions: none
Rule: prod_def · Uses: S09, S12
Leaf basis: prod_def + numeric_evaluation
Cross-check: unfolding prod_def gives ∏_{k=1}^{5} k=1·2·3·4·5=120, which agrees with F(5)=120 from the recursion in S12, as S09 predicts.
S14 · implies
Before
S05,\ S09,\ S10,\ S12
After
\text{goals (1) to (4) established}Conditions: none
Rule: and_intro_elim · Uses: S05, S09, S10, S12
Leaf basis: and_intro_elim
The four goals are established by S05 (uniqueness), S09 (product form), S10 (F(n)≥1 and 0!=1) and S12 (5!=120).
Error controls and negative controls
0! is 1, not 0
The MKO notes the common mistake of taking 0! to be 0. F(0)=1 is part of the definition. If the start were changed to H(0)=0 while keeping H(n+1)=(n+1)H(n), induction would give H(n)=0 for every n (H(n+1)=(n+1)·0=0): the whole function collapses to 0 and 5! would be 0 instead of 120. The convention that the empty product is 1 (S07) agrees with F(0)=1.
n! is not 'n times'
The MKO also notes the mistake of reading n! as 'n times'. Each step of the recursion multiplies by the new factor n+1, so n! accumulates every factor from 1 to n: 3!=6, not 3, and 5!=120, not 5 and not 5·5=25. A related off-by-one error writes H(n+1)=n·H(n); then H(1)=0·H(0)=0 and every later value is 0.
Use exact integers, not floating-point approximations
The MKO warns against passing off floating-point values outside the safe range as exact results. 23!=25852016738884976640000=2¹⁹·49308808782358125, whose odd part exceeds 2⁵³=9007199254740992. IEEE 754 binary64 has a 53-bit significand, and a positive integer within the exponent range is exactly representable if and only if its odd part is below 2⁵³, so binary64 cannot represent 23! exactly. Every computation in this guide uses exact integer multiplication.
- 0!=0 →
reject — The definition gives F(0)=1, and S10 proves F(n)≥1 for every n. - Writing the recursion as H(n+1)=n·H(n) with H(0)=1 defines the same factorial →
reject — H(1)=0·1=0, whereas F(1)=1. - Checking F(n)=∏_{k=1}^{n} k for n=0 to 5 proves it for every n →
reject — A finite check covers only those n; the general statement comes from the uniqueness of S05 (induction). - The value of 23! computed in binary64 floating point is exact →
reject — The odd part of 23! exceeds 2⁵³, so binary64 cannot represent it exactly.