Alphabeta Math
Pipeline-generated
How statement and proof provenance work

The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.

  • Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
  • AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
  • AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.

These labels describe origin, not correctness: citations and verification chips remain separate evidence.

✓ 1 result · all verified · 0 also independently AI-judged
Every result on this page is machine-checked by a proof checker and read in full and owner-audited; the judge is an additional, independent cross-model AI review of the proofs. The 1 not AI-judged were verified by owner audit (typically over a confirmed judge false positive), not failures.

Tabular prediction and control by interaction

1 · Prerequisites

2 · Logical flowchart

3 · Definitions, theorems and proofs

LemmaStatement: AI-adaptedProof: AI-generatedOpen item page →

Predictably weighted bounded martingale differences have a convergent series

Statement

Assume the Axiom of Choice. Let (Ω,F,(Fn)n≥0,P) be a discrete filtered probability space. Let (Dn)n≥1 be a real martingale-difference sequence relative to the filtration, with ∣Dn∣≤C almost surely for a finite constant C≥0. For each n≥1, let Bn be a real Fn−1-measurable random variable. Suppose that a finite deterministic K≥0 satisfies

∑n=1∞Bn2≤Kalmost surely.

Then the partial sums ∑n=1NBnDn converge almost surely to a finite real limit.

Facts & Assumptions

Given: The Axiom of Choice, the filtered probability space, the bounded martingale differences, the predictable coefficients, and the almost-sure square-sum bound in the Statement.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function; this is assumed for the conditional-expectation classes in the martingale-difference definition.

[F1]

Filtration and filtered probability space: Fi⊆Fj whenever i≤j.

[F2]

Martingale difference sequence: each Dn is Fn-measurable and integrable, and E[Dn∣Fn−1]=0 almost surely; conditional expectations are almost-sure classes under AC.

[F3]

Martingale submartingale and supermartingale: an integrable adapted process Xn is a submartingale when E[Xn+1∣Fn]≥Xn almost surely.

[F4]

Tower property of conditional expectation: if H⊆G and X is integrable, then E[E[X∣G]∣H]=E[X∣H] almost surely.

[F5]

Taking out what is known: an integrable factor measurable with respect to the conditioning sigma-algebra can be taken outside conditional expectation when the products are integrable.

[F6]

Basic algebra and order properties of conditional expectation: conditional expectation is linear, order preserving, and expectation preserving.

[F7]

Probability measures and probability spaces and Expectation of a nonnegative or integrable random variable: P(Ω)=1, and a nonnegative integrable constant has expectation equal to that constant.

[F9]

Dominated convergence: pointwise convergence under one integrable majorant permits convergence of expectations.

[F10]

Continuity from below for measures: for increasing measurable events, the measure of their union is the limit of their measures.

[F11]

Finite and countable subadditivity of measures: the measure of a countable union is at most the sum of the measures.

[F12]

The reals are complete: every Cauchy sequence of real numbers converges in R.

[F13]

The well-ordering principle: every nonempty subset of the natural numbers has a least element.

Proof

Given: In addition to the hypotheses in the Statement, all conditional-expectation identities are interpreted almost surely.

1.1givenA1F1F2F4F5F6algebra

Put Yn=BnDn. The square-sum bound implies ∣Bn∣≤K almost surely, so Yn is square integrable. Since Bn is Fn−1-measurable, [F2] and [F5] give E[Yn∣Fn−1]=0. For i<j, [F1] gives Fi⊆Fj−1, and [F4] gives E[Yj∣Fi]=0. Taking out the bounded Fi-measurable factor Yi with [F5], then using expectation preservation [F6], gives E[YiYj]=0. Expanding a finite square therefore yields E ⁣[(∑n=NmYn)2]=∑n=NmE[Yn2]≤C2E ⁣[∑n=NmBn2].

1.2givenF7F8F9

Let RN=∑n=N∞Bn2. By [F8], RN is measurable; the hypothesis gives 0≤RN≤K and RN↓0 almost surely. The constant K is integrable by [F7], so [F9] gives E[RN]→0.

2.1givenF1F2F3F4F5F6step 1.1step 1.2algebra

For finite m≥N, put Sj=∑n=NjYn for N≤j≤m, with SN−1=0. Each Sj is adapted and integrable; [F2] and [F6] give E[Sj+1∣Fj]=Sj+E[Yj+1∣Fj]=Sj, so (Sj) is a martingale. Since Sj is Fj-measurable, [F5] takes it out of the conditional expectation; the MDS identity from step 1.1 gives E[2SjYj+1∣Fj]=2SjE[Yj+1∣Fj]=0. The conditional square expansion therefore gives E[Sj+12∣Fj]=Sj2+E[Yj+12∣Fj]≥Sj2, so (Sj2) is a nonnegative submartingale by [F3]. Let Aj be the event that j is the first index in [N,m] with ∣Sj∣≥ε. These events are disjoint and Aj∈Fj. Repeated use of the submartingale inequality and [F4] gives E[Sm2∣Fj]≥Sj2, hence E[1AjSm2]≥E[1AjSj2]≥ε2P(Aj). Summing over j and using Sm2≥0 gives P ⁣(max⁡N≤j≤m∣Sj∣≥ε)≤E[Sm2]ε2≤C2E[RN]ε2.

3.1step 1.2step 2.1F10F11F13algebra

Since C2E[RN]→0, for each integer r≥1 choose the least Nr>Nr−1 (with N0=0) such that C2E[RNr]≤2−4r; it exists by [F13]. For finite m≥Nr, step 2.1 with ε=2−r bounds the event max⁡Nr≤j≤m∣∑n=NrjYn∣≥2−r by 2−2r. These events increase with m, so [F10] gives the same bound for their union Ar over all m. For each R, [F11] gives P(⋃r≥RAr)≤∑r≥R2−2r, which tends to zero; hence almost surely only finitely many Ar occur. Outside that null event, for every sufficiently large r and all p≤q with p,q≥Nr, the tail sum satisfies ∣∑n=pqYn∣≤21−r. Thus the partial sums are Cauchy.

4.1step 3.1F12algebra∎

Completeness [F12] makes the Cauchy sequence of partial sums converge in R. Since Yn=BnDn, this is the asserted convergence of ∑n≥1BnDn.

DefinitionDefinition: Literature-sourcedProof: AI-generatedprecheck pendingOpen item page →

Optimal action-value Bellman operator

Definition

Let a finite MDP have nonempty finite state set S and let 0≤γ<1. Write D={(s,a):s∈S, a∈A(s)} and RD for the real functions on D. The optimal action-value Bellman operator H:RD→RD is

(HQ)(s,a)=∑s′∈S∑ρ∈Rp(s′,ρ∣s,a)[ρ+γmax⁡b∈A(s′)Q(s′,b)]((s,a)∈D).

Each maximum is attained because every A(s′) is finite and nonempty.

Facts & Assumptions

Given: A finite MDP with nonempty finite state set S, nonempty finite action sets A(s), finite reward set R, joint masses p(s′,ρ∣s,a), and 0≤γ<1.

