File size: 2,688 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | import OAI.NumberTheory.Jacobsthal.Estimates.FiniteSampleSpace
namespace OAI
namespace Erdos970
section
namespace ErdosInverseSampling
attribute [local instance] Classical.decEq
theorem sample_length_le (n h : β) (beta : β) (hb : 0 < beta) (hb1 : beta β€ 1)
(hsize : 4*(h : β)/beta β€ (n : β)) : h β€ n := by
have hh := (div_le_iffβ hb).mp hsize
have hbmul := mul_le_mul_of_nonneg_right hb1 (Nat.cast_nonneg n : (0 : β) β€ n)
have hr : (h : β) β€ n := by nlinarith [show (0 : β) β€ h from Nat.cast_nonneg h]
exact_mod_cast hr
theorem falling_ratio_lower (n m h : β) (beta : β) (hb : 0 < beta) (hb1 : beta β€ 1)
(hgood : (beta/2)*(n : β) β€ (m : β))
(hsize : 4*(h : β)/beta β€ (n : β)) :
(beta/4)^h β€ (m.descFactorial h : β)/(n.descFactorial h : β) := by
have hhn := sample_length_le n h beta hb hb1 hsize
have hpay := (div_le_iffβ hb).mp hsize
have hhm : h β€ m := by
have hh : (h : β) β€ m := by nlinarith [show (0 : β) β€ h from Nat.cast_nonneg h]
exact_mod_cast hh
have hnum : ((beta/4)*(n : β))^h β€ (m.descFactorial h : β) := by
rw [Nat.descFactorial_eq_prod_range,Nat.cast_prod]
calc
_ = β _i β Finset.range h,(beta/4)*(n : β) := by simp
_ β€ β i β Finset.range h,((m-i : β) : β) := by
apply Finset.prod_le_prodβ (fun _ _ => by positivity)
intro i hi
have hih : i < h := Finset.mem_range.mp hi
have him : i β€ m := by omega
rw [Nat.cast_sub him]
have hiR : (i : β) β€ h := by exact_mod_cast hih.le
nlinarith
have hden : (n.descFactorial h : β) β€ (n : β)^h := by
exact_mod_cast Nat.descFactorial_le_pow n h
have hdenpos : (0 : β) < n.descFactorial h := by exact_mod_cast Nat.descFactorial_pos.mpr hhn
apply (le_div_iffβ hdenpos).mpr
calc
_ β€ (beta/4)^h*(n : β)^h := mul_le_mul_of_nonneg_left hden (by positivity)
_ = ((beta/4)*(n : β))^h := by rw [mul_pow]
_ β€ _ := hnum
theorem sampleFrequency_lower {Ξ± : Type*} (U W : Finset Ξ±) (hWU : W β U) (h : β)
(beta : β) (hb : 0 < beta) (hb1 : beta β€ 1)
(hgood : (beta/2)*(U.card : β) β€ (W.card : β))
(hsize : 4*(h : β)/beta β€ (U.card : β)) :
(beta/4)^h β€ sampleFrequency U W h := by
rw [sampleFrequency_eq U W hWU h]
exact falling_ratio_lower U.card W.card h beta hb hb1 hgood hsize
theorem sample_nonempty_of_length {Ξ± : Type*} (U : Finset Ξ±) (h : β) (hh : h β€ U.card) :
Nonempty (Sample U h) := by
apply Fintype.card_pos_iff.mp
rw [sample_card]
exact Nat.descFactorial_pos.mpr hh
end ErdosInverseSampling
end
end Erdos970
end OAI
|