Lean module · Finite-horizon RL
BanditRLProof.RL.FiniteHorizonEmpiricalModel
# Finite-batch empirical models for finite-horizon RL This module builds a genuine finite-state empirical transition kernel from a finite family of recorded episode steps. Positive visit counts are normalized into a finite PMF; zero visit counts use an explicit default-state Dirac PMF. The resulting empirical reward and transition model is then connected to the compiled coordinate-confidence optimistic-regret route.
Module map
Imports
BanditRLProof.RL.FiniteHorizonCoordinateModelConfidence
Imported by
BanditRLProof, BanditRLProof.RL.FiniteHorizonIIDEligibleEmpiricalTransitionConfidence, BanditRLProof.RL.FiniteHorizonIIDTrajectoryBatch
Declarations
Open an item to read its exact compact statement and source link. Detailed teaching notes are linked when registered.
structure
BanditRLProof.FiniteHorizonRL.EpisodeStep
Compiled
One recorded finite-horizon transition with its observed reward.
structure EpisodeStep (State : Type u) (Action : Type v) where
theorem
BanditRLProof.FiniteHorizonRL.EpisodeStep.measurable_state
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
theorem measurable_state : Measurable (fun step : EpisodeStep State Action => step.state)
theorem
BanditRLProof.FiniteHorizonRL.EpisodeStep.measurable_action
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
theorem measurable_action : Measurable (fun step : EpisodeStep State Action => step.action)
theorem
BanditRLProof.FiniteHorizonRL.EpisodeStep.measurable_reward
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
theorem measurable_reward : Measurable (fun step : EpisodeStep State Action => step.reward)
theorem
BanditRLProof.FiniteHorizonRL.EpisodeStep.measurable_nextState
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
theorem measurable_nextState : Measurable (fun step : EpisodeStep State Action => step.nextState)
abbrev
BanditRLProof.FiniteHorizonRL.EpisodeBatch
Compiled
A finite table with one record at each valid stage of every episode. This raw type does not enforce cross-stage state continuity or identify the records with samples from the MDP trajectory law; those are downstream probabilistic laws.
abbrev EpisodeBatch (mdp : MDP State Action) (episodes : Nat)
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.visitCount
Compiled
Number of batch episodes visiting a state-action pair at one stage.
def visitCount {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (stage : Fin mdp.horizon) (state : State) (action : Action) : Nat
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.rewardSum
Compiled
Sum of rewards recorded at a state-action pair and stage.
def rewardSum {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (stage : Fin mdp.horizon) (state : State) (action : Action) : Real
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalReward
Compiled
Empirical reward mean, with the conventional zero value at zero visits.
noncomputable def empiricalReward {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (stage : Fin mdp.horizon) (state : State) (action : Action) : Real
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.transitionCount
Compiled
Number of matching transitions to a fixed next state.
def transitionCount {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (stage : Fin mdp.horizon) (state : State) (action : Action) (nextState : State) : Nat
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.sum_transitionCount_eq_visitCount
Compiled
Next-state transition counts partition the state-action visit count.
theorem sum_transitionCount_eq_visitCount {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (stage : Fin mdp.horizon) (state : State) (action : Action) : ∑ nextState, batch.transitionCount stage state action nextState = batch.visitCount stage state action
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionPMF
Compiled
Empirical next-state PMF with an explicit zero-visit fallback state.
noncomputable def empiricalTransitionPMF {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) : PMF State
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionMass
Compiled
Real singleton mass of the empirical transition PMF.
noncomputable def empiricalTransitionMass {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) (nextState : State) : Real
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionPMF_eq_pure_of_visitCount_eq_zero
Compiled
Zero-visit state-action pairs use the declared fallback distribution.
theorem empiricalTransitionPMF_eq_pure_of_visitCount_eq_zero {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) (hzero : batch.visitCount stage state action = 0) : batch.empiricalTransitionPMF defaultState stage state action = PMF.pure defaultState
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionPMF_apply_of_visitCount_ne_zero
Compiled
At a positive visit count, empirical PMF mass is normalized count.
theorem empiricalTransitionPMF_apply_of_visitCount_ne_zero {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) (nextState : State) (hvisit : batch.visitCount stage state action ≠ 0) : batch.empiricalTransitionPMF defaultState stage state action nextState = (batch.transitionCount stage state action nextState : ENNReal) / (batch.visitCount stage state action : ENNReal)
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionMass_eq_div_of_visitCount_ne_zero
Compiled
Real empirical singleton mass is the usual count divided by visit count.
theorem empiricalTransitionMass_eq_div_of_visitCount_ne_zero {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) (nextState : State) (hvisit : batch.visitCount stage state action ≠ 0) : batch.empiricalTransitionMass defaultState stage state action nextState = (batch.transitionCount stage state action nextState : Real) / (batch.visitCount stage state action : Real)
def
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionKernel
Compiled
State-action indexed empirical PMFs form a measurable finite-state kernel.
noncomputable def empiricalTransitionKernel {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) : ProbabilityTheory.Kernel (State × Action) State
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionKernel_apply
Compiled
No declaration docstring is present; use the chapter context and exact statement below.
theorem empiricalTransitionKernel_apply {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) : batch.empiricalTransitionKernel defaultState stage (state, action) = (batch.empiricalTransitionPMF defaultState stage state action).toMeasure
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionKernel_isMarkov
Compiled
Every section of the empirical transition kernel is a probability law.
theorem empiricalTransitionKernel_isMarkov {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) : ProbabilityTheory.IsMarkovKernel (batch.empiricalTransitionKernel defaultState stage) where
theorem
BanditRLProof.FiniteHorizonRL.EpisodeBatch.empiricalTransitionKernel_real_singleton
Compiled
Kernel singleton mass agrees with the named empirical transition mass.
theorem empiricalTransitionKernel_real_singleton {mdp : MDP State Action} {episodes : Nat} (batch : EpisodeBatch mdp episodes) (defaultState : State) (stage : Fin mdp.horizon) (state : State) (action : Action) (nextState : State) : (batch.empiricalTransitionKernel defaultState stage (state, action)).real {nextState} = batch.empiricalTransitionMass defaultState stage state action nextState
structure
BanditRLProof.FiniteHorizonRL.MDP.FiniteBatchModel
Compiled
A finite batch together with reward and transition radii. The empirical reward and transition model are derived from `batch`; zero transition counts use the explicit `defaultState` fallback rather than an implicit arbitrary law.
structure FiniteBatchModel (mdp : MDP State Action) (episodes : Nat) where
def
BanditRLProof.FiniteHorizonRL.MDP.FiniteBatchModel.plan
Compiled
The estimated-model plan canonically generated by a finite episode batch.
noncomputable def plan {mdp : MDP State Action} {episodes : Nat} (model : FiniteBatchModel mdp episodes) : EstimatedModelPlan mdp where
structure
BanditRLProof.FiniteHorizonRL.MDP.FiniteBatchModel.Confidence
Compiled
Raw finite-batch confidence contracts. Reward errors and singleton-frequency errors are stated directly on the empirical statistics, while the envelope and radius-cover fields discharge the value-dependent coordinate transport.
structure Confidence {mdp : MDP State Action} {episodes : Nat} (model : FiniteBatchModel mdp episodes) where
def
BanditRLProof.FiniteHorizonRL.MDP.FiniteBatchModel.Confidence.toCoordinateConfidence
Compiled
Raw empirical-statistic confidence gives coordinate model confidence.
noncomputable def Confidence.toCoordinateConfidence {mdp : MDP State Action} {episodes : Nat} {model : FiniteBatchModel mdp episodes} (confidence : model.Confidence) : model.plan.CoordinateConfidence where
theorem
BanditRLProof.FiniteHorizonRL.MDP.FiniteBatchModel.Confidence.optimism_and_expectedRegret_le_two_occupancySelectedRadiusRemaining
Compiled
Route endpoint: finite-batch reward and singleton-frequency confidence imply global optimism and the compiled selected-radius expected-regret bound.
theorem Confidence.optimism_and_expectedRegret_le_two_occupancySelectedRadiusRemaining {mdp : MDP State Action} {episodes : Nat} {model : FiniteBatchModel mdp episodes} (confidence : model.Confidence) (initialState : Measure State) [IsProbabilityMeasure initialState] : (forall state, mdp.optimalValueRemaining mdp.horizon le_rfl state <= model.plan.upperValueRemaining mdp.horizon le_rfl state) /\ model.plan.optimisticPolicy.expectedRegret initialState <= model.plan.optimisticPolicy.occupancySumRemaining (fun remaining hremaining state => 2 * model.plan.selectedRadiusRemaining remaining hremaining state) mdp.horizon le_rfl initialState