[F1]

Finite Markov decision process with joint reward-transition law: every A(s′) is nonempty and finite, D is the set of admissible pairs, and each p(⋅,⋅∣s,a) is a probability mass on the finite set S×R.

[F2]

Finite, countably infinite, countable, uncountable and Every nonzero natural number is a successor: a nonempty finite action set is in bijection with a nonzero natural number, and every nonzero natural is the successor σ(n) of a natural n; thus its actions can be listed as a0,…,an.

[F3]

Every nonempty finite set of reals has a maximum and a minimum: for every natural n and real list u0,…,un, the set {u0,…,un} has an attained maximum and minimum.

[F4]

Maximum and minimum of a set: a maximum of a real set belongs to that set and is an upper bound for every member; it is unique when it exists.

[F5]

The sum ∑i∈Sai over a finite index set, and its product form: a real-valued function on a finite index set has a well-defined finite sum.

Verification

Given: The finite MDP, its nonempty finite state-action domain, the discount, and the candidate formula for H in the Definition.

1.1givenF1F2F3construct

Fix s′∈S. By [F1] and [F2], choose a natural n and a bijection ϕ:σ(n)→A(s′). The list uj=Q(s′,ϕ(j)) for j∈σ(n) has an attained maximum m by [F3]. Every action b∈A(s′) equals ϕ(j) for some j, so Q(s′,b)≤m, and the maximum value m is attained by at least one such action.

2.1step 1.1F4algebra

The maximum value in step 1.1 depends only on the set {Q(s′,b):b∈A(s′)}: it belongs to that set and bounds every member. Uniqueness in [F4] therefore makes it independent of the enumeration ϕ. Hence max⁡b∈A(s′)Q(s′,b) is well-defined.

3.1givenF1F5step 2.1algebra∎

For each (s,a)∈D, the bracketed term in the Definition is real by step 2.1, and S×R is finite by [F1]. The finite sum supplied by [F5] is therefore a real number. Thus the displayed formula assigns one real value to every coordinate in D and defines a map H:RD→RD.

LemmaStatement: Literature-sourcedProof: AI-generatedOpen item page →

A finite MDP policy generates action-state-reward trajectories

Statement

Assume the Axiom of Choice. Let a finite MDP have nonempty state set S, and let π be a stationary Markov policy. Fix an initial state s0∈S and let

Z={(s,a,r,s′):s∈S, a∈A(s), r∈R, s′∈S}

with its discrete sigma-algebra. There is a probability law on S×ZN whose first state is S0=s0 and whose subsequent coordinates are Zn=(Sn,An,Rn+1,Sn+1). For every m≥0 and every feasible finite trajectory (s0,a0,r1,s1,…,am−1,rm,sm), its probability is

∏n=0m−1π(an∣sn) p(sn+1,rn+1∣sn,an),

where the empty product for m=0 is 1.

Its state-reward marginal also has the finite-prefix probabilities

∏n=0m−1∑a∈A(sn)π(a∣sn)p(sn+1,rn+1∣sn,a)

for each feasible finite state-reward path (s0,r1,s1,…,rm,sm).

Facts & Assumptions

Given: AC, a finite MDP with S≠∅, a stationary Markov policy π, and an initial state s0∈S.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function.

[F1]

Finite Markov decision process with joint reward-transition law: S, R, and each A(s) are finite; p(s′,r∣s,a)≥0 and ∑s′,rp(s′,r∣s,a)=1; π(⋅∣s) is a probability distribution on A(s).

[F2]

Finite, countably infinite, countable, uncountable: a finite set is in bijection with a natural number.

[F4]

Measure kernel and probability kernel: a probability kernel assigns a probability measure at each input and has measurable event sections.

[F5]

The product sigma-algebra and its finite iterates: finite product sigma-algebras make coordinate projections measurable.

[F6]

The well-ordering principle: every nonempty subset of N has a least element.

[F7]

Ionescu-Tulcea construction of a Markov chain: under AC, an initial probability and a sequence of probability kernels determine a probability law with the prescribed iterated finite-prefix laws.

[F8]

A finite MDP and stationary policy generate a reward-state Markov chain: the reward-state marginal under π has the finite-prefix laws obtained by mixing the joint law p(s′,r∣s,a) with π(a∣s).

[F10]

Ionescu-Tulcea construction of a Markov chain: a probability law with prescribed consistent finite-prefix laws is unique.

Proof

Given: The hypotheses and conventions in the Statement.

1.1givenF1F2F3F4F6algebra

The blocks {s}×A(s) are finite by [F3] and pairwise disjoint because distinct blocks have different first coordinates. Since S is finite, [F3] makes D=⋃s∈S{s}×A(s) finite. Its product with the finite reward and state sets is finite by [F3], so Z is finite. For each s∈S and B⊆Z, define Kπ(s,B)=∑a∈A(s)π(a∣s)∑s′∈S∑r∈R1B(s,a,r,s′)p(s′,r∣s,a). Every term is nonnegative, and [F1] gives Kπ(s,Z)=∑a∈A(s)π(a∣s)=1. If (Bj) is a disjoint sequence of subsets of finite Z, only finitely many Bj are nonempty: enumerate Z and assign each nonempty Bj its least element in that enumeration; disjointness makes these assigned elements distinct. Therefore finite additivity of the displayed finite sums gives countable additivity. Since Z and S have discrete sigma-algebras, B↦Kπ(s,B) is a probability measure and s↦Kπ(s,B) is measurable; hence Kπ is a probability kernel by [F4].

2.1givenA1F4F5F7step 1.1construct

Set E0=S and En=Z for n≥1, with initial measure δs0. For each n≥0, let Kn from E0×⋯×En to Z be Kn(h,B)=Kπ(sn,B), where sn=s0 when n=0 and sn is the final next-state coordinate of the last trajectory record in h when n≥1. That coordinate projection is measurable by [F5], so each Kn is measurable in h; its sections are probability measures by step 1.1. Thus the hypotheses of [F7] hold.

3.1step 1.1step 2.1F1F7algebra

Apply [F7] to obtain the probability law with these finite-prefix kernels. For a feasible atom (s0,a0,r1,s1,…,am−1,rm,sm), its iterated prefix mass is the product over n<m of the atom masses Kπ(sn,{(sn,an,rn+1,sn+1)}). The definition of Kπ makes each such mass π(an∣sn)p(sn+1,rn+1∣sn,an), giving the displayed formula. For m=0, the initial point mass is 1.

4.1step 3.1F8F9F10algebra∎

Fix a finite state-reward path (s0,r1,s1,…,rm,sm). Summing the action-path formula from step 3.1 over its finitely many action sequences and regrouping the finite sums by time gives the displayed state-reward marginal formula by [F9]. These are the finite-prefix probabilities in [F8]. The initial state is the same point mass, so uniqueness [F10] identifies the state-reward marginal with the stationary-policy path law.

