Permutations and combinations: proving P(n,k)=n!/(n−k)! and C(n,k)=n!/(k!(n−k)!) by counting

On this page
  1. Goal and scope
  2. Givens and symbols
  3. Rules and sources
  4. Main derivation
  5. Substeps and lemmas
  6. Reverse audits
  7. Error controls and negative controls
  8. Result and limitations
  9. Verification and source binding

← Guide index · Original MKO

derivation-mko-permutation-combination-01 · production-20261019-adopted-96

Goal and scope

Let X be a set of exactly n distinct objects, with natural numbers n, k and 0≤k≤n, and selection without replacement and without repetition. Prove that the number of ordered selections of k objects from X is P(n,k)=n!/(n−k)!, that the number of unordered selections is C(n,k)=n!/(k!(n−k)!), and that both equal 1 when k=0. Finally compute P(5,3)=60 and C(5,3)=10 for X={a,b,c,d,e} and k=3.

Works only inside the MKO's model: distinct objects, no replacement, no repetition, 0≤k≤n, with permutations distinguishing order and combinations ignoring it. Both formulas are proved by counting disjoint unions of finite sets and by induction on k. Repeated selection, indistinguishable objects, circular arrangements and extra restrictions are not treated (the MKO says they need different counting models); the canonical MKO and its English edition are not changed.

Givens and symbols

  • finite_counting_basics
  • nat_induction
  • frac_rules
  • numeric_evaluation
  • G1 — X is a finite set with exactly n distinct elements; n, k∈ℕ (ℕ contains 0) and 0≤k≤n; selection is without replacement and without repetition (MKO assumption a1).
  • G2 — An ordered selection of k objects is a k-tuple (x_i)_{i=1}^{k} of pairwise distinct elements of X; their set is 𝒫_k(X) and P(n,k)=|𝒫_k(X)|. An unordered selection of k objects is a k-element subset of X; their set is 𝒞_k(X) and C(n,k)=|𝒞_k(X)|. For k=0 the empty tuple and the empty set each count as one selection (MKO assumption a2).
  • G3 — Example: X={a,b,c,d,e} (five distinct letters), k=3.
  • X — a finite set of exactly n distinct objects
  • \mathcal{P}_k(X) — the set of k-tuples of pairwise distinct elements of X (ordered selections)
  • \mathcal{C}_k(X) — the set of k-element subsets of X (unordered selections)
  • P(n,k),\ C(n,k) — the numbers of elements of these two sets
  • \operatorname{set}(t) — the set of entries of the tuple t
  • t^\frown x — the tuple t followed by one more entry x
  • \sigma — the order-forgetting map t↦set(t)
  • m! — factorial: 0!=1, (m+1)!=(m+1)·m!

