https://github.com/mo271/stirling
A proof of Stirling's formula in Lean
https://github.com/mo271/stirling
Last synced: 3 months ago
JSON representation
A proof of Stirling's formula in Lean
- Host: GitHub
- URL: https://github.com/mo271/stirling
- Owner: mo271
- License: apache-2.0
- Created: 2022-05-05T07:00:34.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-17T11:54:28.000Z (almost 4 years ago)
- Last Synced: 2025-06-02T04:16:35.665Z (about 1 year ago)
- Language: Lean
- Homepage:
- Size: 124 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A proof of [Stirling's formula](https://en.wikipedia.org/wiki/Stirling%27s_approximation) in [Lean](https://leanprover.github.io/)
We provide a proof of Stirling's formula in the following form:
$$n! \sim \sqrt{2\pi n}\left(\frac{n}{e}\right)^n.$$
More concretely, we define
```lean
noncomputable def an (n : ℕ) : ℝ :=
(n.factorial : ℝ) /
((real.sqrt(2*n)*((n/(exp 1)))^n))
```
and prove
```lean
lemma an_has_limit_sqrt_pi: tendsto
(λ (n : ℕ), an n) at_top (𝓝 (sqrt π)) :=
```
We follow roughly [this proof](https://proofwiki.org/wiki/Stirling%27s_Formula).
Currently the proof is complete, but in very messy state.
We plan to clean and streamline the proof soon.