BanditRLlib
Lean gate passed before this site build; local proof declarations are shown as compiled.

Lean module · Finite-horizon RL

BanditRLProof.RL.FiniteHorizonAdaptiveCumulativeUCBVIClippedPlanner

# Previous-Q clipped recurrent UCBVI-CH planner This module defines the actual recurrent planner used by the Chapter 9 route. Coordinate zero uses the all-`H` initial Q table and its fixed finite argmax. After observing coordinates `0,...,n`, the successor planner folds those exact transition summaries, normalizes their cross-stage aggregate row, and applies the backward recurrence `Q = H` at zero count and `Q = min Q_previous (min H (reward + P_hat V_next + 7 H L / sqrt N))` at positive count. The adaptive source below therefore contains no arbitrary uncharged initial policy. Its successor policy is a measurable function of the strict generated prefix, and its batch kernel is exactly the one-episode trajectory law of that selected policy.

Module map

Declarations
21
Placeholders
0

Imports

BanditRLProof.RL.FiniteHorizonAdaptiveCumulativeUCBVIAggregateTransition

Imported by

BanditRLProof.RL.FiniteHorizonAdaptiveCumulativeUCBVISameSourceConfidence

Declarations

Open an item to read its exact compact statement and source link. Detailed teaching notes are linked when registered.

abbrev BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.QTable Compiled

A chronological action-value table for all actual decision stages.

abbrev QTable (mdp : MDP State Action)
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.initialQTable Compiled

The UCBVI-CH initialization `Q_{0,h}(x,a)=H`.

def initialQTable (mdp : MDP State Action) : QTable mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.cumulativeSummaryOfSequence Compiled

Sum a finite sequence of observed transition summaries coordinatewise.

def cumulativeSummaryOfSequence {mdp : MDP State Action} {n : Nat} (summaries : Fin n -> TransitionCountSummary mdp) : TransitionCountSummary mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedValueRemaining Compiled

The recursively selected clipped value with a given previous-episode Q table and one pooled empirical transition model. The index is decisions remaining; its successor case uses the chronological stage `H-(remaining+1)`.

