Download data/lean/OAI/Combinatorics/MatchingCount/Probability/Variance.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 18.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/Variance.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Probability/Variance.lean
-
curl -L -o Variance.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/Variance.lean
18.4 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Sampling.EndpointPair | |
| namespace OAI | |
| namespace MatchingFPRAS.Transport | |
| variable {V E : Type*} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] | |
| variable {inc : E β V β Prop} | |
| omit [DecidableEq V] [Fintype E] [DecidableEq E] in | |
| lemma switch_denominator_bound (hinc : β e, β v, inc e v) (A : PM inc) : | |
| 48 * (A.val.card.choose 2 : β) β€ 60 * (Fintype.card V : β)^2 := by | |
| have hm := A.card_le_vertices hinc | |
| have hc : A.val.card.choose 2 β€ (Fintype.card V)^2 := | |
| (Nat.choose_le_pow _ _).trans (Nat.pow_le_pow_left hm 2) | |
| have hc' : (A.val.card.choose 2 : β) β€ (Fintype.card V : β)^2 := by exact_mod_cast hc | |
| nlinarith [sq_nonneg (Fintype.card V : β)] | |
| omit [DecidableEq V] in | |
| lemma safe_switch_elementary (hinc : β e, β v, inc e v) | |
| (w : E β β) (hw : β e, 0 < w e) (K : β) (hK : 1 β€ K) (f : Finset E β β) : | |
| (β A : PM inc, gibbs w A * β B β safeDestinations w K A, (f A.val-f B.val)^2) β€ | |
| 60 * (Fintype.card V : β)^2 * K^2 * switchDirichlet (inc := inc) w f := by | |
| classical | |
| simp only [switchDirichlet,Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro A _ | |
| let term (B : PM inc) := 60*(Fintype.card V : β)^2*K^2 * | |
| (min (gibbs w A) (gibbs w B)*(f A.val-f B.val)^2 / (48*(A.val.card.choose 2 : β))) | |
| change (β B β safeDestinations w K A, gibbs w A*(f A.val-f B.val)^2) β€ | |
| β B β switchDestinations A, term B | |
| calc | |
| _ β€ β B β safeDestinations w K A, term B := by | |
| apply Finset.sum_le_sum | |
| intro B hB | |
| have h : SafeSwitch w K A B := (Finset.mem_filter.mp hB).2 | |
| have hd : 0 < 48 * (A.val.card.choose 2 : β) := by | |
| have hc : 0 < A.val.card.choose 2 := Nat.choose_pos h.legal.two_le | |
| positivity | |
| have hn : 0 β€ min (gibbs w A) (gibbs w B) * (f A.val-f B.val)^2 := | |
| mul_nonneg (le_min (le_of_lt (gibbs_pos w hw A)) (le_of_lt (gibbs_pos w hw B))) (sq_nonneg _) | |
| have hβ := mul_le_mul_of_nonneg_right (h.min_capacity hw hK) (sq_nonneg (f A.val-f B.val)) | |
| have hβ := mul_le_mul_of_nonneg_left (scale_div_lower hn hd (switch_denominator_bound hinc A)) (sq_nonneg K) | |
| dsimp only [term] | |
| nlinarith only [hβ,hβ] | |
| _ β€ _ := by | |
| apply Finset.sum_le_sum_of_subset_of_nonneg | |
| Β· intro B hB | |
| have h : SafeSwitch w K A B := (Finset.mem_filter.mp hB).2 | |
| exact Finset.mem_filter.mpr β¨Finset.mem_univ _,h.legalβ© | |
| Β· intro B _ _ | |
| have ha := le_of_lt (gibbs_pos w hw A) | |
| have hb := le_of_lt (gibbs_pos w hw B) | |
| dsimp only [term] | |
| positivity | |
| variable (ends : E β Sym2 V) | |
| omit [DecidableEq V] [Fintype E] in | |
| lemma ColorChange.card_pos {A B : PM (fun e v => v β ends e)} (h : ColorChange ends A B) : | |
| 0 < A.val.card := by | |
| obtain β¨e,f,R,hef,hA,hBβ© := h | |
| exact Finset.card_pos.mpr β¨e,by rw [hA]; simpβ© | |
| omit [DecidableEq V] in | |
| lemma color_elementary (w : E β β) (hw : β e, 0 < w e) (K : β) (hK : 1 β€ K) | |
| (hcomp : β e f, ends e = ends f β w e β€ K*w f) (f : Finset E β β) : | |
| (β A : PM (fun e v => v β ends e), gibbs w A * | |
| β B β colorDestinations ends A, (f A.val-f B.val)^2) β€ | |
| 12 * (Fintype.card V : β) * K * colorDirichlet ends w f := by | |
| classical | |
| have hinc (e : E) : β v, v β ends e := by | |
| induction ends e using Sym2.inductionOn with | hf a b => exact β¨a,by simpβ© | |
| simp only [colorDirichlet,Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro A _ | |
| apply Finset.sum_le_sum | |
| intro B hB | |
| have h : ColorChange ends A B := (Finset.mem_filter.mp hB).2 | |
| have hd : 0 < 12 * (A.val.card : β) := by have := h.card_pos ends; positivity | |
| have hb : 12 * (A.val.card : β) β€ 12 * (Fintype.card V : β) := by | |
| exact_mod_cast (Nat.mul_le_mul_left 12 (A.card_le_vertices hinc)) | |
| have hn : 0 β€ min (gibbs w A) (gibbs w B) * (f A.val-f B.val)^2 := | |
| mul_nonneg (le_min (le_of_lt (gibbs_pos w hw A)) (le_of_lt (gibbs_pos w hw B))) (sq_nonneg _) | |
| have hβ := mul_le_mul_of_nonneg_right (h.min_capacity ends hw hK hcomp) (sq_nonneg (f A.val-f B.val)) | |
| have hβ := mul_le_mul_of_nonneg_left (scale_div_lower hn hd hb) (by linarith : 0 β€ K) | |
| nlinarith only [hβ,hβ] | |
| omit [Fintype E] in | |
| lemma cycleSquare_common (f g : Finset E β β) (A B S : Finset E) (hS : S β A β© B) : | |
| cycleSquare f g A B S = 0 := by | |
| have hSA : S β A := fun e he => (Finset.mem_inter.mp (hS he)).1 | |
| have hSB : S β B := fun e he => (Finset.mem_inter.mp (hS he)).2 | |
| simp only [cycleSquare,exchange,Finset.inter_eq_right.mpr hSA,Finset.inter_eq_right.mpr hSB, | |
| Finset.sdiff_union_of_subset hSA,Finset.sdiff_union_of_subset hSB,sub_self,zero_pow (by decide : 2 β 0)] | |
| omit [DecidableEq V] [Fintype E] in | |
| lemma all_cycleSquare_sum (f g : Finset E β β) (A B : PM inc) : | |
| (β S β components (inc := inc) (A.val βͺ B.val), cycleSquare f g A.val B.val S) = | |
| β S β discrepancyComponents A B, cycleSquare f g A.val B.val S := by | |
| classical | |
| apply (Finset.sum_subset (Finset.filter_subset _ _) ?_).symm | |
| intro S hS hnot | |
| have hcommon : S β A.val β© B.val := by | |
| by_contra h | |
| exact hnot (Finset.mem_filter.mpr β¨hS,hβ©) | |
| exact cycleSquare_common f g _ _ _ hcommon | |
| omit [DecidableEq V] in | |
| lemma cycle_elementary (hinc : β e, β v, inc e v) | |
| (w : E β β) (hw : β e, 0 < w e) (f g : Finset E β β) : | |
| (β A : PM inc, β B : PM inc, gibbs w A * gibbs w B * | |
| β S β components (inc := inc) (A.val βͺ B.val), cycleSquare f g A.val B.val S) β€ | |
| 6 * (Fintype.card V : β) * cycleDirichlet (inc := inc) w f g := by | |
| classical | |
| simp only [cycleDirichlet,Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro A _ | |
| apply Finset.sum_le_sum | |
| intro B _ | |
| rw [β Finset.mul_sum,all_cycleSquare_sum,Finset.mul_sum] | |
| apply Finset.sum_le_sum | |
| intro S hS | |
| have hcard : 0 < (discrepancyComponents A B).card := Finset.card_pos.mpr β¨S,hSβ© | |
| have hd : (discrepancyComponents A B).card β€ Fintype.card V := | |
| (Finset.card_filter_le _ _).trans (components_card_le hinc _) | |
| have hb : 6 * ((discrepancyComponents A B).card : β) β€ 6 * (Fintype.card V : β) := by exact_mod_cast Nat.mul_le_mul_left 6 hd | |
| have hscale := scale_div_lower (sq_nonneg ((f A.val+g B.val)-(f (exchange A.val B.val S)+g (exchange B.val A.val S)))) | |
| (by positivity : 0 < 6 * ((discrepancyComponents A B).card : β)) hb | |
| have h := mul_le_mul_of_nonneg_left hscale | |
| (mul_nonneg (le_of_lt (gibbs_pos w hw A)) (le_of_lt (gibbs_pos w hw B))) | |
| dsimp only [cycleSquare] at * | |
| nlinarith only [h] | |
| end MatchingFPRAS.Transport | |
| namespace MatchingFPRAS.FiniteVariance | |
| variable {Ξ© : Type*} [Fintype Ξ©] | |
| noncomputable def variance (Ο f : Ξ© β β) : β := | |
| β x, Ο x * (f x - β y, Ο y * f y)^2 | |
| lemma variance_eq_pair (Ο f : Ξ© β β) (hΟ : β x, Ο x = 1) : | |
| variance Ο f = (β p : Ξ© Γ Ξ©, Ο p.1 * Ο p.2 * (f p.1-f p.2)^2) / 2 := by | |
| let m := β y, Ο y * f y | |
| let s := β y, Ο y * f y ^ 2 | |
| have hl : variance Ο f = s-m^2 := by | |
| unfold variance | |
| change (β x, Ο x * (f x-m)^2) = s-m^2 | |
| calc | |
| _ = β x, (Ο x * f x^2 - 2*m*(Ο x*f x) + m^2*Ο x) := by | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| ring | |
| _ = s-m^2 := by | |
| rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,β Finset.mul_sum,β Finset.mul_sum,hΟ] | |
| change s-2*m*m+m^2*1 = s-m^2 | |
| ring | |
| have hr : (β p : Ξ© Γ Ξ©, Ο p.1 * Ο p.2 * (f p.1-f p.2)^2) = 2*(s-m^2) := by | |
| rw [Fintype.sum_prod_type] | |
| have hin (x : Ξ©) : (β y, Ο x*Ο y*(f x-f y)^2) = Ο x*f x^2-2*m*(Ο x*f x)+s*Ο x := by | |
| calc | |
| _ = β y, ((Ο x*f x^2)*Ο y - (2*Ο x*f x)*(Ο y*f y) + Ο x*(Ο y*f y^2)) := by | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| ring | |
| _ = _ := by | |
| rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,β Finset.mul_sum,β Finset.mul_sum,β Finset.mul_sum,hΟ] | |
| change (Ο x*f x^2)*1-(2*Ο x*f x)*m+Ο x*s = _ | |
| ring | |
| simp_rw [hin] | |
| rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,β Finset.mul_sum,β Finset.mul_sum,hΟ] | |
| change s-2*m*m+s*1 = 2*(s-m^2) | |
| ring | |
| rw [hl,hr] | |
| ring | |
| end MatchingFPRAS.FiniteVariance | |
| namespace MatchingFPRAS | |
| lemma energy_coefficient_bound {N D T : β} (hN1 : 1 β€ N) (hD : 1 β€ D) | |
| (hT0 : 0 β€ T) (htag : T β€ (10*N)^30) : | |
| 180*N^5*(1000*D)^6*T+72*N^4*(1000*D)^4*T+12*N^3*(1000*D) β€ | |
| ((10^4 : β)*N*D)^100 := by | |
| let K := 1000*D | |
| have hK : 1 β€ K := by dsimp [K]; linarith | |
| have hN0 : 0 β€ N := by linarith | |
| have hDN : N β€ N*D := by nlinarith [mul_nonneg hN0 (sub_nonneg.mpr hD)] | |
| have hDD : D β€ N*D := by nlinarith [mul_nonneg (sub_nonneg.mpr hN1) (le_trans (by norm_num : (0:β) β€ 1) hD)] | |
| let B := (10^4 : β)*N*D | |
| have hB : 3 β€ B := by dsimp [B]; nlinarith | |
| have hNB : N β€ B := by dsimp [B]; nlinarith | |
| have hKB : K β€ B := by dsimp [B,K]; nlinarith | |
| have h10NB : 10*N β€ B := by dsimp [B]; nlinarith | |
| have hTB : T β€ B^30 := htag.trans (by gcongr) | |
| have h180 : (180:β) β€ B := by dsimp [B]; nlinarith | |
| have h72 : (72:β) β€ B := by linarith | |
| have h12 : (12:β) β€ B := by linarith | |
| have hb0 : 0 β€ B := by linarith | |
| have hterm1 : 180*N^5*K^6*T β€ B^42 := by | |
| calc | |
| _ β€ B*B^5*B^6*B^30 := by gcongr | |
| _ = _ := by ring | |
| have hterm2 : 72*N^4*K^4*T β€ B^39 := by | |
| calc | |
| _ β€ B*B^4*B^4*B^30 := by gcongr | |
| _ = _ := by ring | |
| have hterm3 : 12*N^3*K β€ B^5 := by | |
| calc | |
| _ β€ B*B^3*B := by gcongr | |
| _ = _ := by ring | |
| have hp39 : B^39 β€ B^42 := pow_le_pow_rightβ (by linarith : 1 β€ B) (by omega) | |
| have hp5 : B^5 β€ B^42 := pow_le_pow_rightβ (by linarith : 1 β€ B) (by omega) | |
| have hcoef : 180*N^5*K^6*T+72*N^4*K^4*T+12*N^3*K β€ B^100 := by | |
| calc | |
| _ β€ 3*B^42 := by linarith | |
| _ β€ B*B^42 := mul_le_mul_of_nonneg_right hB (pow_nonneg hb0 _) | |
| _ = B^43 := by ring | |
| _ β€ B^100 := pow_le_pow_rightβ (by linarith : 1 β€ B) (by omega) | |
| exact hcoef | |
| end MatchingFPRAS | |
| namespace MatchingFPRAS.Transport.CellDemands | |
| variable {V L : Type*} [Fintype V] [DecidableEq V] [Fintype L] [DecidableEq L] | |
| variable {bags : V β Finset L} {G : SimpleGraph L} | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| variable {hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b} | |
| variable {hG : G.IsAcyclic} | |
| variable (height : L β β) (hheight : β l, 0 < height l) | |
| variable (hstep : β a b, G.Adj a b β height a β€ 2 * height b) | |
| variable (D : β) (hD : 1 β€ D) (w : BagEdge bags β β) | |
| variable (hw : β e, height e.color / D β€ w e β§ w e β€ 3 * height e.color) | |
| variable (lo hi : β) (hlo : 0 < lo) (hlohi : lo β€ hi) | |
| include hheight hstep hD hw hlo hlohi hbags hG | |
| theorem pair_energy_inequality (hN : 2 β€ Fintype.card V) | |
| (M : PM (BagEdge.Incident (bags := bags))) (f g : Finset (BagEdge bags) β β) : | |
| let wt := fun e => max lo (min hi (w e)) | |
| MatchingFPRAS.FiniteVariance.variance (gibbs (inc := BagEdge.Incident) wt) (fun A => f A.val) β€ | |
| ((10^4 : β) * Fintype.card V * D)^100 * | |
| pairDirichlet (fun e : BagEdge bags => e.val.val.1) wt f g := by | |
| classical | |
| let wt := fun e => max lo (min hi (w e)) | |
| have hwt (e : BagEdge bags) : 0 < wt e := lt_of_lt_of_le hlo (le_max_left _ _) | |
| let N : β := Fintype.card V | |
| let K : β := 1000*D | |
| let T : β := Fintype.card (DemandTag (V := V) (E := BagEdge bags)) | |
| let E := pairDirichlet (fun e : BagEdge bags => e.val.val.1) wt f g | |
| have hK : 1 β€ K := by dsimp [K]; linarith | |
| have hN0 : 0 β€ N := Nat.cast_nonneg _ | |
| have hE : 0 β€ E := by | |
| exact add_nonneg (add_nonneg (switchDirichlet_nonneg wt hwt f) | |
| (colorDirichlet_nonneg _ wt hwt f)) (cycleDirichlet_nonneg wt hwt f g) | |
| have hsE : switchDirichlet (inc := BagEdge.Incident) wt f β€ E := | |
| (le_add_of_nonneg_right (colorDirichlet_nonneg (fun e : BagEdge bags => e.val.val.1) wt hwt f)).trans | |
| (le_add_of_nonneg_right (cycleDirichlet_nonneg wt hwt f g)) | |
| have hcE : colorDirichlet (fun e : BagEdge bags => e.val.val.1) wt f β€ E := | |
| (le_add_of_nonneg_left (switchDirichlet_nonneg (inc := BagEdge.Incident) wt hwt f)).trans | |
| (le_add_of_nonneg_right (cycleDirichlet_nonneg wt hwt f g)) | |
| have hyE : cycleDirichlet (inc := BagEdge.Incident) wt f g β€ E := | |
| le_add_of_nonneg_left (add_nonneg (switchDirichlet_nonneg wt hwt f) | |
| (colorDirichlet_nonneg (fun e : BagEdge bags => e.val.val.1) wt hwt f)) | |
| have hs := (safe_switch_elementary BagEdge.exists_incident wt hwt K hK f).trans | |
| (mul_le_mul_of_nonneg_left hsE (by positivity : 0 β€ 60*N^2*K^2)) | |
| have hc := (color_elementary (fun e : BagEdge bags => e.val.val.1) wt hwt K hK | |
| (color_clamp_comparability hbags height hheight hstep D hD w hw lo hi hlo) f).trans | |
| (mul_le_mul_of_nonneg_left hcE (by positivity : 0 β€ 12*N*K)) | |
| have hy := (cycle_elementary BagEdge.exists_incident wt hwt f g).trans | |
| (mul_le_mul_of_nonneg_left hyE (by positivity : 0 β€ 6*N)) | |
| have hl := total_cell_demand_load (hbags := hbags) (hG := hG) height hheight hstep D hD w hw lo hi hlo hlohi M f g | |
| change (β d : Demand hbags hG, gibbs wt d.1.1 * gibbs wt d.1.2 * d.cellCost f) β€ | |
| K^4*T*((β A : PM BagEdge.Incident, gibbs wt A * | |
| β B β safeDestinations wt K A, (f A.val-f B.val)^2) + 4* | |
| β A : PM BagEdge.Incident, β B : PM BagEdge.Incident, gibbs wt A*gibbs wt B* | |
| β S β components (inc := BagEdge.Incident) (A.valβͺB.val), cycleSquare f g A.val B.val S) at hl | |
| have hload := hl.trans (mul_le_mul_of_nonneg_left (add_le_add hs (mul_le_mul_of_nonneg_left hy (by norm_num))) | |
| (by dsimp [T]; positivity : 0 β€ K^4*T)) | |
| have hv := variance_cell_demand_bound (hbags := hbags) (hG := hG) wt hwt M f | |
| have hvar := hv.trans (add_le_add (mul_le_mul_of_nonneg_left hload (by positivity : 0 β€ 3*N^3)) | |
| (mul_le_mul_of_nonneg_left hc (by positivity : 0 β€ N^2))) | |
| have hraw : MatchingFPRAS.FiniteVariance.variance (gibbs (inc := BagEdge.Incident) wt) (fun A => f A.val) β€ | |
| (180*N^5*K^6*T+72*N^4*K^4*T+12*N^3*K)*E := by | |
| rw [MatchingFPRAS.FiniteVariance.variance_eq_pair _ _ (gibbs_sum wt hwt M)] | |
| calc | |
| _ β€ _ := hvar | |
| _ = _ := by ring | |
| have htag : T β€ (10*N)^30 := by | |
| have h := tag_card_bound (V := V) (E := BagEdge bags) (Fintype.card V) hN le_rfl (bag_edges_card_le hbags hG) | |
| dsimp only [T,N] | |
| exact_mod_cast h | |
| have hT0 : 0 β€ T := Nat.cast_nonneg _ | |
| have hN1 : 1 β€ N := by dsimp [N]; exact_mod_cast (show 1 β€ Fintype.card V by omega) | |
| have hcoef := MatchingFPRAS.energy_coefficient_bound hN1 hD hT0 htag | |
| exact hraw.trans (mul_le_mul_of_nonneg_right hcoef hE) | |
| end MatchingFPRAS.Transport.CellDemands | |
| namespace MatchingFPRAS.Transport | |
| open Finset | |
| variable {V E : Type*} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] | |
| variable (ends : E β Sym2 V) (hloop : β e, Β¬(ends e).IsDiag) | |
| include hloop | |
| omit [Fintype E] [DecidableEq E] in | |
| lemma PM.twice_card (A : PM (fun e v => v β ends e)) : 2*A.val.card = Fintype.card V := by | |
| classical | |
| have hv (v : V) : (β e β A.val, if v β ends e then (1:β) else 0) = 1 := by | |
| obtain β¨e,β¨he,hevβ©,huβ© := A.property.2 v (Finset.mem_univ v) | |
| rw [Finset.sum_eq_single e] | |
| Β· simp [hev] | |
| Β· intro f hf hfe | |
| have : v β ends f := fun hfv => hfe (hu f β¨hf,hfvβ©) | |
| simp [this] | |
| Β· exact fun h => (h he).elim | |
| have he (e : E) : (β v : V, if v β ends e then (1:β) else 0) = 2 := by | |
| have hs : Finset.univ.filter (fun v => v β ends e) = (ends e).toFinset := by | |
| ext v; simp | |
| rw [β Finset.sum_filter,Finset.sum_const,smul_eq_mul,mul_one,hs] | |
| exact Sym2.card_toFinset_of_not_isDiag _ (hloop e) | |
| calc | |
| _ = β e β A.val, β v : V, if v β ends e then (1:β) else 0 := by | |
| simp [he,Nat.mul_comm] | |
| _ = β v : V, β e β A.val, if v β ends e then (1:β) else 0 := by rw [Finset.sum_comm] | |
| _ = _ := by simp [hv] | |
| omit [Fintype E] [DecidableEq E] in | |
| lemma PM.card_eq (A B : PM (fun e v => v β ends e)) : A.val.card = B.val.card := by | |
| have ha := A.twice_card ends hloop | |
| have hb := B.twice_card ends hloop | |
| omega | |
| omit hloop | |
| omit [DecidableEq V] [Fintype E] [DecidableEq E] in | |
| lemma matchingWeight_compare {w z : E β β} (hw : β e, 0 β€ w e) | |
| (c : β) (_hc : 0 β€ c) (h : β e, w e β€ c*z e) | |
| (A : PM (fun e v => v β ends e)) : | |
| matchingWeight w A β€ c^A.val.card*matchingWeight z A := by | |
| calc | |
| _ β€ β e β A.val, c*z e := Finset.prod_le_prodβ (fun edge _ => hw edge) (fun edge _ => h edge) | |
| _ = _ := by simp only [Finset.prod_mul_distrib,Finset.prod_const]; rfl | |
| include hloop | |
| omit [DecidableEq E] in | |
| lemma partition_compare {w z : E β β} (hw : β e, 0 β€ w e) | |
| (c : β) (hc : 0 β€ c) (h : β e, w e β€ c*z e) | |
| (A : PM (fun e v => v β ends e)) : | |
| partition (inc := fun e v => v β ends e) w β€ | |
| c^A.val.card*partition (inc := fun e v => v β ends e) z := by | |
| classical | |
| unfold partition | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_le_sum; intro B _ | |
| have hh := matchingWeight_compare ends hw c hc h B | |
| rwa [PM.card_eq ends hloop B A] at hh | |
| omit [DecidableEq E] in | |
| lemma gibbs_compare {w z : E β β} (hw : β e, 0 < w e) (hz : β e, 0 < z e) | |
| (c : β) (hc : 0 β€ c) (hwz : β e, w e β€ c*z e) (hzw : β e, z e β€ c*w e) | |
| (A : PM (fun e v => v β ends e)) : | |
| gibbs w A β€ c^(Fintype.card V)*gibbs z A := by | |
| have hwa := matchingWeight_compare ends (fun e => (hw e).le) c hc hwz A | |
| have hpz := partition_compare ends hloop (fun e => (hz e).le) c hc hzw A | |
| have hprod := mul_le_mul hwa hpz (le_of_lt (partition_pos z hz A)) | |
| (mul_nonneg (pow_nonneg hc _) (matchingWeight_pos z hz A).le) | |
| have he : c^A.val.card*c^A.val.card = c^(Fintype.card V) := by | |
| rw [β pow_add,β A.twice_card ends hloop] | |
| congr 1; omega | |
| have hh : matchingWeight w A*partition (inc := fun e v => v β ends e) z β€ | |
| c^(Fintype.card V)*matchingWeight z A*partition (inc := fun e v => v β ends e) w := by | |
| calc | |
| _ β€ (c^A.val.card*matchingWeight z A)*(c^A.val.card*partition (inc := fun e v => v β ends e) w) := hprod | |
| _ = _ := by rw [β he]; ring | |
| unfold gibbs | |
| rw [β mul_div_assoc,div_le_div_iffβ (partition_pos w hw A) (partition_pos z hz A)] | |
| exact hh | |
| end MatchingFPRAS.Transport | |
| end OAI | |