Rules and sources

  • finite_counting_basics · prerequisite — Finite counting: for disjoint finite sets A, B, |A∪B|=|A|+|B|; |A×B|=|A|·|B|; there is a bijection between finite sets ⇔ they have the same number of elements.
  • nat_induction · prerequisite — Principle of induction: for a family P(n) starting at n₀, if P(n₀) holds and P(n)⇒P(n+1) for every n≥n₀, then P(n) holds for every n≥n₀.
  • frac_rules · prerequisite — Fraction rules (all denominators nonzero): a/c+b/c=(a+b)/c; (a/b)(c/d)=(ac)/(bd); (a/b)/(c/d)=(ad)/(bc) (also needing c≠0); a/b=(ak)/(bk) for k≠0.
  • numeric_evaluation · prerequisite — Exact evaluation of an explicit integer or rational expression; independently recomputable.
  • def_intro · prerequisite — Introducing a definition: a statement, expression or object may be given a name, after which the name and what it stands for are interchangeable.
  • order_basics · prerequisite — Order of the reals: exactly one of u<v, u=v, u>v holds; u<v and v<w give u<w; u<v gives u+w<v+w; u<v and w>0 give uw<vw; u<v and w<0 give uw>vw.
  • set_extensionality · prerequisite — Set equality: A=B if and only if A⊆B and B⊆A, i.e. they have the same elements.
  • set_operations_def · prerequisite — Set operations: x∈A∪B ⇔ x∈A or x∈B; x∈A∩B ⇔ x∈A and x∈B; x∈A∖B ⇔ x∈A and x∉B; in a universe U, Aᶜ=U∖A.
  • subset_def · prerequisite — Subset: A⊆B means every element of A is an element of B, i.e. ∀x (x∈A⇒x∈B).
  • and_intro_elim · prerequisite — Conjunction: from P and Q infer P∧Q; from P∧Q infer P and infer Q.
  • injective_surjective_def · prerequisite — Injective: f(a)=f(a′) ⇒ a=a′. Surjective: every b∈B has some a∈A with f(a)=b. Bijective: both; then there is a unique inverse f⁻¹ with f⁻¹∘f=id_A and f∘f⁻¹=id_B.
  • eq_congruence · prerequisite — Congruence of equality: if u=v, applying the same defined operation f to both sides gives f(u)=f(v). Operating on one side only is not an instance of this rule.
  • eq_replace · prerequisite — Replacement of equals: an expression inside a statement may be replaced by an equal expression without changing whether the statement is true.
  • forall_intro · prerequisite — ∀-introduction (generalization): if a statement is proved for an arbitrary element x, with no extra assumption on x, it holds for every x in the domain.
  • imp_intro · prerequisite — →-introduction (discharging a hypothesis): if Q is derived inside a scope that temporarily assumes P, then P⇒Q follows, and P may no longer be used as known.
  • function_def · prerequisite — Function: f:A→B assigns to each a∈A exactly one f(a)∈B. Two functions are equal ⇔ they have the same domain and codomain and agree at every a.
  • image_preimage_def · prerequisite — Image and preimage: f(S)={f(a) ∣ a∈S}; f⁻¹(T)={a∈A ∣ f(a)∈T}. The preimage notation does not presuppose that f has an inverse.
  • def_unfold · prerequisite — Unfolding a definition: replacing a defined term by its definition (or folding it back) does not change whether a statement is true.
  • forall_elim · prerequisite — ∀-elimination (instantiation): if ∀x∈D, P(x) holds and a∈D, then P(a) holds.
  • mul_inverse_nonzero · prerequisite — Inverse of a nonzero number: in ℚ, ℝ or ℂ, if u≠0 there is 1/u with u·(1/u)=1, and v/u means v·(1/u). 0 has no inverse, so v/0 is undefined.
  • mko_perm_comb · cited — For natural numbers n and k with 0≤k≤n, the number of ordered selections without replacement is P(n,k)=n!/(n−k)!, while the number of unordered selections is C(n,k)=n!/(k!(n−k)!). Both values are 1 when k=0. · mko-permutation-combination
  • mko_factorial_def · cited — The function F:ℕ→ℕ is uniquely determined recursively by F(0)=1 and F(m+1)=(m+1)F(m); its customary notation is m!. · mko-factorial
  • tuple_eq · prerequisite — Finite tuples: two k-tuples are equal exactly when their entries agree in every position; the only 0-tuple is the empty tuple (); for a k-tuple t and an object x, t⌢x is the tuple whose first k entries are those of t and whose entry k+1 is x; every (k+1)-tuple can be written as t⌢x in exactly one way, with t its first k entries and x its last entry.
  • disjoint_union_count · prerequisite — If a finite set is the union of finitely many pairwise disjoint finite sets B_j (j∈J, J finite), its number of elements is Σ_{j∈J}|B_j|; in particular, if every |B_j|=c, it is |J|·c. This is the two-set case of finite_counting_basics iterated by induction on the number of sets.
  • L_fact_pos · lemma — For every natural number m, m!≥1; in particular m!≠0.
  • L_complement_count · lemma — If Y is a finite set and A⊆Y, then |Y∖A|=|Y|−|A|.
  • L_same_size_subset · lemma — If A is a finite set, B⊆A and |B|=|A|, then B=A.

Main derivation

S01 · definition

Before

\text{ordered and unordered selections of }k\text{ objects from }X

After

P(n,k)=|\mathcal{P}_k(X)|,\quad C(n,k)=|\mathcal{C}_k(X)|

Conditions: 0\le k\le n

Rule: def_intro · Uses: G1, G2

Leaf basis: def_intro + mko_perm_comb

Write the two things being counted as sets. Under the MKO's assumptions, an ordered selection is a k-tuple (x_i)_{i=1}^{k} of pairwise distinct elements of X, and a different order is a different selection; an unordered selection is a k-element subset of X and records only which objects were chosen. P(n,k) and C(n,k) are the numbers of elements of these two sets. What is proved below is that these numbers equal the MKO's formulas; the formulas are not taken as definitions.

S02 · implies

Before

m!\ (m\in\mathbb{N})

After

m!\geq 1,\ \text{hence}\ m!\neq 0

Conditions: m\in\mathbb{N}