LemmaStatement: Literature-sourcedProof: AI-generatedOpen item page →

Coordinate-wise stochastic approximation converges to a contraction fixed point

Statement

Assume the Axiom of Choice. Let I be a nonempty finite set and put ∥x∥∞=max⁡i∈I∣x(i)∣ for x∈RI. Let T:RI→RI satisfy

∥T(x)−T(y)∥∞≤q∥x−y∥∞(x,y∈RI)

for a fixed 0≤q<1, and let x∗∈RI satisfy T(x∗)=x∗. On a discrete filtered probability space (Ω,F,(Fn)n≥0,P), let x0∈RI be deterministic, let In∈I be Fn-measurable, and define Nn(i)=#{k<n:Ik=i}. For each i∈I, let αk(i) be deterministic with 0≤αk(i)≤1, ∑k≥0αk(i)=∞, and ∑k≥0αk(i)2<∞. Let (ξn+1)n≥0 be a bounded martingale-difference sequence relative to the filtration. Update

xn+1(i)=xn(i)+1{In=i}αNn(i)(i)((T(xn))(i)−xn(i)+ξn+1)(i∈I).

If every i∈I is selected infinitely often almost surely and the iterates xn are bounded almost surely, then xn→x∗ almost surely in ∥⋅∥∞.

Facts & Assumptions

Given: The Axiom of Choice, the finite index set, the contraction and fixed point, filtration, bounded martingale-difference noise, deterministic per-coordinate step sizes, infinite visitation, and bounded iterates in the Statement.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function; AC is assumed for the conditional-expectation classes used in the martingale-difference definition.

[F1]
[F2]

Martingale difference sequence: ξn+1 is Fn+1-measurable and integrable, and E[ξn+1∣Fn]=0 almost surely.

[F3]

Every nonempty finite set of reals has a maximum and a minimum: every nonempty finite set of real numbers has an attained maximum, so the displayed sup norm is finite and well defined.

[F4]

Predictably weighted bounded martingale differences have a convergent series: if Dn+1 is bounded martingale-difference noise and Bn+1 is Fn-measurable with an almost-sure deterministic square-sum bound, then ∑n≥0Bn+1Dn+1 converges almost surely.

[F5]

Limit superior and limit inferior of a nonnegative extended-real sequence: for a bounded nonnegative sequence (an), lim sup⁡an=inf⁡Nsup⁡k≥Nak and is nonnegative.

Proof

Given: All hypotheses and conventions in the Statement.

1.1givenA1F1F2F4F3construct

Fix i∈I and put Bn+1(i)=1{In=i}αNn(i)(i). The indicator and visit count are Fn-measurable, so Bn+1(i) is Fn-measurable. Each visit to i contributes one term αk(i)2 to ∑n≥0(Bn+1(i))2, hence this sum is at most ∑k≥0αk(i)2<∞. By [F2], [F4], and the bound on ξ, the series ∑n≥0Bn+1(i)ξn+1 converges almost surely. Since I is finite, these convergence events hold simultaneously for all i outside one null set.

2.1givenF4step 1.1algebra

Fix an outcome in that full-measure event where all coordinates are visited infinitely often and the iterates are bounded. For a fixed i, let τi(k) be the time of the (k+1)st update of coordinate i, put z0=x0(i)−x∗(i) and zk+1=xτi(k)+1(i)−x∗(i), and let uk=(T(xτi(k)))(i)−x∗(i) and vk=αk(i)ξτi(k)+1. Before the (k+1)st update, coordinate i still has its value after the first k updates, so the update and T(x∗)=x∗ give zk+1=(1−αk(i))zk+αk(i)uk+vk. By step 1.1, ∑k≥0vk converges; put ek=∑j≥kvj, so ek→0. For yk=zk+ek, the identity ek=vk+ek+1 gives yk+1=(1−αk(i))yk+αk(i)(uk+ek).

3.1givenF5step 2.1algebra

Let Ui=lim sup⁡k→∞∣uk∣, which is finite because the iterates are bounded and T is a contraction. For every ε>0, eventually ∣uk+ek∣≤Ui+2ε. Iterating the convex-combination recurrence in step 2.1 from such an index m bounds ∣yk∣ by a vanishing multiple of ∣ym∣ plus Ui+2ε: the coefficient of ∣ym∣ is ∏j=mk−1(1−αj(i)), which tends to zero since ∏j=mk−1(1−αj(i))≤11+∑j=mk−1αj(i)⟶0. Thus lim sup⁡k∣yk∣≤Ui+2ε. Letting ε↓0 and using ek→0 yields lim sup⁡k∣zk∣≤Ui.

4.1givenF3F5step 3.1algebra∎

Put E=lim sup⁡n→∞∥xn−x∗∥∞, finite by boundedness. For every ε>0, eventually ∥xn−x∗∥∞≤E+ε. Since τi(k)→∞, contraction gives ∣uk∣=∣(T(xτi(k)))(i)−(T(x∗))(i)∣≤q∥xτi(k)−x∗∥∞, so Ui≤qE. Step 3.1 gives lim sup⁡k∣zk∣≤qE. Coordinate i is constant between updates; since the number of its updates tends to infinity, its full-time limsup error equals the limsup of the post-update sequence ∣zk∣. Also, for finite I, taking a tail supremum commutes with the finite maximum, and the decreasing tail suprema commute with a finite maximum when taking their infimum; hence E=max⁡i∈Ilim sup⁡n∣xn(i)−x∗(i)∣. Therefore E≤qE, and 0≤q<1 forces E=0. Thus ∥xn−x∗∥∞→0 on the full-measure event, proving almost-sure convergence.

AlgorithmAlgorithm: Literature-sourcedProof: Not applicableOpen item page →

Tabular Q-learning

Definition

Inputs: A finite MDP with nonempty finite state set S, finite nonempty action sets A(s), finite reward alphabet R, and discount 0≤γ<1; an initial state S0∈S; a behavior rule that selects a legal action using the interaction history available at time n; an initial table Q0∈RD; and a step-size rule that, before observing the next reward and state, supplies αn(Sn,An)∈[0,1] from the history and selected pair. A deterministic per-pair schedule αk(s,a)∈[0,1] based on the number of previous visits to (s,a) is a special case. The interaction must, conditional on its history and the selected pair (Sn,An), draw (Sn+1,Rn+1) with joint mass p(s′,ρ∣Sn,An).

Output: The action-value table after every interaction, (Qn)n≥0; a finite run outputs its current table Qn.

Initialize Q=Q0. For each n=0,1,2,…, select An by the behavior rule, obtain αn(Sn,An) from the step-size rule, and observe (Rn+1,Sn+1). Compute

δn=Rn+1+γmax⁡b∈A(Sn+1)Qn(Sn+1,b)−Qn(Sn,An),

then update only the visited coordinate by

Qn+1(Sn,An)=Qn(Sn,An)+αn(Sn,An)δn.

