LeanMachineLearning exposition

Learning.IsBayesAlgEnvSeq.condDistrib_history_eq_condDistrib_hist_withDensityπŸ”—

This page has the declaration's own card below, then its dependency graph, then a card for each dependency (type dependencies first, then the rest of the transitive closure). For a theorem, the graph and the dependency cards only follow its statement's dependencies (its proof is replaced by sorry, so what it proves doesn't depend on how); for everything else, both the type and the body/value are followed, since their content is part of what later declarations build on.

Minimal Lean file

condDistrib_history_eq_condDistrib_hist_withDensityπŸ”—

LemmaLearning.IsBayesAlgEnvSeq.condDistrib_history_eq_condDistrib_hist_withDensity

No docstring.

πŸ”—theorem
Learning.IsBayesAlgEnvSeq.condDistrib_history_eq_condDistrib_hist_withDensity.{u_1, u_2, u_3, u_4, u_5} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] {𝓔 : Type u_3} [MeasurableSpace 𝓔] [StandardBorelSpace 𝓐] [Nonempty 𝓐] [StandardBorelSpace 𝓨] [Nonempty 𝓨] {Q : MeasureTheory.Measure 𝓔} {ΞΊ : ProbabilityTheory.Kernel (𝓔 Γ— 𝓐) 𝓨} [ProbabilityTheory.IsMarkovKernel ΞΊ] {Ξ© : Type u_4} [MeasurableSpace Ξ©] {E : Ξ© β†’ 𝓔} {A : β„• β†’ Ξ© β†’ 𝓐} {Y : β„• β†’ Ξ© β†’ 𝓨} {alg : Algorithm 𝓐 𝓨} {P : MeasureTheory.Measure Ξ©} [MeasureTheory.IsProbabilityMeasure P] {Ξ©β‚€ : Type u_5} [MeasurableSpace Ξ©β‚€] {Eβ‚€ : Ξ©β‚€ β†’ 𝓔} {Aβ‚€ : β„• β†’ Ξ©β‚€ β†’ 𝓐} {Yβ‚€ : β„• β†’ Ξ©β‚€ β†’ 𝓨} {algβ‚€ : Algorithm 𝓐 𝓨} {Pβ‚€ : MeasureTheory.Measure Ξ©β‚€} [MeasureTheory.IsProbabilityMeasure Pβ‚€] (h : IsBayesAlgEnvSeq Q ΞΊ alg E A Y P) (hβ‚€ : IsBayesAlgEnvSeq Q ΞΊ algβ‚€ Eβ‚€ Aβ‚€ Yβ‚€ Pβ‚€) (hc : Algorithm.AbsolutelyContinuous alg algβ‚€) (n : β„•) : ⇑𝓛[history A Y n | E; P] =ᡐ[Q] ⇑(ProbabilityTheory.Kernel.withDensity 𝓛[history Aβ‚€ Yβ‚€ n | Eβ‚€; Pβ‚€] fun x => Algorithm.density alg algβ‚€ n)
Learning.IsBayesAlgEnvSeq.condDistrib_history_eq_condDistrib_hist_withDensity.{u_1, u_2, u_3, u_4, u_5} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] {𝓔 : Type u_3} [MeasurableSpace 𝓔] [StandardBorelSpace 𝓐] [Nonempty 𝓐] [StandardBorelSpace 𝓨] [Nonempty 𝓨] {Q : MeasureTheory.Measure 𝓔} {ΞΊ : ProbabilityTheory.Kernel (𝓔 Γ— 𝓐) 𝓨} [ProbabilityTheory.IsMarkovKernel ΞΊ] {Ξ© : Type u_4} [MeasurableSpace Ξ©] {E : Ξ© β†’ 𝓔} {A : β„• β†’ Ξ© β†’ 𝓐} {Y : β„• β†’ Ξ© β†’ 𝓨} {alg : Algorithm 𝓐 𝓨} {P : MeasureTheory.Measure Ξ©} [MeasureTheory.IsProbabilityMeasure P] {Ξ©β‚€ : Type u_5} [MeasurableSpace Ξ©β‚€] {Eβ‚€ : Ξ©β‚€ β†’ 𝓔} {Aβ‚€ : β„• β†’ Ξ©β‚€ β†’ 𝓐} {Yβ‚€ : β„• β†’ Ξ©β‚€ β†’ 𝓨} {algβ‚€ : Algorithm 𝓐 𝓨} {Pβ‚€ : MeasureTheory.Measure Ξ©β‚€} [MeasureTheory.IsProbabilityMeasure Pβ‚€] (h : IsBayesAlgEnvSeq Q ΞΊ alg E A Y P) (hβ‚€ : IsBayesAlgEnvSeq Q ΞΊ algβ‚€ Eβ‚€ Aβ‚€ Yβ‚€ Pβ‚€) (hc : Algorithm.AbsolutelyContinuous alg algβ‚€) (n : β„•) : ⇑𝓛[history A Y n | E; P] =ᡐ[Q] ⇑(ProbabilityTheory.Kernel.withDensity 𝓛[history Aβ‚€ Yβ‚€ n | Eβ‚€; Pβ‚€] fun x => Algorithm.density alg algβ‚€ n)