Rule: L_fact_pos · Uses: mko_factorial_def

Leaf basis: nat_induction + mko_factorial_def + order_basics

Later steps divide by n!, (n−k)! and k!, so first make sure a factorial is never zero. By Lemma L_fact_pos every m! is at least 1; the proof by induction is in S02.1 and S02.2.

S03 · induction_base

Before

\mathcal{P}_0(X)

After

\mathcal{P}_0(X)=\{()\},\quad |\mathcal{P}_0(X)|=1=\frac{n!}{(n-0)!}

Conditions: n!\neq 0

Rule: tuple_eq · Uses: G1, G2, S02, tuple_eq

Leaf basis: tuple_eq + frac_rules + L_fact_pos

The only 0-tuple is the empty tuple (); it has no entries, so pairwise distinctness holds vacuously and 𝒫_0(X)={()} has exactly 1 element. On the other side n!/(n−0)!=n!/n!=1, where the division needs n!≠0 (S02). This is the base of the induction on k, and it is the MKO's statement that the empty permutation counts once.

S04 · implies

Before

\mathcal{P}_{k+1}(X)\quad(k+1\le n)

After

\mathcal{P}_{k+1}(X)=\bigcup_{t\in\mathcal{P}_k(X)}E(t),\quad E(t)=\{t^\frown x\mid x\in X\setminus\operatorname{set}(t)\},\ \text{pairwise disjoint}

Conditions: k+1\le n

Rule: set_extensionality · Uses: G2, tuple_eq

Leaf basis: set_extensionality + tuple_eq + set_operations_def

Fix k with k+1≤n. Sort each ordered selection of k+1 objects by its first k entries: E(t) collects the tuples that begin with t and continue with one object not already in t. Sub-steps S04.1 and S04.2 prove the two inclusions, and S04.3 proves that the classes are disjoint.

S05 · implies

Before

E(t)\quad(t\in\mathcal{P}_k(X))

After

|E(t)|=n-k\geq 1

Conditions: k+1\le n

Rule: L_complement_count · Uses: G1, G2, S04

Leaf basis: L_complement_count + finite_counting_basics + injective_surjective_def

Each class E(t) has exactly n−k elements, whichever tuple t is; this is what makes a product count legitimate (the counting-principle MKO requires the number of options at each stage to be explicit). The proof has three sub-steps: counting a complement (S05.1), set(t) having exactly k elements (S05.2), and x↦t⌢x being a bijection (S05.3). Since k+1≤n, n−k≥1.

S06 · implies

Before

\mathcal{P}_{k+1}(X)=\bigcup_{t\in\mathcal{P}_k(X)}E(t)

After

|\mathcal{P}_{k+1}(X)|=|\mathcal{P}_k(X)|\cdot(n-k)

Conditions: k+1\le n

Rule: disjoint_union_count · Uses: S04, S04.3, S05

Leaf basis: disjoint_union_count + finite_counting_basics

S04 writes 𝒫_{k+1}(X) as the union of the pairwise disjoint classes E(t) indexed by t∈𝒫_k(X), and S05 says every class has exactly n−k elements. By disjoint_union_count (c=n−k) the total is |𝒫_k(X)|·(n−k). This is the precise form of the MKO's remark that the numbers of choices are n, n−1 and so on: at choice number k+1 there are n−k options.

S07 · induction_step

Before

|\mathcal{P}_k(X)|=\frac{n!}{(n-k)!}

After

|\mathcal{P}_{k+1}(X)|=\frac{n!}{(n-(k+1))!}

Conditions: k+1\le n

Rule: frac_rules · Uses: S06, S02, mko_factorial_def

Leaf basis: frac_rules + mko_factorial_def + L_fact_pos

Assume the induction hypothesis |𝒫_k(X)|=n!/(n−k)! and k+1≤n. By S06, |𝒫_{k+1}(X)|=n!(n−k)/(n−k)!. Sub-step S07.1 splits (n−k)! as (n−k)·(n−k−1)!, and S07.2 cancels the common factor n−k to reach n!/(n−(k+1))!.

S08 · implies

Before

Q(k):\ k\le n\Rightarrow|\mathcal{P}_k(X)|=\frac{n!}{(n-k)!}

After

P(n,k)=\frac{n!}{(n-k)!}\quad\text{for all}\ 0\le k\le n

Conditions: none

Rule: nat_induction · Uses: S03, S07

Leaf basis: nat_induction + forall_intro + imp_intro

