Download data/lean/OAI/Combinatorics/MatchingCount/Probability/Mean.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 17.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/Mean.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Probability/Mean.lean
-
curl -L -o Mean.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/Mean.lean
17.8 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Graphs.Density | |
| namespace OAI | |
| namespace MatchingFPRAS.Replica | |
| section | |
| open Finset | |
| variable {I Ξ© : Type*} [Fintype I] [DecidableEq I] [Fintype Ξ©] | |
| variable (p : I β Ξ© β β) | |
| noncomputable def mean (f : (I β Ξ©) β β) : β := β s, density p s*f s | |
| noncomputable def variance (f : (I β Ξ©) β β) : β := | |
| dot p (f-(fun _ => mean p f)) (f-(fun _ => mean p f)) | |
| lemma mean_dot (f : (I β Ξ©) β β) : mean p f = dot p (fun _ => 1) f := by simp [mean,dot] | |
| lemma density_sum (hs : β i, β a, p i a = 1) : β s, density p s = 1 := by | |
| unfold density | |
| rw [β Fintype.prod_sum] | |
| simp_rw [hs] | |
| simp | |
| lemma mean_average (hs : β i, β a, p i a = 1) (i : I) (f : (I β Ξ©) β β) : | |
| mean p (average p i f) = mean p f := by | |
| rw [mean_dot, β average_adjoint] | |
| have ho : average p i (fun _ => 1) = (fun _ => 1) := by | |
| funext s; simpa [average_apply] using hs i | |
| rw [ho, β mean_dot] | |
| lemma mean_avgList (hs : β i, β a, p i a = 1) (l : List I) (f : (I β Ξ©) β β) : | |
| mean p (avgList p l f) = mean p f := by | |
| induction l with | |
| | nil => rfl | |
| | cons i l ih => rw [avgList_cons,mean_average p hs,ih] | |
| omit [Fintype I] in | |
| lemma average_update (i : I) (a : Ξ©) (f : (I β Ξ©) β β) (s : I β Ξ©) : | |
| average p i f (Function.update s i a) = average p i f s := by | |
| simp only [average_apply,Function.update_idem] | |
| lemma invariant_constant (f : (I β Ξ©) β β) (hf : β i, average p i f = f) | |
| (s t : I β Ξ©) : f s = f t := by | |
| classical | |
| have hu (i : I) (a : Ξ©) (s : I β Ξ©) : f (Function.update s i a) = f s := by | |
| rw [β hf i] | |
| exact average_update p i a f s | |
| have hpatch (S : Finset I) : f (fun i => if i β S then t i else s i) = f s := by | |
| induction S using Finset.induction_on with | |
| | empty => simp | |
| | i S hi ih => | |
| have he : (fun j => if j β insert i S then t j else s j) = | |
| Function.update (fun j => if j β S then t j else s j) i (t i) := by | |
| funext j | |
| by_cases hji : j = i | |
| Β· subst j; simp | |
| Β· simp [hji] | |
| rw [he,hu,ih] | |
| simpa using (hpatch Finset.univ).symm | |
| lemma average_all (hs : β i, β a, p i a = 1) (l : List I) (hl : β i, i β l) | |
| (f : (I β Ξ©) β β) : avgList p l f = (fun _ => mean p f) := by | |
| funext s | |
| have hc : β t, avgList p l f t = avgList p l f s := fun t => | |
| invariant_constant p (avgList p l f) (fun i => average_list_mem p hs l i (hl i) f) t s | |
| have hm := mean_avgList p hs l f | |
| unfold mean at hm | |
| simp_rw [hc] at hm | |
| rw [β Finset.sum_mul,density_sum p hs,one_mul] at hm | |
| exact hm | |
| omit [Fintype I] in | |
| lemma avgList_fixed (l : List I) (f : (I β Ξ©) β β) | |
| (hf : β i β l, average p i f = f) : avgList p l f = f := by | |
| induction l with | |
| | nil => rfl | |
| | cons i l ih => | |
| rw [avgList_cons,ih (fun j hj => hf j (List.mem_cons_of_mem i hj)),hf i (List.mem_cons_self)] | |
| omit [Fintype I] in | |
| lemma avgList_comm_list (l k : List I) (f : (I β Ξ©) β β) : | |
| avgList p l (avgList p k f) = avgList p k (avgList p l f) := by | |
| induction l with | |
| | nil => rfl | |
| | cons i l ih => rw [avgList_cons,ih,average_comm_list,avgList_cons] | |
| omit [Fintype I] in | |
| lemma avgList_congr (hs : β i, β a, p i a = 1) (l k : List I) | |
| (hmem : β i, i β l β i β k) (f : (I β Ξ©) β β) : avgList p l f = avgList p k f := by | |
| have hβ : avgList p l (avgList p k f) = avgList p k f := | |
| avgList_fixed p l _ (fun i hi => average_list_mem p hs k i ((hmem i).mp hi) f) | |
| have hβ : avgList p k (avgList p l f) = avgList p l f := | |
| avgList_fixed p k _ (fun i hi => average_list_mem p hs l i ((hmem i).mpr hi) f) | |
| rw [avgList_comm_list,hβ] at hβ | |
| exact hβ | |
| lemma projection_pythagoras (P : Projection p) (f : (I β Ξ©) β β) : | |
| dot p (f-P.op f) (f-P.op f) = dot p f f-dot p (P.op f) (P.op f) := by | |
| rw [dot_sub_left p f (P.op f) (f-P.op f),dot_sub_right p f f (P.op f), | |
| dot_sub_right p (P.op f) f (P.op f),dot_comm p (P.op f) f,P.dot_image] | |
| ring | |
| end | |
| section | |
| open Finset | |
| variable {I Ξ© : Type*} [Fintype I] [DecidableEq I] [LinearOrder I] | |
| [Fintype Ξ©] | |
| variable (p : I β Ξ© β β) | |
| noncomputable def future (S : Finset I) (x : I) := avgList p ((S.filter (x < Β·)).toList) | |
| noncomputable def increment (S : Finset I) (x : I) (f : (I β Ξ©) β β) : (I β Ξ©) β β := | |
| future p S x f-average p x (future p S x f) | |
| lemma martingale_partial (hs : β i, β a, p i a = 1) (S : Finset I) (f : (I β Ξ©) β β) : | |
| (β x β S, dot p (increment p S x f) (increment p S x f)) = | |
| dot p f f-dot p (avgList p S.toList f) (avgList p S.toList f) := by | |
| classical | |
| induction S using Finset.induction_on_min with | |
| | empty => simp [future,increment,avgList] | |
| | insert a S hmin ih => | |
| have ha : a β S := fun h => (lt_irrefl a) (hmin a h) | |
| have hfilter : (insert a S).filter (a < Β·) = S := by | |
| ext i | |
| simp only [Finset.mem_filter,Finset.mem_insert] | |
| constructor | |
| Β· rintro β¨hi,haiβ©; rcases hi with rfl | hi | |
| Β· exact (lt_irrefl _ hai).elim | |
| Β· exact hi | |
| Β· intro hi; exact β¨Or.inr hi,hmin i hiβ© | |
| have hother (x) (hx : x β S) : (insert a S).filter (x < Β·) = S.filter (x < Β·) := by | |
| ext i | |
| simp only [Finset.mem_filter,Finset.mem_insert] | |
| constructor | |
| Β· rintro β¨hi,hxiβ©; rcases hi with rfl | hi | |
| Β· exact (not_lt_of_gt (hmin x hx) hxi).elim | |
| Β· exact β¨hi,hxiβ© | |
| Β· rintro β¨hi,hxiβ©; exact β¨Or.inr hi,hxiβ© | |
| have hc : avgList p (insert a S).toList f = average p a (avgList p S.toList f) := by | |
| change avgList p (insert a S).toList f = avgList p (a::S.toList) f | |
| apply avgList_congr p hs | |
| intro i; simp | |
| rw [Finset.sum_insert ha,hc] | |
| have hsum : (β x β S, dot p (increment p (insert a S) x f) | |
| (increment p (insert a S) x f)) = β x β S, dot p (increment p S x f) (increment p S x f) := by | |
| apply Finset.sum_congr rfl | |
| intro x hx | |
| simp only [increment,future,hother x hx] | |
| rw [hsum,ih] | |
| have hp := projection_pythagoras p (avgProjection p hs a) (avgList p S.toList f) | |
| change dot p (increment p (insert a S) a f) (increment p (insert a S) a f) + _ = _ | |
| unfold increment future | |
| rw [hfilter] | |
| change dot p (avgList p S.toList f-average p a (avgList p S.toList f)) | |
| (avgList p S.toList f-average p a (avgList p S.toList f)) = | |
| dot p (avgList p S.toList f) (avgList p S.toList f)- | |
| dot p (average p a (avgList p S.toList f)) (average p a (avgList p S.toList f)) at hp | |
| linarith | |
| lemma martingale_variance (hs : β i, β a, p i a = 1) (f : (I β Ξ©) β β) : | |
| variance p f = β x, dot p (increment p Finset.univ x f) (increment p Finset.univ x f) := by | |
| rw [martingale_partial p hs] | |
| have hp := projection_pythagoras p (listProjection p hs Finset.univ.toList) f | |
| change dot p (f-avgList p Finset.univ.toList f) (f-avgList p Finset.univ.toList f) = | |
| dot p f f-dot p (avgList p Finset.univ.toList f) (avgList p Finset.univ.toList f) at hp | |
| rw [average_all p hs Finset.univ.toList (by simp)] at hp β’ | |
| exact hp | |
| omit [Fintype I] in | |
| lemma increment_center (hs : β i, β a, p i a = 1) (S : Finset I) (x : I) (f : (I β Ξ©) β β) : | |
| average p x (increment p S x f) = 0 := by | |
| simp [increment,map_sub,average_idem p hs] | |
| lemma average_pair_future (hs : β i, β a, p i a = 1) (x y : I) (hxy : x < y) | |
| (f : (I β Ξ©) β β) : average p y (pairCondition p x y f) = future p Finset.univ x f := by | |
| change avgList p (y::outside x y) f = avgList p ((Finset.univ.filter (x < Β·)).toList) f | |
| apply avgList_congr p hs | |
| intro i | |
| simp only [List.mem_cons,Finset.mem_toList,Finset.mem_filter,Finset.mem_univ,true_and,outside] | |
| constructor | |
| Β· rintro (rfl | β¨hi,_β©) | |
| Β· exact hxy | |
| Β· exact hi | |
| Β· intro hi | |
| by_cases hiy : i=y | |
| Β· exact Or.inl hiy | |
| Β· exact Or.inr β¨hi,hiyβ© | |
| lemma increment_pair_formula (hs : β i, β a, p i a = 1) (x y : I) (hxy : x < y) | |
| (f : (I β Ξ©) β β) : increment p Finset.univ x f = | |
| average p y (pairCondition p x y f)-average p x (average p y (pairCondition p x y f)) := by | |
| rw [average_pair_future p hs x y hxy] | |
| rfl | |
| end | |
| section | |
| open Finset | |
| variable {Ξ© A : Type*} [Fintype Ξ©] [Fintype A] | |
| noncomputable def localEnergy (q : Ξ© β Ξ© β β) (f : Ξ© β β) : β := | |
| (β a, β b, q a b * (f a-f b)^2)/2 | |
| lemma localEnergy_nonneg (q : Ξ© β Ξ© β β) (hq : β a b, 0 β€ q a b) (f : Ξ© β β) : | |
| 0 β€ localEnergy q f := by | |
| exact div_nonneg (Finset.sum_nonneg (fun a _ => Finset.sum_nonneg | |
| (fun b _ => mul_nonneg (hq a b) (sq_nonneg _)))) (by norm_num) | |
| lemma localEnergy_sub (q : Ξ© β Ξ© β β) (hq : β a b, 0 β€ q a b) (f g : Ξ© β β) : | |
| localEnergy q (f-g) β€ 2*localEnergy q f+2*localEnergy q g := by | |
| unfold localEnergy | |
| have h : (β a, β b, q a b*((f-g) a-(f-g) b)^2) β€ | |
| β a, β b, (2*(q a b*(f a-f b)^2)+2*(q a b*(g a-g b)^2)) := by | |
| apply Finset.sum_le_sum; intro a _ | |
| apply Finset.sum_le_sum; intro b _ | |
| have hsq : ((f a-g a)-(f b-g b))^2 β€ 2*(f a-f b)^2+2*(g a-g b)^2 := by | |
| nlinarith [sq_nonneg ((f a-f b)+(g a-g b))] | |
| change q a b*((f a-g a)-(f b-g b))^2 β€ _ | |
| calc | |
| _ β€ q a b*(2*(f a-f b)^2+2*(g a-g b)^2) := mul_le_mul_of_nonneg_left hsq (hq a b) | |
| _ = _ := by ring | |
| simp only [Finset.sum_add_distrib,β Finset.mul_sum] at h | |
| linarith | |
| lemma localEnergy_shift (q : Ξ© β Ξ© β β) (f : Ξ© β β) (c : β) : | |
| localEnergy q (fun a => f a-c) = localEnergy q f := by | |
| unfold localEnergy | |
| congr 1 | |
| apply Finset.sum_congr rfl; intro a _ | |
| apply Finset.sum_congr rfl; intro b _ | |
| congr 2; ring | |
| lemma square_average (w : A β β) (hw : β a, 0 β€ w a) (hs : β a, w a = 1) (f : A β β) : | |
| (β a, w a*f a)^2 β€ β a, w a*(f a)^2 := by | |
| have h := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul Finset.univ | |
| (r := fun a => w a*f a) (f := w) (g := fun a => w a*(f a)^2) | |
| (fun a _ => hw a) (fun a _ => mul_nonneg (hw a) (sq_nonneg _)) | |
| (fun a _ => by nlinarith [sq_nonneg (w a*f a)]) | |
| simpa only [hs,one_mul] using h | |
| lemma localEnergy_average (q : Ξ© β Ξ© β β) (hq : β a b, 0 β€ q a b) | |
| (w : A β β) (hw : β a, 0 β€ w a) (hs : β a, w a = 1) (f : A β Ξ© β β) : | |
| localEnergy q (fun a => β i, w i*f i a) β€ β i, w i*localEnergy q (f i) := by | |
| have h : (β a, β b, q a b*((β i, w i*f i a)-(β i, w i*f i b))^2) β€ | |
| β a, β b, q a b*(β i, w i*(f i a-f i b)^2) := by | |
| apply Finset.sum_le_sum; intro a _ | |
| apply Finset.sum_le_sum; intro b _ | |
| apply mul_le_mul_of_nonneg_left _ (hq a b) | |
| simpa only [mul_sub,Finset.sum_sub_distrib] using square_average w hw hs (fun i => f i a-f i b) | |
| have he : (β a, β b, q a b*(β i, w i*(f i a-f i b)^2)) = | |
| β i, w i*(β a, β b, q a b*(f i a-f i b)^2) := by | |
| simp only [Finset.mul_sum] | |
| have hin (a : Ξ©) : (β b, β i, q a b*(w i*(f i a-f i b)^2)) = | |
| β i, β b, q a b*(w i*(f i a-f i b)^2) := Finset.sum_comm | |
| simp_rw [hin] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl; intro i _ | |
| apply Finset.sum_congr rfl; intro a _ | |
| apply Finset.sum_congr rfl; intro b _ | |
| ring | |
| unfold localEnergy | |
| rw [he] at h | |
| have := div_le_div_of_nonneg_right h (by norm_num : (0:β) β€ 2) | |
| simpa only [Finset.sum_div,mul_div_assoc] using this | |
| lemma localEnergy_bound (Ο : Ξ© β β) (q : Ξ© β Ξ© β β) (hq : β a b, 0 β€ q a b) | |
| (hr : β a, β b, q a b = Ο a) (hc : β b, β a, q a b = Ο b) (f : Ξ© β β) : | |
| localEnergy q f β€ 2*β a, Ο a*(f a)^2 := by | |
| have hh : (β a, β b, q a b*(f a-f b)^2) β€ | |
| β a, β b, (2*(q a b*(f a)^2)+2*(q a b*(f b)^2)) := by | |
| apply Finset.sum_le_sum; intro a _ | |
| apply Finset.sum_le_sum; intro b _ | |
| have hs : (f a-f b)^2 β€ 2*(f a)^2+2*(f b)^2 := by nlinarith [sq_nonneg (f a+f b)] | |
| calc | |
| _ β€ q a b * (2 * (f a)^2 + 2 * (f b)^2) := | |
| mul_le_mul_of_nonneg_left hs (hq a b) | |
| _ = _ := by ring | |
| have hleft : (β a, β b, q a b*(f a)^2) = β a, Ο a*(f a)^2 := by | |
| simp only [β Finset.sum_mul,hr] | |
| have hright : (β a, β b, q a b*(f b)^2) = β b, Ο b*(f b)^2 := by | |
| rw [Finset.sum_comm] | |
| simp only [β Finset.sum_mul,hc] | |
| simp only [Finset.sum_add_distrib,β Finset.mul_sum,hleft,hright] at hh | |
| unfold localEnergy; linarith | |
| end | |
| open Finset | |
| variable {I Ξ© : Type*} [Fintype I] [DecidableEq I] [Fintype Ξ©] | |
| variable (p : I β Ξ© β β) | |
| omit [DecidableEq I] [Fintype Ξ©] in | |
| lemma density_nonneg (hp : β i a, 0 β€ p i a) (s : I β Ξ©) : 0 β€ density p s := | |
| Finset.prod_nonneg (fun i _ => hp i (s i)) | |
| lemma mean_mono (hp : β i a, 0 β€ p i a) {f g : (I β Ξ©) β β} | |
| (h : β s, f s β€ g s) : mean p f β€ mean p g := | |
| Finset.sum_le_sum (fun s _ => mul_le_mul_of_nonneg_left (h s) (density_nonneg p hp s)) | |
| lemma mean_nonneg (hp : β i a, 0 β€ p i a) {f : (I β Ξ©) β β} (h : β s, 0 β€ f s) : | |
| 0 β€ mean p f := Finset.sum_nonneg (fun s _ => mul_nonneg (density_nonneg p hp s) (h s)) | |
| lemma mean_add (f g : (I β Ξ©) β β) : mean p (f+g) = mean p f+mean p g := by | |
| simp [mean,mul_add,Finset.sum_add_distrib] | |
| lemma mean_mul (c : β) (f : (I β Ξ©) β β) : mean p (fun s => c*f s) = c*mean p f := by | |
| simp only [mean,Finset.mul_sum]; apply Finset.sum_congr rfl; intro s _; ring | |
| lemma mean_square (f : (I β Ξ©) β β) : mean p (fun s => (f s)^2) = dot p f f := by | |
| simp only [mean,dot]; apply Finset.sum_congr rfl; intro s _; ring | |
| structure PairCapacity (x y : I) where | |
| q : (Ξ© Γ Ξ©) β (Ξ© Γ Ξ©) β β | |
| nonneg : β a b, 0 β€ q a b | |
| row : β a, β b, q a b = p x a.1*p y a.2 | |
| col : β b, β a, q a b = p x b.1*p y b.2 | |
| def replacePair (x y : I) (s : I β Ξ©) (a : Ξ© Γ Ξ©) : I β Ξ© := | |
| Function.update (Function.update s x a.1) y a.2 | |
| def slice (x y : I) (f : (I β Ξ©) β β) (s : I β Ξ©) (a : Ξ© Γ Ξ©) : β := | |
| f (replacePair x y s a) | |
| noncomputable def pairEnergy (x y : I) (Q : PairCapacity p x y) (f : (I β Ξ©) β β) : β := | |
| mean p (fun s => localEnergy Q.q (slice x y f s)) | |
| omit [Fintype I] [Fintype Ξ©] in | |
| lemma slice_sub (x y : I) (f g : (I β Ξ©) β β) (s : I β Ξ©) : | |
| slice x y (f-g) s = slice x y f s-slice x y g s := rfl | |
| lemma pairEnergy_nonneg (hp : β i a, 0 β€ p i a) (x y : I) (Q : PairCapacity p x y) | |
| (f : (I β Ξ©) β β) : 0 β€ pairEnergy p x y Q f := | |
| mean_nonneg p hp (fun _ => localEnergy_nonneg Q.q Q.nonneg _) | |
| lemma pairEnergy_sub (hp : β i a, 0 β€ p i a) (x y : I) (Q : PairCapacity p x y) | |
| (f g : (I β Ξ©) β β) : pairEnergy p x y Q (f-g) β€ | |
| 2*pairEnergy p x y Q f+2*pairEnergy p x y Q g := by | |
| have hh := mean_mono p hp (fun s => localEnergy_sub Q.q Q.nonneg (slice x y f s) (slice x y g s)) | |
| change mean p (fun s => localEnergy Q.q (slice x y (f-g) s)) β€ | |
| mean p ((fun s => 2*localEnergy Q.q (slice x y f s))+(fun s => 2*localEnergy Q.q (slice x y g s))) at hh | |
| rw [mean_add,mean_mul,mean_mul] at hh | |
| exact hh | |
| lemma slice_square_mean (hs : β i, β a, p i a = 1) (x y : I) (f : (I β Ξ©) β β) : | |
| mean p (fun s => β a : Ξ© Γ Ξ©, (p x a.1*p y a.2)*(slice x y f s a)^2) = dot p f f := by | |
| have he (s : I β Ξ©) : (β a : Ξ© Γ Ξ©, (p x a.1*p y a.2)*(slice x y f s a)^2) = | |
| average p x (average p y (fun s => (f s)^2)) s := by | |
| rw [Fintype.sum_prod_type] | |
| simp only [average_apply,Finset.mul_sum] | |
| apply Finset.sum_congr rfl; intro a _ | |
| apply Finset.sum_congr rfl; intro b _ | |
| unfold slice replacePair; ring | |
| simp_rw [he] | |
| rw [mean_average p hs,mean_average p hs,mean_square] | |
| lemma pairEnergy_bound (hp : β i a, 0 β€ p i a) (hs : β i, β a, p i a = 1) | |
| (x y : I) (Q : PairCapacity p x y) (f : (I β Ξ©) β β) : | |
| pairEnergy p x y Q f β€ 2*dot p f f := by | |
| have hh := mean_mono p hp (fun s => localEnergy_bound (fun a => p x a.1*p y a.2) | |
| Q.q Q.nonneg Q.row Q.col (slice x y f s)) | |
| rw [mean_mul,slice_square_mean p hs] at hh | |
| exact hh | |
| omit [Fintype I] [Fintype Ξ©] in | |
| lemma replacePair_update (i x y : I) (hix : i β x) (hiy : i β y) | |
| (s : I β Ξ©) (a : Ξ© Γ Ξ©) (b : Ξ©) : | |
| replacePair x y (Function.update s i b) a = Function.update (replacePair x y s a) i b := by | |
| unfold replacePair | |
| rw [Function.update_comm hix,Function.update_comm hiy] | |
| omit [Fintype I] in | |
| lemma slice_average (i x y : I) (hix : i β x) (hiy : i β y) | |
| (f : (I β Ξ©) β β) (s : I β Ξ©) : | |
| slice x y (average p i f) s = (fun a => β b, p i b*slice x y f (Function.update s i b) a) := by | |
| funext a | |
| simp only [slice,average_apply,replacePair_update i x y hix hiy] | |
| lemma pairEnergy_average (hp : β i a, 0 β€ p i a) (hs : β i, β a, p i a = 1) | |
| (i x y : I) (hix : i β x) (hiy : i β y) (Q : PairCapacity p x y) (f : (I β Ξ©) β β) : | |
| pairEnergy p x y Q (average p i f) β€ pairEnergy p x y Q f := by | |
| have hh (s : I β Ξ©) : localEnergy Q.q (slice x y (average p i f) s) β€ | |
| average p i (fun s => localEnergy Q.q (slice x y f s)) s := by | |
| rw [slice_average p i x y hix hiy] | |
| exact localEnergy_average Q.q Q.nonneg (p i) (hp i) (hs i) (fun b => slice x y f (Function.update s i b)) | |
| have hh := mean_mono p hp hh | |
| rw [mean_average p hs] at hh | |
| exact hh | |
| lemma pairEnergy_avgList (hp : β i a, 0 β€ p i a) (hs : β i, β a, p i a = 1) | |
| (l : List I) (x y : I) (hl : β i β l, i β x β§ i β y) (Q : PairCapacity p x y) | |
| (f : (I β Ξ©) β β) : pairEnergy p x y Q (avgList p l f) β€ pairEnergy p x y Q f := by | |
| induction l with | |
| | nil => exact le_rfl | |
| | cons i l ih => | |
| rw [avgList_cons] | |
| exact (pairEnergy_average p hp hs i x y (hl i (by simp)).1 (hl i (by simp)).2 Q _).trans | |
| (ih (fun j hj => hl j (List.mem_cons_of_mem i hj))) | |
| end MatchingFPRAS.Replica | |
| end OAI | |