Code

lemma condDistrib_history_eq_condDistrib_hist_withDensity (h : IsBayesAlgEnvSeq Q ΞΊ alg E A Y P)
    (hβ‚€ : IsBayesAlgEnvSeq Q ΞΊ algβ‚€ Eβ‚€ Aβ‚€ Yβ‚€ Pβ‚€) (hc : alg β‰ͺₐ algβ‚€) (n : β„•) :
    condDistrib (history A Y n) E P =ᡐ[Q]
      ((condDistrib (history Aβ‚€ Yβ‚€ n) Eβ‚€ Pβ‚€).withDensity
        (fun _ ↦ alg.density algβ‚€ n))
Type uses (5)
Body uses (10)
Used by (2)

Actions: Source Β· Open Issue

Proof
by
    filter_upwards [h.ae_IsAlgEnvSeq, hβ‚€.ae_IsAlgEnvSeq, h.hasLaw_IT_hist n, hβ‚€.hasLaw_IT_hist n]
      with _ hae haeβ‚€ he heβ‚€
    rw [Kernel.withDensity_apply _ (by fun_prop), ← he.map_eq, ← heβ‚€.map_eq]
    exact (hae.hasLaw_history_withDensity haeβ‚€ hc n).map_eq

Dependency graph

Type dependencies (5)

AlgorithmπŸ”—

StructureLearning.Algorithm

A stochastic, sequential algorithm.

πŸ”—structure
Learning.Algorithm.{u_4, u_5} (𝓐 : Type u_4) (𝓨 : Type u_5) [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] : Type (max u_4 u_5)
Learning.Algorithm.{u_4, u_5} (𝓐 : Type u_4) (𝓨 : Type u_5) [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] : Type (max u_4 u_5)

Code

structure Algorithm (𝓐 𝓨 : Type*) [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] where
  /-- Policy or sampling rule: distribution of the next action. -/
  policy : (n : β„•) β†’ Kernel (Iic n β†’ 𝓐 Γ— 𝓨) 𝓐
  /-- The policy is a Markov kernel. -/
  [h_policy : βˆ€ n, IsMarkovKernel (policy n)]
  /-- Distribution of the first action. -/
  p0 : Measure 𝓐
  /-- The first action distribution is a probability measure. -/
  [hp0 : IsProbabilityMeasure p0]
Used by (216)

Actions: Source Β· Open Issue

IsBayesAlgEnvSeqπŸ”—

StructureLearning.IsBayesAlgEnvSeq

IsBayesAlgEnvSeq Q ΞΊ alg E A Y P states that there is a measure P : Measure Ξ© such that the parameter E : Ξ© β†’ 𝓔 has law Q and that the sequences of actions A : β„• β†’ Ξ© β†’ 𝓐 and feedbacks Y : β„• β†’ Ξ© β†’ 𝓨 are generated by the algorithm alg : Algorithm 𝓐 𝓨 interacting with an underlying environment that depends on E and ΞΊ (stationaryEnv (ΞΊ.sectR (E Ο‰))).