Leave every other coordinate unchanged, set the current table to Qn+1, and set the current state to Sn+1. The target uses the greedy maximum even when the behavior rule explores, so this is off-policy and uses no importance-sampling ratio. The procedure makes no convergence claim; convergence requires additional hypotheses not imposed here.

DefinitionDefinition: Literature-sourcedProof: Not applicableOpen item page →

Episodic returns, temporal-difference errors, and policy support

Definition

Let a finite MDP have 0≤γ<1 and let S†⊆S be a set of terminal states. Form an absorbing extension with reward alphabet R†=R∪{0}: from each nonterminal state retain the original joint reward-transition law, and from each terminal state use the deterministic transition back to that state with reward zero. Assume AC for the path laws defining policy values. For a stationary policy σ, an episode starting from s ends at its first hitting time T=inf⁡{n≥0:Sn∈S†}; require T<∞ almost surely under every policy used. The return from time t<T is

Gt=∑k=tT−1γk−tRk+1,

and GT=0. This equals the infinite discounted return of the absorbing extension, whose state value is Vσ(s)=Eσ,s[G0].

For a state-value estimate Vn, the state temporal-difference error on a transition is δnV=Rn+1+γVn(Sn+1)−Vn(Sn). For an action-value estimate Qn, the sampled-action Sarsa error is δnSarsa=Rn+1+γQn(Sn+1,An+1)−Qn(Sn,An), and the greedy Q-learning error is δnQ=Rn+1+γmax⁡b∈A(Sn+1)Qn(Sn+1,b)−Qn(Sn,An). In each error, the continuation term is defined as zero when Sn+1 is terminal.

In off-policy prediction, μ denotes the behavior policy generating episodes and π the target policy whose value is estimated. Target support means π(a∣s)>0 implies μ(a∣s)>0 for every state-action pair that can be visited. For a behavior-generated episode, the state-return likelihood ratio from time t is

Λt:T−1=∏k=tT−1π(Ak∣Sk)μ(Ak∣Sk).

Each denominator is positive on the observed behavior path. When estimating a value conditional on an already fixed action At, the first factor begins at time t+1.

LemmaStatement: Literature-sourcedProof: AI-generatedjudge pass (gpt-6-luna)Open item page →

The optimal action value is attained by a greedy stationary policy

Statement

Assume the Axiom of Choice. Let a finite MDP have nonempty finite state set S and discount 0≤γ<1, and let T∗ be its Bellman optimality operator. For a fixed initial pair (s,a)∈D, an admissible continuation is any discrete filtered process (Sn,An,Rn+1)n≥0 on a probability space such that (S0,A0)=(s,a) almost surely, Sn,Sn+1∈S, An∈A(Sn), Rn+1∈R almost surely, (Sn,An) is measurable with respect to Fn, Rn+1 and Sn+1 are measurable with respect to Fn+1, and

E[1{Sn+1=s′, Rn+1=ρ}∣Fn]=p(s′,ρ∣Sn,An)

almost surely for every n≥0, s′∈S, and ρ∈R. Its discounted return is G=∑n=0∞γnRn+1. Let V∗ be the unique fixed point of T∗ and define Qopt(s,a) as the supremum of E[G] over all admissible continuations from (s,a). Then this supremum is finite and attained by a continuation that, after the prescribed initial action, always chooses an action maximizing r(s′,b)+γ∑u∈SP(u∣s′,b)V∗(u) at the current state s′. In particular,

Qopt(s,a)=∑s′∈S∑ρ∈Rp(s′,ρ∣s,a)[ρ+γV∗(s′)].

Facts & Assumptions

Given: The finite MDP, its reward-transition law, 0≤γ<1, and the Axiom of Choice.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function; this is used for the path-law construction and to select one maximizing action at each state.

[F1]

Finite Markov decision process with joint reward-transition law: each A(s) is finite nonempty, D and the reward/state sets are finite, p(⋅,⋅∣s,a) is a probability mass, and ∣ρ∣≤M.

[F2]

Filtration and filtered probability space: (Fn) is increasing; current state-action pairs are measurable at time n in an admissible continuation.

[F3]

Basic algebra and order properties of conditional expectation: conditional expectation is linear, preserves order and constants, and preserves expectation.

[F4]

Bellman optimality operator: (T∗V)(s)=max⁡b∈A(s)[r(s,b)+γ∑uP(u∣s,b)V(u)].

[F5]

Policy Bellman operator: (TπV)(s)=∑bπ(b∣s)[r(s,b)+γ∑uP(u∣s,b)V(u)].

[F6]

Finite-MDP Bellman operators are gamma contractions with unique fixed points: T∗ and each stationary-policy operator Tπ have unique fixed points for 0≤γ<1.

[F7]

Discounted returns and policy values in a finite MDP: Vπ(s) is the expected discounted return from state s under the policy-induced path law.

[F8]

Expected discounted policy value is a fixed point of its Bellman operator: TπVπ=Vπ under the stated Axiom of Choice and discount hypotheses.

[F9]

Ionescu-Tulcea construction of a Markov chain: under Choice, an initial law and a sequence of history-dependent probability kernels determine a probability law with the prescribed finite-prefix laws.

[F10]

A finite MDP policy generates action-state-reward trajectories: a stationary Markov policy has the stated finite-prefix action-state-reward path probabilities from each fixed initial state.

[F11]

Absolute convergence and tail bound for bounded discounted rewards: bounded rewards give an absolutely convergent discounted return and a uniform tail bound MγN/(1−γ).

[F12]

Dominated convergence: pointwise-convergent measurable functions under one integrable majorant have convergent expectations.

[F13]

Expectation of a nonnegative or integrable random variable, The expectation of an indicator is the probability of the event, and Monotonicity and nonnegative homogeneity of the nonnegative integral: a bounded constant is integrable on a probability space because E[1Ω]=P(Ω)=1 and the nonnegative integral preserves scaling and order.

[F14]

Finite, countably infinite, countable, uncountable, On N the order is membership: m<n  ⟺  m∈n, and Every nonzero natural number is a successor: each nonempty finite action set is bijective with a successor natural and can be enumerated by the corresponding finite list a0,…,an.

[F15]

Every nonempty finite set of reals has a maximum and a minimum and Maximum and minimum of a set: every finite real list has an attained maximum, which is an upper bound for the list and is unique.

[F17]

Sequential suprema, infima, limsup, liminf, and pointwise limits of measurable functions are measurable: the pointwise limit of a sequence of measurable real functions is measurable.

[F18]

The product sigma-algebra and its finite iterates: coordinate projections from the history product spaces are measurable.

[F19]

Measure kernel and probability kernel: a history-dependent assignment of probability measures with measurable event sections is a probability kernel of the type required by [F9].

[F20]

The product rule: ∣A×B∣=∣A∣ ∣B∣, and ∣∏i<mAi∣=∏i<m∣Ai∣: each finite history-coordinate space formed from finitely many finite state, reward, and state-action sets is finite.

Proof

Given: The hypotheses, definitions, and conventions in the Statement and [A1], [F1]–[F20].

