LeanMachineLearning exposition

Learning.IT.bayesTrajMeasure๐Ÿ”—

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

bayesTrajMeasure๐Ÿ”—

DefinitionLearning.IT.bayesTrajMeasure

A measure P on a measurable space that carries random variables E, A, and Y such that IsBayesAlgEnvSeq Q ฮบ alg E A Y P.

๐Ÿ”—def
Learning.IT.bayesTrajMeasure.{u_1, u_2, u_3} {๐“” : Type u_1} {๐“ : Type u_2} {๐“จ : Type u_3} [MeasurableSpace ๐“”] [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] (Q : MeasureTheory.Measure ๐“”) [MeasureTheory.IsProbabilityMeasure Q] (ฮบ : ProbabilityTheory.Kernel (๐“” ร— ๐“) ๐“จ) [ProbabilityTheory.IsMarkovKernel ฮบ] (alg : Algorithm ๐“ ๐“จ) : MeasureTheory.Measure (โ„• โ†’ ๐“ ร— ๐“” ร— ๐“จ)
Learning.IT.bayesTrajMeasure.{u_1, u_2, u_3} {๐“” : Type u_1} {๐“ : Type u_2} {๐“จ : Type u_3} [MeasurableSpace ๐“”] [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] (Q : MeasureTheory.Measure ๐“”) [MeasureTheory.IsProbabilityMeasure Q] (ฮบ : ProbabilityTheory.Kernel (๐“” ร— ๐“) ๐“จ) [ProbabilityTheory.IsMarkovKernel ฮบ] (alg : Algorithm ๐“ ๐“จ) : MeasureTheory.Measure (โ„• โ†’ ๐“ ร— ๐“” ร— ๐“จ)

Code

noncomputable
def bayesTrajMeasure (Q : Measure ๐“”) [IsProbabilityMeasure Q] (ฮบ : Kernel (๐“” ร— ๐“) ๐“จ)
    [IsMarkovKernel ฮบ] (alg : Algorithm ๐“ ๐“จ) : Measure (โ„• โ†’ ๐“ ร— ๐“” ร— ๐“จ) :=
  trajMeasure (alg.prodLeft ๐“”) (bayesStationaryEnv Q ฮบ)
deriving IsProbabilityMeasure
Type uses (1)
Body uses (3)
Used by (5)

Actions: Source ยท Open Issue

Dependency graph

Type dependencies (1)

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

All dependencies, transitively (9)

Environment๐Ÿ”—

StructureLearning.Environment

A stochastic environment.

๐Ÿ”—structure
Learning.Environment.{u_4, u_5} (๐“ : Type u_4) (๐“จ : Type u_5) [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] : Type (max u_4 u_5)
Learning.Environment.{u_4, u_5} (๐“ : Type u_4) (๐“จ : Type u_5) [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] : Type (max u_4 u_5)

Code

structure Environment (๐“ ๐“จ : Type*) [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] where
  /-- Distribution of the next observation as function of the past history. -/
  feedback : (n : โ„•) โ†’ Kernel ((Iic n โ†’ ๐“ ร— ๐“จ) ร— ๐“) ๐“จ
  /-- The feedback kernels are Markov kernels. -/
  [h_feedback : โˆ€ n, IsMarkovKernel (feedback n)]
  /-- Distribution of the first observation given the first action. -/
  ฮฝ0 : Kernel ๐“ ๐“จ
  /-- The initial observation kernel is a Markov kernel. -/
  [hp0 : IsMarkovKernel ฮฝ0]
Used by (128)

Actions: Source ยท Open Issue

stepKernel๐Ÿ”—

DefinitionLearning.stepKernel

Kernel describing the distribution of the next action-feedback pair given the history up to n.

๐Ÿ”—def
Learning.stepKernel.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.Kernel (โ†ฅ(Finset.Iic n) โ†’ ๐“ ร— ๐“จ) (๐“ ร— ๐“จ)
Learning.stepKernel.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.Kernel (โ†ฅ(Finset.Iic n) โ†’ ๐“ ร— ๐“จ) (๐“ ร— ๐“จ)

