Download data/lean/OAI/Combinatorics/BalancedRyser/Probability/DistinctPairs.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Probability/DistinctPairs.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/BalancedRyser/Probability/DistinctPairs.lean
-
curl -L -o DistinctPairs.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Probability/DistinctPairs.lean
3.3 kB
| import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds | |
| import Mathlib.Data.Fintype.CardEmbedding | |
| import Mathlib.Tactic | |
| import OAI.Combinatorics.BalancedRyser.Candidates.ConstituentOffsets | |
| namespace OAI | |
| open Filter | |
| open scoped Topology | |
| open scoped Classical | |
| namespace Balanced | |
| open scoped _root_.Balanced | |
| noncomputable section | |
| theorem card_distinct_pairs (K : Type*) [Fintype K] : | |
| Fintype.card {p : K Γ K // p.1 β p.2} = | |
| Fintype.card K * (Fintype.card K - 1) := by | |
| classical | |
| let e : {p : K Γ K // p.1 β p.2} β (Ξ£ x : K, {y : K // y β x}) := | |
| { toFun := fun p => β¨p.1.1, p.1.2, Ne.symm p.2β© | |
| invFun := fun p => β¨(p.1, p.2.1), Ne.symm p.2.2β© | |
| left_inv := fun p => by cases p; rfl | |
| right_inv := fun p => by cases p; rfl } | |
| rw [Fintype.card_congr e, Fintype.card_sigma] | |
| simp | |
| theorem card_allConstituentPairsDistinct (D K : Type*) [Fintype D] [Fintype K] : | |
| Fintype.card {M : ConstituentOffsets D K // AllConstituentPairsDistinct M} = | |
| (Fintype.card K * (Fintype.card K - 1)) ^ Fintype.card D := by | |
| classical | |
| let e : {M : ConstituentOffsets D K // AllConstituentPairsDistinct M} β | |
| (D β {p : K Γ K // p.1 β p.2}) := | |
| { toFun := fun M d => β¨M.1 d, M.2 dβ© | |
| invFun := fun M => β¨fun d => (M d).1, fun d => (M d).2β© | |
| left_inv := fun M => rfl | |
| right_inv := fun M => rfl } | |
| calc | |
| _ = Fintype.card (D β {p : K Γ K // p.1 β p.2}) := Fintype.card_congr e | |
| _ = _ := by | |
| rw [Fintype.card_fun] | |
| exact congrArg (fun n => n ^ Fintype.card D) (card_distinct_pairs K) | |
| theorem finiteUniformProbability_eq_toOuterMeasure {Ξ© : Type*} [Fintype Ξ©] | |
| [Nonempty Ξ©] (E : Ξ© β Prop) : | |
| finiteUniformProbability E = | |
| ((PMF.uniformOfFintype Ξ©).toOuterMeasure {Ο | E Ο}).toReal := by | |
| rw [PMF.toOuterMeasure_uniformOfFintype_apply] | |
| simp only [finiteUniformProbability, ENNReal.toReal_div, ENNReal.toReal_natCast, | |
| Fintype.card_eq_nat_card] | |
| rfl | |
| theorem distinctConstituentProbability_eq (q : β) (hq : 0 < q) : | |
| distinctConstituentProbability q = (1 - 1 / (q : β)) ^ (q + 1) := by | |
| unfold distinctConstituentProbability finiteUniformProbability | |
| have hc := card_allConstituentPairsDistinct (Fin (q + 1)) (Fin q) | |
| rw [Fintype.card_eq_nat_card] at hc | |
| rw [hc] | |
| rw [Nat.card_eq_fintype_card] | |
| simp only [Fintype.card_fun, Fintype.card_prod, Fintype.card_fin, | |
| Nat.cast_pow, Nat.cast_mul] | |
| rw [β div_pow] | |
| congr 1 | |
| rw [Nat.cast_sub (by omega : 1 β€ q), Nat.cast_one] | |
| have hq0 : (q : β) β 0 := by positivity | |
| field_simp | |
| theorem tendsto_distinctConstituentProbability : | |
| Tendsto distinctConstituentProbability atTop (π (Real.exp (-1))) := by | |
| have hβ : Tendsto (fun q : β => 1 - 1 / (q : β)) atTop (π (1 : β)) := by | |
| simpa using tendsto_const_nhds.sub | |
| (tendsto_one_div_atTop_nhds_zero_nat (π := β)) | |
| have hβ : Tendsto (fun q : β => (1 - 1 / (q : β)) ^ q) | |
| atTop (π (Real.exp (-1))) := by | |
| simpa only [neg_div, one_div, sub_eq_add_neg] using | |
| Real.tendsto_one_add_div_pow_exp (-1) | |
| have h := hβ.mul hβ | |
| simp only [mul_one] at h | |
| apply h.congr' | |
| filter_upwards [eventually_ge_atTop 1] with q hq | |
| rw [distinctConstituentProbability_eq q (by omega), pow_succ] | |
| end | |
| end Balanced | |
| end OAI | |