An open API service indexing awesome lists of open source software.

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

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.