File size: 3,007 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | import Mathlib
import OAI.Probability.LogConcave.OraclePrograms.Expression
namespace OAI
section
section
noncomputable section
namespace LogConcaveSampling
open MeasureTheory
open OracleCompiler OracleCompiler.Expression
namespace SeedCompiler
variable {k d : β}
lemma slotTransform_add_shift (c : β) (a v : Fin k β β) (g : Fin k β Point d) (Ξ : Point d) :
slotTransform c a (shiftSlots v Ξ g)=
shiftSlots (slotTransform c a v) Ξ (slotTransform c a g) := by
have hs : slotSum a (shiftSlots v Ξ g)=slotSum a g+(slotSum a v) β’ Ξ := by
simp only [slotSum,shiftSlots,smul_add,Finset.sum_add_distrib,smul_smul,smul_eq_mul]
rw [Finset.sum_smul]
ext i
simp only [slotTransform,shiftSlots,hs,smul_add,sub_smul,smul_smul,smul_eq_mul]
abel_nf
lemma slotTransform_scalar_mul (c s : β) (a v : Fin k β β) :
slotTransform c a (fun i => s*v i)=fun i => s*slotTransform c a v i := by
ext i
simp only [slotTransform,slotSum,smul_eq_mul]
have he : (βi,a i*(s*v i))=s*βi,a i*v i := by
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro j _
ring
rw [he]
ring
lemma inverse_shift_identity (a v : Fin k β β) (ha : (βi,a i^2)<1)
(s : β) (g : Fin k β Point d) (Ξ : Point d) :
slotTransform (sqrtCoefficient a) a
(shiftSlots (fun i => s*slotTransform (inverseCoefficient a) a v i) Ξ g)=
shiftSlots v (s β’ Ξ) (slotTransform (sqrtCoefficient a) a g) := by
rw [slotTransform_add_shift,slotTransform_scalar_mul,slotTransform_inverse a ha]
funext i
simp only [shiftSlots,smul_smul]
rw [mul_comm s (v i)]
lemma inverse_shift_energy (a v : Fin k β β) (ha : (βi,a i^2)β€1/4) (s : β) :
(βi,(s*slotTransform (inverseCoefficient a) a v i)^2) β€
4*s^2*(βi,v i^2) := by
have h := inverse_slot_energy (E:=β) a ha v
simp only [Real.norm_eq_abs,sq_abs] at h
simp_rw [mul_pow]
rw [βFinset.mul_sum]
nlinarith [mul_le_mul_of_nonneg_left h (sq_nonneg s)]
lemma measurable_slotTransform (c : β) (a : Fin k β β) :
Measurable (slotTransform (E:=Point d) c a) := by
unfold slotTransform slotSum
fun_prop
theorem transformed_mean_equivariant {queryCount : β}
(M : Program (Point d Γ (Fin k β Point d)) d queryCount (Point d))
{r : β} (hr : rβ 0) (v a : Fin k β β) (ha : (βi,a i^2)<1)
(hM : βΞ,M.Equivariant (moveSeed (fun x => x+r β’ Ξ) v Ξ) id)
(c : β) (Ξ : Point d) :
(M.seedMap (fun z => (z.1,slotTransform (sqrtCoefficient a) a z.2))
(measurable_fst.prodMk ((measurable_slotTransform _ _).comp measurable_snd))).Equivariant
(moveSeed (fun x => x+c β’ Ξ)
(fun i => (c/r)*slotTransform (inverseCoefficient a) a v i) Ξ) id := by
apply (hM ((c/r) β’ Ξ)).seedMap
intro z
apply Prod.ext
Β· dsimp [moveSeed]
rw [smul_smul]
congr 2
field_simp
Β· dsimp [moveSeed]
exact inverse_shift_identity a v ha (c/r) z.2 Ξ
end SeedCompiler
end LogConcaveSampling
end
end
end
end OAI
|