Pentagonal number theorem with Franklin's bijective proof #
This file proves the
pentagonal number theorem
at pentagonalNumberTheorem in terms of formal power series:
$$\prod_{n=1}^{\infty} (1 - x^n) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k-1)/2}$$
following Franklin's bijective proof presented on the wikipedia page. This long proof
is obsolete by the shorter ones in PowerSeries.lean and Complex.lean, but I keep
it here to show case how a combinatorial proof can be done.
Basic properties of pentagonal numbers #
Pentagonal numbers, including negative inputs
Instances For
Because integer division is hard to work with, we often multiply it by two
There are no repeated pentagonal number
The inverse of pentagonal number $n = k(3k - 1) / 2$ is $$ k = \frac{1 \pm \sqrt{1 + 24n}}{6} $$ We can use $1 + 24n$ to determine whether such inverse exists.
Equations
- pentagonalDelta n = 1 + 24 * n
Instances For
The coefficients are exactly $(-1)^k$ at pentagonal numbers.
A coefficient is zero iff and only if it is not a pentagonal number.
$\phi(x)$ is constructed using the coefficients defined above.
Equations
- phi = PowerSeries.mk fun (x : ℕ) => phiCoeff ↑x
Instances For
The second definition of $\phi(x)$, summing over terms with pentagonal exponents directly.
Some utility of lists #
Returns the number of leading elements satisfying a condition.
Equations
- List.lengthWhile p [] = 0
- List.lengthWhile p (x_1 :: xs) = if p x_1 then List.lengthWhile p xs + 1 else 0
Instances For
Ferrers diagram #
A FerrersDiagram n is a representation of distinct partition of number n.
To represent a partition, we first sort all parts in descending order, such as
26 = 14 + 8 + 3 + 1 → [14, 8, 3, 1]
We then calculate the difference between each element, and keep the last element:
[14, 8, 3, 1] → [6, 5, 2, 1]
We get a valid x : FerrersDiagram 26 where x.delta = [6, 5, 2, 1].
The difference between parts.
- delta_pos : List.Forall (fun (x : ℕ) => 0 < x) self.delta
since we require distinct partition, all delta should be positive.
All parts should sum back to
n. Since we took the difference, this becomes a rolling sum.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprFerrersDiagram = { reprPrec := instReprFerrersDiagram.repr }
There can't be more parts than n
The parts are not empty for non-zero n. We will discuss mostly with this condition,
leaving the n = 0 case a special one for later.
All parts are not greater than n. Since the last element of delta equals to the
smallest part, it is not greater either.
Pentagonal configuration #
There is a type of distinct partition we will call "pentagonal". Later, we will see they are in correspondence with pentagonal numbers.
The special configuration corresponding to pentagonal number n with a positive k.
For example when n = 12, this looks like
∘ ∘ ∘ ∘ ∘
∘ ∘ ∘ ∘
∘ ∘ ∘
Equations
Instances For
The special configuration corresponding to pentagonal number n with a negative k.
For example when n = 15, this looks like
∘ ∘ ∘ ∘ ∘ ∘
∘ ∘ ∘ ∘ ∘
∘ ∘ ∘ ∘
Equations
Instances For
"Up" and "Down" movement #
We will define two operations on distinct partitions / Ferrers diagram:
down: Take the elements on the right-most 45 degree diagonal and put them to a new bottom rowup: Take the elements on the bottom row and spread them to the leading rows, forming the new right-most 45 degree diagonal
It is obvious that they are inverse to each other. We will only allow the operation when it is legal
to do so. We will then show that for non-pentagonal configurations, either up or down will be
legal, and performing the action will make the other one legal.
The number of consecutive leading 1 in delta.
This is mimicking the "number of elements in the rightmost 45 degree line of the diagram" s,
where we have diagSize = s - 1. However, if the configuration is a complete triangle
(i.e. delta are all 1), then we actually have diagSize = s. This inconsistency turns out
insignificant, because we only care whether this size is smaller than the smallest part, and
that's never the case for triangle configuration regardless which definition we take
(except for pentagonal configuration, which we will discuss separately anyway)
Instances For
The action to subtract one from the first i + 1 parts.
Equations
Instances For
The action to add a new part smaller than every other part.
Equations
- FerrersDiagram.putLast hn x i hi = { delta := FerrersDiagram.putLastFun x.delta i, delta_pos := ⋯, delta_sum := ⋯ }
Instances For
The criteria to legally move the diagonal down
Instances For
Equations
Specialize takeDiag to take precisely the 45 degree diagonal.
Equations
- FerrersDiagram.takeDiag' hn x hdown = x.takeDiag x.diagSize ⋯ ⋯
Instances For
The down action is defined as takeDiag then putLast.
Equations
- FerrersDiagram.down hn x hdown hnegpen = ⋯.mpr (FerrersDiagram.putLast ⋯ (FerrersDiagram.takeDiag' hn x hdown) x.diagSize ⋯)
Instances For
Barring pentagonal configuration, doing down will make it illegal to down.
Non-pentagonal configuration will not be positive-pentagonal after down.
Non-pentagonal configuration will not be negative-pentagonal after down.
The inverse of putLast
Equations
- FerrersDiagram.takeLast hn x = { delta := FerrersDiagram.takeLastFun x.delta ⋯, delta_pos := ⋯, delta_sum := ⋯ }
Instances For
The inverse of takeDiag.
Equations
Instances For
The inverse of down.
Equations
- FerrersDiagram.up hn x hdown hpospen = ⋯.mp ((FerrersDiagram.takeLast hn x).putDiag (x.delta.getLast ⋯ - 1) ⋯)
Instances For
Barring pentagonal configuration, doing up will make it legal to do down.
Non-pentagonal configuration will not be pentagonal after doing up.
Here we disprove the common condition of both pos- and neg- pentagonal.
Up/down involution #
We now combine both up and down into one function bij, selecting the operation based on
which way is legal. We notice that in either way the parity of delta.length is changed,
so this provides a bijection between even and odd non-pentagonal configurations.
bij is either up or down, depending on which way is legal.
Equations
- FerrersDiagram.bij hn x hpospen hnegpen = if hdown : FerrersDiagram.IsToDown hn x then FerrersDiagram.down hn x hdown hnegpen else FerrersDiagram.up hn x hdown hpospen
Instances For
Type of all non-pentagonal Ferrers diagrams.
Equations
Instances For
bij as a function on NpFerrers.
Equations
- FerrersDiagram.bijNp x = ⟨FerrersDiagram.bij hn ↑x ⋯ ⋯, ⋯⟩
Instances For
The numer of even and odd configurations, barring pentagonal ones, are equal.
Translate Ferrers diagram to distinct partition #
Correspondence between FerrersDiagram n and Nat.Partition.distincts n,
which also preserves parity.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The difference between even and odd partitions is reduced to pentagonal cases.
For positive pentagonal case, delta.length = k.
In summary, pentagonal case always gives a pentagonal number n.
The converse: pentagonal number n gives a pentagonal case.
There is at most one pentagonal case for a given n.
Third definition of $\phi$: coefficients represents the existence of even and odd pentagonal partition.
Final connection #
The multiplication formula of $\phi(x)$ expands precisely to the partition formula.