Download data/lean/OAI/Combinatorics/MatchingCount/Probability/Tv.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/Tv.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatchingCount/Probability/Tv.lean
-
curl -L -o Tv.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatchingCount/Probability/Tv.lean
18.4 kB
| import Mathlib | |
| import OAI.Combinatorics.MatchingCount.Graphs.Marked | |
| namespace OAI | |
| namespace MatchingFPRAS.Variation | |
| open Finset | |
| open scoped Classical | |
| variable {Ξ© Ξ¨ : Type*} [Fintype Ξ©] [Fintype Ξ¨] | |
| noncomputable def tv (p q : Ξ© β β) : β := (β s,|p s-q s|)/2 | |
| lemma tv_nonneg (p q : Ξ© β β) : 0 β€ tv p q := by | |
| unfold tv; positivity | |
| lemma tv_symm (p q : Ξ© β β) : tv p q=tv q p := by | |
| unfold tv | |
| simp_rw [abs_sub_comm] | |
| lemma tv_triangle (p q r : Ξ© β β) : tv p r β€ tv p q+tv q r := by | |
| unfold tv | |
| rw [βadd_div,βsum_add_distrib] | |
| exact div_le_div_of_nonneg_right (sum_le_sum (fun s _ => abs_sub_le _ _ _)) (by norm_num) | |
| noncomputable def event (p : Ξ© β β) (P : Ξ© β Prop) : β := β x,if P x then p x else 0 | |
| lemma event_nonneg (p : Ξ© β β) (hp : β x,0 β€ p x) (P : Ξ© β Prop) : 0 β€ event p P := by | |
| unfold event; apply sum_nonneg; intro x _; split_ifs | |
| Β· exact hp x | |
| Β· exact le_rfl | |
| theorem event_sub_le (p q : Ξ© β β) (hs : β x,p x=β x,q x) (P : Ξ© β Prop) : | |
| |event p P-event q P| β€ tv p q := by | |
| let A : Finset Ξ© := univ.filter P | |
| have hz : β x,(p x-q x)=0 := by rw [sum_sub_distrib,hs,sub_self] | |
| have he : event p P-event q P=β x β A,(p x-q x) := by | |
| simp only [event,βsum_sub_distrib,A,sum_filter] | |
| apply sum_congr rfl | |
| intro x _ | |
| split_ifs <;> simp | |
| have hc : β x β AαΆ,(p x-q x)= -(β x β A,(p x-q x)) := by | |
| have h := Finset.sum_add_sum_compl A (fun x => p x-q x) | |
| rw [hz] at h | |
| linarith | |
| have ha := abs_sum_le_sum_abs (fun x => p x-q x) A | |
| have hb := abs_sum_le_sum_abs (fun x => p x-q x) AαΆ | |
| rw [hc,abs_neg] at hb | |
| have hab := Finset.sum_add_sum_compl A (fun x => |p x-q x|) | |
| rw [he] | |
| unfold tv | |
| linarith | |
| noncomputable def bind (p : Ξ© β β) (k : Ξ© β Ξ¨ β β) (y : Ξ¨) : β := β x,p x*k x y | |
| omit [Fintype Ξ¨] in | |
| lemma bind_nonneg (p : Ξ© β β) (k : Ξ© β Ξ¨ β β) | |
| (hp : β x,0 β€ p x) (hk : β x y,0 β€ k x y) (y : Ξ¨) : 0 β€ bind p k y := | |
| sum_nonneg fun x _ => mul_nonneg (hp x) (hk x y) | |
| lemma bind_sum (p : Ξ© β β) (k : Ξ© β Ξ¨ β β) (hs : β x,p x=1) | |
| (hk : β x,β y,k x y=1) : β y,bind p k y=1 := by | |
| unfold bind | |
| rw [sum_comm] | |
| simp_rw [βmul_sum,hk,mul_one] | |
| exact hs | |
| lemma bind_contraction (p q : Ξ© β β) (k : Ξ© β Ξ¨ β β) | |
| (hk : β x y,0 β€ k x y) (hs : β x,β y,k x y=1) : | |
| tv (bind p k) (bind q k) β€ tv p q := by | |
| unfold tv bind | |
| apply div_le_div_of_nonneg_right _ (by norm_num) | |
| calc | |
| _ = β y,|β x,(p x-q x)*k x y| := by simp only [sub_mul,sum_sub_distrib] | |
| _ β€ β y,β x,|(p x-q x)*k x y| := sum_le_sum (fun y _ => abs_sum_le_sum_abs _ _) | |
| _ = _ := by | |
| rw [sum_comm] | |
| simp_rw [abs_mul,abs_of_nonneg (hk _ _),βmul_sum,hs,mul_one] | |
| lemma bind_perturbation (p : Ξ© β β) (k l : Ξ© β Ξ¨ β β) | |
| (hp : β x,0 β€ p x) (hs : β x,p x=1) (Ξ΅ : β) (he : β x,tv (k x) (l x) β€ Ξ΅) : | |
| tv (bind p k) (bind p l) β€ Ξ΅ := by | |
| unfold tv bind | |
| have h : β y,|β x,p x*k x y-β x,p x*l x y| β€ 2*Ξ΅ := by | |
| calc | |
| _ = β y,|β x,p x*(k x y-l x y)| := by simp only [mul_sub,sum_sub_distrib] | |
| _ β€ β y,β x,|p x*(k x y-l x y)| := sum_le_sum (fun y _ => abs_sum_le_sum_abs _ _) | |
| _ = β x,p x*(β y,|k x y-l x y|) := by | |
| rw [sum_comm]; simp_rw [abs_mul,abs_of_nonneg (hp _),βmul_sum] | |
| _ β€ β x,p x*(2*Ξ΅) := by | |
| apply sum_le_sum | |
| intro x _ | |
| apply mul_le_mul_of_nonneg_left _ (hp x) | |
| have hh := he x | |
| unfold tv at hh | |
| linarith | |
| _ = _ := by rw [βsum_mul,hs,one_mul] | |
| linarith | |
| noncomputable def push (p : Ξ© β β) (f : Ξ© β Ξ¨) (y : Ξ¨) : β := | |
| β x,if f x=y then p x else 0 | |
| omit [Fintype Ξ¨] in | |
| lemma push_nonneg (p : Ξ© β β) (hp : β x,0 β€ p x) (f : Ξ© β Ξ¨) (y : Ξ¨) : | |
| 0 β€ push p f y := by | |
| unfold push; apply sum_nonneg; intro x _; split_ifs | |
| Β· exact hp x | |
| Β· exact le_rfl | |
| lemma push_sum (p : Ξ© β β) (hs : β x,p x=1) (f : Ξ© β Ξ¨) : β y,push p f y=1 := by | |
| unfold push; rw [sum_comm]; simpa using hs | |
| lemma push_contraction (p q : Ξ© β β) (f : Ξ© β Ξ¨) : tv (push p f) (push q f) β€ tv p q := by | |
| have he (r : Ξ© β β) : push r f=bind r (fun x y => if f x=y then 1 else 0) := by | |
| funext y | |
| simp only [push,bind,mul_ite,mul_one,mul_zero] | |
| rw [he p,he q] | |
| exact | |
| bind_contraction p q (fun x y => if f x=y then 1 else 0) | |
| (fun x y => by split_ifs <;> norm_num) (fun x => by simp) | |
| noncomputable def tensor (p : Ξ© β β) (q : Ξ¨ β β) (x : Ξ©ΓΞ¨) : β := p x.1*q x.2 | |
| lemma tensor_tv (p q : Ξ© β β) (r s : Ξ¨ β β) | |
| (hp : β x,0 β€ p x) (hps : β x,p x=1) (hs : β y,0 β€ s y) (hss : β y,s y=1) : | |
| tv (tensor p r) (tensor q s) β€ tv p q+tv r s := by | |
| have hv (x : Ξ©) (y : Ξ¨) : |p x*r y-q x*s y| β€ p x*|r y-s y|+|p x-q x| *s y := by | |
| have he : p x*r y-q x*s y=p x*(r y-s y)+(p x-q x)*s y := by ring | |
| rw [he] | |
| simpa only [abs_mul,abs_of_nonneg (hp x),abs_of_nonneg (hs y)] using abs_add_le (p x*(r y-s y)) ((p x-q x)*s y) | |
| unfold tv tensor | |
| rw [βadd_div] | |
| apply div_le_div_of_nonneg_right _ (by norm_num) | |
| rw [Fintype.sum_prod_type] | |
| calc | |
| _ β€ β x,β y,(p x*|r y-s y|+|p x-q x| *s y) := sum_le_sum (fun x _ => sum_le_sum (fun y _ => hv x y)) | |
| _ = _ := by simp_rw [sum_add_distrib,βmul_sum,hss,mul_one,βsum_mul,hps,one_mul]; ring | |
| lemma tv_equiv (e : Ξ© β Ξ¨) (p q : Ξ¨ β β) : tv (p β e) (q β e)=tv p q := by | |
| unfold tv | |
| rw [βe.sum_comp (fun y => |p y-q y|)] | |
| rfl | |
| noncomputable def iid (p : Ξ© β β) (n : β) (x : Fin n β Ξ©) : β := β i,p (x i) | |
| omit [Fintype Ξ©] in | |
| lemma iid_nonneg (p : Ξ© β β) (hp : β x,0 β€ p x) (n : β) (x : Fin n β Ξ©) : 0 β€ iid p n x := | |
| prod_nonneg fun _ _ => hp _ | |
| lemma iid_sum (p : Ξ© β β) (hs : β x,p x=1) (n : β) : β x,iid p n x=1 := by | |
| unfold iid | |
| rw [βFintype.prod_sum] | |
| simp [hs] | |
| theorem iid_tv (p q : Ξ© β β) (hp : β x,0 β€ p x) (hps : β x,p x=1) | |
| (hq : β x,0 β€ q x) (hqs : β x,q x=1) (n : β) : | |
| tv (iid p n) (iid q n) β€ n*tv p q := by | |
| induction n with | |
| | zero => simp [tv,iid] | |
| | succ n ih => | |
| let e : (Ξ©Γ(Fin n β Ξ©)) β (Fin (n+1) β Ξ©) := Fin.consEquiv (fun _ : Fin (n+1) => Ξ©) | |
| have hpE : iid p (n+1) β e=tensor p (iid p n) := by | |
| funext x | |
| simp [iid,tensor,e,Fin.prod_univ_succ] | |
| have hqE : iid q (n+1) β e=tensor q (iid q n) := by | |
| funext x | |
| simp [iid,tensor,e,Fin.prod_univ_succ] | |
| rw [βtv_equiv e,hpE,hqE] | |
| have ht := tensor_tv p q (iid p n) (iid q n) hp hps (iid_nonneg q hq n) (iid_sum q hqs n) | |
| push_cast | |
| nlinarith | |
| section Product | |
| variable {I : Type*} [Fintype I] [DecidableEq I] | |
| noncomputable def product (p : I β Ξ© β β) (x : I β Ξ©) : β := β i,p i (x i) | |
| lemma product_marginal (p : I β Ξ© β β) (hs : β i,β a,p i a=1) (j : I) : | |
| push (product p) (fun x => x j)=p j := by | |
| classical | |
| funext y | |
| let q : I β Ξ© β β := fun i a => if i=j then (if a=y then p i a else 0) else p i a | |
| have he (x : I β Ξ©) : (if x j=y then product p x else 0)=β i,q i (x i) := by | |
| by_cases h : x j=y | |
| Β· simp only [ite_eq_left h,product] | |
| apply prod_congr rfl | |
| intro i _ | |
| by_cases hi : i=j | |
| Β· subst i; simp [q,h] | |
| Β· simp [q,hi] | |
| Β· simp only [ite_eq_right h] | |
| symm | |
| apply prod_eq_zero (mem_univ j) | |
| simp [q,h] | |
| have hq (i : I) : β a,q i a=if i=j then p j y else 1 := by | |
| by_cases h : i=j | |
| Β· subst i; simp [q] | |
| Β· simp [q,h,hs i] | |
| unfold push | |
| simp_rw [he] | |
| rw [βFintype.prod_sum] | |
| simp_rw [hq] | |
| simp | |
| end Product | |
| variable {B : Ξ© β Type*} [β a,Fintype (B a)] | |
| noncomputable def sigmaLift (p : Ξ© β β) (k : β a,B a β β) (s : Sigma B) : β := | |
| p s.1*k s.1 s.2 | |
| omit [Fintype Ξ©] [β a,Fintype (B a)] in | |
| lemma sigmaLift_nonneg (p : Ξ© β β) (k : β a,B a β β) | |
| (hp : β a,0 β€ p a) (hk : β a b,0 β€ k a b) (s : Sigma B) : 0 β€ sigmaLift p k s := | |
| mul_nonneg (hp _) (hk _ _) | |
| lemma sigmaLift_sum (p : Ξ© β β) (k : β a,B a β β) | |
| (hs : β a,p a=1) (hk : β a,β b,k a b=1) : β s,sigmaLift p k s=1 := by | |
| simp only [sigmaLift,Fintype.sum_sigma,βmul_sum,hk,mul_one,hs] | |
| lemma sigmaLift_tv (p q : Ξ© β β) (k : β a,B a β β) | |
| (hk : β a b,0 β€ k a b) (hs : β a,β b,k a b=1) : | |
| tv (sigmaLift p k) (sigmaLift q k)=tv p q := by | |
| simp only [tv,sigmaLift,Fintype.sum_sigma,βsub_mul,abs_mul,abs_of_nonneg (hk _ _),βmul_sum,hs,mul_one] | |
| end MatchingFPRAS.Variation | |
| namespace MatchingFPRAS.Transport | |
| def tierBound (N D K : β) : β := N^2*(Nat.clog 2 D+2*K+2) | |
| lemma base_block (N : β) (hN : 0<N) : 2 β€ (1+((N:β)^2)β»ΒΉ)^(N^2) := by | |
| have hp : (0:β)<N := by exact_mod_cast hN | |
| have ha : -(2:β)β€((N:β)^2)β»ΒΉ := by | |
| have : (0:β)β€((N:β)^2)β»ΒΉ := by positivity | |
| linarith | |
| have h := one_add_mul_le_pow (a:=((N:β)^2)β»ΒΉ) ha (N^2) | |
| norm_cast at h | |
| have he : (N^2:β)*((N:β)^2)β»ΒΉ=1 := mul_inv_cancelβ (by positivity) | |
| norm_num only [Nat.cast_pow, he] at h | |
| linarith | |
| lemma tierBound_reaches (N D K : β) (hN : 0<N) : | |
| max (D:β) (3*4^K) β€ (1+((N:β)^2)β»ΒΉ)^(tierBound N D K) := by | |
| have hb := base_block N hN | |
| have hp : 0β€(1+((N:β)^2)β»ΒΉ)^(N^2) := by positivity | |
| have hD : (D:β) β€ 2^(Nat.clog 2 D) := by exact_mod_cast Nat.le_pow_clog (by decide : 1<2) D | |
| have hk : (3:β)*4^K β€ 2^(2*K+2) := by | |
| rw [pow_add,pow_mul] | |
| norm_num | |
| nlinarith [pow_pos (by norm_num : (0:β)<4) K] | |
| have eD : Nat.clog 2 D β€ Nat.clog 2 D+2*K+2 := by omega | |
| have eK : 2*K+2 β€ Nat.clog 2 D+2*K+2 := by omega | |
| calc | |
| max (D:β) (3*4^K) β€ 2^(Nat.clog 2 D+2*K+2) := max_le | |
| (hD.trans (pow_le_pow_rightβ (by norm_num) eD)) | |
| (hk.trans (pow_le_pow_rightβ (by norm_num) eK)) | |
| _ β€ _ := by | |
| unfold tierBound | |
| rw [pow_mul] | |
| exact pow_le_pow_leftβ (by norm_num) hb _ | |
| noncomputable def ladderTier (N D K : β) (hN : 0<N) : β := | |
| Nat.find (β¨tierBound N D K,tierBound_reaches N D K hNβ© : | |
| β t : β,max (D:β) (3*4^K) β€ (1+((N:β)^2)β»ΒΉ)^t) | |
| lemma ladderTier_spec (N D K : β) (hN : 0<N) : | |
| max (D:β) (3*4^K) β€ (1+((N:β)^2)β»ΒΉ)^(ladderTier N D K hN) := by | |
| exact Nat.find_spec (p:=fun t : β => max (D:β) (3*4^K) β€ (1+((N:β)^2)β»ΒΉ)^t) | |
| β¨tierBound N D K,tierBound_reaches N D K hNβ© | |
| lemma ladderTier_le (N D K : β) (hN : 0<N) : ladderTier N D K hN β€ tierBound N D K := | |
| Nat.find_min' _ (tierBound_reaches N D K hN) | |
| lemma ladderTier_min (N D K : β) (hN : 0<N) {t : β} (ht : t<ladderTier N D K hN) : | |
| (1+((N:β)^2)β»ΒΉ)^t < max (D:β) (3*4^K) := lt_of_not_ge (Nat.find_min _ ht) | |
| lemma topClamp_eq (N D K : β) (hN : 0<N) (hD : 0<D) (w : β) | |
| (hw : (D:β)β»ΒΉ β€ w β§ w β€ 3*4^K) : | |
| tierClamp (1+((N:β)^2)β»ΒΉ) (ladderTier N D K hN) w=w := by | |
| have ht := ladderTier_spec N D K hN | |
| have hlo : ((1+((N:β)^2)β»ΒΉ)^(ladderTier N D K hN))β»ΒΉ β€ w := | |
| (inv_antiβ (by exact_mod_cast hD) ((le_max_left _ _).trans ht)).trans hw.1 | |
| have hhi : w β€ (1+((N:β)^2)β»ΒΉ)^(ladderTier N D K hN) := hw.2.trans ((le_max_right _ _).trans ht) | |
| simp only [tierClamp,min_eq_right hhi,max_eq_right hlo] | |
| end MatchingFPRAS.Transport | |
| namespace MatchingFPRAS.FiniteChain | |
| open Finset | |
| open scoped Classical | |
| variable {Ξ© : Type*} [Fintype Ξ©] [DecidableEq Ξ©] | |
| lemma walk_nonneg (Ο : Ξ© β β) (hp : β a,0<Ο a) (C : Ξ© β Ξ© β β) | |
| (hC : β a b,0β€C a b) (z a : Ξ©) (n : β) : 0 β€ walk Ο C z n a := by | |
| induction n generalizing a with | |
| | zero => simp only [walk]; split_ifs <;> norm_num | |
| | succ n ih => exact sum_nonneg fun b _ => mul_nonneg (ih b) (div_nonneg (hC b a) (hp b).le) | |
| lemma walk_sum (Ο : Ξ© β β) (hp : β a,0<Ο a) (C : Ξ© β Ξ© β β) | |
| (hC : β a,β b,C a b=Ο a) (z : Ξ©) (n : β) : β a,walk Ο C z n a=1 := by | |
| induction n with | |
| | zero => simp [walk] | |
| | succ n ih => | |
| simp only [walk,kernel] | |
| rw [sum_comm] | |
| simp_rw [βmul_sum,βsum_div,hC,div_self (hp _).ne',mul_one] | |
| exact ih | |
| end MatchingFPRAS.FiniteChain | |
| namespace MatchingFPRAS.Transport | |
| open Finset MatchingFPRAS.Replica MatchingFPRAS.Replica.Ladder | |
| variable {V J : Type*} [Fintype V] [DecidableEq V] [Fintype J] [DecidableEq J] | |
| variable {bags : V β Finset J} | |
| noncomputable local instance : Fintype (BagEdge bags) := Fintype.ofFinite _ | |
| noncomputable local instance : DecidableEq (PM (BagEdge.Incident (bags := bags))) := Classical.decEq _ | |
| def topSlot (T q : β) (hq : 0<q) : Slot T q := toLex (0,β¨0,hqβ©) | |
| lemma topSlot_tier (T q : β) (hq : 0<q) : tier (topSlot T q hq)=T := by simp [tier,rank,topSlot] | |
| omit [DecidableEq V] [DecidableEq J] in | |
| lemma ladder_top_marginal (w : BagEdge bags β β) (T q : β) (hq : 0<q) | |
| (M : PM (BagEdge.Incident (bags := bags))) : | |
| Variation.push (ladderLaw w T q) (fun x => x (topSlot T q hq))=slotLaw w (topSlot T q hq) := by | |
| exact Variation.product_marginal (slotLaw w) (fun i => slotLaw_sum w i M) _ | |
| omit [DecidableEq V] [Fintype J] [DecidableEq J] in | |
| lemma slotWeight_top (w : BagEdge bags β β) (D K T q : β) (hD : 0<D) (hq : 0<q) | |
| (hw : β e,(D:β)β»ΒΉ β€ w e β§ w e β€ 3*4^K) | |
| (hT : max (D:β) (3*4^K) β€ (tierBase V)^T) : | |
| slotWeight w (topSlot T q hq)=w := by | |
| funext e | |
| have hlo : ((tierBase V)^T)β»ΒΉ β€ w e := | |
| (inv_antiβ (by exact_mod_cast hD) ((le_max_left _ _).trans hT)).trans (hw e).1 | |
| have hhi : w e β€ (tierBase V)^T := (hw e).2.trans ((le_max_right _ _).trans hT) | |
| simp only [slotWeight,topSlot_tier,tierClamp,min_eq_right hhi,max_eq_right hlo] | |
| end MatchingFPRAS.Transport | |
| namespace MatchingFPRAS.Enlargement | |
| 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 _ | |
| noncomputable def revealLaw (w : V β V β β) (K D : β) (p : SourcePM w K β β) : SourceMarked w K β β := | |
| Variation.sigmaLift p (Marking.conditional BagEdge.Incident (sourcePortions w K D)) | |
| lemma sourceBagWeight_pos (w : V β V β β) (hw : β x y,0<w x y) (K D : β) (hD : 0<D) | |
| (e : BagEdge (sourceBags w K)) : 0<sourceBagWeight w K D e := by | |
| unfold sourceBagWeight | |
| exact add_pos_of_nonneg_of_pos (sourceRealPortion_nonneg w hw K e) (div_pos (bagHeight_pos w K _) (by exact_mod_cast hD)) | |
| lemma revealLaw_ideal (w : V β V β β) (hw : β x y,0<w x y) (K D : β) (hD : 0<D) : | |
| revealLaw w K D (gibbs (sourceBagWeight w K D))=sourceLaw w K D := by | |
| funext a | |
| have hc (e : BagEdge (sourceBags w K)) : Marking.collapse (sourcePortions w K D) eβ 0 := by | |
| rw [sourcePortions_collapse] | |
| exact (sourceBagWeight_pos w hw K D hD e).ne' | |
| have h := Marking.law_from_reveal BagEdge.Incident (sourcePortions w K D) hc a | |
| have he : Marking.collapse (sourcePortions w K D)=sourceBagWeight w K D := | |
| sourcePortions_collapse w K D | |
| rw [he] at h | |
| have hz : Transport.partition (inc:=BagEdge.Incident) (sourceBagWeight w K D)= | |
| partitionWeight BagEdge.Incident (sourceBagWeight w K D) univ := by | |
| unfold Transport.partition partitionWeight matchingWeight | |
| congr 1 | |
| ext M | |
| simp | |
| exact (show revealLaw w K D (gibbs (sourceBagWeight w K D)) a= | |
| sourceLaw w K D a from by | |
| unfold revealLaw Variation.sigmaLift gibbs matchingWeight | |
| rw [hz] | |
| exact h) | |
| lemma revealLaw_tv (w : V β V β β) (hw : β x y,0<w x y) (K D : β) (hD : 0<D) | |
| (p q : SourcePM w K β β) : | |
| Variation.tv (revealLaw w K D p) (revealLaw w K D q)=Variation.tv p q := by | |
| apply Variation.sigmaLift_tv | |
| Β· intro M a | |
| unfold Marking.conditional | |
| apply prod_nonneg | |
| intro e _ | |
| apply div_nonneg (sourcePortions_nonneg w hw K D _ _) | |
| rw [sourcePortions_collapse] | |
| exact (sourceBagWeight_pos w hw K D hD e).le | |
| Β· intro M | |
| apply Marking.conditional_sum | |
| intro e | |
| rw [sourcePortions_collapse] | |
| exact (sourceBagWeight_pos w hw K D hD e).ne' | |
| theorem source_marked_sampling (hn : 2 β€ Fintype.card V) | |
| (w : V β V β β) (hw : β x y,0 < w x y) (K : β) | |
| (hK : β x y,xβ y β edgeActivity w x y β€ (4:β)^K) | |
| (Mβ : SourcePM w K) (T : β) | |
| (hT : max (sourceD (V:=V) K:β) (3*4^K) β€ (tierBase (SourceVertex V K))^T) | |
| (z : Slot T (ladderQ (Fintype.card (SourceVertex V K)) (sourceD (V:=V) K)) β SourcePM w K) | |
| (ΞΎ : β) (hΞΎ : 0<ΞΎ) (hΞΎ1 : ΞΎ<1) : | |
| let D := sourceD (V:=V) K | |
| let N := Fintype.card (SourceVertex V K) | |
| let q := ladderQ N D | |
| β hq : 0<q, | |
| let wt := sourceBagWeight w K D | |
| let Ξ½ := ladderLaw wt T q | |
| let C := ladderFlow (fun x a ha b hb => sourceBag_tree_adjacent w K hK x a b ha hb) (sourceTree_isTree w K).2 wt T q | |
| let p := Variation.push (MatchingFPRAS.FiniteChain.walk Ξ½ C z (ladderSteps N D K T ΞΎ)) | |
| (fun a => a (topSlot T q hq)) | |
| Variation.tv (revealLaw w K D p) (sourceLaw w K D) β€ ΞΎ := by | |
| dsimp only | |
| let D := sourceD (V:=V) K | |
| let N := Fintype.card (SourceVertex V K) | |
| have hd : 0<D := lt_of_lt_of_le (by decide) (sourceD_one K) | |
| have hn' : 0<N := lt_of_lt_of_le (by decide : 0<2) (hn.trans (sourceVertex_card_ge K)) | |
| have hq : 0<ladderQ N D := by unfold ladderQ ladderL; positivity | |
| refine β¨hq,?_β© | |
| rw [βrevealLaw_ideal w hw K D hd,revealLaw_tv w hw K D hd] | |
| have hm := ladder_top_marginal (sourceBagWeight w K D) T (ladderQ N D) hq Mβ | |
| have he := slotWeight_top (sourceBagWeight w K D) D K T (ladderQ N D) hd hq | |
| (sourceBagWeight_global w K D (sourceD_one K) hw hK) hT | |
| unfold slotLaw at hm | |
| rw [he] at hm | |
| change Variation.push (ladderLaw (sourceBagWeight w K D) T (ladderQ N D)) | |
| (fun a => a (topSlot T (ladderQ N D) hq))=gibbs (sourceBagWeight w K D) at hm | |
| rw [βhm] | |
| apply (Variation.push_contraction _ _ _).trans | |
| exact source_ladder_sampling hn w hw K hK Mβ T z ΞΎ hΞΎ hΞΎ1 | |
| end MatchingFPRAS.Enlargement | |
| end OAI | |