Lean / Reader
Lean readerWallisStatement.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports WallisLimit, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import WallisLimitopen Finset Filteropen scoped Topology BigOperatorsnamespace WallisEncodingnoncomputable sectionopen Classicaldef permutationsAtDefect (n m : ℕ) : Finset (Equiv.Perm (Fin n)) :=univ.filter (AtDefect m)/-- The marked-point ratio is the uniform mean of the fixed-point proportions. -/theorem expected_eq_perm_average (n m : ℕ) :expected n m =(∑ p ∈ permutationsAtDefect n m,((univ.filter fun u : Fin n => p u = u).card : ℝ) / n) /(permutationsAtDefect n m).card := bylet P := permutationsAtDefect n mhave ht : target n m = P ×ˢ (univ : Finset (Fin n)) := byext zsimp [P,permutationsAtDefect,target]unfold expectedrw [ht, card_product, card_univ, Fintype.card_fin, ← sum_indicator, Nat.cast_mul, sum_product, ← sum_div]simp only [fixed]rw [div_div, mul_comm (n : ℝ)]congr 1apply sum_congr rflintro p hpconvert sum_indicator (univ : Finset (Fin n)) (fun u => p u = u) using 1 <;> congrfunext xby_cases h : p x = x <;> simp [h]/-- The expectation stated entirely as a uniform average of fixed-point proportions. -/theorem uniform_fixedPoint_proportions (m : ℕ) :Tendsto (fun n => (∑ p ∈ permutationsAtDefect n m,((univ.filter fun u : Fin n => p u = u).card : ℝ) / n) /(permutationsAtDefect n m).card) atTop(𝓝 (∫ x in 0..Real.pi / 2, Real.sin x ^ (2*m+1))) := bysimpa only [← expected_eq_perm_average] using erickson_problem_1_6 m#print axioms uniform_fixedPoint_proportionsendend WallisEncoding