Skip to content

Commit 5948832

Browse files
committed
chore(Archive/Wiedijk100Theorems/BirthdayProblem): cleanup (leanprover-community#37679)
We remove some redundant instances, and a redundant `open scoped`.
1 parent 39328e9 commit 5948832

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

Archive/Wiedijk100Theorems/BirthdayProblem.lean

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ in terms of injective functions. The general result about `Fintype.card (α ↪
1717
uses is `Fintype.card_embedding_eq`.
1818
-/
1919

20-
2120
namespace Theorems100
2221

2322
local notation "|" x "|" => Finset.card x
24-
2523
local notation "‖" x "‖" => Fintype.card x
2624

2725
/-- **Birthday Problem**: set cardinality interpretation. -/
@@ -30,38 +28,23 @@ theorem birthday :
3028
simp only [Fintype.card_fin, Fintype.card_embedding_eq, Fintype.card_fun]
3129
decide
3230

33-
section MeasureTheory
34-
3531
open MeasureTheory ProbabilityTheory
3632

37-
open scoped ProbabilityTheory ENNReal
38-
3933
variable {n m : ℕ}
4034

41-
/- In order for Lean to understand that we can take probabilities in `Fin 23 → Fin 365`, we must
42-
tell Lean that there is a `MeasurableSpace` structure on the space. Note that this instance
43-
is only for `Fin m` - Lean automatically figures out that the function space `Fin n → Fin m`
44-
is _also_ measurable, by using `MeasurableSpace.pi`, and furthermore that all sets are measurable,
45-
from `MeasurableSingletonClass.pi`. -/
46-
instance : MeasurableSpace (Fin m) :=
47-
48-
49-
instance : MeasurableSingletonClass (Fin m) :=
50-
fun _ => trivial⟩
51-
5235
/- We then endow the space with a canonical measure, which is called ℙ.
5336
We define this to be the conditional counting measure. -/
5437
noncomputable instance measureSpace : MeasureSpace (Fin n → Fin m) :=
5538
⟨uniformOn Set.univ⟩
5639

57-
theorem FinFin.measure_apply {s : Set <| Fin n → Fin m} :
40+
theorem Fin.measure_apply {s : Set <| Fin n → Fin m} :
5841
ℙ s = |s.toFinite.toFinset| / ‖Fin n → Fin m‖ := by
5942
rw [volume, measureSpace, uniformOn_univ, Measure.count_apply_finite]
6043

6144
/-- **Birthday Problem**: first probabilistic interpretation. -/
6245
theorem birthday_measure :
63-
ℙ ({f | (Function.Injective f)} : Set ((Fin 23)(Fin 365))) < 1 / 2 := by
64-
rw [FinFin.measure_apply]
46+
ℙ ({f | f.Injective} : Set (Fin 23 → Fin 365)) < 1 / 2 := by
47+
rw [Fin.measure_apply]
6548
generalize_proofs hfin
6649
have : |hfin.toFinset| = 42200819302092359872395663074908957253749760700776448000000 := by
6750
trans ‖Fin 23 ↪ Fin 365
@@ -76,6 +59,4 @@ theorem birthday_measure :
7659
simp only [Fintype.card_pi, Fintype.card_fin, Finset.prod_const, Finset.card_univ]
7760
norm_num
7861

79-
end MeasureTheory
80-
8162
end Theorems100

0 commit comments

Comments
 (0)