1.1F1F4F6F14F15algebra

The unique fixed point V∗ exists by [F6]. Let B=∥V∗∥∞, which is finite because S is finite. Fix s∈S and enumerate A(s)={a0,…,an} using [F1] and [F14]. For uj=r(s,aj)+γ∑xP(x∣s,aj)V∗(x), [F15] gives an attained list maximum; because the list enumerates all actions, its maximum is exactly the maximum in [F4], independent of the enumeration by uniqueness in [F15]. For each j, expanding r and P by [F1] gives uj=∑x,ρp(x,ρ∣s,aj)[ρ+γV∗(x)]. The triangle inequality, ∣ρ∣≤M, and the probability-mass identity give ∣uj∣≤M+γB. Since the maximum is one of the list entries, ∣(T∗V∗)(s)∣≤M+γB. As s was arbitrary, B=∥T∗V∗∥∞≤M+γB. Since 1−γ>0, B≤M/(1−γ).

2.1givenF1F2F3F4step 1.1

Fix any admissible continuation from (s,a). For each n≥1, expand Rn+1+γV∗(Sn+1) as the finite sum ∑s′,ρ(ρ+γV∗(s′))1{Sn+1=s′,Rn+1=ρ}. These variables are bounded by [F1] and step 1.1, so they are integrable. Conditional linearity and the transition-reward identity in the definition give E[Rn+1+γV∗(Sn+1)∣Fn]=∑s′,ρp(s′,ρ∣Sn,An)[ρ+γV∗(s′)]. The right side is the one-step action value of the measurable current action An, so it is at most (T∗V∗)(Sn)=V∗(Sn) by [F4] and the fixed-point identity.

2.2A1F4F5F6F8step 1.1

The attained list maximum argument in step 1.1 makes the maximizing-action set nonempty at every state. By [A1], choose one such action at every state and call the resulting deterministic stationary policy π∗. Define its stationary probability-family embedding by π^∗(b∣s)=1{b=π∗(s)} for b∈A(s). These numbers are nonnegative and sum to one because exactly one legal action equals π∗(s), so π^∗ is a stationary Markov policy in [F5]–[F8]. Its policy Bellman sum has only the chosen maximizing action as a nonzero term. The definitions [F4]–[F5] and T∗V∗=V∗ give Tπ^∗V∗=V∗. By [F6] this is the unique fixed point of Tπ^∗, while [F8] gives Tπ^∗Vπ^∗=Vπ^∗; hence Vπ^∗=V∗.

3.1F1F3F13step 1.1step 2.1algebra

Apply order and expectation preservation from [F3] to the conditional inequality in step 2.1, multiply by the nonnegative scalar γn, and sum for n=1,…,N. The intermediate state-value terms cancel, giving ∑n=1NγnE[Rn+1]+γN+1E[V∗(SN+1)]≤γE[V∗(S1)]. The initial transition law gives E[R1+γV∗(S1)]=∑s′,ρp(s′,ρ∣s,a)[ρ+γV∗(s′)]=:Q†(s,a). Since ∣E[V∗(SN+1)]∣≤B by step 1.1 and [F13], it follows that E[∑n=0NγnRn+1]≤Q†(s,a)+γN+1B.

4.1F11F12F13F16F17step 3.1

Write GN=∑n=0NγnRn+1. Each GN is measurable because it is a finite sum of measurable rewards, and [F11] gives pointwise convergence to G and the bound ∣GN∣≤M/(1−γ). Thus G is measurable by [F17]; the constant bound is integrable by [F13], so [F12] gives E[GN]→E[G]. Also γN+1B→0 by [F16]. Passing to the limit in the upper bound of step 3.1 shows E[G]≤Q†(s,a). The continuation was arbitrary, so Qopt(s,a)≤Q†(s,a).

5.1F1F7F9F10F18F19F20step 4.1step 2.2construct

Construct a continuation with initial pair (s,a) and thereafter action π∗(Sn+1) following each transition. Take E0=D and En+1=R×D with their discrete sigma-algebras, initial law concentrated at (s,a), and history kernels Kn(h,B)=∑s′,ρp(s′,ρ∣sn,an)1B(ρ,(s′,π∗(s′))) for every measurable B⊆En+1, where (sn,an) is the last pair in h. For disjoint sets Bj⊆En+1, their preimages {(s′,ρ):(ρ,(s′,π∗(s′)))∈Bj} are disjoint subsets of the finite set S×R, so only finitely many are nonempty and the finite mass formula is countably additive; its total mass is one by [F1]. It is measurable in h because it is a finite sum of functions of the current-pair coordinate projection, which is measurable by [F18]. Thus each Kn is a probability kernel by [F19], and [F9] gives a path law with these prefix products. Set Fn=σ(X0,Y1,…,Yn), where X0=(S0,A0) and Yj=(Rj,(Sj,Aj)). The coordinate projections make current pairs measurable at time n and next observations measurable at time n+1 by [F18]. The finite history-coordinate set is finite by [F20], so each atom of Fn fixes a finite history. On a positive-mass atom ending at (sn,an), the prefix product in [F9] shows that extending it by reward ρ, state s′, and next action π∗(s′) has conditional probability p(s′,ρ∣sn,an); all other next-action extensions have conditional probability zero. Thus the conditional probability of {Rn+1=ρ,Sn+1=s′} given Fn is p(s′,ρ∣Sn,An) on every positive-mass atom, which proves the required almost-sure conditional identity. Hence this process is admissible. By the product form of the finite-prefix probabilities, after the first transition its conditional continuation from S1=s′ has the stationary-policy prefix laws in [F10] for π^∗: the next action equals π∗ at its current state with probability one, so [F7] identifies its conditional expected discounted tail as Vπ^∗(s′). The expectation convergence proved for every admissible continuation in step 4.1 passes this prefix identity to the infinite return. Therefore E[G]=∑s′,ρp(s′,ρ∣s,a)[ρ+γVπ^∗(s′)]=Q†(s,a) by step 2.2. This admissible continuation attains the upper bound, so Qopt(s,a)=Q†(s,a) and the supremum is a finite maximum.

6.1givenstep 5.1∎

Since (s,a) was arbitrary, the formula and finite attainment claim hold on all of D.

TheoremStatement: Literature-sourcedProof: AI-generatedOpen item page →

Tabular Q-learning converges under per-pair Robbins–Monro steps and full visitation

Statement

Assume the Axiom of Choice. Let a finite MDP have nonempty state set S, finite state-action set D, finite reward alphabet R, and discount 0≤γ<1. Put M=max⁡ρ∈R∣ρ∣. On a discrete filtered probability space (Ω,F,(Fn)n≥0,P), let Q0∈RD be deterministic. At time n, the current pair In=(Sn,An)∈D is Fn-measurable, the reward Rn+1∈R almost surely and next state Sn+1∈S are Fn+1-measurable, and

E[1{Sn+1=s′, Rn+1=ρ}∣Fn]=p(s′,ρ∣Sn,An)

