11/-
2- Copyright (c) 2024-present Ching-Tsun Chou and Chris Wong. All rights reserved.
2+ Copyright (c) 2024 Ching-Tsun Chou, Chris Wong. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
4- Authors: Ching-Tsun Chou and Chris Wong
4+ Authors: Ching-Tsun Chou, Chris Wong
55-/
66
77import Mathlib.Data.Fintype.Perm
88import Mathlib.Probability.UniformOn
99
1010/-!
11- # Proof of the LYM inequality using probability theory
11+ # The LYM inequality using probability theory
1212
13- This file contains a formalization of the proof of the LYM inequality using
14- (very elementary) probability theory given in Section 1.2 of Prof. Yufei Zhao's
15- lecture notes for MIT 18.226:
13+ This file proves the LYM inequality using (very elementary) probability theory.
14+
15+ ## References
16+
17+ This proof formalizes Section 1.2 of Prof. Yufei Zhao's lecture notes for MIT 18.226:
1618
1719<https://yufeizhao.com/pm/probmethod_notes.pdf>
1820
19- A video of Prof. Zhao's lecture on this proof is available on YouTube:
21+ A video of Prof. Zhao's lecture is available on YouTube:
2022
21- <https://youtu.be/exBXHYl4po8?si=aW8hhJ6zBrvWT1T0 >
23+ <https://youtu.be/exBXHYl4po8>
2224
2325The proof of Theorem 1.10, Lecture 3 in the Cambridge lecture notes on combinatorics:
2426
2527<https://github.com/YaelDillies/maths-notes/blob/master/combinatorics.pdf>
2628
27- is basically the same proof, except with probability theory stripped out .
29+ is basically the same proof, except without using probability theory.
2830-/
2931
3032open BigOperators Fintype Finset Set MeasureTheory ProbabilityTheory
@@ -45,14 +47,14 @@ def NumberingOn {α : Type*} (s : Finset α) := {x // x ∈ s} ≃ Fin s.card
4547
4648variable {α : Type *} [Fintype α] [DecidableEq α]
4749
48- theorem numbering_card : card (Numbering α) = (card α).factorial := by
50+ theorem card_Numbering : card (Numbering α) = (card α).factorial := by
4951 exact Fintype.card_equiv (Fintype.equivFinOfCardEq rfl)
5052
5153omit [Fintype α] in
52- theorem numbering_on_card (s : Finset α) : card (NumberingOn s) = s.card.factorial := by
54+ theorem card_NumberingOn (s : Finset α) : card (NumberingOn s) = s.card.factorial := by
5355 simp only [NumberingOn]
5456 have h1 : card {x // x ∈ s} = card (Fin s.card) := by simp
55- have h2 : {x // x ∈ s} ≃ ( Fin s.card) := by exact Fintype.equivOfCardEq h1
57+ have h2 : {x // x ∈ s} ≃ Fin s.card := by exact Fintype.equivOfCardEq h1
5658 simp [Fintype.card_equiv h2]
5759
5860/-- `IsPrefix s f` means that the elements of `s` precede the elements of `sᶜ`
@@ -61,12 +63,12 @@ def IsPrefix (s : Finset α) (f : Numbering α) :=
6163 ∀ x, x ∈ s ↔ f x < s.card
6264
6365omit [DecidableEq α] in
64- theorem is_prefix_subset {s1 s2 : Finset α} {f : Numbering α}
66+ theorem subset_IsPrefix_IsPrefix {s1 s2 : Finset α} {f : Numbering α}
6567 (h_s1 : IsPrefix s1 f) (h_s2 : IsPrefix s2 f) (h_card : s1.card ≤ s2.card) : s1 ⊆ s2 := by
6668 intro a h_as1
6769 exact (h_s2 a).mpr (lt_of_lt_of_le ((h_s1 a).mp h_as1) h_card)
6870
69- def is_prefix_equiv (s : Finset α) : {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ where
71+ def equiv_IsPrefix_NumberingOn2 (s : Finset α) : {f // IsPrefix s f} ≃ NumberingOn s × NumberingOn sᶜ where
7072 toFun := fun ⟨f, hf⟩ ↦
7173 ({
7274 toFun := fun ⟨x, hx⟩ ↦ ⟨f x, by rwa [← hf x]⟩
@@ -143,16 +145,17 @@ instance (s : Finset α) :
143145 DecidablePred fun f ↦ (IsPrefix s f) := by
144146 intro f ; exact Classical.propDecidable ((fun f ↦ IsPrefix s f) f)
145147
146- def SetPrefix (s : Finset α) : Finset (Numbering α) :=
148+ def PrefixedNumbering (s : Finset α) : Finset (Numbering α) :=
147149 {f | IsPrefix s f}
148150
149- theorem set_prefix_card (s : Finset α) :
150- (SetPrefix s).card = s.card.factorial * (card α - s.card).factorial := by
151- have h_eq:= Fintype.card_congr (is_prefix_equiv s)
151+ theorem card_PrefixedNumbering (s : Finset α) :
152+ (PrefixedNumbering s).card = s.card.factorial * (card α - s.card).factorial := by
153+ have h_eq:= Fintype.card_congr (equiv_IsPrefix_NumberingOn2 s)
152154 rw [Fintype.card_subtype] at h_eq
153- rw [SetPrefix, h_eq, Fintype.card_prod, numbering_on_card s, numbering_on_card sᶜ, card_compl]
155+ rw [PrefixedNumbering, h_eq, Fintype.card_prod,
156+ card_NumberingOn s, card_NumberingOn sᶜ, card_compl]
154157
155- private lemma aux_1 {k m n : ℕ} (hn : 0 < n) (heq : k * m = n) :
158+ private lemma auxLemma {k m n : ℕ} (hn : 0 < n) (heq : k * m = n) :
156159 (↑ m : ENNReal) / (↑ n : ENNReal) = 1 / (↑ k : ENNReal) := by
157160 -- The following proof is due to Aaron Liu.
158161 subst heq
@@ -170,50 +173,50 @@ private lemma aux_1 {k m n : ℕ} (hn : 0 < n) (heq : k * m = n) :
170173
171174instance : MeasurableSpace (Numbering α) := ⊤
172175
173- theorem set_prefix_count (s : Finset α) :
174- count (SetPrefix s).toSet = ↑(s.card.factorial * (card α - s.card).factorial) := by
175- rw [← set_prefix_card s, count_apply_finset]
176+ theorem count_PrefixedNumbering (s : Finset α) :
177+ count (PrefixedNumbering s).toSet = ↑(s.card.factorial * (card α - s.card).factorial) := by
178+ rw [← card_PrefixedNumbering s, count_apply_finset]
176179
177- theorem set_prefix_prob (s : Finset α) :
178- uniformOn Set.univ (SetPrefix s).toSet = 1 / (card α).choose s.card := by
179- rw [uniformOn_univ, set_prefix_count s, numbering_card ]
180- apply aux_1 (Nat.factorial_pos (card α))
180+ theorem prob_PrefixedNumbering (s : Finset α) :
181+ uniformOn Set.univ (PrefixedNumbering s).toSet = 1 / (card α).choose s.card := by
182+ rw [uniformOn_univ, count_PrefixedNumbering s, card_Numbering ]
183+ apply auxLemma (Nat.factorial_pos (card α))
181184 rw [← mul_assoc]
182185 exact Nat.choose_mul_factorial_mul_factorial (Finset.card_le_univ s)
183186
184- theorem set_prefix_disj {s t : Finset α} (h_st : ¬ s ⊆ t) (h_ts : ¬ t ⊆ s) :
185- Disjoint (SetPrefix s).toSet (SetPrefix t).toSet := by
187+ theorem disj_PrefixedNumbering {s t : Finset α} (h_st : ¬ s ⊆ t) (h_ts : ¬ t ⊆ s) :
188+ Disjoint (PrefixedNumbering s).toSet (PrefixedNumbering t).toSet := by
186189 refine Set.disjoint_iff.mpr ?_
187190 intro p
188191 simp only [mem_inter_iff, Finset.mem_coe, mem_empty_iff_false, imp_false, not_and]
189- simp [SetPrefix ]
192+ simp [PrefixedNumbering ]
190193 intro h_s h_t
191194 rcases Nat.le_total s.card t.card with h_st' | h_ts'
192- · exact h_st (is_prefix_subset h_s h_t h_st')
193- · exact h_ts (is_prefix_subset h_t h_s h_ts')
195+ · exact h_st (subset_IsPrefix_IsPrefix h_s h_t h_st')
196+ · exact h_ts (subset_IsPrefix_IsPrefix h_t h_s h_ts')
194197
195198variable {𝓐 : Finset (Finset α)}
196199
197- theorem antichain_union_prob (h𝓐 : IsAntichain (· ⊆ ·) 𝓐.toSet) :
198- uniformOn Set.univ (⋃ s ∈ 𝓐, (SetPrefix s).toSet) =
199- ∑ s ∈ 𝓐, uniformOn Set.univ (SetPrefix s).toSet := by
200- have hd : 𝓐.toSet.PairwiseDisjoint (fun s ↦ (SetPrefix s).toSet) := by
200+ theorem prob_biUnion_antichain (h𝓐 : IsAntichain (· ⊆ ·) 𝓐.toSet) :
201+ uniformOn Set.univ (⋃ s ∈ 𝓐, (PrefixedNumbering s).toSet) =
202+ ∑ s ∈ 𝓐, uniformOn Set.univ (PrefixedNumbering s).toSet := by
203+ have hd : 𝓐.toSet.PairwiseDisjoint (fun s ↦ (PrefixedNumbering s).toSet) := by
201204 intro s h_s t h_t h_ne
202205 simp only [Function.onFun]
203206 have h_st := h𝓐 h_s h_t h_ne
204207 have h_ts := h𝓐 h_t h_s h_ne.symm
205- exact set_prefix_disj h_st h_ts
206- have hm : ∀ s ∈ 𝓐, MeasurableSet (SetPrefix s).toSet := by
208+ exact disj_PrefixedNumbering h_st h_ts
209+ have hm : ∀ s ∈ 𝓐, MeasurableSet (PrefixedNumbering s).toSet := by
207210 intro s h_s ; exact trivial
208211 rw [measure_biUnion_finset hd hm (μ := uniformOn Set.univ)]
209212
210213theorem LYM_inequality (h𝓐 : IsAntichain (· ⊆ ·) 𝓐.toSet) :
211214 ∑ s ∈ 𝓐, ((1 : ENNReal) / (card α).choose s.card) ≤ 1 := by
212215 have h1 : ∀ s ∈ 𝓐,
213- (1 : ENNReal) / (card α).choose s.card = uniformOn Set.univ (SetPrefix s).toSet := by
216+ (1 : ENNReal) / (card α).choose s.card = uniformOn Set.univ (PrefixedNumbering s).toSet := by
214217 intro s h_s
215- rw [set_prefix_prob ]
216- rw [Finset.sum_congr (rfl : 𝓐 = 𝓐) h1, ← antichain_union_prob h𝓐]
218+ rw [prob_PrefixedNumbering ]
219+ rw [Finset.sum_congr (rfl : 𝓐 = 𝓐) h1, ← prob_biUnion_antichain h𝓐]
217220 exact prob_le_one
218221
219222end
0 commit comments