Induct on k for Q(k): 'if k≤n then |𝒫_k(X)|=n!/(n−k)!'. Q(0) is S03. Assume Q(k): if k+1≤n then k≤n, so Q(k) gives |𝒫_k(X)|=n!/(n−k)!, and S07 gives Q(k+1); if k+1>n, the hypothesis of Q(k+1) fails and Q(k+1) holds vacuously. By the induction principle Q(k) holds for every k. The proof used only |X|=n and the distinctness of the elements, nothing about which elements X has, so it holds for every n-element set (forall_intro).

S09 · definition

Before

t\in\mathcal{P}_k(X)

After

\sigma(t)=\operatorname{set}(t)\in\mathcal{C}_k(X)

Conditions: none

Rule: function_def · Uses: G2, S05.2

Leaf basis: function_def + def_intro

Define σ:𝒫_k(X)→𝒞_k(X) sending an ordered selection to the set of objects it selects, that is, forgetting the order. σ is well defined: by the reasoning of S05.2, set(t) is a subset of X with exactly k elements, so set(t)∈𝒞_k(X), and each t gives a single set.

S10 · implies

Before

\sigma^{-1}(\{A\})\quad(A\in\mathcal{C}_k(X))

After

\sigma^{-1}(\{A\})=\mathcal{P}_k(A)

Conditions: A\subseteq X,\ |A|=k

Rule: set_extensionality · Uses: S09

Leaf basis: set_extensionality + image_preimage_def + L_same_size_subset

For each k-element subset A, the ordered selections that σ sends to A are exactly the k-tuples of distinct elements of A, that is, the orderings of A. The two inclusions are S10.1 and S10.3, and S10.2 proves the finite-set lemma they need.

S11 · theorem_application

Before

|\sigma^{-1}(\{A\})|=|\mathcal{P}_k(A)|

After

|\sigma^{-1}(\{A\})|=\frac{k!}{(k-k)!}=\frac{k!}{0!}=k!

Conditions: |A|=k

Rule: forall_elim · Uses: S08, S10

Leaf basis: forall_elim + mko_factorial_def + numeric_evaluation

S08 holds for every n-element set and every 0≤k≤n. Applying it to the k-element set A (n replaced by k, with k objects still selected and 0≤k≤k true) gives |𝒫_k(A)|=k!/(k−k)!=k!/0!=k!, since 0!=1. So each k-element subset has exactly k! orderings, which is the MKO's reason for dividing by k!.

S12 · implies

Before

\mathcal{P}_k(X)=\bigcup_{A\in\mathcal{C}_k(X)}\sigma^{-1}(\{A\})

After

P(n,k)=C(n,k)\cdot k!

Conditions: none

Rule: disjoint_union_count · Uses: S09, S10, S11

Leaf basis: disjoint_union_count + function_def + image_preimage_def

Each t∈𝒫_k(X) lies in exactly one fibre, namely σ^{-1}({σ(t)}) (σ is a function and gives t a single image), so the fibres are pairwise disjoint and their union is 𝒫_k(X). Every fibre has exactly k! elements (S11), and there are |𝒞_k(X)|=C(n,k) fibres. By disjoint_union_count (c=k!), P(n,k)=C(n,k)·k!.

S13 · equivalent

Before

P(n,k)=C(n,k)\cdot k!

After

C(n,k)=\frac{P(n,k)}{k!}=\frac{n!}{k!\,(n-k)!}

Conditions: k!\neq 0

Rule: mul_inverse_nonzero · Uses: S12, S08, S02

Leaf basis: mul_inverse_nonzero + frac_rules + eq_replace + L_fact_pos

Since k!≠0 (S02), multiplying both sides by 1/k! gives C(n,k)=P(n,k)/k!; substituting P(n,k)=n!/(n−k)! from S08 and using frac_rules gives n!/(k!(n−k)!).

S14 · implies

Before

k=0

After

P(n,0)=\frac{n!}{n!}=1,\quad C(n,0)=\frac{n!}{0!\,n!}=1,\quad \mathcal{C}_0(X)=\{\varnothing\}

Conditions: 0!=1; n!\neq 0

Rule: forall_elim · Uses: S08, S13, G2

Leaf basis: forall_elim + mko_factorial_def + frac_rules

Substitute k=0: P(n,0)=n!/n!=1 and C(n,0)=n!/(0!·n!)=n!/n!=1 (0!=1). The sets agree directly: the only subset with no elements is the empty set, so 𝒞_0(X)={∅}, and the empty selection counts as one, as in MKO assumption a2; this also holds for n=0 (X empty).