almost surely for every s′∈S and ρ∈R. Define Nn(i)=#{k<n:Ik=i}. Suppose every i∈D is selected infinitely often almost surely and the deterministic per-pair step sizes satisfy

0≤αk(i)≤1,∑k≥0αk(i)=∞,∑k≥0αk(i)2<∞(i∈D).

Apply the Q-learning update

Qn+1(In)=Qn(In)+αNn(In)(In)[Rn+1+γmax⁡b∈A(Sn+1)Qn(Sn+1,b)−Qn(In)],

leaving all other coordinates unchanged.

For each initial pair (s,a)∈D, define Q∗(s,a) as the supremum of E[∑k=0∞γkRk+1] over all discrete filtered processes with initial pair (S0,A0)=(s,a) almost surely, Sn∈S, An∈A(Sn), Rn+1∈R almost surely, current state-action pairs measurable at time n, next states and rewards measurable at time n+1, and the same conditional reward-transition law displayed above at every time. The rewards are bounded, so all these discounted returns are absolutely convergent and integrable.

Then Qn converges almost surely in the finite-state sup norm to the unique function Q∗∈RD satisfying

Q∗(s,a)=∑s′∈S∑ρ∈Rp(s′,ρ∣s,a)[ρ+γmax⁡b∈A(s′)Q∗(s′,b)]((s,a)∈D).

This unique fixed point is the optimal action-value function.

The claim uses diminishing per-pair steps and full visitation; it gives no convergence guarantee for a constant step size.

Facts & Assumptions

Given: The Axiom of Choice, a finite MDP, 0≤γ<1, the filtered interaction process and its conditional transition-reward law, the per-pair visit counts and step sizes, and the Q-learning update in the Statement.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function; AC is inherited by conditional-expectation classes and martingale differences used below.

[F1]

Finite Markov decision process with joint reward-transition law: for each admissible pair (s,a), p(s′,ρ∣s,a)≥0 and its finite sum over (s′,ρ) is 1; r(s,a)=∑s′,ρρp(s′,ρ∣s,a) and P(s′∣s,a)=∑ρp(s′,ρ∣s,a); the expected reward is bounded in absolute value by M.

[F2]

Bellman optimality operator: (T∗V)(s)=max⁡a∈A(s)∑s′,ρp(s′,ρ∣s,a)[ρ+γV(s′)].

[F3]

Finite-MDP Bellman operators are gamma contractions with unique fixed points: T∗ has a unique fixed point V∗∈RS when 0≤γ<1.

[F4]

Optimal action-value Bellman operator: (HQ)(s,a)=∑s′,ρp(s′,ρ∣s,a)[ρ+γmax⁡b∈A(s′)Q(s′,b)].

[F5]

Tabular Q-learning: the visited action-value coordinate is updated toward Rn+1+γmax⁡bQn(Sn+1,b).

[F6]

Filtration and filtered probability space and Martingale difference sequence: the filtration is increasing, and a martingale difference is adapted, integrable, and has zero conditional mean given the preceding sigma-algebra.

[F7]

Conditional expectation given a sigma algebra and Conditional expectation as an ae class: conditional-expectation versions satisfy event-integral identities; the class is unique almost surely and exists under the stated AC assumption.

[F8]

Basic algebra and order properties of conditional expectation and Taking out what is known: conditional expectation is linear, expectation preserving, and order preserving (if X≤Y almost surely then E[X∣Fn]≤E[Y∣Fn] almost surely); bounded measurable factors can be taken outside.

[F9]

Coordinate-wise stochastic approximation converges to a contraction fixed point: a bounded MDS-driven coordinate-wise recursion converges to its contraction fixed point under infinite visitation and per-coordinate Robbins–Monro steps.

[F10]

The optimal action value is attained by a greedy stationary policy: for each initial state-action pair, the maximal expected discounted return over all adapted MDP continuations is attained by following a greedy stationary policy after the initial action and equals ∑s′,ρp(s′,ρ∣s,a)[ρ+γV∗(s′)], where V∗ is the unique fixed point of T∗.

Proof

Given: The hypotheses, definitions, and conventions in the Statement and [A1], [F1]–[F10].

1.1A1F1F2F3F4F10algebra

Let V∗ be the unique fixed point of T∗ supplied by [F3], and define Q†(s,a)=∑s′,ρp(s′,ρ∣s,a)[ρ+γV∗(s′)]. For each (s,a), the finite sum in [F1] gives Q†(s,a)=r(s,a)+γ∑s′P(s′∣s,a)V∗(s′). Thus [F2] and T∗V∗=V∗ give max⁡a∈A(s)Q†(s,a)=V∗(s). Substituting this identity into [F4] yields HQ†=Q†. For finite lists (xb) and (yb), let m=max⁡b∣xb−yb∣; then xb≤yb+m for every b, so max⁡bxb≤max⁡byb+m, and exchanging the lists gives ∣max⁡bxb−max⁡byb∣≤m. Therefore, for each (s,a), ∣(HQ)(s,a)−(HQ~)(s,a)∣≤γ∑s′,ρp(s′,ρ∣s,a)∣max⁡bQ(s′,b)−max⁡bQ~(s′,b)∣≤γ∥Q−Q~∥∞. Taking the maximum over (s,a)∈D proves ∥HQ−HQ~∥∞≤γ∥Q−Q~∥∞. Any other fixed point Q would then satisfy ∥Q−Q†∥∞≤γ∥Q−Q†∥∞; since γ<1, this forces Q=Q†. By [F10], this fixed point is the pointwise maximal expected discounted return from each initial state-action pair and is attained by a greedy stationary continuation, so it is the optimal action-value function Q∗ in the Statement.

1.2givenF1F5algebrainduction

Put C=max⁡{∥Q0∥∞,M/(1−γ)}. Then M+γC≤C. If ∥Qn∥∞≤C, the sampled target Yn+1=Rn+1+γmax⁡bQn(Sn+1,b) lies in [−M−γC,M+γC]⊆[−C,C]. The update is a convex combination of Qn(In) and Yn+1 because 0≤αNn(In)(In)≤1; hence induction gives ∥Qn∥∞≤C for every n.

2.1A1F1F4F5F6F7F8F9step 1.1step 1.2algebra

By induction from deterministic Q0, the update and the observation measurability in the Statement make Qn Fn-measurable. Define ξn+1=Yn+1−(HQn)(In). Expand Yn+1 as a finite sum over s′∈S and ρ∈R using the indicators of (Sn+1,Rn+1)=(s′,ρ). Since Qn and In are Fn-measurable, the conditional transition-reward identity in the Statement, linearity, and taking out known factors [F7]–[F8] give E[Yn+1∣Fn]=(HQn)(In). Thus ξn+1 is an Fn+1-measurable martingale difference by [F6]. Step 1.2 bounds both Yn+1 and its conditional expectation by C, so ∣ξn+1∣≤2C almost surely. Rewriting the update as Qn+1(i)=Qn(i)+1{In=i}αNn(i)(i)[(HQn)(i)−Qn(i)+ξn+1] shows that all hypotheses of [F9] hold for index set D, map H, fixed point Q∗ from step 1.1, and contraction constant γ.

