introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
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