Lean / Reader
Lean reader

WallisStatement.lean

44 lines3 declarationsno sorryimports WallisLimit

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.

  1. import WallisLimit
  2. open Finset Filter
  3. open scoped Topology BigOperators
  4. namespace WallisEncoding
  5. noncomputable section
  6. open Classical
  7. def permutationsAtDefect (n m : ℕ) : Finset (Equiv.Perm (Fin n)) :=
  8. univ.filter (AtDefect m)
  9. /-- The marked-point ratio is the uniform mean of the fixed-point proportions. -/
  10. theorem expected_eq_perm_average (n m : ℕ) :
  11. expected n m =
  12. (∑ p ∈ permutationsAtDefect n m,
  13. ((univ.filter fun u : Fin n => p u = u).card : ℝ) / n) /
  14. (permutationsAtDefect n m).card := by
  15. let P := permutationsAtDefect n m
  16. have ht : target n m = P ×ˢ (univ : Finset (Fin n)) := by
  17. ext z
  18. simp [P,permutationsAtDefect,target]
  19. unfold expected
  20. rw [ht, card_product, card_univ, Fintype.card_fin, ← sum_indicator, Nat.cast_mul, sum_product, ← sum_div]
  21. simp only [fixed]
  22. rw [div_div, mul_comm (n : ℝ)]
  23. congr 1
  24. apply sum_congr rfl
  25. intro p hp
  26. convert sum_indicator (univ : Finset (Fin n)) (fun u => p u = u) using 1 <;> congr
  27. funext x
  28. by_cases h : p x = x <;> simp [h]
  29. /-- The expectation stated entirely as a uniform average of fixed-point proportions. -/
  30. theorem uniform_fixedPoint_proportions (m : ℕ) :
  31. Tendsto (fun n => (∑ p ∈ permutationsAtDefect n m,
  32. ((univ.filter fun u : Fin n => p u = u).card : ℝ) / n) /
  33. (permutationsAtDefect n m).card) atTop
  34. (𝓝 (∫ x in 0..Real.pi / 2, Real.sin x ^ (2*m+1))) := by
  35. simpa only [← expected_eq_perm_average] using erickson_problem_1_6 m
  36. #print axioms uniform_fixedPoint_proportions
  37. end
  38. end WallisEncoding