πŸ”—structure
Learning.IsBayesAlgEnvSeq.{u_1, u_2, u_3, u_4} {𝓔 : Type u_1} {𝓐 : Type u_2} {𝓨 : Type u_3} {Ξ© : Type u_4} [MeasurableSpace 𝓔] [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] [MeasurableSpace Ξ©] (Q : MeasureTheory.Measure 𝓔) (ΞΊ : ProbabilityTheory.Kernel (𝓔 Γ— 𝓐) 𝓨) (alg : Algorithm 𝓐 𝓨) (E : Ξ© β†’ 𝓔) (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨) (P : MeasureTheory.Measure Ξ©) [MeasureTheory.IsFiniteMeasure P] : Prop
Learning.IsBayesAlgEnvSeq.{u_1, u_2, u_3, u_4} {𝓔 : Type u_1} {𝓐 : Type u_2} {𝓨 : Type u_3} {Ξ© : Type u_4} [MeasurableSpace 𝓔] [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] [MeasurableSpace Ξ©] (Q : MeasureTheory.Measure 𝓔) (ΞΊ : ProbabilityTheory.Kernel (𝓔 Γ— 𝓐) 𝓨) (alg : Algorithm 𝓐 𝓨) (E : Ξ© β†’ 𝓔) (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨) (P : MeasureTheory.Measure Ξ©) [MeasureTheory.IsFiniteMeasure P] : Prop

Code

structure IsBayesAlgEnvSeq
    (Q : Measure 𝓔) (ΞΊ : Kernel (𝓔 Γ— 𝓐) 𝓨) (alg : Algorithm 𝓐 𝓨)
    (E : Ξ© β†’ 𝓔) (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨)
    (P : Measure Ξ©) [IsFiniteMeasure P] : Prop where
  measurable_param : Measurable E := by fun_prop
  measurable_action n : Measurable (A n) := by fun_prop
  measurable_feedback n : Measurable (Y n) := by fun_prop
  hasLaw_env : HasLaw E Q P
  hasCondDistrib_action_zero : HasCondDistrib (A 0) E (Kernel.const _ alg.p0) P
  hasCondDistrib_feedback_zero : HasCondDistrib (Y 0) (fun Ο‰ ↦ (E Ο‰, A 0 Ο‰)) ΞΊ P
  hasCondDistrib_action n :
    HasCondDistrib (A (n + 1)) (fun Ο‰ ↦ (E Ο‰, history A Y n Ο‰))
      ((alg.policy n).prodMkLeft _) P
  hasCondDistrib_feedback n :
    HasCondDistrib (Y (n + 1)) (fun Ο‰ ↦ (history A Y n Ο‰, E Ο‰, A (n + 1) Ο‰))
      (ΞΊ.prodMkLeft _) P
Type uses (2)
Used by (22)

Actions: Source Β· Open Issue

AbsolutelyContinuousπŸ”—

StructureLearning.Algorithm.AbsolutelyContinuous

For every time and history, the distribution over actions according to alg is absolutely continuous with respect to the distribution over actions according to algβ‚€.

πŸ”—structure
Learning.Algorithm.AbsolutelyContinuous.{u_1, u_2} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] (alg algβ‚€ : Algorithm 𝓐 𝓨) : Prop
Learning.Algorithm.AbsolutelyContinuous.{u_1, u_2} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] (alg algβ‚€ : Algorithm 𝓐 𝓨) : Prop

Code

structure AbsolutelyContinuous (alg algβ‚€ : Algorithm 𝓐 𝓨) : Prop where
  p0 : alg.p0 β‰ͺ algβ‚€.p0
  policy n h : alg.policy n h β‰ͺ algβ‚€.policy n h
Type uses (1)
Used by (7)

Actions: Source Β· Open Issue

historyπŸ”—

DefinitionLearning.history

History of the algorithm-environment sequence up to time n.

πŸ”—def
Learning.history.{u_1, u_2, u_3} {𝓐 : Type u_1} {𝓨 : Type u_2} {Ξ© : Type u_3} (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨) (n : β„•) (Ο‰ : Ξ©) : β†₯(Finset.Iic n) β†’ 𝓐 Γ— 𝓨
Learning.history.{u_1, u_2, u_3} {𝓐 : Type u_1} {𝓨 : Type u_2} {Ξ© : Type u_3} (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨) (n : β„•) (Ο‰ : Ξ©) : β†₯(Finset.Iic n) β†’ 𝓐 Γ— 𝓨

