File size: 1,759 Bytes
dd14c26 | 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 | import Mathlib
import OAI.Probability.LogConcave.Sampling.TapeSnocEquiv
import OAI.Probability.LogConcave.OraclePrograms.Program
namespace OAI
section
noncomputable section
namespace LogConcaveSampling.OracleCompiler.Program
open MeasureTheory ProbabilityTheory Function
open scoped Classical
variable {E R : Type*} [MeasurableSpace E] [MeasurableSpace R] {d q : ℕ}
def fresh (A : ℕ → Program (E × R) d q E) :
(n : ℕ) → Program (E × (Fin n → R)) d (q*n) E
| 0 => pure Prod.fst measurable_fst
| n+1 =>
(((fresh A n).seedMap (fun p : E × (Fin (n+1) → R) => (p.1,Fin.init p.2))
(measurable_fst.prodMk (Measurable.of_eval
(fun index => (measurable_pi_apply index.castSucc).comp measurable_snd)))).seq
((A n).seedMap (fun p : (E × (Fin (n+1) → R)) × E => (p.2,p.1.2 (Fin.last n)))
(by fun_prop)))
lemma fresh_run (A : ℕ → Program (E × R) d q E) (V : Point d → ℝ) (n : ℕ)
(p : E × (Fin n → R)) :
(fresh A n).run V p=stateRun id (fun j => (A j).run V) n p := by
induction n with
| zero => rfl
| succ n ih =>
simp only [fresh,seq_run,seedMap_run,stateRun]
rw [ih]
lemma fresh_law (A : ℕ → Program (E × R) d q E) {V : Point d → ℝ}
(hV : Measurable (firstOrderReply V)) (μ : Measure E) (γ : Measure R)
[IsProbabilityMeasure μ] [IsProbabilityMeasure γ] (n : ℕ) :
(μ.prod (Measure.pi (fun _ : Fin n => γ))).map ((fresh A n).run V)=
stateLaw μ γ (fun j => (A j).run V) n := by
have h := stateRun_law μ γ id measurable_id (fun j => (A j).run V)
(fun j => (A j).measurable_run V hV) n
simpa only [←funext (fresh_run A V n),Measure.map_id] using h
end LogConcaveSampling.OracleCompiler.Program
end
end
end OAI
|