roseking's picture
Add lean source and binary files (part 122)
b317718 verified
Raw History Blame Contribute Delete
5.25 kB
import OAI.Probability.GaussianRegression.Transfer
import OAI.Probability.GaussianRegression.Rotational
namespace OAI
/-!
Uniform-prior success bounds for finite-state estimators.
-/
open MeasureTheory ProbabilityTheory Set Filter
open scoped ENNReal NNReal RealInnerProductSpace Topology
open InnerProductSpace
open scoped Pointwise
noncomputable section
universe u
namespace NoiselessRegression
namespace Learner
lemma frozen_success_bound {d M T : ℕ} {Ω : Type u} (L : Learner d M T Ω)
(ω : Ω) (hd : 3 ≤ d)
(htrans : ∀ t j, AEMeasurable (fun obs => (L.transition t ω j obs).2) (observationReference d))
{ε : ℝ} (hε : 0 < ε) {a q : ℕ} (ha : 2*a ≤ d-1) (hq : 2 ≤ q) (hqa : 2*q ≤ a) :
((uniformSphere d).prod (sampleLaw d T))
{z | angularError z.1 (L.estimate z.1 ω z.2) ≤ ε} ≤
(T+1 : ℝ≥0∞) * (ENNReal.ofReal ((3 : ℝ)*4^d) * ENNReal.ofReal (ε^a)) *
streamFactor (E := Vector d) (J := State M) q ^ (T/q+1) := by
classical
let : NeZero d := ⟨by omega⟩
let δ : ℕ → State M → (Vector d × ℝ) → State M := fun t j => (htrans t j).mk _
have hδ (t : ℕ) (j : State M) : Measurable (δ t j) := (htrans t j).measurable_mk
let μ := (uniformSphere d).prod (sampleLaw d T)
have hgood : ∀ᵐ z ∂μ, ∀ t j (i : Fin T),
(L.transition t ω j (z.2 i,⟪z.1.val,z.2 i⟫)).2 = δ t j (z.2 i,⟪z.1.val,z.2 i⟫) := by
simp only [ae_all_iff]
intro t j i
exact (sphere_sample_observation_quasi (by simpa using hd) i).ae (htrans t j).ae_eq_mk
let S : Fin (T+1) → Set (UnitSphere d × Samples d T) := fun t =>
{z | dist z.1.val (L.output t ω (streamRoute δ 0 t (L.initialChoice ω).2
((fun i => z.2 (Fin.castLE (by omega) i)),fun i => ⟪z.1.val,z.2 (Fin.castLE (by omega) i)⟫))).val ≤ ε}
have hmono : {z : UnitSphere d × Samples d T | angularError z.1 (L.estimate z.1 ω z.2) ≤ ε}
≤ᵐ[μ] ⋃ t, S t := by
filter_upwards [hgood] with z hz
intro hs
rcases L.terminal_forced_witness z.1 ω z.2 with ⟨t,ht,he⟩
have hf : L.forcedRun z.1 ω z.2 t = streamRoute δ 0 t (L.initialChoice ω).2
((fun i => z.2 (Fin.castLE ht i)),fun i => ⟪z.1.val,z.2 (Fin.castLE ht i)⟫) := by
rw [L.forcedRun_eq_route z.1 ω z.2 ht]
exact streamRoute_congr _ _ 0 t _ _ _ (fun n j i => hz n j (Fin.castLE ht i))
have hc : dist z.1.val (L.estimate z.1 ω z.2).val ≤ ε := by
apply le_trans _ hs
simpa only [angularError, dist_comm] using chord_le_arccos (L.estimate z.1 ω z.2) z.1
refine Set.mem_iUnion.mpr ⟨⟨t,by omega⟩, ?_⟩
change dist z.1.val (L.output t ω _) ≤ ε
simpa only [estimate, he, hf] using hc
let B : ℝ≥0∞ := (ENNReal.ofReal ((3 : ℝ)*4^d) * ENNReal.ofReal (ε^a)) *
streamFactor (E := Vector d) (J := State M) q ^ (T/q+1)
have hb (t : Fin (T+1)) : μ (S t) ≤ B := by
simpa only [B, μ, S, uniformSphere, sphereLaw, sampleLaw, finrank_euclideanSpace_fin] using
prefix_route_cap_bound hδ (fun j => (L.output t ω j).val) hε
(by simpa using ha) hq hqa (by omega : (t : ℕ) ≤ T) (L.initialChoice ω).2
calc
_ ≤ μ (⋃ t, S t) := measure_mono_ae hmono
_ ≤ ∑' t, μ (S t) := measure_iUnion_le S
_ ≤ ∑' _ : Fin (T+1), B := ENNReal.tsum_le_tsum hb
_ = _ := by simp [B, tsum_fintype, nsmul_eq_mul, mul_assoc]
lemma streaming_success_bound {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω]
(L : Learner d M T Ω) (ρ : Measure Ω) [IsProbabilityMeasure ρ]
(hL : L.Admissible ρ) (hd : 3 ≤ d) {ε : ℝ} (hε : 0 < ε)
{a q : ℕ} (ha : 2*a ≤ d-1) (hq : 2 ≤ q) (hqa : 2*q ≤ a) :
L.uniformSuccess ρ ε ≤
(T+1 : ℝ≥0∞) * (ENNReal.ofReal ((3 : ℝ)*4^d) * ENNReal.ofReal (ε^a)) *
streamFactor (E := Vector d) (J := State M) q ^ (T/q+1) := by
let : NeZero d := ⟨by omega⟩
let : SigmaFinite (observationReference d) := by unfold observationReference; infer_instance
have hω : ∀ᵐ ω ∂ρ, ∀ t j,
AEMeasurable (fun obs => (L.transition t ω j obs).2) (observationReference d) := by
simp only [ae_all_iff]
intro t j
filter_upwards [ae_fiber_aemeasurable (hL.transition t j).prod_swap] with ω hω
exact measurable_snd.comp_aemeasurable hω
have hp := ((MeasurePreserving.id (uniformSphere d)).prod
(Measure.measurePreserving_swap (μ := sampleLaw d T) (ν := ρ))).comp
(measurePreserving_prodAssoc (uniformSphere d) (sampleLaw d T) ρ)
let S := {z : UnitSphere d × (Ω × Samples d T) |
angularError z.1 (L.estimate z.1 z.2.1 z.2.2) ≤ ε}
have hS : NullMeasurableSet S ((uniformSphere d).prod (ρ.prod (sampleLaw d T))) :=
L.angularSuccess_nullMeasurable ρ ε hL
have he := hp.measure_preimage hS
have hb := prod_null_set_bound (hS.preimage hp.quasiMeasurePreserving)
(c := (T+1 : ℝ≥0∞) * (ENNReal.ofReal ((3 : ℝ)*4^d) * ENNReal.ofReal (ε^a)) *
streamFactor (E := Vector d) (J := State M) q ^ (T/q+1))
(by
filter_upwards [hω] with ω hω
exact L.frozen_success_bound ω hd hω hε ha hq hqa)
simpa only [he, measure_univ, mul_one, S, uniformSuccess] using hb
end Learner
end NoiselessRegression
end
end OAI