Code

noncomputable
def stepKernel (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) (n : โ„•) :
    Kernel (Iic n โ†’ ๐“ ร— ๐“จ) (๐“ ร— ๐“จ) :=
  alg.policy n โŠ—โ‚– env.feedback n
deriving IsMarkovKernel
Type uses (2)
Used by (17)

Actions: Source ยท Open Issue

instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy๐Ÿ”—

InstanceLearning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy

No docstring.

๐Ÿ”—theorem
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (Algorithm.policy alg n)
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdPolicy.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (Algorithm.policy alg n)

Code

instance (alg : Algorithm ๐“ ๐“จ) (n : โ„•) : IsMarkovKernel (alg.policy n)
Type uses (1)
Used by (14)

Actions: Source ยท Open Issue

Proof
alg.h_policy n

instIsMarkovKernelProdForallSubtypeNatMemFinsetIicFeedback๐Ÿ”—

InstanceLearning.instIsMarkovKernelProdForallSubtypeNatMemFinsetIicFeedback

No docstring.

๐Ÿ”—theorem
Learning.instIsMarkovKernelProdForallSubtypeNatMemFinsetIicFeedback.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (Environment.feedback env n)
Learning.instIsMarkovKernelProdForallSubtypeNatMemFinsetIicFeedback.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (Environment.feedback env n)

Code

instance (env : Environment ๐“ ๐“จ) (n : โ„•) : IsMarkovKernel (env.feedback n)
Type uses (1)
Used by (5)

Actions: Source ยท Open Issue

Proof
env.h_feedback n

instIsMarkovKernelForallSubtypeNatMemFinsetIicProdStepKernel๐Ÿ”—

InstanceLearning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdStepKernel

No docstring.

๐Ÿ”—theorem
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdStepKernel.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (stepKernel alg env n)
Learning.instIsMarkovKernelForallSubtypeNatMemFinsetIicProdStepKernel.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) (n : โ„•) : ProbabilityTheory.IsMarkovKernel (stepKernel alg env n)

Code

deriving IsMarkovKernel
Type uses (3)
Body uses (2)
Used by (10)

Actions: Source ยท Open Issue

Proof
deriving IsMarkovKernel

trajMeasure๐Ÿ”—

DefinitionLearning.trajMeasure

Measure on the sequence of actions and observations generated by the algorithm/environment.

๐Ÿ”—def
Learning.trajMeasure.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) : MeasureTheory.Measure (โ„• โ†’ ๐“ ร— ๐“จ)
Learning.trajMeasure.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) : MeasureTheory.Measure (โ„• โ†’ ๐“ ร— ๐“จ)

Code

noncomputable
def trajMeasure (alg : Algorithm ๐“ ๐“จ) (env : Environment ๐“ ๐“จ) :
    Measure (โ„• โ†’ ๐“ ร— ๐“จ) :=
  Kernel.trajMeasure (alg.p0 โŠ—โ‚˜ env.ฮฝ0) (stepKernel alg env)
deriving IsProbabilityMeasure
Type uses (2)
Body uses (2)
Used by (19)

Actions: Source ยท Open Issue

instIsProbabilityMeasureP0๐Ÿ”—

InstanceLearning.instIsProbabilityMeasureP0

No docstring.

๐Ÿ”—theorem
Learning.instIsProbabilityMeasureP0.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) : MeasureTheory.IsProbabilityMeasure (Algorithm.p0 alg)
Learning.instIsProbabilityMeasureP0.{u_1, u_2} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (alg : Algorithm ๐“ ๐“จ) : MeasureTheory.IsProbabilityMeasure (Algorithm.p0 alg)

Code

instance (alg : Algorithm ๐“ ๐“จ) : IsProbabilityMeasure alg.p0
Type uses (1)
Used by (13)