S15 · implies

Before

n=5,\ k=3

After

P(5,3)=60,\quad C(5,3)=10,\quad 10\cdot 3!=60

Conditions: 0\le 3\le 5

Rule: forall_elim · Uses: G3, S06, S08, S13

Leaf basis: forall_elim + numeric_evaluation

Substitute n=5 and k=3: P(5,3)=5!/2!=120/2=60, which matches the recursion of S06, 1, 5, 20, 60 (multiplying by 5, 4 and 3 in turn); C(5,3)=5!/(3!·2!)=120/12=10. Check S12: 10·3!=60. For A={a,b,c}, its fibre is exactly the 6 ordered selections (a,b,c), (a,c,b), (b,a,c), (b,c,a), (c,a,b), (c,b,a), and 3!=6.

Substeps and lemmas

S02.1 · induction_base

Before

0!

After

0!=1\geq 1

Conditions: none

Rule: mko_factorial_def · Uses: mko_factorial_def

Leaf basis: mko_factorial_def

By definition F(0)=1, so 0!=1≥1. Note that 0! is 1, not 0; the factorial MKO warns against the common error of taking 0! to be 0.

S02.2 · induction_step

Before

m!\geq 1

After

(m+1)!=(m+1)\,m!\geq m!\geq 1

Conditions: m\geq 0

Rule: order_basics · Uses: S02.1, mko_factorial_def, order_basics

Leaf basis: order_basics + mko_factorial_def + nat_induction

Assume m!≥1. By the recursion (m+1)!=(m+1)·m!. Since m≥0, (m+1)·m!−m!=m·m!≥0 (a product of nonnegative numbers is nonnegative), so (m+1)!≥m!≥1. By the induction principle, S02.1 and S02.2 together prove Lemma L_fact_pos for every m.

S04.1 · implies

Before

u\in\mathcal{P}_{k+1}(X)

After

u=t^\frown x,\ t\in\mathcal{P}_k(X),\ x\in X\setminus\operatorname{set}(t)

Conditions: none

Rule: tuple_eq · Uses: G2, tuple_eq

Leaf basis: tuple_eq + set_operations_def + subset_def

Take any u∈𝒫_{k+1}(X). By tuple_eq, u=t⌢x with t the first k entries of u and x its last entry. The entries of t are entries of u, so they lie in X and are pairwise distinct: t∈𝒫_k(X). The entry x differs from every other entry of u, that is, x∉set(t), so x∈X∖set(t) and u∈E(t).

S04.2 · implies

Before

t\in\mathcal{P}_k(X),\ x\in X\setminus\operatorname{set}(t)

After

t^\frown x\in\mathcal{P}_{k+1}(X)

Conditions: x\notin\operatorname{set}(t)

Rule: tuple_eq · Uses: G2, tuple_eq, S04.1

Leaf basis: tuple_eq + set_operations_def + set_extensionality

Conversely, let t∈𝒫_k(X), x∈X and x∉set(t). The first k entries of t⌢x are pairwise distinct and the last entry x differs from each of them, so all k+1 entries are pairwise distinct and lie in X: t⌢x∈𝒫_{k+1}(X). S04.1 and S04.2 together give the set equality of S04 by set_extensionality.

S04.3 · implies

Before

t^\frown x=s^\frown y

After

t=s\ \land\ x=y

Conditions: none

Rule: tuple_eq · Uses: tuple_eq

Leaf basis: tuple_eq + and_intro_elim

If t⌢x=s⌢y, the tuples agree position by position: the first k entries give t=s and the last entry gives x=y. Hence E(t) and E(s) share no element when t≠s, and inside one E(t) different x give different tuples.

S05.1 · implies

Before

A\subseteq Y,\ Y\ \text{finite}

After

|Y\setminus A|=|Y|-|A|

Conditions: A\subseteq Y

Rule: finite_counting_basics · Uses: finite_counting_basics, set_operations_def

Leaf basis: finite_counting_basics + set_operations_def + eq_congruence

Since A⊆Y, Y=A∪(Y∖A), and A and Y∖A are disjoint (elements of Y∖A are not in A). By finite_counting_basics, |Y|=|A|+|Y∖A|; subtracting |A| from both sides gives |Y∖A|=|Y|−|A|. This proves Lemma L_complement_count.

S05.2 · implies

Before

t=(x_i)_{i=1}^{k}\in\mathcal{P}_k(X)