3.1step 2.1F9∎

Applying [F9] gives Qn→Q∗ almost surely in ∥⋅∥∞. This is the asserted convergence.

LemmaStatement: Literature-sourcedProof: AI-generatedOpen item page →

Finite-episode importance sampling has the target-policy mean under support

Statement

Assume the Axiom of Choice. Let a finite MDP with terminal set S† have 0≤γ<1, and let π and μ be stationary target and behavior policies. Suppose π(a∣x)>0 implies μ(a∣x)>0 for every nonterminal state x and action a∈A(x), and episodes reach S† in finite time almost surely from every state under both policies. For any starting state s, a behavior-generated episode has first terminal time T and ratio

Λ0:T−1=∏k=0T−1π(Ak∣Sk)μ(Ak∣Sk),

where the empty product for T=0 is 1. For every bounded measurable real function G of the finite episode,

Eμ,s[Λ0:T−1G]=Eπ,s[G].

The identity therefore applies to every episode suffix starting at a state s that can be reached by a finite behavior history. Fix an initial state s0. If H is a positive-probability finite behavior history from s0 that first visits s at time t and ends immediately upon observing St=s, before the action At is sampled (when s is terminal, no action is sampled and the suffix is empty), let

Gt=∑k=tT−1γk−tRk+1

be the suffix return. Then

Eμ,s0[1HΛt:T−1Gt]Pμ,s0(H)=Vπ(s).

Thus the ordinary first-visit importance-sampling return has mean Vπ(s) conditional on each pre-action first-visit history.

Facts & Assumptions

Given: AC, a finite MDP and discount, target and behavior policies, target support, almost-sure episode termination from every state under both policies, and the bounded measurable function G in the Statement.

[A1]

The Axiom of Choice: every family of nonempty sets has a choice function; AC is used for the policy path laws.

[F1]

Finite Markov decision process with joint reward-transition law: conditional on a state-action pair, the same finite joint next-state/reward law p(s′,r∣s,a) is used under both policies.

[F2]

A finite MDP policy generates action-state-reward trajectories: for every feasible finite state-action-reward trajectory, its probability under policy σ is the product of σ(ak∣sk)p(sk+1,rk+1∣sk,ak) over its steps.

[F3]

Episodic returns, temporal-difference errors, and policy support: Λ0:T−1 is the product of action-probability ratios along the finite episode, and the support condition makes its denominators positive on behavior-observed paths.

[F4]

Discounted returns and policy values in a finite MDP: under the absorbing zero-reward extension, the target return is the discounted path return and is bounded by M/(1−γ).

[F5]

Probability measures and probability spaces and Expectation of a nonnegative or integrable random variable: path probabilities are countably additive and expectations are Lebesgue integrals.

[F6]

Monotone convergence for the integral: expectations of increasing nonnegative measurable functions converge to the expectation of their pointwise limit.

Proof

Given: The hypotheses and conventions in the Statement and [A1], [F1]–[F6].

1.1A1F1F2F3algebra

Fix a finite terminal trajectory ω=(s0,a0,r1,s1,…,am−1,rm,sm) with s0=s and sm∈S†. By [F2], Pπ,s(ω)=∏k=0m−1π(ak∣sk)p(sk+1,rk+1∣sk,ak),Pμ,s(ω)=∏k=0m−1μ(ak∣sk)p(sk+1,rk+1∣sk,ak). If Pπ,s(ω)>0, every transition-reward factor and every target action factor is positive. Target support then makes every corresponding behavior action factor positive, so Pμ,s(ω)>0. On each behavior-positive trajectory, canceling the shared transition-reward factors gives Pπ,s(ω)=Λ0:m−1(ω)Pμ,s(ω); if its target probability is zero, the ratio is zero.

2.1givenF4F5F6step 1.1algebra

For each episode length m, there are finitely many terminal trajectories because the state, action, and reward alphabets are finite. These terminal-path events are disjoint over all lengths and cover probability one under both policies by the termination hypothesis. Enumerate them by increasing length and, within each length, any finite enumeration. For any finite initial collection C of these paths, step 1.1 gives ∑ω∈CPμ,s(ω)Λ(ω)∣G(ω)∣=∑ω∈CPπ,s(ω)∣G(ω)∣. As the collections increase to all terminal paths, [F6] passes both nonnegative sums to their expectations. Thus Eμ,s[Λ∣G∣]=Eπ,s[∣G∣]<∞, so ΛG is integrable.

3.1step 1.1step 2.1F4F5F6algebra

Apply the same finite-path identity separately to the nonnegative functions G+=max⁡(G,0) and G−=max⁡(−G,0); step 2.1 makes both weighted expectations finite. Subtracting the two equalities by linearity of the integral gives Eμ,s[ΛG]=Eπ,s[G]. For G=G0, the target expectation is Vπ(s) by [F4].

4.1givenF2F3F4step 1.1step 3.1algebra∎

Let H be one finite behavior history ending at a first visit to s at time t, with Pμ,s0(H)>0. For every finite terminal suffix ω starting at s, the product formula [F2] factors the joint probability as Pμ,s0(H)Pμ,s(ω). The suffix likelihood ratio contains only action factors from time t onward, so step 1.1 gives the target-to-behavior ratio for that suffix. Since Gt is the bounded discounted suffix return and target termination holds from s, step 3.1 gives Eμ,s[Λ0:T−1G0]=Vπ(s). Summing over suffixes therefore yields Eμ,s0[1HΛt:T−1Gt]=Pμ,s0(H)Vπ(s). Dividing by the positive Pμ,s0(H) proves the conditional first-visit assertion.

AlgorithmAlgorithm: Literature-sourcedProof: Not applicableOpen item page →

Tabular TD(0) policy prediction

Definition

Inputs: A finite MDP with nonempty state set S, discount 0≤γ<1, terminal set S†⊆S, stationary policy π, an initial-state rule specifying a distribution on S at each episode boundary (a fixed distribution ν sampled independently for each episode is a special case), an episode budget m∈N∪{∞}, an initial table V0:S→R with V0(s)=0 on S†, and a step-size rule giving αn(Sn)∈[0,1] from the available history before the next reward and state are observed. Deterministic per-state sequences αk(s) indexed by visit count are a special case. Assume the Axiom of Choice for the path laws defining Vπ, and that every episode used reaches S† almost surely from its start state.

Interpret successive draws on finite discrete transition-record spaces, including a restart record at each episode boundary. Conditional on the full available history and its current state s, choose the action using π(a∣s) and the next reward/state using p(s′,ρ∣s,a); the initial-state rule gives the restart kernel. Require all sampling and step-size rules to be measurable with respect to their available histories. The table and counts are computed from these records. Under the stated AC assumption, the history-dependent kernel construction supplies this law, with a fixed stop symbol after a finite budget.