noncomputable def clippedValueRemaining {mdp : MDP State Action} (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) : (remaining : Nat) -> remaining <= mdp.horizon -> State -> Real | 0, _ => fun _state => 0 | remaining + 1, hremaining => let stage := mdp.decisionStageRemaining remaining hremaining let tail := clippedValueRemaining previousQ summary defaultState bonusScale remaining (by omega) let score : State -> Action -> Real := fun state action => let count := summary.aggregateVisitCount state action if count = 0 then (mdp.horizon : Real) else min (previousQ stage state action) (min (mdp.horizon : Real) (mdp.reward state action + (∫ nextState, tail nextState ∂ summary.aggregateEmpiricalTransitionKernel defaultState (state, action)) + bonusScale / Real.sqrt count)) fun state => score state (FiniteRealArgmax.choose (fun action => score state action)) /-- The action-value used at one remaining-horizon coordinate. -/ noncomputable def clippedQRemaining {mdp : MDP State Action} (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (remaining : Nat) (hremaining : remaining + 1 <= mdp.horizon) (state : State) (action : Action) : Real
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedQRemaining Compiled

The action-value used at one remaining-horizon coordinate.

noncomputable def clippedQRemaining {mdp : MDP State Action} (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (remaining : Nat) (hremaining : remaining + 1 <= mdp.horizon) (state : State) (action : Action) : Real
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedQTable Compiled

The complete chronological Q table produced by one recurrent update.

noncomputable def clippedQTable (mdp : MDP State Action) (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) : QTable mdp
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedQRemaining_of_aggregateVisitCount_eq_zero Compiled

No declaration docstring is present; use the chapter context and exact statement below.

theorem clippedQRemaining_of_aggregateVisitCount_eq_zero {mdp : MDP State Action} (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (remaining : Nat) (hremaining : remaining + 1 <= mdp.horizon) (state : State) (action : Action) (hzero : summary.aggregateVisitCount state action = 0) : clippedQRemaining previousQ summary defaultState bonusScale remaining hremaining state action = (mdp.horizon : Real)
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedQRemaining_of_aggregateVisitCount_pos Compiled

No declaration docstring is present; use the chapter context and exact statement below.

theorem clippedQRemaining_of_aggregateVisitCount_pos {mdp : MDP State Action} (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (remaining : Nat) (hremaining : remaining + 1 <= mdp.horizon) (state : State) (action : Action) (hpos : 0 < summary.aggregateVisitCount state action) : clippedQRemaining previousQ summary defaultState bonusScale remaining hremaining state action = min (previousQ (mdp.decisionStageRemaining remaining hremaining) state action) (min (mdp.horizon : Real) (mdp.reward state action + (∫ nextState, clippedValueRemaining previousQ summary defaultState bonusScale remaining (by omega) nextState ∂ summary.aggregateEmpiricalTransitionKernel defaultState (state, action)) + bonusScale / Real.sqrt (summary.aggregateVisitCount state action)))
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedPolicyTable Compiled

Fixed-enumeration argmax table of one recurrent Q update.

noncomputable def clippedPolicyTable (mdp : MDP State Action) (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) : DeterministicMarkovPolicyTable mdp
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.clippedQTable_le_selected Compiled

The selected recurrent action maximizes the actual clipped Q table.

theorem clippedQTable_le_selected (mdp : MDP State Action) (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (stage : Fin mdp.horizon) (state : State) (action : Action) : clippedQTable mdp previousQ summary defaultState bonusScale stage state action <= clippedQTable mdp previousQ summary defaultState bonusScale stage state (clippedPolicyTable mdp previousQ summary defaultState bonusScale stage state)
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.measurable_clippedPolicyTable Compiled

Every recurrent selector is measurable on the finite state space.

theorem measurable_clippedPolicyTable (mdp : MDP State Action) (previousQ : QTable mdp) (summary : TransitionCountSummary mdp) (defaultState : State) (bonusScale : Real) (stage : Fin mdp.horizon) : Measurable (clippedPolicyTable mdp previousQ summary defaultState bonusScale stage)
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentQTableOfSummaries Compiled

Fold observed summaries into the genuine sequence of previous-Q updates.

noncomputable def recurrentQTableOfSummaries (mdp : MDP State Action) (defaultState : State) (bonusScale : Real) : (n : Nat) -> (Fin n -> TransitionCountSummary mdp) -> QTable mdp | 0, _summaries => initialQTable mdp | n + 1, summaries => let previous := recurrentQTableOfSummaries mdp defaultState bonusScale n (fun i => summaries i.castSucc) let cumulative := cumulativeSummaryOfSequence summaries clippedQTable mdp previous cumulative defaultState bonusScale /-- Policy table obtained after the same finite previous-Q fold. -/ noncomputable def recurrentPolicyTableOfSummaries (mdp : MDP State Action) (defaultState : State) (bonusScale : Real) (n : Nat) (summaries : Fin n -> TransitionCountSummary mdp) : DeterministicMarkovPolicyTable mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentPolicyTableOfSummaries Compiled

Policy table obtained after the same finite previous-Q fold.

noncomputable def recurrentPolicyTableOfSummaries (mdp : MDP State Action) (defaultState : State) (bonusScale : Real) (n : Nat) (summaries : Fin n -> TransitionCountSummary mdp) : DeterministicMarkovPolicyTable mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.prefixTransitionSummaries Compiled

Extract exactly the transition summaries stored in one finite prefix.

def prefixTransitionSummaries {mdp : MDP State Action} {episodes n : Nat} (history : EpisodeBatchPrefix mdp episodes n) : Fin (n + 1) -> TransitionCountSummary mdp
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.measurable_prefixTransitionSummaries Compiled

No declaration docstring is present; use the chapter context and exact statement below.

theorem measurable_prefixTransitionSummaries {mdp : MDP State Action} {episodes n : Nat} : Measurable (prefixTransitionSummaries : EpisodeBatchPrefix mdp episodes n -> Fin (n + 1) -> TransitionCountSummary mdp)
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentSuccessorTable Compiled

Measurable strict-prefix selector for the recurrent generated source.

noncomputable def recurrentSuccessorTable {mdp : MDP State Action} {episodes : Nat} (defaultState : State) (bonusScale : Real) (n : Nat) (history : EpisodeBatchPrefix mdp episodes n) : DeterministicMarkovPolicyTable mdp
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.measurable_recurrentSuccessorTable Compiled

No declaration docstring is present; use the chapter context and exact statement below.

theorem measurable_recurrentSuccessorTable {mdp : MDP State Action} {episodes : Nat} (defaultState : State) (bonusScale : Real) (n : Nat) : Measurable (recurrentSuccessorTable (mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentInitialTable Compiled

The initial table is the fixed argmax of the all-`H` Q initialization.

noncomputable def recurrentInitialTable (mdp : MDP State Action) : DeterministicMarkovPolicyTable mdp
def BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentSource Compiled

Canonical one-episode recurrent UCBVI source. It has no arbitrary initial policy parameter: coordinate zero executes `recurrentInitialTable`; coordinate `n+1` executes the fold of exactly the observed coordinates `0,...,n`.

noncomputable def recurrentSource (mdp : MDP State Action) (initialState : Measure State) [IsProbabilityMeasure initialState] (defaultState : State) (episodes : Nat) (delta : Real) : AdaptiveEpisodeBatchSource mdp initialState 1 where
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentSource_policyAt_zero Compiled

Coordinate zero uses the all-`H` initialized recurrent policy.

theorem recurrentSource_policyAt_zero (mdp : MDP State Action) (initialState : Measure State) [IsProbabilityMeasure initialState] (defaultState : State) (episodes : Nat) (delta : Real) (trajectory : EpisodeBatchTrajectory mdp 1) : (recurrentSource mdp initialState defaultState episodes delta).policyAt trajectory 0 = (recurrentInitialTable mdp).toMarkovPolicy
theorem BanditRLProof.FiniteHorizonRL.AdaptiveCumulativeHoeffdingUCBVI.recurrentSource_policyAt_succ Compiled

Every successor policy is the exact strict-prefix previous-Q fold.

theorem recurrentSource_policyAt_succ (mdp : MDP State Action) (initialState : Measure State) [IsProbabilityMeasure initialState] (defaultState : State) (episodes : Nat) (delta : Real) (trajectory : EpisodeBatchTrajectory mdp 1) (n : Nat) : (recurrentSource mdp initialState defaultState episodes delta).policyAt trajectory (n + 1) = (recurrentSuccessorTable defaultState (scale (State