After

|\operatorname{set}(t)|=k,\quad |X\setminus\operatorname{set}(t)|=n-k

Conditions: none

Rule: finite_counting_basics · Uses: G2, S05.1

Leaf basis: injective_surjective_def + finite_counting_basics + L_complement_count

The map i↦x_i from the set of positions {i∈ℕ ∣ 1≤i≤k} to set(t) is onto (set(t) is the set of entries) and one-to-one (the entries are pairwise distinct). By the bijection clause of finite_counting_basics, |set(t)|=k. Also set(t)⊆X, so by S05.1 (Y=X, A=set(t)), |X∖set(t)|=n−k. This reasoning holds for every t∈𝒫_k(X) and is used again in S09 and S10.3.

S05.3 · implies

Before

x\mapsto t^\frown x:\ X\setminus\operatorname{set}(t)\to E(t)

After

|E(t)|=|X\setminus\operatorname{set}(t)|=n-k

Conditions: none

Rule: injective_surjective_def · Uses: S04.3, S05.2

Leaf basis: injective_surjective_def + finite_counting_basics

By the definition of E(t), each of its elements is t⌢x for some x∈X∖set(t), so the map is onto; by S04.3, t⌢x=t⌢y gives x=y, so it is one-to-one. Finite sets in bijection have the same number of elements, so |E(t)|=n−k.

S07.1 · equivalent

Before

(n-k)!

After

(n-k)\cdot(n-k-1)!

Conditions: n-k-1\in\mathbb{N}

Rule: mko_factorial_def · Uses: mko_factorial_def

Leaf basis: mko_factorial_def + eq_replace

Let m=n−k−1; since k+1≤n, m is a natural number and n−k=m+1. By the recursion F(m+1)=(m+1)F(m), (n−k)!=(n−k)·(n−k−1)!.

S07.2 · equivalent

Before

\frac{n!\,(n-k)}{(n-k)\cdot(n-k-1)!}

After

\frac{n!}{(n-k-1)!}=\frac{n!}{(n-(k+1))!}

Conditions: n-k\neq 0; (n-k-1)!\neq 0

Rule: frac_rules · Uses: S07.1, S02

Leaf basis: frac_rules + L_fact_pos + eq_replace

By the rule in frac_rules that multiplying numerator and denominator by the same nonzero number does not change a fraction, cancel the nonzero common factor n−k from numerator and denominator; (n−k−1)!≠0 holds by S02. Finally n−k−1=n−(k+1).

S10.1 · implies

Before

t\in\mathcal{P}_k(X),\ \sigma(t)=A

After

t\in\mathcal{P}_k(A)

Conditions: none

Rule: image_preimage_def · Uses: S09, image_preimage_def

Leaf basis: image_preimage_def + def_unfold

If σ(t)=A, every entry of t lies in set(t)=A, and the entries are pairwise distinct, so t is a k-tuple of distinct elements of A: t∈𝒫_k(A).

S10.2 · implies

Before

B\subseteq A,\ |B|=|A|,\ A\ \text{finite}

After

B=A

Conditions: A\ \text{finite}

Rule: L_complement_count · Uses: S05.1, set_operations_def

Leaf basis: L_complement_count + set_extensionality + set_operations_def

By L_complement_count (S05.1 with Y=A), |A∖B|=|A|−|B|=0, so A∖B is empty: every element of A lies in B, so A⊆B. Together with B⊆A, set_extensionality gives B=A. This proves Lemma L_same_size_subset.

S10.3 · implies

Before

t\in\mathcal{P}_k(A)

After

t\in\mathcal{P}_k(X)\ \land\ \sigma(t)=A

Conditions: A\subseteq X

Rule: L_same_size_subset · Uses: S05.2, S10.2, G2

Leaf basis: L_same_size_subset + subset_def + set_extensionality

Let t∈𝒫_k(A). Since A⊆X, t is also a k-tuple of distinct elements of X, so t∈𝒫_k(X). By the reasoning of S05.2, |set(t)|=k=|A|, and set(t)⊆A; by L_same_size_subset, set(t)=A, that is σ(t)=A. S10.1 and S10.3 together give σ^{-1}({A})=𝒫_k(A).