Output: The value table after every transition update and after every completed episode. A finite budget returns the final table after those episodes; budget ∞ specifies the successive tables indefinitely, with no final output or convergence assertion.

Initialize V=V0 and visit counts C(s)=0 for s∉S†. For each episode allowed by the budget, sample its start state using the initial-state rule. If it is terminal, end that episode without an update. Otherwise, at each current nonterminal state Sn, sample An from π(⋅∣Sn), obtain αn(Sn) from the step-size rule, and then observe (Rn+1,Sn+1) from the MDP's joint reward-transition law conditional on the available history and selected pair. For a visit-index schedule use k=C(Sn). Form

δnV=Rn+1+γVn(Sn+1)−Vn(Sn),

where the continuation term is zero when Sn+1∈S†. Update

Vn+1(Sn)=Vn(Sn)+αn(Sn)δnV.

Leave every other coordinate unchanged, increment C(Sn), and output the updated table. If Sn+1 is terminal, end the episode; otherwise continue from Sn+1. The next episode starts by applying the initial-state rule again, retaining the table and counts; stop after m completed episodes when m is finite. Thus the sampled transitions use the policy whose value is estimated. This is a one-step bootstrapped prediction procedure and makes no convergence claim.

AlgorithmAlgorithm: Literature-sourcedProof: Not applicableOpen item page →

Tabular on-policy Sarsa control

Definition

Inputs: A finite MDP with nonempty finite state set S, finite nonempty action sets, discount 0≤γ<1, terminal set S†⊆S, an initial-state rule specifying a distribution on S at each episode boundary (independent draws from a fixed ν are a special case), an episode budget m∈N∪{∞}, an initial table Q0:D→R, a step-size rule giving αn(Sn,An)∈[0,1] from available history before the next reward and state are observed (deterministic per-pair visit-index schedules are a special case), and an action-selection rule Π that uses the current table and available history to supply a distribution on the legal actions of the current state. Assume the Axiom of Choice for the policy path laws, that the sampling rules are measurable functions of the information available when used, and that the episodes generated by the actual rule, including within-episode changes, reach S† almost surely from their start states.

Interpret successive draws on finite discrete transition-record spaces, including a restart record at each episode boundary. Conditional on the full available history and its current state s, choose the action using the distribution supplied by Π at the current history and the next reward/state using p(s′,ρ∣s,a); the initial-state rule gives the restart kernel. Require all sampling and step-size rules to be measurable with respect to their available histories. The table and counts are computed from these records. Under the stated AC assumption, the history-dependent kernel construction supplies this law, with a fixed stop symbol after a finite budget.

Output: The action-value table after every transition update and after every completed episode. A finite budget returns the final table after those episodes; budget ∞ specifies the successive tables indefinitely and has no final output or convergence assertion.

Initialize Q=Q0 and visit counts C(s,a)=0 for all (s,a)∈D. For each episode allowed by the budget, sample its start state using the initial-state rule. If it is terminal, end the episode without an update. Otherwise sample the initial action using Π with the current table and history. At each current nonterminal pair (Sn,An), obtain αn(Sn,An) from the step-size rule before observing (Rn+1,Sn+1) from the MDP's conditional joint reward-transition law. For a visit-index schedule use k=C(Sn,An). If Sn+1∉S†, apply Π to the still pre-update table Qn and the available history through the new state, sample An+1 from that action distribution, and set

δnSarsa=Rn+1+γQn(Sn+1,An+1)−Qn(Sn,An).

If Sn+1∈S†, instead set δnSarsa=Rn+1−Qn(Sn,An) and take no terminal action. Update only the current pair:

Qn+1(Sn,An)=Qn(Sn,An)+αn(Sn,An)δnSarsa,

leaving every other coordinate unchanged. Increment C(Sn,An) and output the updated table. If the next state is terminal, end the episode; otherwise set (S,A)=(Sn+1,An+1) and continue. Retain the sampled An+1 as the action actually executed next; do not resample it after updating the table. At the following transition, the next application of Π may use the updated table and history. A policy frozen for an episode is permitted as a special case. Stop after m completed episodes when m is finite. The sampled next action, rather than a maximum over actions, is part of the target and is also used by the behavior process, so Sarsa is on-policy. The procedure makes no convergence claim.

AlgorithmAlgorithm: Literature-sourcedProof: Not applicableOpen item page →

First-visit Monte Carlo policy evaluation

Definition

Inputs: A finite MDP with nonempty finite state set S, discount 0≤γ<1, terminal set S†⊆S, an initial-state rule, and an episode budget N∈N∪{∞}. Assume the Axiom of Choice for the policy path laws defining Vπ and the episode distributions, and that episodes reach S† in finite time almost surely from every state under each stationary policy used: the target π, and also the behavior μ in off-policy mode. Choose one mode: (a) on-policy prediction with independent episodes under a stationary target policy π; or (b) off-policy prediction with independent episodes under a stationary behavior policy μ and stationary target policy π. In off-policy mode require π(a∣x)>0⇒μ(a∣x)>0 for every nonterminal state x and action a∈A(x).

Output: After every finite number n of completed episodes, for every nonterminal state its visit count and each available estimate; report no estimate when its required denominator is zero. A finite budget N returns these outputs after episode N; budget ∞ emits successive finite-prefix outputs without a final output or convergence assertion. Set the value estimate of every terminal state to 0.

Initialize visit counts C(s)=0 and leave each nonterminal state's estimate unavailable. Generate successive independent episodes using the selected mode and initial-state rule; stop after N episodes when N is finite. In episode i, for each nonterminal state s visited before termination, let ti(s) be its first visit time and let Gti(s)=∑k=ti(s)Ti−1γk−ti(s)Rk+1 be the return from that visit.

In on-policy mode, update only on this first visit: set m=C(s)+1; if m=1, set V^(s)=Gti(s), and otherwise set

V^(s)←V^(s)+Gti(s)−V^(s)m.

Then set C(s)=m. In off-policy mode, for each first visit compute

Wi(s)=∏k=ti(s)Ti−1π(Ak∣Sk)μ(Ak∣Sk),

where Ti is the terminal time and an empty product is 1. Maintain B(s)=0 and WΣ(s)=0 initially; add Wi(s)Gti(s) to B(s) and Wi(s) to WΣ(s), and increment C(s). After any n completed episodes, the ordinary first-visit estimator is

V^nordinary(s)=B(s)C(s)

when C(s)>0; otherwise no ordinary estimate is produced. The weighted first-visit estimator is

V^nweighted(s)=B(s)WΣ(s)

when WΣ(s)>0; otherwise no weighted estimate is produced. Under target support, for each positive-probability behavior history ending immediately upon a first visit to a nonterminal state s, before its action is sampled, the ordinary weighted return has conditional mean Vπ(s) by the finite-episode likelihood-ratio identity. The self-normalized weighted estimator need not be unbiased at a finite sample size. These procedures make no convergence claim or Monte Carlo control claim.

4 · Examples, counterexamples and false statements

None yet.

Sources