Download data/lean/OAI/Combinatorics/MatchingCount/Graphs/Evolve.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 20.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Graphs/Evolve.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Graphs/Evolve.lean
-
curl -L -o Evolve.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Graphs/Evolve.lean
20.4 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Machines.TreePairProposal | |
| import OAI.Combinatorics.MatchingCount.Graphs.PushedFlow | |
| namespace OAI | |
| namespace MatchingFPRAS.FiniteChain | |
| open Finset MatchingFPRAS.Replica | |
| variable {Ξ© : Type*} [Fintype Ξ©] [DecidableEq Ξ©] | |
| noncomputable def evolve (Ο : Ξ© β β) (C : Ξ© β Ξ© β β) : β β (Ξ© β β) β (Ξ© β β) | |
| | 0, f => f | |
| | n+1, f => stepDensity Ο C (evolve Ο C n f) | |
| omit [DecidableEq Ξ©] in | |
| lemma evolve_mean (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (C : Ξ© β Ξ© β β) | |
| (hrow : β a, β b, C a b = Ο a) (n : β) (f : Ξ© β β) : | |
| massMean Ο (evolve Ο C n f) = massMean Ο f := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => rw [evolve,stepDensity_mean Ο hp C hrow,ih] | |
| omit [DecidableEq Ξ©] in | |
| lemma evolve_center (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (C : Ξ© β Ξ© β β) | |
| (hcol : β b, β a, C a b = Ο b) (n : β) (f : Ξ© β β) : | |
| evolve Ο C n (fun a => f a-1) = fun a => evolve Ο C n f a-1 := by | |
| induction n with | |
| | zero => rfl | |
| | succ n ih => | |
| simp only [evolve,ih] | |
| have he : (fun a => evolve Ο C n f a-1) = fun a => 1*evolve Ο C n f a+(-1)*(1:β) := by funext a; ring | |
| rw [he,stepDensity_linear,stepDensity_one Ο hp C hcol] | |
| funext a; ring | |
| lemma lazy_decay (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (C : Ξ© β Ξ© β β) | |
| (hC : β a b, 0 β€ C a b) (hrow : β a, β b, C a b = Ο a) | |
| (hcol : β b, β a, C a b = Ο b) (hlazy : β a, Ο a/2 β€ C a a) | |
| (Ξ³ : β) (hΞ³ : Ξ³ β€ 1) | |
| (hgap : β f, massMean Ο f = 0 β Ξ³*sqNorm Ο f β€ localEnergy C f) | |
| (f : Ξ© β β) (hf : massMean Ο f = 0) (n : β) : | |
| sqNorm Ο (evolve Ο C n f) β€ (1-Ξ³)^n*sqNorm Ο f := by | |
| induction n with | |
| | zero => simp [evolve] | |
| | succ n ih => | |
| have hm : massMean Ο (evolve Ο C n f) = 0 := (evolve_mean Ο hp C hrow n f).trans hf | |
| have hl := lazy_l2 Ο hp C hC hrow hcol hlazy (evolve Ο C n f) | |
| have hg := hgap (evolve Ο C n f) hm | |
| have hh := mul_le_mul_of_nonneg_left ih (sub_nonneg.mpr hΞ³) | |
| rw [evolve,pow_succ] | |
| nlinarith | |
| noncomputable def deltaDensity (Ο : Ξ© β β) (z a : Ξ©) : β := if a=z then (Ο z)β»ΒΉ else 0 | |
| lemma deltaDensity_mean (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (z : Ξ©) : | |
| massMean Ο (deltaDensity Ο z) = 1 := by | |
| simp [massMean,deltaDensity,mul_ite,ne_of_gt (hp z)] | |
| omit [DecidableEq Ξ©] in | |
| lemma sqNorm_center (Ο f : Ξ© β β) (hs : β a, Ο a = 1) : | |
| sqNorm Ο (fun a => f a-1) = sqNorm Ο f-2*massMean Ο f+1 := by | |
| have he (a : Ξ©) : Ο a*(f a-1)^2 = Ο a*(f a)^2-2*(Ο a*f a)+Ο a := by ring | |
| simp only [sqNorm,massMean,he,Finset.sum_add_distrib,Finset.sum_sub_distrib,β Finset.mul_sum,hs] | |
| lemma deltaDensity_sqNorm (Ο : Ξ© β β) (_hp : β a, 0 < Ο a) (z : Ξ©) : | |
| sqNorm Ο (deltaDensity Ο z) = (Ο z)β»ΒΉ := by | |
| simp only [sqNorm,deltaDensity,ite_pow,zero_pow (by decide : (2:β) β 0),mul_ite,mul_zero, | |
| Finset.sum_ite_eq',Finset.mem_univ,ite_true] | |
| field_simp | |
| lemma deltaDensity_center_norm (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (hs : β a, Ο a = 1) (z : Ξ©) : | |
| sqNorm Ο (fun a => deltaDensity Ο z a-1) = (Ο z)β»ΒΉ-1 := by | |
| rw [sqNorm_center Ο _ hs,deltaDensity_sqNorm Ο hp,deltaDensity_mean Ο hp] | |
| ring | |
| omit [DecidableEq Ξ©] in | |
| lemma abs_sum_sq_le (Ο f : Ξ© β β) (hp : β a, 0 β€ Ο a) (hs : β a, Ο a = 1) : | |
| (β a, |Ο a*f a|)^2 β€ sqNorm Ο f := by | |
| have hh := square_average Ο hp hs (fun a => |f a|) | |
| simpa only [abs_mul,abs_of_nonneg (hp _),sq_abs,sqNorm] using hh | |
| noncomputable def kernel (Ο : Ξ© β β) (C : Ξ© β Ξ© β β) (a b : Ξ©) : β := C a b/Ο a | |
| noncomputable def walk (Ο : Ξ© β β) (C : Ξ© β Ξ© β β) (z : Ξ©) : β β Ξ© β β | |
| | 0, a => if a=z then 1 else 0 | |
| | n+1, b => β a, walk Ο C z n a*kernel Ο C a b | |
| lemma walk_density (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (C : Ξ© β Ξ© β β) (z : Ξ©) (n : β) (a : Ξ©) : | |
| walk Ο C z n a = Ο a*evolve Ο C n (deltaDensity Ο z) a := by | |
| induction n generalizing a with | |
| | zero => | |
| by_cases h : a=z | |
| Β· subst a; simp [walk,evolve,deltaDensity,ne_of_gt (hp z)] | |
| Β· simp [walk,evolve,deltaDensity,h] | |
| | succ n ih => | |
| simp only [walk,ih,kernel,evolve,stepDensity,mul_div_cancelβ _ (ne_of_gt (hp a))] | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| field_simp [ne_of_gt (hp b)] | |
| lemma meeting_bound (Ο : Ξ© β β) (hp : β a, 0 < Ο a) (hs : β a, Ο a = 1) | |
| (C : Ξ© β Ξ© β β) (hC : β a b, 0 β€ C a b) | |
| (hrow : β a, β b, C a b = Ο a) (hcol : β b, β a, C a b = Ο b) | |
| (hlazy : β a, Ο a/2 β€ C a a) (Ξ³ : β) (hΞ³ : Ξ³ β€ 1) | |
| (hgap : β f, massMean Ο f = 0 β Ξ³*sqNorm Ο f β€ localEnergy C f) | |
| (z : Ξ©) (n : β) : | |
| (β a, |walk Ο C z n a-Ο a|)^2 β€ (1-Ξ³)^n*((Ο z)β»ΒΉ-1) := by | |
| let f : Ξ© β β := fun a => deltaDensity Ο z a-1 | |
| have hf : massMean Ο f = 0 := by | |
| simp only [f,massMean,mul_sub,mul_one,Finset.sum_sub_distrib,hs] | |
| change massMean Ο (deltaDensity Ο z)-1=0 | |
| rw [deltaDensity_mean Ο hp]; ring | |
| have hb := lazy_decay Ο hp C hC hrow hcol hlazy Ξ³ hΞ³ hgap f hf n | |
| have ha := abs_sum_sq_le Ο (evolve Ο C n f) (fun a => (hp a).le) hs | |
| have he : (fun a => Ο a*evolve Ο C n f a) = fun a => walk Ο C z n a-Ο a := by | |
| funext a | |
| dsimp only [f] | |
| rw [evolve_center Ο hp C hcol,walk_density Ο hp C z n] | |
| ring | |
| have hh : (β a, |Ο a*evolve Ο C n f a|) = β a, |walk Ο C z n a-Ο a| := by | |
| exact congrArg (fun g : Ξ© β β => β a, |g a|) he | |
| rw [hh] at ha | |
| have hn : sqNorm Ο f = (Ο z)β»ΒΉ-1 := deltaDensity_center_norm Ο hp hs z | |
| rw [hn] at hb | |
| exact ha.trans hb | |
| end MatchingFPRAS.FiniteChain | |
| namespace MatchingFPRAS.Transport | |
| section | |
| open Finset MatchingFPRAS.Replica MatchingFPRAS.Replica.Ladder | |
| variable {V J : Type*} [Fintype V] [DecidableEq V] [Fintype J] [DecidableEq J] | |
| variable {bags : V β Finset J} {G : SimpleGraph J} | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| noncomputable local instance : DecidableEq (PM (BagEdge.Incident (bags := bags))) := Classical.decEq _ | |
| noncomputable def ladderLaw (w : BagEdge bags β β) (T q : β) : | |
| (Slot T q β PM (BagEdge.Incident (bags := bags))) β β := density (slotLaw w) | |
| noncomputable def ladderFlow | |
| (hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b) | |
| (hG : G.IsAcyclic) (w : BagEdge bags β β) (T q : β) : | |
| (Slot T q β PM (BagEdge.Incident (bags := bags))) β | |
| (Slot T q β PM (BagEdge.Incident (bags := bags))) β β := | |
| scanFlow (slotLaw w) guides (base T q) (treeLadderCapacity hbags hG w) | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| noncomputable local instance : DecidableEq (PM (BagEdge.Incident (bags := bags))) := Classical.decEq _ | |
| variable {hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b} | |
| variable {hG : G.IsAcyclic} | |
| variable (height : J β β) (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) | |
| include hheight hstep hD hw hbags hG | |
| theorem concrete_ladder_mixing (hN : 2 β€ Fintype.card V) | |
| (Mβ : PM (BagEdge.Incident (bags := bags))) (T : β) | |
| (z : Slot T (32*(10^4*Fintype.card V*D)^100) β PM (BagEdge.Incident (bags := bags))) | |
| (n : β) : | |
| let q := 32*(10^4*Fintype.card V*D)^100 | |
| let Ξ½ := ladderLaw w T q | |
| let C := ladderFlow hbags hG w T q | |
| (β s, |MatchingFPRAS.FiniteChain.walk Ξ½ C z n s-Ξ½ s|)^2 β€ | |
| (1-3/((8*(T*q^2+q):β):β))^n*((Ξ½ z)β»ΒΉ-1) := by | |
| classical | |
| dsimp only | |
| let q : β := 32*(10^4*Fintype.card V*D)^100 | |
| let Ξ½ := ladderLaw w T q | |
| let C := ladderFlow hbags hG w T q | |
| have hq : 0 < q := by | |
| have hV : 0 < Fintype.card V := lt_of_lt_of_le (by norm_num) hN | |
| have hd : 0 < D := lt_of_lt_of_le (by norm_num) hD | |
| dsimp [q]; positivity | |
| have hM : 0 < ((8*(T*q^2+q):β):β) := by exact_mod_cast (by omega : 0 < 8*(T*q^2+q)) | |
| have hp (s) : 0 < Ξ½ s := by | |
| apply Finset.prod_pos; intro i _; exact slotLaw_pos w i (s i) | |
| have hs : (β s, Ξ½ s) = 1 := density_sum (slotLaw w) (fun i => slotLaw_sum w i Mβ) | |
| have hbase : (base T q).Nonempty := Finset.card_pos.mp (by rw [base_card]; exact hq) | |
| have hC (s t) : 0 β€ C s t := scanFlow_nonneg (slotLaw w) (fun i a => (slotLaw_pos w i a).le) | |
| guides (base T q) (treeLadderCapacity hbags hG w) s t | |
| have hrow (s) : (β t, C s t) = Ξ½ s := scanFlow_row (slotLaw w) (fun i => slotLaw_sum w i Mβ) | |
| guides (base T q) hbase (treeLadderCapacity hbags hG w) s | |
| have hcol (t) : (β s, C s t) = Ξ½ t := scanFlow_col (slotLaw w) (fun i => slotLaw_sum w i Mβ) | |
| guides (base T q) hbase (treeLadderCapacity hbags hG w) t | |
| have hlazy (s) : Ξ½ s/2 β€ C s s := scanFlow_lazy (slotLaw w) (fun i a => (slotLaw_pos w i a).le) | |
| guides (base T q) (treeLadderCapacity hbags hG w) s | |
| have hΞ³ : 3/((8*(T*q^2+q):β):β) β€ 1 := by | |
| apply (div_le_one hM).mpr | |
| exact_mod_cast (by omega : 3 β€ 8*(T*q^2+q)) | |
| have hgap (f) (hf : MatchingFPRAS.FiniteChain.massMean Ξ½ f = 0) : | |
| (3/((8*(T*q^2+q):β):β))*MatchingFPRAS.FiniteChain.sqNorm Ξ½ f β€ localEnergy C f := by | |
| have hh := concrete_ladder_poincare (hbags := hbags) (hG := hG) height hheight hstep D hD w hw hN Mβ T f | |
| dsimp only at hh | |
| have hv : MatchingFPRAS.Replica.variance (slotLaw w) f = MatchingFPRAS.FiniteChain.sqNorm Ξ½ f := by | |
| have hm : MatchingFPRAS.Replica.mean (slotLaw w) f = 0 := hf | |
| unfold MatchingFPRAS.Replica.variance MatchingFPRAS.Replica.dot | |
| simp only [hm,Pi.sub_apply,sub_zero] | |
| unfold MatchingFPRAS.FiniteChain.sqNorm | |
| apply Finset.sum_congr rfl | |
| intro s _; change Ξ½ s*f s*f s=Ξ½ s*(f s)^2; ring | |
| rw [hv] at hh | |
| have he : localEnergy C f = scanEnergy (slotLaw w) guides (base T q) (treeLadderCapacity hbags hG w) f := | |
| scanFlow_energy (slotLaw w) (fun i => slotLaw_sum w i Mβ) guides (base T q) (treeLadderCapacity hbags hG w) f | |
| rw [β he] at hh | |
| change MatchingFPRAS.FiniteChain.sqNorm Ξ½ f β€ ((8*(T*q^2+q):β):β)/3*localEnergy C f at hh | |
| rw [div_mul_eq_mul_div] | |
| apply (div_le_iffβ hM).mpr | |
| linarith | |
| exact MatchingFPRAS.FiniteChain.meeting_bound Ξ½ hp hs C hC hrow hcol hlazy | |
| (3/((8*(T*q^2+q):β):β)) hΞ³ hgap z n | |
| end | |
| section | |
| open Finset | |
| variable {V E : Type*} [Fintype V] [DecidableEq V] [Fintype E] [DecidableEq E] | |
| variable {inc : E β V β Prop} | |
| noncomputable def chosenEdge (A : PM inc) (v : V) : E := | |
| Classical.choose (A.property.2 v (mem_univ v)) | |
| omit [DecidableEq V] [Fintype E] [DecidableEq E] in | |
| lemma chosenEdge_mem (A : PM inc) (v : V) : chosenEdge A v β A.val := | |
| (Classical.choose_spec (A.property.2 v (mem_univ v))).1.1 | |
| omit [DecidableEq V] [Fintype E] [DecidableEq E] in | |
| lemma chosenEdge_incident (A : PM inc) (v : V) : inc (chosenEdge A v) v := | |
| (Classical.choose_spec (A.property.2 v (mem_univ v))).1.2 | |
| omit [DecidableEq V] [Fintype E] [DecidableEq E] in | |
| lemma chosenEdge_injective (hinc : β e, β v, inc e v) : | |
| Function.Injective (chosenEdge (inc := inc)) := by | |
| intro A B h | |
| apply Subtype.ext; ext e | |
| have hh (A B : PM inc) (h : chosenEdge A = chosenEdge B) : e β A.val β e β B.val := by | |
| intro he | |
| obtain β¨v,hvβ© := hinc e | |
| have heq : e = chosenEdge A v := A.property.unique (mem_univ v) he hv | |
| (chosenEdge_mem A v) (chosenEdge_incident A v) | |
| rw [heq,congrFun h v] | |
| exact chosenEdge_mem B v | |
| exact β¨hh A B h,hh B A h.symmβ© | |
| omit [DecidableEq E] in | |
| lemma pm_card_le (hinc : β e, β v, inc e v) : | |
| Fintype.card (PM inc) β€ Fintype.card E ^ Fintype.card V := by | |
| classical | |
| simpa only [Fintype.card_fun] using Fintype.card_le_of_injective chosenEdge (chosenEdge_injective hinc) | |
| omit [DecidableEq V] [DecidableEq E] in | |
| lemma gibbs_mass_lower (hinc : β e, β v, inc e v) (w : E β β) | |
| (D B : β) (hD : 1 β€ D) (hB : 1 β€ B) | |
| (hw : β e, Dβ»ΒΉ β€ w e β§ w e β€ B) (A : PM inc) : | |
| (Fintype.card (PM inc)*(D*B)^Fintype.card V)β»ΒΉ β€ gibbs w A := by | |
| classical | |
| have hD0 : 0 < D := by linarith | |
| have hB0 : 0 < B := by linarith | |
| have hw0 : β e, 0 < w e := fun e => (inv_pos.mpr hD0).trans_le (hw e).1 | |
| have lower (M : PM inc) : (D^Fintype.card V)β»ΒΉ β€ matchingWeight w M := by | |
| have hh : (Dβ»ΒΉ)^M.val.card β€ matchingWeight w M := by | |
| simpa only [matchingWeight,Finset.prod_const] using Finset.prod_le_prodβ | |
| (fun e (_ : e β M.val) => (inv_pos.mpr hD0).le) (fun e _ => (hw e).1) | |
| rw [inv_pow] at hh | |
| exact (inv_antiβ (pow_pos hD0 _) (pow_le_pow_rightβ hD (PM.card_le_vertices hinc M))).trans hh | |
| have upper (M : PM inc) : matchingWeight w M β€ B^Fintype.card V := by | |
| have hh : matchingWeight w M β€ B^M.val.card := by | |
| simpa only [matchingWeight,Finset.prod_const] using Finset.prod_le_prodβ | |
| (fun e (_ : e β M.val) => (hw0 e).le) (fun e _ => (hw e).2) | |
| exact hh.trans (pow_le_pow_rightβ hB (PM.card_le_vertices hinc M)) | |
| have hc : 0 < (Fintype.card (PM inc):β) := by | |
| have : Nonempty (PM inc) := β¨Aβ© | |
| exact_mod_cast Fintype.card_pos | |
| have hz : partition (inc := inc) w β€ Fintype.card (PM inc)*B^Fintype.card V := by | |
| have he : partition (inc := inc) w = β M : PM inc, matchingWeight w M := by | |
| unfold partition | |
| congr | |
| exact Subsingleton.elim _ _ | |
| rw [he] | |
| calc | |
| _ β€ β _M : PM inc, B^Fintype.card V := Finset.sum_le_sum (fun M _ => upper M) | |
| _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] | |
| have hp := partition_pos w hw0 A | |
| have hden : 0 < (Fintype.card (PM inc):β)*B^Fintype.card V := mul_pos hc (pow_pos hB0 _) | |
| calc | |
| _ = (D^Fintype.card V)β»ΒΉ/(Fintype.card (PM inc)*B^Fintype.card V) := by | |
| rw [mul_pow]; field_simp | |
| _ β€ matchingWeight w A/partition (inc := inc) w := | |
| div_le_divβ (matchingWeight_pos w hw0 A).le (lower A) hp hz | |
| _ = _ := rfl | |
| end | |
| section | |
| open Finset MatchingFPRAS.Replica MatchingFPRAS.Replica.Ladder | |
| variable {V J : Type*} [Fintype V] [DecidableEq V] [Fintype J] [DecidableEq J] | |
| variable {bags : V β Finset J} {G : SimpleGraph J} | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| lemma tierClamp_range {c lo hi w : β} (hc : 1 β€ c) (hlo : lo β€ 1) (hhi : 1 β€ hi) | |
| (hw : lo β€ w β§ w β€ hi) (t : β) : lo β€ tierClamp c t w β§ tierClamp c t w β€ hi := by | |
| have hp : 1 β€ c^t := one_le_powβ hc | |
| have hip : (c^t)β»ΒΉ β€ 1 := inv_le_one_of_one_leβ hp | |
| constructor | |
| Β· exact le_trans (le_min (hlo.trans hp) hw.1) (le_max_right _ _) | |
| Β· exact max_le (hip.trans hhi) ((min_le_right _ _).trans hw.2) | |
| omit [DecidableEq V] [Fintype J] [DecidableEq J] in | |
| lemma slotWeight_range (D K : β) (hD : 1 β€ D) (w : BagEdge bags β β) | |
| (hw : β e, (D:β)β»ΒΉ β€ w e β§ w e β€ 3*4^K) {T q : β} (x : Slot T q) (e : BagEdge bags) : | |
| (D:β)β»ΒΉ β€ slotWeight w x e β§ slotWeight w x e β€ 3*4^K := by | |
| apply tierClamp_range | |
| Β· unfold tierBase; exact le_add_of_nonneg_right (by positivity) | |
| Β· apply inv_le_one_of_one_leβ; exact_mod_cast hD | |
| Β· have h : (1:β) β€ 4^K := one_le_powβ (by norm_num) | |
| linarith | |
| Β· exact hw e | |
| omit [DecidableEq J] in | |
| lemma bag_pm_card_le | |
| (hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b) | |
| (hG : G.IsAcyclic) : | |
| Fintype.card (PM (BagEdge.Incident (bags := bags))) β€ (2*Fintype.card V^2)^Fintype.card V := by | |
| apply (pm_card_le BagEdge.exists_incident).trans | |
| exact Nat.pow_le_pow_left (bag_edges_card_le hbags hG) _ | |
| lemma denominator_power_bound (N D K : β) (hN : 2 β€ N) (hD : 1 β€ D) : | |
| ((2*(N:β)^2)^N)*((D:β)*(3*4^K))^N β€ | |
| (2:β)^(10*N*(K+Nat.clog 2 (N*D+2)+1)) := by | |
| let a := Nat.clog 2 (N*D+2) | |
| have hp : (N*D+2:β) β€ (2:β)^a := by exact_mod_cast Nat.le_pow_clog (by decide : 1 < 2) (N*D+2) | |
| have hn : (N:β) β€ 2^a := by | |
| have hd : (1:β) β€ D := by exact_mod_cast hD | |
| have hn0 : (0:β) β€ N := Nat.cast_nonneg N | |
| have hnd : (N:β) β€ N*D := by nlinarith | |
| exact hnd.trans (le_trans (by linarith) hp) | |
| have hd : (D:β) β€ 2^a := by | |
| have hn2 : (2:β) β€ N := by exact_mod_cast hN | |
| have hd0 : (0:β) β€ D := Nat.cast_nonneg D | |
| have hnd : (D:β) β€ N*D := by nlinarith | |
| exact hnd.trans (le_trans (by linarith) hp) | |
| have hfour : (4:β)^K = 2^(2*K) := by rw [pow_mul]; norm_num | |
| have hb : 2*(N:β)^2*((D:β)*(3*4^K)) β€ 2^(3+3*a+2*K) := by | |
| calc | |
| _ β€ 2*(2^a)^2*((2^a)*(3*4^K)) := mul_le_mul | |
| (mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (Nat.cast_nonneg N) hn 2) (by norm_num)) | |
| (mul_le_mul_of_nonneg_right hd (by positivity)) (by positivity) (by positivity) | |
| _ β€ 2*(2^a)^2*((2^a)*(4*4^K)) := by | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| exact mul_le_mul_of_nonneg_right (by norm_num : (3:β) β€ 4) (by positivity) | |
| _ = _ := by | |
| rw [hfour] | |
| calc | |
| _ = (2:β)^3*2^(a*2)*2^a*2^(2*K) := by rw [pow_mul]; norm_num; ring | |
| _ = _ := by simp only [β pow_add]; congr 1; omega | |
| calc | |
| _ = (2*(N:β)^2*((D:β)*(3*4^K)))^N := (mul_pow _ _ _).symm | |
| _ β€ (2^(3+3*a+2*K))^N := pow_le_pow_leftβ (by positivity) hb N | |
| _ = (2:β)^((3+3*a+2*K)*N) := (pow_mul _ _ _).symm | |
| _ β€ _ := pow_le_pow_rightβ (by norm_num) (by dsimp only [a]; nlinarith) | |
| end | |
| open Finset MatchingFPRAS.Replica MatchingFPRAS.Replica.Ladder | |
| variable {V J : Type*} [Fintype V] [DecidableEq V] [Fintype J] [DecidableEq J] | |
| variable {bags : V β Finset J} {G : SimpleGraph J} | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| omit [DecidableEq J] in | |
| lemma slotLaw_minimum_mass | |
| (hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b) | |
| (hG : G.IsAcyclic) (D K : β) (hD : 1 β€ D) (hN : 2 β€ Fintype.card V) | |
| (w : BagEdge bags β β) (hw : β e, (D:β)β»ΒΉ β€ w e β§ w e β€ 3*4^K) | |
| {T q : β} (x : Slot T q) (A : PM (BagEdge.Incident (bags := bags))) : | |
| ((2:β)^(10*Fintype.card V*(K+Nat.clog 2 (Fintype.card V*D+2)+1)))β»ΒΉ β€ slotLaw w x A := by | |
| have hl := gibbs_mass_lower BagEdge.exists_incident (slotWeight w x) D (3*4^K) | |
| (by exact_mod_cast hD) (by | |
| have hh : (1:β) β€ 4^K := one_le_powβ (by norm_num) | |
| linarith) | |
| (slotWeight_range D K hD w hw x) A | |
| have hc : (Fintype.card (PM (BagEdge.Incident (bags := bags))):β) β€ | |
| (2*Fintype.card V^2:β)^Fintype.card V := by exact_mod_cast bag_pm_card_le hbags hG | |
| have hd := (mul_le_mul_of_nonneg_right hc (by positivity : (0:β) β€ ((D:β)*(3*4^K))^Fintype.card V)).trans | |
| (denominator_power_bound (Fintype.card V) D K hN hD) | |
| have hp : 0 < (Fintype.card (PM (BagEdge.Incident (bags := bags))):β)* | |
| ((D:β)*(3*4^K))^Fintype.card V := by | |
| have : Nonempty (PM (BagEdge.Incident (bags := bags))) := β¨Aβ© | |
| have hc0 : (0:β) < Fintype.card (PM (BagEdge.Incident (bags := bags))) := by exact_mod_cast Fintype.card_pos | |
| have hd0 : (0:β) < D := by exact_mod_cast (by omega : 0 < D) | |
| positivity | |
| exact (inv_antiβ hp hd).trans hl | |
| omit [DecidableEq J] in | |
| lemma ladderLaw_power_lower | |
| (hbags : β v, β a β bags v, β b β bags v, a = b β¨ G.Adj a b) | |
| (hG : G.IsAcyclic) (D K : β) (hD : 1 β€ D) (hN : 2 β€ Fintype.card V) | |
| (w : BagEdge bags β β) (hw : β e, (D:β)β»ΒΉ β€ w e β§ w e β€ 3*4^K) (T q : β) | |
| (z : Slot T q β PM (BagEdge.Incident (bags := bags))) : | |
| ((2:β)^(10*Fintype.card V*q*(T+1)*(K+Nat.clog 2 (Fintype.card V*D+2)+1)))β»ΒΉ β€ ladderLaw w T q z := by | |
| have hh := Finset.prod_le_prodβ (s := Finset.univ) | |
| (fun (x : Slot T q) _ => (by positivity : (0:β) β€ ((2:β)^(10*Fintype.card V*(K+Nat.clog 2 (Fintype.card V*D+2)+1)))β»ΒΉ)) | |
| (fun x _ => slotLaw_minimum_mass hbags hG D K hD hN w hw x (z x)) | |
| simp only [prod_const,card_univ,slots_card,β inv_pow,β pow_mul] at hh | |
| have he : 10*Fintype.card V*(K+Nat.clog 2 (Fintype.card V*D+2)+1)*((T+1)*q) = | |
| 10*Fintype.card V*q*(T+1)*(K+Nat.clog 2 (Fintype.card V*D+2)+1) := by ring | |
| rw [he] at hh | |
| simpa only [inv_pow,ladderLaw,density] using hh | |
| end MatchingFPRAS.Transport | |
| end OAI | |