Reverse audits

  • S15 · premise_audit · G3, S08, S13, numeric_evaluation — This is one instance of the general formulas and can be recomputed independently (N1 to N6, N9, N10); it cannot replace the general proof in S03 to S13.
  • S14 · premise_audit · S08, S13, forall_elim, mko_factorial_def — It needs 0!=1 and n!≠0; taking 0! to be 0 would make C(n,0) a division by zero.
  • S13 · inverse_equivalence · mul_inverse_nonzero, S02, frac_rules — Multiplying by 1/k! and by k! undo each other, given k!≠0; substituting S08 replaces equals by equals, so the step is two-way.
  • S12 · premise_audit · S09, S11, disjoint_union_count, function_def — It needs every fibre to have exactly k! elements; with indistinguishable objects the numbers of orderings could differ and the count would not be a product.
  • S11 · premise_audit · S08, S10, forall_elim, mko_factorial_def — Substituting into S08 needs the elements of A to be distinct and |A|=k; what is used is the general result already proved, not a recomputation for one example.
  • S10.3 · premise_audit · S05.2, S10.2, L_same_size_subset, set_extensionality — The key point is that set(t) already has |A| elements and so cannot be a proper subset of A; this relies on A being finite.
  • S10.2 · premise_audit · S05.1, set_extensionality, set_operations_def — It needs A to be finite; for infinite sets a proper subset can be in bijection with the whole set (for example the even numbers and ℕ), and the lemma fails.
  • S10.1 · premise_audit · S09, image_preimage_def — Uses only the definition of set(t); the reverse inclusion is S10.3.
  • S10 · premise_audit · S09, set_extensionality, image_preimage_def — Set equality needs both inclusions, which are proved in the sub-steps below; one inclusion alone would not suffice.
  • S09 · premise_audit · G2, S05.2, function_def — It needs the image of each t to lie in 𝒞_k(X), which rests on the entries being pairwise distinct. With a repeated entry set(t) would have fewer than k elements and σ would not land in 𝒞_k(X).
  • S08 · sufficient_goal_reduction · S03, S07, nat_induction, forall_intro — Goal G: P(n,k)=n!/(n−k)! for 0≤k≤n. Sufficient condition H: Q(0) and Q(k)⇒Q(k+1) for every k; H⇒G by the induction principle. H is proved forwards in S03 and S07; G is never used as a premise.
  • S07.2 · inverse_equivalence · frac_rules, S02 — Cancelling and expanding by a common factor undo each other, provided the factor n−k is nonzero; with n−k=0 the cancellation would be invalid.
  • S07.1 · inverse_equivalence · mko_factorial_def, eq_replace — Both sides name the same number and may replace each other in either direction; the condition is n−k≥1, since for n−k=0 the factorial (n−k−1)! is undefined.
  • S07 · premise_audit · S06, S02, frac_rules — It needs the induction hypothesis, k+1≤n (so that n−k−1 is a natural number) and nonzero denominators (S02); it goes from k to k+1 only.
  • S06 · premise_audit · S04, S04.3, S05, disjoint_union_count — It needs disjointness (otherwise elements are counted twice) and equal class sizes (otherwise the sum is not a product); S04.3 and S05 supply them.
  • S05.3 · premise_audit · S04.3, S05.2, injective_surjective_def, finite_counting_basics — Both injectivity and surjectivity are needed; either alone would not give equal sizes.
  • S05.2 · premise_audit · G2, finite_counting_basics, injective_surjective_def, S05.1 — Pairwise distinctness gives injectivity; with a repeated entry set(t) would have fewer than k elements.
  • S05.1 · premise_audit · finite_counting_basics, set_operations_def, eq_congruence — It needs A⊆Y; if A is not a subset of Y, Y=A∪(Y∖A) fails and so does the formula.
  • S05 · premise_audit · L_complement_count, G1, finite_counting_basics — It needs the size of E(t) not to depend on t; if the number of later options changed with earlier choices, one could not simply multiply.
  • S04.3 · premise_audit · tuple_eq — Uses only the positionwise equality of tuples; the conclusion serves both the disjointness of the classes (S06) and the injectivity in S05.3.
  • S04.2 · premise_audit · tuple_eq, set_operations_def, set_extensionality — It needs x∉set(t), which is exactly why E(t) takes x from X∖set(t).
  • S04.1 · premise_audit · G2, tuple_eq, set_operations_def — It uses that the entries of u are pairwise distinct; if repetition were allowed, x could lie in set(t) and this inclusion would fail.
  • S04 · premise_audit · G2, tuple_eq, set_extensionality — Set equality needs both inclusions, and disjointness needs its own proof; all three are proved in the sub-steps that follow, and one inclusion alone would not suffice.
  • S03 · premise_audit · tuple_eq, S02 — It needs the uniqueness of the 0-tuple and n!≠0; it does not depend on the particular elements of X and holds for n=0 as well.
  • S02.2 · premise_audit · mko_factorial_def, order_basics, nat_induction — It needs the hypothesis m!≥1 and m≥0; the conclusion goes from m to m+1 only, and no converse is claimed.
  • S02.1 · premise_audit · mko_factorial_def — Uses only the first clause of the definition; nothing else is needed.
  • S02 · premise_audit · L_fact_pos, mko_factorial_def — Only the recursive definition of factorial and induction are needed; no converse (recovering the recursion from m!≥1) is claimed.
  • S01 · premise_audit · G1, G2, def_intro, mko_perm_comb — This step only introduces names and derives no new fact. It relies on the objects being distinct (otherwise pairwise distinctness cannot be judged) and on selection without replacement (no repeated entry); if repetition were allowed, 𝒫_k(X) would be defined differently and the proof below would not apply.

