import Mathlib.MeasureTheory.Order.Lattice import Mathlib.Probability.Kernel.IonescuTulcea.Traj import Mathlib.Probability.Process.FiniteDimensionalLaws import Mathlib.Probability.HasCondDistrib import Mathlib.MeasureTheory.Measure.ProbabilityMeasure import Mathlib.Probability.Independence.Basic import Mathlib.Probability.Independence.Conditional import Mathlib.MeasureTheory.Measure.SubFinite import Mathlib.Probability.Kernel.RadonNikodym import Mathlib.Analysis.Normed.Ring.Basic import Mathlib.MeasureTheory.Constructions.BorelSpace.Basic /-! # Standalone extraction for `Learning.trajMeasure` Definitions are copied verbatim; theorem proofs are replaced by `sorry`. Auto-generated by Referee. -/ set_option quotPrecheck false -- Namespace stubs (so later `open`s resolve). namespace Finset end Finset namespace MeasureTheory end MeasureTheory namespace ProbabilityTheory end ProbabilityTheory namespace ENNReal end ENNReal namespace Learning end Learning -- ═══ ForMathlib.MeasureTheory.Order.Lattice ═══ section open Finset variable {α δ : Type*} [MeasurableSpace δ] [SemilatticeInf α] {m : MeasurableSpace α} [MeasurableInf₂ α] attribute [to_dual existing] MeasurableInf₂ end -- ═══ SequentialLearning.Algorithm ═══ section open MeasureTheory ProbabilityTheory Filter Real Finset open scoped ENNReal NNReal namespace Learning variable {𝓐 𝓨 Ω : Type*} {m𝓐 : MeasurableSpace 𝓐} {m𝓨 : MeasurableSpace 𝓨} {mΩ : MeasurableSpace Ω} /-- A stochastic, sequential algorithm. -/ 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] instance (alg : Algorithm 𝓐 𝓨) (n : ℕ) : IsMarkovKernel (alg.policy n) := alg.h_policy n instance (alg : Algorithm 𝓐 𝓨) : IsProbabilityMeasure alg.p0 := alg.hp0 /-- A stochastic environment. -/ 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] instance (env : Environment 𝓐 𝓨) (n : ℕ) : IsMarkovKernel (env.feedback n) := env.h_feedback n instance (env : Environment 𝓐 𝓨) : IsMarkovKernel env.ν0 := env.hp0 /-- Kernel describing the distribution of the next action-feedback pair given the history up to `n`. -/ noncomputable def stepKernel (alg : Algorithm 𝓐 𝓨) (env : Environment 𝓐 𝓨) (n : ℕ) : Kernel (Iic n → 𝓐 × 𝓨) (𝓐 × 𝓨) := alg.policy n ⊗ₖ env.feedback n instance (alg : Algorithm 𝓐 𝓨) (env : Environment 𝓐 𝓨) (n : ℕ) : IsMarkovKernel (stepKernel alg env n) := sorry end Learning end -- ═══ SequentialLearning.IonescuTulceaSpace ═══ section open MeasureTheory ProbabilityTheory Filter Real Finset open scoped ENNReal NNReal namespace Learning variable {𝓐 𝓨 Ω : Type*} {m𝓐 : MeasurableSpace 𝓐} {m𝓨 : MeasurableSpace 𝓨} {mΩ : MeasurableSpace Ω} /-- Measure on the sequence of actions and observations generated by the algorithm/environment. -/ noncomputable def trajMeasure (alg : Algorithm 𝓐 𝓨) (env : Environment 𝓐 𝓨) : Measure (ℕ → 𝓐 × 𝓨) := Kernel.trajMeasure (alg.p0 ⊗ₘ env.ν0) (stepKernel alg env) instance (alg : Algorithm 𝓐 𝓨) (env : Environment 𝓐 𝓨) : IsProbabilityMeasure (trajMeasure alg env) := sorry end Learning end