Code

def history (A : β„• β†’ Ξ© β†’ 𝓐) (Y : β„• β†’ Ξ© β†’ 𝓨) (n : β„•) (Ο‰ : Ξ©) : Iic n β†’ 𝓐 Γ— 𝓨 :=
  fun i ↦ (A i Ο‰, Y i Ο‰)
Used by (72)

Actions: Source Β· Open Issue

densityπŸ”—

DefinitionLearning.Algorithm.density

If the algorithm alg is absolutely continuous with respect to the algorithm algβ‚€ and they are both interacting with the same environment, then the law of the history at time n under alg is the law of the history at time n under algβ‚€ with density alg.density algβ‚€ n.

πŸ”—def
Learning.Algorithm.density.{u_1, u_2} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] [MeasurableSpace.CountablyGenerated 𝓐] (alg algβ‚€ : Algorithm 𝓐 𝓨) (n : β„•) : (β†₯(Finset.Iic n) β†’ 𝓐 Γ— 𝓨) β†’ ENNReal
Learning.Algorithm.density.{u_1, u_2} {𝓐 : Type u_1} {𝓨 : Type u_2} [MeasurableSpace 𝓐] [MeasurableSpace 𝓨] [MeasurableSpace.CountablyGenerated 𝓐] (alg algβ‚€ : Algorithm 𝓐 𝓨) (n : β„•) : (β†₯(Finset.Iic n) β†’ 𝓐 Γ— 𝓨) β†’ ENNReal

Code

noncomputable
def density [MeasurableSpace.CountablyGenerated 𝓐] (alg algβ‚€ : Algorithm 𝓐 𝓨) :
    (n : β„•) β†’ (Iic n β†’ 𝓐 Γ— 𝓨) β†’ ℝβ‰₯0∞
  | 0, h => (alg.p0.rnDeriv algβ‚€.p0 (h ⟨0, by simp⟩).1)
  | n + 1, h =>
    let p := MeasurableEquiv.IicSuccProd (fun _ ↦ 𝓐 Γ— 𝓨) n h
    alg.density algβ‚€ n p.1 * (alg.policy n).rnDeriv (algβ‚€.policy n) p.1 p.2.1
Type uses (1)
Body uses (1)
Used by (5)

Actions: Source Β· Open Issue

All dependencies, transitively (1)

IicSuccProdπŸ”—

DefinitionMeasurableEquiv.IicSuccProd

Measurable equivalence between a product up to n + 1 and the pair of the product up to n and the space at n + 1.

πŸ”—def
MeasurableEquiv.IicSuccProd.{u_3} (X : β„• β†’ Type u_3) [(n : β„•) β†’ MeasurableSpace (X n)] (n : β„•) : ((i : β†₯(Finset.Iic (n + 1))) β†’ X ↑i) ≃ᡐ ((i : β†₯(Finset.Iic n)) β†’ X ↑i) Γ— X (n + 1)
MeasurableEquiv.IicSuccProd.{u_3} (X : β„• β†’ Type u_3) [(n : β„•) β†’ MeasurableSpace (X n)] (n : β„•) : ((i : β†₯(Finset.Iic (n + 1))) β†’ X ↑i) ≃ᡐ ((i : β†₯(Finset.Iic n)) β†’ X ↑i) Γ— X (n + 1)

Code

def _root_.MeasurableEquiv.IicSuccProd (X : β„• β†’ Type*) [βˆ€ n, MeasurableSpace (X n)] (n : β„•) :
    MeasurableEquiv (Ξ  i : Iic (n + 1), X i) ((Ξ  i : Iic n, X i) Γ— X (n + 1)) :=
  (MeasurableEquiv.IicProdIoc (Nat.le_succ n)).symm.trans
    (MeasurableEquiv.prodCongr (MeasurableEquiv.refl _) (MeasurableEquiv.piSingleton n).symm)
Used by (11)

Actions: Source Β· Open Issue