Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Example, pp. 961–962 — gains 70,50,80,6070, 50, 80, 6070,50,80,60; (B,A)(B,A)(B,A) optimal for all nnn with V1(n)=80n+170+(−1)n+1170V_1(n) = 80n+170+(-1)^{n+1}170V1​(n)=80n+170+(−1)n+1170; Cesàro biases ±170\pm 170±170

Proved
JewellMRP.InfiniteStep.machine_example

by mikedeng1 · Sep 28, 2026 · Mathlib 0df444a (Lean v4.33.1)

examplemachine-maintenancemarkov-renewalp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1

The paper's two-state machine maintenance-repair example. State 1 is "running", state 2 "broken down". Every alternative moves the machine to the other state with probability one, so under every stationary policy the embedded chain is

P=(0110).P = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}.P=(01​10​).

With the linear reward structure (8) (Rij′=RijR'_{ij} = R_{ij}Rij′​=Rij​, Rij′′=0R''_{ij} = 0Rij′′​=0) the one-step expected reward of an alternative is Rij+rijνijR_{ij} + r_{ij}\nu_{ij}Rij​+rij​νij​: in state 1, alternative AAA gives 0+100⋅4=4000 + 100\cdot 4 = 4000+100⋅4=400 and alternative BBB gives 0+84⋅5=4200 + 84 \cdot 5 = 4200+84⋅5=420; in state 2, alternative AAA gives 0+(−65)⋅4=−2600 + (-65)\cdot 4 = -2600+(−65)⋅4=−260 and alternative BBB gives −100+(−200)⋅1=−300-100 + (-200)\cdot 1 = -300−100+(−200)⋅1=−300. Let ρ=(420,−260)\rho = (420, -260)ρ=(420,−260) be the reward vector of the policy (B,A)(B,A)(B,A), V(0)=0V(0) = 0V(0)=0, and π=(12,12)\pi = (\tfrac12, \tfrac12)π=(21​,21​). Then

  1. PPP is ergodic (irreducible, row-stochastic, of period 222) and π\piπ is a stationary probability vector;
  2. the gains G=∑iπiρiG = \sum_i \pi_i \rho_iG=∑i​πi​ρi​ of the four stationary policies are GAA=70G^{AA} = 70GAA=70, GAB=50G^{AB} = 50GAB=50, GBA=80G^{BA} = 80GBA=80, GBB=60G^{BB} = 60GBB=60;
  3. (B,A)(B,A)(B,A) is optimal for every nnn: the return V(n)V(n)V(n) of (B,A)(B,A)(B,A) satisfies the optimality recursion (I 16),
Vi(n+1)=max⁡z∈{A,B}[ρiz+∑jpijVj(n)],i=1,2, n≥0,V_i(n+1) = \max_{z \in \{A, B\}} \Bigl[\rho_i^z + \sum_j p_{ij} V_j(n)\Bigr], \qquad i = 1, 2,\ n \ge 0,Vi​(n+1)=z∈{A,B}max​[ρiz​+j∑​pij​Vj​(n)],i=1,2, n≥0,

so it is the optimal nnn-step return; 4. for every n≥0n \ge 0n≥0,

V1(n)=80n+170+(−1)n+1170,V2(n)=80n−170−(−1)n+1170;V_1(n) = 80n + 170 + (-1)^{n+1}170, \qquad V_2(n) = 80n - 170 - (-1)^{n+1}170 ;V1​(n)=80n+170+(−1)n+1170,V2​(n)=80n−170−(−1)n+1170;
  1. the limiting bias vector is (Z−Π)ρ+ΠV(0)=(170,−170)(Z - \Pi)\rho + \Pi V(0) = (170, -170)(Z−Π)ρ+ΠV(0)=(170,−170);
  2. the relative values V1=340V_1 = 340V1​=340, V2=0V_2 = 0V2​=0 solve equations (5): Vi+G=ρi+∑jpijVjV_i + G = \rho_i + \sum_j p_{ij} V_jVi​+G=ρi​+∑j​pij​Vj​ with G=80G = 80G=80.

The example shows why the bias limit is a Cesàro limit: W(n)=V(n)−80nW(n) = V(n) - 80nW(n)=V(n)−80n oscillates between two values forever, and only its average converges.

Formalization Note States 1 and 2 are the Lean indices 0 and 1, and the paper's (−)n+1(-)^{n+1}(−)n+1 is (−1)n+1(-1)^{n+1}(−1)n+1. The paper's "optimal for all values of nnn" is stated as: the (B,A)(B,A)(B,A) return satisfies (I 16) with the maximum over both alternatives in each state, which determines the optimal return uniquely from V(0)=0V(0) = 0V(0)=0. The rewards are written as R+rνR + r\nuR+rν so that each number can be read off p. 961.

Preamble
import Mathlib
import Definitions.Def_JewellMRP_InfiniteStep_Model

open Matrix Filter Topology
Formal statement
namespace JewellMRP.InfiniteStep

theorem machine_example :
    let P : Matrix (Fin 2) (Fin 2) ℝ := !![0, 1; 1, 0]
    let ρA₁ : ℝ := 0 + 100 * 4
    let ρB₁ : ℝ := 0 + 84 * 5
    let ρA₂ : ℝ := 0 + (-65) * 4
    let ρB₂ : ℝ := -100 + (-200) * 1
    let ρ : Fin 2 → ℝ := ![ρB₁, ρA₂]
    let π : Fin 2 → ℝ := ![1 / 2, 1 / 2]
    IsErgodic P ∧ IsStationary P π ∧
      gain π ![ρA₁, ρA₂] = 70 ∧ gain π ![ρA₁, ρB₂] = 50 ∧ gain π ρ = 80 ∧
      gain π ![ρB₁, ρB₂] = 60 ∧
      (∀ n : ℕ,
        stepReturn P ρ 0 (n + 1) 0 =
            max (ρA₁ + ∑ j, P 0 j * stepReturn P ρ 0 n j)
              (ρB₁ + ∑ j, P 0 j * stepReturn P ρ 0 n j) ∧
          stepReturn P ρ 0 (n + 1) 1 =
            max (ρA₂ + ∑ j, P 1 j * stepReturn P ρ 0 n j)
              (ρB₂ + ∑ j, P 1 j * stepReturn P ρ 0 n j)) ∧
      (∀ n : ℕ, stepReturn P ρ 0 n 0 = 80 * n + 170 + (-1) ^ (n + 1) * 170 ∧
        stepReturn P ρ 0 n 1 = 80 * n - 170 - (-1) ^ (n + 1) * 170) ∧
      (fundamentalMatrix P π - limitMatrix π) *ᵥ ρ + limitMatrix π *ᵥ 0 = ![170, -170] ∧
      (∀ i, ![340, 0] i + gain π ρ = ρ i + ∑ j, P i j * ![(340 : ℝ), 0] j) := by sorry

end JewellMRP.InfiniteStep
Source
Jewell, Markov-Renewal Programming. II: Infinite Return Models, Example, Oper. Res. 11 (1963), pp. 961-962, An Example, Fig. 4
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me