math / data /lean /OAI /Dynamics /ConditionalShuffle /FiniteMinorization.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.66 kB
import OAI.Dynamics.ConditionalShuffle.InjectionKernel
namespace OAI
noncomputable section
open scoped BigOperators Classical
namespace Thorp.Conditional.Reset
variable {X : Type*} [Fintype X] [nonempty_X : Nonempty X]
lemma sum_uniform_deficit (P : X β†’ ℝ) (hP : βˆ‘ x, P x = 1) :
(βˆ‘ x, ((Fintype.card X : ℝ)⁻¹ - min (P x) (Fintype.card X : ℝ)⁻¹)) ≀
tv P (fun _ => (Fintype.card X : ℝ)⁻¹) := by
have huw : (βˆ‘ _ : X, (Fintype.card X : ℝ)⁻¹) = 1 := by simp
have hh := sum_sub_le_tv (fun _ : X => (Fintype.card X : ℝ)⁻¹) P
(huw.trans hP.symm) (Finset.univ.filter (fun x => P x ≀ (Fintype.card X : ℝ)⁻¹))
have he : (βˆ‘ x, ((Fintype.card X : ℝ)⁻¹ - min (P x) (Fintype.card X : ℝ)⁻¹)) =
βˆ‘ x ∈ Finset.univ.filter (fun x => P x ≀ (Fintype.card X : ℝ)⁻¹),
((Fintype.card X : ℝ)⁻¹-P x) := by
rw [Finset.sum_filter]
apply Finset.sum_congr rfl; intro x _
by_cases hx : P x ≀ (Fintype.card X : ℝ)⁻¹
Β· rw [min_eq_left hx, ite_eq_left hx]
Β· rw [min_eq_right (le_of_not_ge hx), ite_eq_right hx, sub_self]
rw [he]
have ht : tv (fun _ : X => (Fintype.card X : ℝ)⁻¹) P = tv P (fun _ => (Fintype.card X : ℝ)⁻¹) := by
unfold tv; simp_rw [abs_sub_comm]
rwa [ht] at hh
lemma uniform_overlap (P Q : X β†’ ℝ) (hP : βˆ€ x, 0 ≀ P x) (hQ : βˆ€ x, 0 ≀ Q x)
(hP1 : βˆ‘ x, P x = 1) (hQ1 : βˆ‘ x, Q x = 1) (Ξ΅ : ℝ)
(hPt : tv P (fun _ => (Fintype.card X : ℝ)⁻¹) ≀ Ξ΅)
(hQt : tv Q (fun _ => (Fintype.card X : ℝ)⁻¹) ≀ Ξ΅) :
(1-2*Ξ΅) / Fintype.card X ≀ βˆ‘ x, P x * Q x := by
let w : ℝ := (Fintype.card X : ℝ)⁻¹
let a (x : X) := w - min (P x) w
let b (x : X) := w - min (Q x) w
have ha : βˆ‘ x, a x ≀ Ξ΅ := (sum_uniform_deficit P hP1).trans hPt
have hb : βˆ‘ x, b x ≀ Ξ΅ := (sum_uniform_deficit Q hQ1).trans hQt
have hw : 0 ≀ w := by dsimp [w]; positivity
have hlocal (x) : w^2-w*(a x+b x) ≀ P x * Q x := by
have haa : 0 ≀ a x := sub_nonneg.mpr (min_le_right _ _)
have hbb : 0 ≀ b x := sub_nonneg.mpr (min_le_right _ _)
have hprod := mul_le_mul (min_le_left (P x) w) (min_le_left (Q x) w)
(le_min (hQ x) hw) (hP x)
dsimp [a,b] at *
nlinarith [mul_nonneg haa hbb]
have hs := Finset.sum_le_sum (s := Finset.univ) (fun x _ => hlocal x)
simp only [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_univ, nsmul_eq_mul,
← Finset.mul_sum, Finset.sum_add_distrib] at hs
have hcard : (Fintype.card X : ℝ)*w = 1 := by dsimp [w]; simp
have hdef : w*(βˆ‘ x, a x + βˆ‘ x, b x) ≀ w*(2*Ξ΅) := mul_le_mul_of_nonneg_left (by linarith) hw
change (1-2*Ξ΅)*w ≀ _
nlinarith
def squareKernel (K : X β†’ X β†’ ℝ) (x y : X) : ℝ := βˆ‘ z, K x z * K z y
lemma square_minorization (K : X β†’ X β†’ ℝ) (hK : βˆ€ x y, 0 ≀ K x y)
(hrow : βˆ€ x, βˆ‘ y, K x y = 1) (hcol : βˆ€ y, βˆ‘ x, K x y = 1) (Ξ΅ : ℝ)
(hrowTV : βˆ€ x, tv (K x) (fun _ => (Fintype.card X : ℝ)⁻¹) ≀ Ξ΅)
(hcolTV : βˆ€ y, tv (fun x => K x y) (fun _ => (Fintype.card X : ℝ)⁻¹) ≀ Ξ΅)
(x y : X) : (1-2*Ξ΅) / Fintype.card X ≀ squareKernel K x y :=
uniform_overlap (K x) (fun z => K z y) (hK x) (fun z => hK z y)
(hrow x) (hcol y) Ξ΅ (hrowTV x) (hcolTV y)
def acceptance (R : X β†’ X β†’ ℝ) (p : ℝ) (x y : X) : ℝ := p / ((Fintype.card X : ℝ)*R x y)
def markedKernel (R : X β†’ X β†’ ℝ) (p : ℝ) (x : X) (z : X Γ— Bool) : ℝ :=
R x z.1 * (if z.2 then acceptance R p x z.1 else 1-acceptance R p x z.1)
lemma acceptance_bounds (R : X β†’ X β†’ ℝ) (p : ℝ) (hp : 0 < p)
(hR : βˆ€ x y, p / Fintype.card X ≀ R x y) (x y : X) :
0 ≀ acceptance R p x y ∧ acceptance R p x y ≀ 1 := by
have hn : 0 < (Fintype.card X : ℝ) := Nat.cast_pos.mpr Fintype.card_pos
have hxy : 0 < R x y := (div_pos hp hn).trans_le (hR x y)
constructor
Β· unfold acceptance; positivity
Β· unfold acceptance; apply (div_le_one (mul_pos hn hxy)).mpr
have hh := (div_le_iffβ‚€ hn).mp (hR x y); nlinarith
lemma marked_true (R : X β†’ X β†’ ℝ) (p : ℝ) (hp : 0 < p)
(hR : βˆ€ x y, p / Fintype.card X ≀ R x y) (x y : X) :
markedKernel R p x (y,true) = p / Fintype.card X := by
have hn : 0 < (Fintype.card X : ℝ) := Nat.cast_pos.mpr Fintype.card_pos
have hxy : 0 < R x y := (div_pos hp hn).trans_le (hR x y)
simp only [markedKernel, ite_true, acceptance]
field_simp
lemma marked_marginal (R : X β†’ X β†’ ℝ) (p : ℝ) (x y : X) :
(βˆ‘ b : Bool, markedKernel R p x (y,b)) = R x y := by
let retained_nonempty_X := nonempty_X
simp [markedKernel]; ring
lemma marked_nonneg (R : X β†’ X β†’ ℝ) (p : ℝ) (hp : 0 < p)
(hR : βˆ€ x y, p / Fintype.card X ≀ R x y) (x : X) (z : X Γ— Bool) :
0 ≀ markedKernel R p x z := by
have hb := acceptance_bounds R p hp hR x z.1
have hxy : 0 ≀ R x z.1 := (div_nonneg hp.le (Nat.cast_nonneg _)).trans (hR x z.1)
unfold markedKernel
apply mul_nonneg hxy
cases z.2 <;> simp only [Bool.false_eq_true, ite_false, ite_true] <;> linarith
lemma marked_sum (R : X β†’ X β†’ ℝ) (p : ℝ) (hR : βˆ€ x, βˆ‘ y, R x y = 1) (x : X) :
βˆ‘ z, markedKernel R p x z = 1 := by rw [Fintype.sum_prod_type]; simp_rw [marked_marginal]; exact hR x
lemma accepted_uniform (R : X β†’ X β†’ ℝ) (p : ℝ) (hp : 0 < p)
(hR : βˆ€ x y, p / Fintype.card X ≀ R x y) (x : X) :
(βˆ‘ y, markedKernel R p x (y,true)) = p ∧
βˆ€ y, markedKernel R p x (y,true) / p = (Fintype.card X : ℝ)⁻¹ := by
simp only [marked_true R p hp hR]
constructor
Β· simp; field_simp
Β· intro y; field_simp
end Thorp.Conditional.Reset
end
end OAI