Actions: Source ยท Open Issue

Proof
alg.hp0

prodLeft๐Ÿ”—

DefinitionLearning.Algorithm.prodLeft

An algorithm with observations in ๐“ง ร— ๐“จ obtained from an algorithm with observations in ๐“จ by ignoring the ๐“ง component of each observation.

๐Ÿ”—def
Learning.Algorithm.prodLeft.{u_1, u_2, u_4} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (๐“ง : Type u_4) [MeasurableSpace ๐“ง] (alg : Algorithm ๐“ ๐“จ) : Algorithm ๐“ (๐“ง ร— ๐“จ)
Learning.Algorithm.prodLeft.{u_1, u_2, u_4} {๐“ : Type u_1} {๐“จ : Type u_2} {m๐“ : MeasurableSpace ๐“} {m๐“จ : MeasurableSpace ๐“จ} (๐“ง : Type u_4) [MeasurableSpace ๐“ง] (alg : Algorithm ๐“ ๐“จ) : Algorithm ๐“ (๐“ง ร— ๐“จ)

Code

def Algorithm.prodLeft (๐“ง : Type*) [MeasurableSpace ๐“ง] (alg : Algorithm ๐“ ๐“จ) :
    Algorithm ๐“ (๐“ง ร— ๐“จ) where
  policy n := (alg.policy n).comap (fun h i โ†ฆ ((h i).1, (h i).2.2)) (by fun_prop)
  p0 := alg.p0
Type uses (1)
Body uses (2)
Used by (6)

Actions: Source ยท Open Issue

bayesStationaryEnv๐Ÿ”—

DefinitionLearning.bayesStationaryEnv

An environment with observations in ๐“” ร— ๐“จ. The first element e of an observation is sampled from Q once and remains constant. The second element of an observation is sampled from ฮบ (e, a), where a is the corresponding action.

๐Ÿ”—def
Learning.bayesStationaryEnv.{u_1, u_2, u_3} {๐“” : Type u_1} {๐“ : Type u_2} {๐“จ : Type u_3} [MeasurableSpace ๐“”] [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] (Q : MeasureTheory.Measure ๐“”) [MeasureTheory.IsProbabilityMeasure Q] (ฮบ : ProbabilityTheory.Kernel (๐“” ร— ๐“) ๐“จ) [ProbabilityTheory.IsMarkovKernel ฮบ] : Environment ๐“ (๐“” ร— ๐“จ)
Learning.bayesStationaryEnv.{u_1, u_2, u_3} {๐“” : Type u_1} {๐“ : Type u_2} {๐“จ : Type u_3} [MeasurableSpace ๐“”] [MeasurableSpace ๐“] [MeasurableSpace ๐“จ] (Q : MeasureTheory.Measure ๐“”) [MeasureTheory.IsProbabilityMeasure Q] (ฮบ : ProbabilityTheory.Kernel (๐“” ร— ๐“) ๐“จ) [ProbabilityTheory.IsMarkovKernel ฮบ] : Environment ๐“ (๐“” ร— ๐“จ)

Code

noncomputable
def bayesStationaryEnv (Q : Measure ๐“”) [IsProbabilityMeasure Q] (ฮบ : Kernel (๐“” ร— ๐“) ๐“จ)
    [IsMarkovKernel ฮบ] : Environment ๐“ (๐“” ร— ๐“จ) where
  feedback n :=
    let g : (Iic n โ†’ ๐“ ร— ๐“” ร— ๐“จ) ร— ๐“ โ†’ ๐“” ร— ๐“ := fun (h, a) => ((h โŸจ0, by simpโŸฉ).2.1, a)
    (Kernel.deterministic (Prod.fst โˆ˜ g) (by fun_prop)) ร—โ‚– (ฮบ.comap g (by fun_prop))
  ฮฝ0 := (Kernel.const _ Q) โŠ—โ‚– ฮบ.swapLeft
Type uses (1)
Used by (4)

Actions: Source ยท Open Issue