Error controls and negative controls

Decide order, distinctness and replacement first

The common error named in the MKO is to apply a formula before checking the conditions. Choosing 3 from {a,b,c,d,e}: if order matters and there is no repetition (president, vice-president and secretary), use P(5,3)=60; if only who is chosen matters (a three-person committee), use C(5,3)=10; if repetition is allowed (a three-letter code whose letters may repeat), each position has 5 options, giving 5³=125, and neither P nor C applies. Every step here relies on distinctness and no replacement: S04.1 needs x not in t, and S05.2 needs the entries to be pairwise distinct.

Dividing by k! needs exactly k! orderings for every subset

S12 can be written as C(n,k)·k! because every fibre has exactly k! elements (S11), and that rests on the objects being distinct. With indistinguishable objects, for example the letters A, A, B in three positions, there are only three different results, AAB, ABA and BAA, not 3!=6; taking 3! as the count doubles it. Such cases need a different counting model (MKO para2).

0!=1 and the empty selection

For k=0 there is exactly one ordered and one unordered selection: the empty tuple and the empty set (S03, S14). Taking 0! to be 0 would make C(n,0)=n!/(0!·n!) a division by zero; thinking that choosing nothing does not count would wrongly give C(5,0)=0.

  • Three-letter codes from {a,b,c,d,e} with repetition allowed number P(5,3)=60 → reject — With repetition each position has 5 options, giving 5³=125; P(5,3) counts only ordered selections with pairwise distinct entries.
  • The number of ways to choose a president and a secretary (two different posts) from 5 people is C(5,2)=10 → reject — The posts distinguish order: A as president with B as secretary differs from B as president with A as secretary, so the count is P(5,2)=20=10·2!.
  • The letters A, A, B have 3!=6 different arrangements → reject — The objects are not distinct; there are only AAB, ABA and BAA, three arrangements, and this lies outside the MKO's model of distinct objects.
  • C(5,0)=0 because nothing is chosen → reject — The empty selection counts as one: 5!/(0!·5!)=1, and 𝒞_0(X)={∅}.

Result and limitations

For selections from n distinct objects with 0≤k≤n, without replacement or repetition: the number of ordered selections is P(n,k)=n!/(n−k)! (choice number i has n−i+1 options, S06 to S08), the number of unordered selections is C(n,k)=n!/(k!(n−k)!) (each k-element subset has exactly k! orderings, S11 to S13), and both equal 1 when k=0. Example: P(5,3)=60 and C(5,3)=10.

  • disjoint_union_count is the two-set case of finite_counting_basics extended by induction on the number of sets; this guide takes it as a prerequisite and does not write out that induction.
  • N11 and N12 are finite checks for n from 3 to 25 only, used to cross-check how the formulas are written; the general result rests on the proofs in S08 and S13, not on these checks.
  • Counting with repetition, with indistinguishable objects or around a circle is outside this guide; the numbers in the negative controls only show that the formulas do not apply.

Verification and source binding

16 declared checks for this guide; only the listed expressions are covered.

  • source commit: b28a5edbd46279b1db2a3f3f48bb3f447e18899f
  • adopted source SHA-256: 87cb2ae2d23efddad0cb4a3c6cf56e3e9661d77e4fa32202b282969bac1604f2
  • original source SHA-256: 87cb2ae2d23efddad0cb4a3c6cf56e3e9661d77e4fa32202b282969bac1604f2
  • Lean: NOT_RUN · independent AI: NOT_MEASURED

Same-source full JSON (formulas, ASTs, controls and revision log)