Download data/lean/OAI/Combinatorics/MatchingCount/Probability/FinitePMF.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 21.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/FinitePMF.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Probability/FinitePMF.lean
-
curl -L -o FinitePMF.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/FinitePMF.lean
21.3 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Graphs.RowPeak | |
| namespace OAI | |
| namespace MatchingFPRAS.Concentration | |
| open MeasureTheory ProbabilityTheory Finset | |
| variable {Ξ© I J : Type*} [MeasurableSpace Ξ©] [Fintype I] | |
| variable {ΞΌ : Measure Ξ©} [IsProbabilityMeasure ΞΌ] | |
| theorem hoeffding_mean (X : I β Ξ© β β) (hi : iIndepFun X ΞΌ) | |
| (hm : β i,AEMeasurable (X i) ΞΌ) (hb : β i,βα΅ Ο βΞΌ,X i ΟβSet.Icc (0:β) 1) | |
| (m : β) (hmean : β i,(β« Ο,X i Ο βΞΌ)=m) | |
| (hI : 0<Fintype.card I) (t : β) (ht : 0β€t) : | |
| ΞΌ.real {Ο | t < |(β i,X i Ο)/(Fintype.card I : β)-m|} β€ | |
| 2*Real.exp (-2*(Fintype.card I : β)*t^2) := by | |
| classical | |
| have hN : (0:β)<Fintype.card I := Nat.cast_pos.mpr hI | |
| have hc (i : I) : HasSubgaussianMGF (fun Ο => X i Ο-m) (1/4) ΞΌ := by | |
| have h := hasSubgaussianMGF_of_mem_Icc (hm i) (hb i) | |
| rw [hmean i] at h | |
| norm_num at h β’ | |
| exact h | |
| have hind : iIndepFun (fun i Ο => X i Ο-m) ΞΌ := by | |
| exact hi.comp (fun _ x => x-m) (fun _ => by fun_prop) | |
| have hs : HasSubgaussianMGF (fun Ο => β i,(X i Ο-m)) | |
| ((Fintype.card I : NNReal)/4) ΞΌ := by | |
| simpa only [Finset.sum_const,nsmul_eq_mul,mul_one_div,Finset.card_univ] using HasSubgaussianMGF.sum_of_iIndepFun hind (s:=univ) (fun i _ => hc i) | |
| have hh := hs.measure_ge_le (mul_nonneg hN.le ht) | |
| have hl := hs.neg.measure_ge_le (mul_nonneg hN.le ht) | |
| have he : -((Fintype.card I : β)*t)^2 / | |
| (2*((Fintype.card I : NNReal)/4 : NNReal)) = -2*(Fintype.card I : β)*t^2 := by | |
| push_cast | |
| field_simp [ne_of_gt hN] | |
| ring | |
| rw [he] at hh hl | |
| calc | |
| _ β€ ΞΌ.real ({Ο | (Fintype.card I : β)*t β€ β i,(X i Ο-m)} βͺ | |
| {Ο | (Fintype.card I : β)*t β€ -(β i,(X i Ο-m))}) := by | |
| refine measureReal_mono ?_ (by finiteness) | |
| intro Ο hΟ | |
| simp only [Set.mem_ofPred_eq,Set.mem_union] at hΟ β’ | |
| by_cases h : (Fintype.card I : β)*t β€ β i,(X i Ο-m) | |
| Β· exact Or.inl h | |
| Β· right | |
| simp only [sum_sub_distrib,sum_const,nsmul_eq_mul,Finset.card_univ] at h β’ | |
| rcases lt_abs.mp hΟ with hv | hv | |
| Β· have hv' := (lt_div_iffβ hN).mp (by linarith : m+t < (β i,X i Ο)/(Fintype.card I : β)) | |
| nlinarith | |
| Β· have hv' := (div_lt_iffβ hN).mp (by linarith : (β i,X i Ο)/(Fintype.card I : β) < m-t) | |
| nlinarith | |
| _ β€ ΞΌ.real {Ο | (Fintype.card I : β)*t β€ β i,(X i Ο-m)} + | |
| ΞΌ.real {Ο | (Fintype.card I : β)*t β€ -(β i,(X i Ο-m))} := measureReal_union_le _ _ | |
| _ β€ _ := by simpa only [Pi.neg_apply, two_mul] using add_le_add hh hl | |
| theorem hoeffding_observables [Fintype J] (X : J β I β Ξ© β β) | |
| (hi : β j,iIndepFun (X j) ΞΌ) (hm : β j i,AEMeasurable (X j i) ΞΌ) | |
| (hb : β j i,βα΅ Ο βΞΌ,X j i ΟβSet.Icc (0:β) 1) | |
| (m : J β β) (hmean : β j i,(β« Ο,X j i Ο βΞΌ)=m j) | |
| (hI : 0<Fintype.card I) (t : β) (ht : 0β€t) : | |
| ΞΌ.real {Ο | β j,t < |(β i,X j i Ο)/(Fintype.card I : β)-m j|} β€ | |
| 2*(Fintype.card J : β)*Real.exp (-2*(Fintype.card I : β)*t^2) := by | |
| classical | |
| have he : {Ο | β j,t < |(β i,X j i Ο)/(Fintype.card I : β)-m j|} = | |
| β j,{Ο | t < |(β i,X j i Ο)/(Fintype.card I : β)-m j|} := by ext; simp | |
| rw [he] | |
| apply (measureReal_iUnion_fintype_le _).trans | |
| calc | |
| _ β€ β _ : J,2*Real.exp (-2*(Fintype.card I : β)*t^2) := by | |
| apply sum_le_sum | |
| intro j hj | |
| exact hoeffding_mean (X j) (hi j) (hm j) (hb j) (m j) (hmean j) hI t ht | |
| _ = _ := by simp; ring | |
| open MeasureTheory ProbabilityTheory Finset | |
| open scoped Classical | |
| variable {Ξ© I J : Type*} [Fintype Ξ©] [Fintype I] [Fintype J] | |
| noncomputable def finitePMF (p : Ξ© β β) (hp : β x,0 β€ p x) (hs : β x,p x=1) : PMF Ξ© := | |
| PMF.ofFintype (fun x => ENNReal.ofReal (p x)) (by | |
| rw [βENNReal.ofReal_sum_of_nonneg (fun x _ => hp x),hs] | |
| simp) | |
| lemma finitePMF_apply (p : Ξ© β β) (hp : β x,0 β€ p x) (hs : β x,p x=1) (x : Ξ©) : | |
| (finitePMF p hp hs x).toReal=p x := by simp [finitePMF,hp x] | |
| theorem finite_hoeffding [DecidableEq I] (p : Ξ© β β) (hp : β x,0 β€ p x) (hs : β x,p x=1) | |
| (f : J β Ξ© β β) (hf : β j x,f j xβSet.Icc (0:β) 1) | |
| (hI : 0<Fintype.card I) (t : β) (ht : 0β€t) : | |
| β v : I β Ξ©,(if β j,t < |(β i,f j (v i))/(Fintype.card I : β)-β x,p x*f j x| | |
| then β i,p (v i) else 0) β€ | |
| 2*(Fintype.card J : β)*Real.exp (-2*(Fintype.card I : β)*t^2) := by | |
| classical | |
| let : MeasurableSpace Ξ© := β€ | |
| let q := finitePMF p hp hs | |
| let ΞΌ : Measure (I β Ξ©) := Measure.pi (fun _ : I => q.toMeasure) | |
| have hi (j : J) : iIndepFun (fun i (v : I β Ξ©) => f j (v i)) ΞΌ := by | |
| exact iIndepFun_pi (fun _ : I => (measurable_of_finite (f j)).aemeasurable) | |
| have hm (j : J) (i : I) : AEMeasurable (fun v : I β Ξ© => f j (v i)) ΞΌ := | |
| (measurable_of_finite _).aemeasurable | |
| have hb (j : J) (i : I) : βα΅ v βΞΌ,f j (v i)βSet.Icc (0:β) 1 := | |
| Filter.Eventually.of_forall (fun v => hf j (v i)) | |
| have he (j : J) (i : I) : (β« v,f j (v i) βΞΌ)=β x,p x*f j x := by | |
| have hev := (measurePreserving_eval (fun _ : I => q.toMeasure) i).map_eq | |
| have hmap := integral_map ((measurable_of_finite (Function.eval i)).aemeasurable (ΞΌ:=ΞΌ)) | |
| ((measurable_of_finite (f j)).aestronglyMeasurable (ΞΌ:=Measure.map (Function.eval i) ΞΌ)) | |
| rw [hev] at hmap | |
| rw [βhmap, PMF.integral_eq_sum] | |
| apply sum_congr rfl | |
| intro x hx | |
| simp [q,finitePMF_apply,smul_eq_mul] | |
| have h := hoeffding_observables (ΞΌ:=ΞΌ) (fun j i v => f j (v i)) hi hm hb | |
| (fun j => β x,p x*f j x) he hI t ht | |
| have hsingle (v : I β Ξ©) : ΞΌ.real {v}=β i,p (v i) := by | |
| simp only [Measure.real,ΞΌ,Measure.pi_singleton,ENNReal.toReal_prod] | |
| apply prod_congr rfl | |
| intro i hi | |
| simp [q,finitePMF,hp (v i)] | |
| let B : Finset (I β Ξ©) := univ.filter (fun v => β j,t < |(β i,f j (v i))/(Fintype.card I : β)-β x,p x*f j x|) | |
| have hB : (B : Set (I β Ξ©))={v | β j,t < |(β i,f j (v i))/(Fintype.card I : β)-β x,p x*f j x|} := by | |
| ext v; simp [B] | |
| rw [βhB,βsum_measureReal_singleton] at h | |
| simpa only [hsingle, B, sum_filter] using h | |
| lemma observables_exp_tail (n K : β) (hK : 0<K) : | |
| 2*((n:β)^2+2)*Real.exp (-20*((n:β)+K+1)) < 1/(100*K) := by | |
| have hK0 : (0:β)<K := Nat.cast_pos.mpr hK | |
| have hn0 : (0:β)β€n := Nat.cast_nonneg n | |
| have h1 : (2:β)β€Real.exp 1 := by linarith [Real.add_one_le_exp (1:β)] | |
| have hc : (200:β)<Real.exp 8 := by | |
| calc | |
| (200:β) < 2^8 := by norm_num | |
| _ β€ (Real.exp 1)^8 := pow_le_pow_leftβ (by norm_num) h1 _ | |
| _ = Real.exp 8 := by rw [β Real.exp_nat_mul]; norm_num | |
| have hn : (n:β)^2+2β€Real.exp (2*((n:β)+1)) := by | |
| have h := Real.add_one_le_exp ((n:β)+1) | |
| have hh : 0β€(n:β)+2 := by positivity | |
| calc | |
| _ β€ ((n:β)+2)^2 := by nlinarith | |
| _ β€ (Real.exp ((n:β)+1))^2 := pow_le_pow_leftβ hh (by linarith) _ | |
| _ = _ := by rw [β Real.exp_nat_mul]; norm_num | |
| have hk : (K:β)β€Real.exp (K:β) := by linarith [Real.add_one_le_exp (K:β)] | |
| have hprod : 200*(K:β)*((n:β)^2+2)<Real.exp (20*((n:β)+K+1)) := by | |
| calc | |
| _ β€ 200*Real.exp (K:β)*Real.exp (2*((n:β)+1)) := by gcongr | |
| _ < Real.exp 8*Real.exp (K:β)*Real.exp (2*((n:β)+1)) := by gcongr | |
| _ = Real.exp (8+(K:β)+2*((n:β)+1)) := by rw [Real.exp_add,Real.exp_add] | |
| _ < _ := Real.exp_lt_exp.mpr (by nlinarith) | |
| have he : 0<Real.exp (20*((n:β)+K+1)) := Real.exp_pos _ | |
| rw [show -20*((n:β)+K+1)= -(20*((n:β)+K+1)) by ring,Real.exp_neg] | |
| apply (lt_div_iffβ (by positivity : (0:β)<100*K)).mpr | |
| rw [β div_eq_mul_inv, (div_mul_eq_mul_div), div_lt_one he] | |
| nlinarith [hprod] | |
| lemma stage_hoeffding_budget (n K S : β) (hK : 0<K) (sigma : β) | |
| (hS : 10*((n:β)+K+1)β€(S:β)*sigma^2) : | |
| 2*((n:β)^2+2)*Real.exp (-2*(S:β)*sigma^2)<1/(100*K) := by | |
| apply lt_of_le_of_lt _ (observables_exp_tail n K hK) | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| apply Real.exp_le_exp.mpr | |
| nlinarith | |
| def trials (ell : β) : β := 10*(ell+1)+1 | |
| lemma median_tail (ell : β) : | |
| Real.exp (-2*(4/10:β)^2*(trials ell)) < (2:β)^(-(ell:β€)) := by | |
| have hlog : Real.log 2<1 := by | |
| rw [Real.log_lt_iff_lt_exp (by norm_num)] | |
| have hx := Real.add_one_lt_exp (by norm_num : (1:β)β 0) | |
| norm_num at hx | |
| exact hx | |
| have he : Real.exp (-((ell:β)*Real.log 2))=(2:β)^(-(ell:β€)) := by | |
| rw [Real.exp_neg,Real.exp_nat_mul,Real.exp_log (by norm_num : (0:β)<2)] | |
| simp | |
| rw [β he] | |
| apply Real.exp_lt_exp.mpr | |
| have hh := mul_le_mul_of_nonneg_left hlog.le (Nat.cast_nonneg ell : (0:β)β€ell) | |
| dsimp [trials] | |
| push_cast | |
| norm_num at * | |
| nlinarith [(Nat.cast_nonneg ell : (0:β)β€ell)] | |
| end MatchingFPRAS.Concentration | |
| namespace MatchingFPRAS.Enlargement | |
| open MatchingFPRAS.Switching MatchingFPRAS.Subdivision MatchingFPRAS.RealGeometry | |
| open MatchingFPRAS.Hierarchy MatchingFPRAS.Transport MatchingFPRAS.StageAnalysis Finset | |
| open scoped Classical | |
| variable {V : Type*} [Fintype V] [LinearOrder V] [Nontrivial V] | |
| noncomputable local instance (w : V β V β β) (K : β) : DecidableEq (SourceLabel w K) := Classical.decEq _ | |
| noncomputable local instance (w : V β V β β) (K : β) : Fintype (BagEdge (sourceBags w K)) := Fintype.ofFinite _ | |
| omit [Fintype V] [Nontrivial V] in | |
| lemma logicalActivity_le_off (w wβ : V β V β β) | |
| (h : β i j,iβ j β wβ i j β€ w i j) (e : LogicalEdge V) : | |
| logicalActivity wβ e β€ logicalActivity w e := by | |
| unfold logicalActivity edgeActivity | |
| split_ifs | |
| Β· exact h _ _ e.property.ne | |
| Β· exact h _ _ e.property.ne.symm | |
| lemma bagReweight_range_off (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (K : β) (e : BagEdge (sourceBags w K)) : | |
| 0 β€ bagReweight w wβ K e β§ bagReweight w wβ K e β€ 1 := by | |
| unfold bagReweight | |
| split_ifs with he | |
| Β· unfold rawReweight | |
| split_ifs | |
| Β· have hβ : 0 < logicalActivity w he.choose.1 := by | |
| unfold logicalActivity edgeActivity; split_ifs <;> exact hw _ _ | |
| have hβ : 0 β€ logicalActivity wβ he.choose.1 := by | |
| unfold logicalActivity edgeActivity; split_ifs <;> exact hwβ _ _ | |
| exact β¨div_nonneg hβ hβ.le,(div_le_one hβ).mpr (logicalActivity_le_off w wβ hle _)β© | |
| Β· norm_num | |
| Β· norm_num | |
| lemma observableD_range_off (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (K : β) (a : SourceMarked w K) : | |
| 0 β€ observableD w wβ K a β§ observableD w wβ K a β€ 1 := by | |
| unfold observableD | |
| split_ifs | |
| Β· exact β¨Finset.prod_nonneg (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).1), | |
| Finset.prod_le_oneβ (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).1) | |
| (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).2)β© | |
| Β· norm_num | |
| lemma observableProbe_range_off (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (K : β) (eβ : LogicalEdge V) (a : SourceMarked w K) : | |
| 0 β€ observableProbe w wβ K eβ a β§ observableProbe w wβ K eβ a β€ 1 := by | |
| unfold observableProbe | |
| split_ifs | |
| Β· exact β¨Finset.prod_nonneg (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).1), | |
| Finset.prod_le_oneβ (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).1) | |
| (fun e _ => (bagReweight_range_off w wβ hw hwβ hle K e).2)β© | |
| Β· norm_num | |
| abbrev ObservableIndex (V : Type*) [LinearOrder V] := Fin 2 β LogicalEdge V | |
| noncomputable def sourceObservable (w wβ : V β V β β) (K : β) : | |
| ObservableIndex V β SourceMarked w K β β | |
| | Sum.inl i => if i=0 then observableA w K else observableD w wβ K | |
| | Sum.inr e => observableProbe w wβ K e | |
| lemma sourceObservable_range (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (K : β) (j : ObservableIndex V) (a : SourceMarked w K) : | |
| sourceObservable w wβ K j aβSet.Icc (0:β) 1 := by | |
| cases j with | |
| | inl i => | |
| dsimp [sourceObservable] | |
| split_ifs | |
| Β· exact observableA_range w K a | |
| Β· exact observableD_range_off w wβ hw hwβ hle K a | |
| | inr e => exact observableProbe_range_off w wβ hw hwβ hle K e a | |
| omit [Nontrivial V] in | |
| lemma observableIndex_card : Fintype.card (ObservableIndex V) β€ (Fintype.card V)^2+2 := by | |
| have h := Fintype.card_subtype_le (fun e : VΓV => e.1<e.2) | |
| change Fintype.card (LogicalEdge V) β€ Fintype.card (VΓV) at h | |
| simp only [Fintype.card_prod] at h | |
| simpa only [ObservableIndex,Fintype.card_sum,Fintype.card_fin,pow_two,Nat.add_comm] using Nat.add_le_add_left h 2 | |
| noncomputable def sampleAverage {Ξ© : Type*} {S : β} (f : Ξ© β β) (x : Fin S β Ξ©) : β := | |
| (β i,f (x i))/(S:β) | |
| noncomputable def sourceMean (w wβ : V β V β β) (K : β) (j : ObservableIndex V) : β := | |
| β x : SourceMarked w K,sourceLaw w K (sourceD (V:=V) K) x*sourceObservable w wβ K j x | |
| def StageGood {S : β} (w wβ : V β V β β) (K : β) (Ο : β) (x : Fin S β SourceMarked w K) : Prop := | |
| β j : ObservableIndex V, |sampleAverage (sourceObservable w wβ K j) x-sourceMean w wβ K j| β€ Ο | |
| theorem source_ideal_concentration (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (hz : 0 < partition w β ) (K S : β) (hS : 0<S) (Ο : β) (hΟ : 0β€Ο) : | |
| β x : Fin S β SourceMarked w K,(if Β¬StageGood w wβ K Ο x | |
| then β i,sourceLaw w K (sourceD (V:=V) K) (x i) else 0) β€ | |
| 2*((Fintype.card V:β)^2+2)*Real.exp (-2*(S:β)*Ο^2) := by | |
| have hp := sourceBagZ_pos w hw hz K (sourceD (V:=V) K) | |
| have h := MatchingFPRAS.Concentration.finite_hoeffding (I:=Fin S) | |
| (sourceLaw w K (sourceD (V:=V) K)) (sourceLaw_nonneg w hw K _ hp.le) | |
| (sourceLaw_sum w K _ hp.ne') (sourceObservable w wβ K) (sourceObservable_range w wβ hw hwβ hle K) | |
| (by simpa using hS) Ο hΟ | |
| have he : β x : Fin S β SourceMarked w K, | |
| (Β¬StageGood w wβ K Ο x) β | |
| (β j,Ο < |(β i,sourceObservable w wβ K j (x i))/(Fintype.card (Fin S):β)- | |
| β a,sourceLaw w K (sourceD (V:=V) K) a*sourceObservable w wβ K j a|) := by | |
| intro x | |
| simp only [StageGood,not_forall,not_le,sampleAverage,sourceMean,Fintype.card_fin] | |
| simp_rw [he] at β’ | |
| apply h.trans | |
| have hc : (Fintype.card (ObservableIndex V):β) β€ (Fintype.card V:β)^2+2 := by | |
| exact_mod_cast (observableIndex_card (V:=V)) | |
| simpa only [Fintype.card_fin] using mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hc (by norm_num)) (Real.exp_pos _).le | |
| variable {n K T S : β} [Nontrivial (Fin n)] | |
| noncomputable def empiricalData (c : StageData n K T) (x : Fin S β SourceMarked c.w K) | |
| (h : StageGood c.w c.next K (RealStage.sigma (sourceD (V:=Fin n) K) T c.epsilon) x) : EmpiricalData c where | |
| abar := sampleAverage (observableA c.w K) x | |
| dbar := sampleAverage (observableD c.w c.next K) x | |
| zbar e := sampleAverage (observableProbe c.w c.next K e) x | |
| errorA := by simpa only [sourceObservable,ite_true,sourceMean,meanA] using h (Sum.inl 0) | |
| errorD := by simpa only [sourceObservable,show (1:Fin 2)β 0 by decide,ite_false,sourceMean,meanD] using h (Sum.inl 1) | |
| errorProbe e := by simpa only [sourceObservable,sourceMean,meanProbe] using h (Sum.inr e) | |
| lemma StageData.sigma_pos (c : StageData n K T) : 0 < RealStage.sigma (sourceD (V:=Fin n) K) T c.epsilon := by | |
| unfold RealStage.sigma RealStage.alpha | |
| have hD : 0 < sourceD (V:=Fin n) K := sourceD_one K | |
| have ht : 0 < T := c.stages | |
| have he := c.epsilon_positive | |
| exact lt_min (by positivity) (by positivity) | |
| noncomputable def stageSampleCount (n D T : β) (Ξ΅ : β) : β := | |
| β10*((RealStage.sigma D T Ξ΅)β»ΒΉ)^2*((n:β)+T+1)ββ | |
| lemma StageData.sampleCount_pos (c : StageData n K T) : | |
| 0 < stageSampleCount n (sourceD (V:=Fin n) K) T c.epsilon := by | |
| unfold stageSampleCount | |
| apply Nat.ceil_pos.mpr | |
| have hs := c.sigma_pos | |
| positivity | |
| lemma StageData.sampleCount_bound (c : StageData n K T) : | |
| 10*((n:β)+T+1) β€ | |
| (stageSampleCount n (sourceD (V:=Fin n) K) T c.epsilon:β)* | |
| (RealStage.sigma (sourceD (V:=Fin n) K) T c.epsilon)^2 := by | |
| have hs := c.sigma_pos | |
| have h := mul_le_mul_of_nonneg_right | |
| (Nat.le_ceil (10*((RealStage.sigma (sourceD (V:=Fin n) K) T c.epsilon)β»ΒΉ)^2*((n:β)+T+1))) | |
| (sq_nonneg (RealStage.sigma (sourceD (V:=Fin n) K) T c.epsilon)) | |
| convert h using 1 | |
| all_goals first | rfl | field_simp [ne_of_gt hs] | |
| theorem source_ideal_budget (w wβ : V β V β β) (hw : β x y,0 < w x y) | |
| (hwβ : β x y,0 β€ wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (hz : 0 < partition w β ) (K T S : β) (hT : 0<T) (hS : 0<S) | |
| (Ο : β) (hΟ : 0β€Ο) (hsize : 10*((Fintype.card V:β)+T+1) β€ (S:β)*Ο^2) : | |
| β x : Fin S β SourceMarked w K,(if Β¬StageGood w wβ K Ο x | |
| then β i,sourceLaw w K (sourceD (V:=V) K) (x i) else 0) < 1/(100*T) := by | |
| exact (source_ideal_concentration w wβ hw hwβ hle hz K S hS Ο hΟ).trans_lt | |
| (MatchingFPRAS.Concentration.stage_hoeffding_budget (Fintype.card V) T S hT Ο hsize) | |
| open MatchingFPRAS.Switching MatchingFPRAS.Subdivision MatchingFPRAS.RealGeometry | |
| open MatchingFPRAS.Hierarchy MatchingFPRAS.Transport Finset | |
| open MatchingFPRAS.Replica MatchingFPRAS.Replica.Ladder | |
| open scoped Classical | |
| variable {V : Type*} [Fintype V] [LinearOrder V] [Nontrivial V] | |
| noncomputable local instance (w : V β V β β) (K : β) : DecidableEq (SourceLabel w K) := Classical.decEq _ | |
| noncomputable local instance (w : V β V β β) (K : β) : Fintype (BagEdge (sourceBags w K)) := Fintype.ofFinite _ | |
| noncomputable local instance (w : V β V β β) (K : β) : DecidableEq (SourcePM w K) := Classical.decEq _ | |
| theorem source_nearby_budget (w wβ : V β V β β) (hw : β x y,0<w x y) | |
| (hwβ : β x y,0β€wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (hz : 0<Switching.partition w β ) (K T S : β) (hT : 0<T) (hS : 0<S) | |
| (Ο : β) (hΟ : 0β€Ο) (hsize : 10*((Fintype.card V:β)+T+1) β€ (S:β)*Ο^2) | |
| (p : SourceMarked w K β β) (hp : β a,0β€p a) (hpsum : β a,p a=1) | |
| (htv : Variation.tv p (sourceLaw w K (sourceD (V:=V) K)) β€ 3/(1000*T*S)) : | |
| Variation.event (Variation.iid p S) (fun x => Β¬StageGood w wβ K Ο x) < 13/(1000*T) := by | |
| have hpos := sourceBagZ_pos w hw hz K (sourceD (V:=V) K) | |
| have hq := sourceLaw_nonneg w hw K _ hpos.le | |
| have hqs := sourceLaw_sum w K _ hpos.ne' | |
| have hiid := Variation.iid_tv p (sourceLaw w K (sourceD (V:=V) K)) hp hpsum hq hqs S | |
| have he := Variation.event_sub_le (Variation.iid p S) | |
| (Variation.iid (sourceLaw w K (sourceD (V:=V) K)) S) | |
| (by rw [Variation.iid_sum p hpsum,Variation.iid_sum _ hqs]) | |
| (fun x => Β¬StageGood w wβ K Ο x) | |
| have hv := (le_abs_self _).trans (he.trans hiid) | |
| have hh := source_ideal_budget w wβ hw hwβ hle hz K T S hT hS Ο hΟ hsize | |
| have ht := mul_le_mul_of_nonneg_left htv (Nat.cast_nonneg S : (0:β)β€S) | |
| have hid : (1:β)/(100*T)+(S:β)*(3/(1000*T*S))=13/(1000*T) := by | |
| have ht0 : (T:β)β 0 := by exact_mod_cast hT.ne' | |
| have hs0 : (S:β)β 0 := by exact_mod_cast hS.ne' | |
| field_simp | |
| ring | |
| have hh' : Variation.event (Variation.iid (sourceLaw w K (sourceD (V:=V) K)) S) | |
| (fun x => Β¬StageGood w wβ K Ο x) < 1/(100*T) := by | |
| convert hh using 1 | |
| unfold Variation.event Variation.iid | |
| congr 1 | |
| funext x | |
| split_ifs <;> rfl | |
| linarith | |
| theorem source_run_stage_budget (hn : 2 β€ Fintype.card V) | |
| (w wβ : V β V β β) (hw : β x y,0<w x y) | |
| (hwβ : β x y,0β€wβ x y) (hle : β x y,xβ y β wβ x y β€ w x y) | |
| (hz : 0<Switching.partition w β ) (K T S : β) (hT : 0<T) (hS : 0<S) | |
| (hK : β x y,xβ y β edgeActivity w x y β€ (4:β)^K) | |
| (Ο : β) (hΟ : 0β€Ο) (hsize : 10*((Fintype.card V:β)+T+1) β€ (S:β)*Ο^2) | |
| (L : β) (hL : max (sourceD (V:=V) K:β) (3*4^K) β€ (tierBase (SourceVertex V K))^L) | |
| (hq : 0<ladderQ (Fintype.card (SourceVertex V K)) (sourceD (V:=V) K)) | |
| (z : Slot L (ladderQ (Fintype.card (SourceVertex V K)) (sourceD (V:=V) K)) β SourcePM w K) : | |
| let ΞΎ : β := 1/(1000*T*S) | |
| let p := sourceRun w K hK L _ hq z | |
| (ladderSteps (Fintype.card (SourceVertex V K)) (sourceD (V:=V) K) K L ΞΎ) | |
| Variation.event (Variation.iid p S) (fun x => Β¬StageGood w wβ K Ο x) < 13/(1000*T) := by | |
| dsimp only | |
| apply source_nearby_budget w wβ hw hwβ hle hz K T S hT hS Ο hΟ hsize | |
| Β· exact sourceRun_nonneg w hw K hK L _ hq z _ | |
| Β· exact sourceRun_sum w hw K hK L _ hq z _ | |
| Β· have ht : (1:β)β€T := by exact_mod_cast hT | |
| have hs : (1:β)β€S := by exact_mod_cast hS | |
| have hd : (1:β)<1000*T*S := by nlinarith | |
| exact (sourceRun_tv hn w hw K hK L hL hq z _ (by positivity) | |
| ((div_lt_one (by positivity)).mpr hd)).trans (by gcongr; norm_num) | |
| end MatchingFPRAS.Enlargement | |
| end OAI | |