Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Stochastic and observation-based goal-conditioned policies, success probabilities and δ\deltaδ-optimality

Definition
GeneralAgentsPO_Basic

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

goal-conditioned-agentsmarkov-decision-processespartial-observabilityreinforcement-learningworld-models

Objects of Sections 2 and 4 of Cifuentes (2026). The framework of Section 2 is that of Richens et al. (2025); its cMDP, goals and goal semantics are imported from the definitions file GeneralAgentsWorldModels_Basic.

  1. cMDP (Definition 1, imported). Finite sets S\mathcal SS of states and A\mathcal AA of actions and a kernel P(s′∣s,a)≥0P(s'\mid s,a)\ge0P(s′∣s,a)≥0 with ∑s′P(s′∣s,a)=1\sum_{s'}P(s'\mid s,a)=1∑s′​P(s′∣s,a)=1. It is communicating if the directed graph with an edge s→s′s\to s's→s′ whenever P(s′∣s,a)>0P(s'\mid s,a)>0P(s′∣s,a)>0 for some aaa is strongly connected.
  2. Goals (Definition 2, imported). A basic goal is ⊤[V]\top[V]⊤[V], ◯[V]\bigcirc[V]◯[V] or ◊[V]\Diamond[V]◊[V] with V⊆S×AV\subseteq\mathcal S\times\mathcal AV⊆S×A; a sequential goal is a finite list ⟨φ1,…,φn⟩\langle\varphi_1,\dots,\varphi_n\rangle⟨φ1​,…,φn​⟩ of basic goals; a goal is a finite disjunction ⋁i∈Iψi\bigvee_{i\in I}\psi_i⋁i∈I​ψi​ of sequential goals. A history h=s0a0s1a1…h=s_0a_0s_1a_1\dotsh=s0​a0​s1​a1​… satisfies ⟨⊤[V],… ⟩\langle\top[V],\dots\rangle⟨⊤[V],…⟩ if (s0,a0)∈V(s_0,a_0)\in V(s0​,a0​)∈V and hhh satisfies the rest; ⟨◯[V],… ⟩\langle\bigcirc[V],\dots\rangle⟨◯[V],…⟩ if (s1,a1)∈V(s_1,a_1)\in V(s1​,a1​)∈V and s1a1…s_1a_1\dotss1​a1​… satisfies the rest; ⟨◊[V],… ⟩\langle\Diamond[V],\dots\rangle⟨◊[V],…⟩ if there is a least iii with (si,ai)∈V(s_i,a_i)\in V(si​,ai​)∈V and siai…s_ia_i\dotssi​ai​… satisfies the rest.
  3. Depth and width. depth(⋁iψi)=max⁡ilength(ψi)\mathrm{depth}(\bigvee_i\psi_i)=\max_i\mathrm{length}(\psi_i)depth(⋁i​ψi​)=maxi​length(ψi​) and width(⋁i∈Iψi)=∣I∣\mathrm{width}(\bigvee_{i\in I}\psi_i)=|I|width(⋁i∈I​ψi​)=∣I∣. Ψn\Psi_nΨn​ is the set of goals of depth nnn, and Ψn,k\Psi_{n,k}Ψn,k​ the set of goals of depth nnn and width kkk. Two goals are incompatible if no history satisfies both.
  4. The goals of Section 3. For b∈Ab\in\mathcal Ab∈A and w∈{0,1}nw\in\{0,1\}^nw∈{0,1}n, φb,w=⟨⊤[A=b],φ2,φ3w1,…,φ2,φ3wn⟩\varphi_{b,w}=\langle\top[A=b],\varphi_2,\varphi_3^{w_1},\dots,\varphi_2,\varphi_3^{w_n}\rangleφb,w​=⟨⊤[A=b],φ2​,φ3w1​​,…,φ2​,φ3wn​​⟩ with φ2=◊[S=s,A=a]\varphi_2=\Diamond[S=s,A=a]φ2​=◊[S=s,A=a], φ31=◯[S=s′]\varphi_3^1=\bigcirc[S=s']φ31​=◯[S=s′], φ30=◯[S≠s′]\varphi_3^0=\bigcirc[S\neq s']φ30​=◯[S=s′]; φw\varphi_wφw​ is the same goal without the leading ⊤[A=b]\top[A=b]⊤[A=b]; ∣w∣1|w|_1∣w∣1​ is the number of ones of www. ρb,r=⋁∣w∣1=rφb,w\rho_{b,r}=\bigvee_{|w|_1=r}\varphi_{b,w}ρb,r​=⋁∣w∣1​=r​φb,w​ (eq. (1)), ψb,k=⋁r≤kρb,r\psi_{b,k}=\bigvee_{r\le k}\rho_{b,r}ψb,k​=⋁r≤k​ρb,r​ and χb,k=⋁r>kρb,r\chi_{b,k}=\bigvee_{r>k}\rho_{b,r}χb,k​=⋁r>k​ρb,r​ (eq. (3)). Binn(p)(r)=(nr)pr(1−p)n−r\mathrm{Bin}_n(p)(r)=\binom nr p^r(1-p)^{n-r}Binn​(p)(r)=(rn​)pr(1−p)n−r.
  5. Policies. A policy maps each finite history x0a0…xtx_0a_0\dots x_tx0​a0​…xt​ to a probability distribution on A\mathcal AA; it is deterministic if each of these distributions is a point mass. A goal-conditioned policy is a family (πψ)ψ∈Ψ(\pi_\psi)_{\psi\in\Psi}(πψ​)ψ∈Ψ​ of policies. In a cMDP the histories are over states; for an observation-based policy they are over observations.
  6. Success probability. For a policy π\piπ and a start state sss, the probability of the cylinder of histories beginning with (s0,a0),…,(sT−1,aT−1)(s_0,a_0),\dots,(s_{T-1},a_{T-1})(s0​,a0​),…,(sT−1​,aT−1​) is [s0=s]∏i<TPr⁡(π(s0a0…si)=ai)∏i+1<TP(si+1∣si,ai)[s_0=s]\prod_{i<T}\Pr(\pi(s_0a_0\dots s_i)=a_i)\prod_{i+1<T}P(s_{i+1}\mid s_i,a_i)[s0​=s]∏i<T​Pr(π(s0​a0​…si​)=ai​)∏i+1<T​P(si+1​∣si​,ai​), and Pr⁡(ψ∣π,s)\Pr(\psi\mid\pi,s)Pr(ψ∣π,s) is the probability of the set of histories satisfying ψ\psiψ.
  7. δ\deltaδ-optimality (Definition 3). π\piπ is δ\deltaδ-optimal for Φ⊆Ψ\Phi\subseteq\PsiΦ⊆Ψ if (1−δ)sup⁡π′Pr⁡(φ∣π′,s)≤Pr⁡(φ∣πφ,s)(1-\delta)\sup_{\pi'}\Pr(\varphi\mid\pi',s)\le\Pr(\varphi\mid\pi_\varphi,s)(1−δ)supπ′​Pr(φ∣π′,s)≤Pr(φ∣πφ​,s) for all φ∈Φ\varphi\in\Phiφ∈Φ and all s∈Ss\in\mathcal Ss∈S, the supremum being over all policies.
  8. Partial observability (Definition 4, Section 4.2). A partially observable cMDP adds a finite set OOO of observations and a kernel Ω(o∣s)\Omega(o\mid s)Ω(o∣s). For an observation-based policy π\piπ, the probability of the cylinder of state histories beginning with (si,ai)i<T(s_i,a_i)_{i<T}(si​,ai​)i<T​ is ∑o0,…,oT−1[s0=s]∏i<TΩ(oi∣si)Pr⁡(π(o0a0…oi)=ai)∏i+1<TP(si+1∣si,ai)\sum_{o_0,\dots,o_{T-1}}[s_0=s]\prod_{i<T}\Omega(o_i\mid s_i)\Pr(\pi(o_0a_0\dots o_i)=a_i)\prod_{i+1<T}P(s_{i+1}\mid s_i,a_i)∑o0​,…,oT−1​​[s0​=s]∏i<T​Ω(oi​∣si​)Pr(π(o0​a0​…oi​)=ai​)∏i+1<T​P(si+1​∣si​,ai​). Success probabilities, optimal values and δ\deltaδ-optimality are defined from it as in items 6 and 7, with the supremum over observation-based policies. Goals are still phrased in terms of states.

Formalization Note Every goal is satisfied, if at all, at a finite time, so the event that a history satisfies ψ\psiψ is the increasing union over TTT of the events that its first TTT pairs already force ψ\psiψ. Pr⁡(ψ∣π,s)\Pr(\psi\mid\pi,s)Pr(ψ∣π,s) is therefore defined as the supremum over TTT of the (finite) probabilities of these events, which is the value of the cylinder-set measure on histories. The maximum max⁡π\max_\pimaxπ​ of the paper is written as a supremum. The paper does not say whether OOO is finite; here it is.

Definition code
import Mathlib
import Definitions.Def_GeneralAgentsWorldModels_Basic

/-!
Cifuentes, *General Agents Contain World Models, even under Partial Observability and
Stochasticity*, arXiv:2602.03146v1 (2026).

Section 2 of the paper restates the framework of Richens et al. (arXiv:2506.01622). The
controlled Markov decision process (Definition 1, `CMP`), the communicating condition
(`CMP.IsCommunicating`), basic, sequential and general goals with their semantics (Definition 2,
`SubGoal`, `SeqGoal`, `CompGoal`, `seqSat`, `compSat`), the finite-prefix test `Decides`, the goals
`φ_{b,w}` and `ρ_{b,r}` of eq. (1) (`trialSeq`, `binGoal`) and the binomial mass function
(`binPmf`) are reused from `Definitions.Def_GeneralAgentsWorldModels_Basic`.

This file adds what is new in the paper: depth and width of goals and the classes `Ψ_n`,
`Ψ_{n,k}` (Sections 2 and 4.3), stochastic history-dependent policies and goal-conditioned
policies (Section 2), the probability that a stochastic policy achieves a goal (Section 2),
`δ`-optimality (Definition 3), partially observable cMDPs (Definition 4), observation-based
policies and the probability that they achieve a goal (Section 4.2).
-/

noncomputable section

open GeneralAgentsWorldModels

namespace GeneralAgentsPO

/-- Section 2 (p. 4): the depth of a goal `⋁_{i ∈ I} ψ_i`, the length of its longest sequential
goal, `depth(⋁_i ψ_i) = max_i depth(ψ_i)`, `depth(⟨φ₁, …, φ_n⟩) = n` (the empty disjunction has
depth `0`). -/
def goalDepth {S A : Type*} (ψ : CompGoal S A) : ℕ := (ψ.map List.length).foldr max 0

/-- Section 4.3 (p. 15): the width of a goal `⋁_{i ∈ I} ψ_i`, the number `|I|` of its
disjuncts. -/
def goalWidth {S A : Type*} (ψ : CompGoal S A) : ℕ := ψ.length

/-- Section 2 (p. 4): `Ψ_n`, the set of goals of depth `n`. -/
def PsiDepth {S A : Type*} (n : ℕ) : Set (CompGoal S A) := {ψ | goalDepth ψ = n}

/-- Section 4.3 (p. 15): `Ψ_{n,k}`, the set of goals of depth `n` and width `k`. -/
def PsiDepthWidth {S A : Type*} (n k : ℕ) : Set (CompGoal S A) :=
  {ψ | goalDepth ψ = n ∧ goalWidth ψ = k}

/-- Section 2 (p. 5): two goals are incompatible if no history satisfies both. -/
def IsIncompatible {S A : Type*} (φ₁ φ₂ : CompGoal S A) : Prop :=
  ∀ τ : ℕ → S × A, compSat φ₁ τ → ¬ compSat φ₂ τ

/-- Section 2 (p. 5), the sequential goal `φ_w = ⟨φ₂, φ₃^{w₁}, …, φ₂, φ₃^{w_n}⟩` of the proof of
Theorem 3 (p. 13), with `φ₂ = ◇[S = s, A = a]`, `φ₃^1 = ◯[S = s']`, `φ₃^0 = ◯[S ≠ s']`. The goal
`φ_{b,w}` of Section 3 is `trialSeq b s a s' w = ⊤[A = b] :: visitSeq s a s' w`. -/
def visitSeq {S A : Type*} (s : S) (a : A) (s' : S) (w : List Bool) : SeqGoal S A :=
  w.flatMap fun c => [evVisit s a, nextIn (if c then {s'} else {s'}ᶜ)]

/-- Section 3 (p. 6): `|w|_1 = |{i : w_i = 1}|` for `w ∈ {0,1}^n`. -/
def onesCount {n : ℕ} (w : Fin n → Bool) : ℕ := (Finset.univ.filter fun i => w i = true).card

/-- Section 2 (p. 4): a (stochastic, history-dependent) policy `π : H_F → Δ(A)`. A finite history
`x₀ a₀ … x_{t-1} a_{t-1} x_t` is given by the list of its past pairs `(x_i, a_i)`, `i < t`, and its
last element `x_t`; `act h x c` is `Pr(π(h x) = c)`. With `X = S` this is a policy of a cMDP; with
`X = O` it is an observation-based policy (Section 4.2, p. 11). -/
structure StochPolicy (X A : Type*) [Fintype A] where
  /-- `act h x c = Pr(π(h x) = c)`. -/
  act : List (X × A) → X → A → ℝ
  nonneg : ∀ h x c, 0 ≤ act h x c
  sum_one : ∀ h x, ∑ c, act h x c = 1

/-- Section 2 (p. 4): a policy is deterministic if for every finite history some action has
probability `1`. -/
def StochPolicy.IsDeterministic {X A : Type*} [Fintype A] (π : StochPolicy X A) : Prop :=
  ∀ h x, ∃ c, π.act h x c = 1

/-- Section 2 (p. 4): a goal-conditioned policy `π : H_F × Ψ → Δ(A)`, written `ψ ↦ π_ψ`; goals are
over `S × A`, and the policy reads histories over `X` (`X = S`, or `X = O` for an observation-based
policy, Section 4.2). -/
abbrev GCStochPolicy (S X A : Type*) [Fintype A] := CompGoal S A → StochPolicy X A

/-- The list of the first `i` entries `u 0, …, u (i-1)` of a finite sequence `u`. -/
def histBefore {X : Type*} {T : ℕ} (u : Fin T → X) (i : Fin T) : List X :=
  List.ofFn fun j : Fin i.val => u (Fin.castLE i.isLt.le j)

open Classical in
/-- Section 2 (p. 4): the probability, under the policy `π` started at `s`, of the cylinder set of
histories whose first `T` state-action pairs are `u = ((s₀, a₀), …, (s_{T-1}, a_{T-1}))`:
`[s₀ = s] ∏_{i<T} Pr(π(h_i) = a_i) ∏_{i+1<T} P(s_{i+1} | s_i, a_i)`, `h_i = s₀ a₀ … s_i`. -/
def prefixProb {S A : Type*} [Fintype S] [Fintype A] (M : CMP S A) (π : StochPolicy S A) (s : S)
    {T : ℕ} (u : Fin T → S × A) : ℝ :=
  (if ∀ h : 0 < T, (u ⟨0, h⟩).1 = s then 1 else 0) *
    ∏ i : Fin T, (π.act (histBefore u i) (u i).1 (u i).2 *
      if h : i.val + 1 < T then M.P (u i).1 (u i).2 (u ⟨i.val + 1, h⟩).1 else 1)

open Classical in
/-- The probability that the first `T` state-action pairs of the history generated by `π` from `s`
already guarantee `ψ` (every history with this prefix satisfies `ψ`). -/
def probUpTo {S A : Type*} [Fintype S] [Fintype A] (M : CMP S A) (π : StochPolicy S A)
    (ψ : CompGoal S A) (s : S) (T : ℕ) : ℝ :=
  ∑ u : Fin T → S × A, if Decides ψ (List.ofFn u) then prefixProb M π s u else 0

/-- Section 2 (p. 5): `Pr(ψ | π, s) = ∑_{h ⊨ ψ} Pr(h | π, s)`, the probability under the measure on
histories induced by `π` from `s` (extended from finite histories via cylinder sets) that the
history satisfies `ψ`. Satisfaction of a goal is decided by a finite prefix (p. 14), so the event
`h ⊨ ψ` is the increasing union over `T` of the events decided by the first `T` pairs, and its
probability is the supremum of their probabilities. -/
def goalProb {S A : Type*} [Fintype S] [Fintype A] (M : CMP S A) (π : StochPolicy S A)
    (ψ : CompGoal S A) (s : S) : ℝ :=
  ⨆ T : ℕ, probUpTo M π ψ s T

/-- Definition 3 (p. 5): `max_π Pr(ψ | π, s)`, the supremum over all (stochastic,
history-dependent) policies. -/
def optValue {S A : Type*} [Fintype S] [Fintype A] (M : CMP S A) (ψ : CompGoal S A) (s : S) : ℝ :=
  ⨆ π : StochPolicy S A, goalProb M π ψ s

/-- Definition 3 (p. 5): the goal-conditioned policy `π` is `δ`-optimal for `Φ ⊆ Ψ`: for all
`φ ∈ Φ` and `s ∈ S`, `(1 - δ) max_π' Pr(φ | π', s) ≤ Pr(φ | π_φ, s)`. It is `n`-th-degree
`δ`-optimal if it is `δ`-optimal for `Ψ_n`. -/
def IsDeltaOptimal {S A : Type*} [Fintype S] [Fintype A] (M : CMP S A) (δ : ℝ)
    (Φ : Set (CompGoal S A)) (π : GCStochPolicy S S A) : Prop :=
  ∀ φ ∈ Φ, ∀ s : S, (1 - δ) * optValue M φ s ≤ goalProb M (π φ) φ s

/-- Definition 4 (p. 11): a partially observable cMDP `(S, A, P, O, Ω)`: a cMDP `(S, A, P)`, a set
of observations `O` (here finite) and an observation kernel `obs s o = Ω(o | s)` with
`∑_o Ω(o | s) = 1`. -/
structure POCMP (S A O : Type*) [Fintype S] [Fintype O] extends CMP S A where
  /-- `obs s o = Ω(o | s)`. -/
  obs : S → O → ℝ
  obs_nonneg : ∀ s o, 0 ≤ obs s o
  obs_sum_one : ∀ s, ∑ o, obs s o = 1

open Classical in
/-- Section 4.2 (p. 12): the probability, under the observation-based policy `π` started at `s`,
that the first `T` state-action pairs are `u = ((s₀, a₀), …, (s_{T-1}, a_{T-1}))`:
`∑_{o₀ … o_{T-1}} [s₀ = s] ∏_{i<T} Ω(o_i | s_i) Pr(π(o₀ a₀ … o_i) = a_i) ∏_{i+1<T} P(s_{i+1} | s_i, a_i)`,
the joint probability of the state history and the observation history, summed over the
observations. -/
def obsPrefixProb {S A O : Type*} [Fintype S] [Fintype A] [Fintype O] (M : POCMP S A O)
    (π : StochPolicy O A) (s : S) {T : ℕ} (u : Fin T → S × A) : ℝ :=
  (if ∀ h : 0 < T, (u ⟨0, h⟩).1 = s then 1 else 0) *
    ∑ o : Fin T → O, ∏ i : Fin T, (M.obs (u i).1 (o i) *
      π.act (histBefore (fun j => (o j, (u j).2)) i) (o i) (u i).2 *
      if h : i.val + 1 < T then M.P (u i).1 (u i).2 (u ⟨i.val + 1, h⟩).1 else 1)

open Classical in
/-- The probability that the first `T` state-action pairs generated by the observation-based policy
`π` from `s` already guarantee `ψ`. -/
def obsProbUpTo {S A O : Type*} [Fintype S] [Fintype A] [Fintype O] (M : POCMP S A O)
    (π : StochPolicy O A) (ψ : CompGoal S A) (s : S) (T : ℕ) : ℝ :=
  ∑ u : Fin T → S × A, if Decides ψ (List.ofFn u) then obsPrefixProb M π s u else 0

/-- Section 4.2 (p. 12): `Pr(ψ | π, s) = ∑_{h ⊨ ψ} Pr(h | π, s)` for an observation-based policy;
goals are phrased in terms of the real states. As for `goalProb`, it is the supremum over `T` of
the probability that the first `T` pairs decide `ψ`. -/
def obsGoalProb {S A O : Type*} [Fintype S] [Fintype A] [Fintype O] (M : POCMP S A O)
    (π : StochPolicy O A) (ψ : CompGoal S A) (s : S) : ℝ :=
  ⨆ T : ℕ, obsProbUpTo M π ψ s T

/-- Section 4.2 (p. 12): `max_π Pr(ψ | π, s)` over observation-based policies. -/
def obsOptValue {S A O : Type*} [Fintype S] [Fintype A] [Fintype O] (M : POCMP S A O)
    (ψ : CompGoal S A) (s : S) : ℝ :=
  ⨆ π : StochPolicy O A, obsGoalProb M π ψ s

/-- Definition 3 read in a partially observable cMDP (Section 4.2, p. 12): the goal-conditioned
observation-based policy `π` is `δ`-optimal for `Φ`. -/
def IsObsDeltaOptimal {S A O : Type*} [Fintype S] [Fintype A] [Fintype O] (M : POCMP S A O)
    (δ : ℝ) (Φ : Set (CompGoal S A)) (π : GCStochPolicy S O A) : Prop :=
  ∀ φ ∈ Φ, ∀ s : S, (1 - δ) * obsOptValue M φ s ≤ obsGoalProb M (π φ) φ s

end GeneralAgentsPO
Source
Cifuentes, General Agents Contain World Models, even under Partial Observability and Stochasticity, arXiv:2602.03146v1 (2026), Section 2 (Definitions 1-3, pp. 2-5), Section 4.2 (Definition 4, pp. 11-12), Section 4.3 (width, p. 15)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

The declarations below rely on objects from the imported file Definitions.Def_GeneralAgentsWorldModels_Basic, which is not reproduced in the code supplied. These are CMP\mathrm{CMP}CMP, CompGoal\mathrm{CompGoal}CompGoal, SeqGoal\mathrm{SeqGoal}SeqGoal, compSat\mathrm{compSat}compSat, Decides\mathrm{Decides}Decides, evVisit\mathrm{evVisit}evVisit, nextIn\mathrm{nextIn}nextIn, and the transition function PPP of a CMP\mathrm{CMP}CMP. Their meaning can only be stated as far as this file reveals it.

From the way they are used here:

  • A goal ψ∈CompGoal(S,A)\psi \in \mathrm{CompGoal}(S,A)ψ∈CompGoal(S,A) is a finite list [ψ1,…,ψk][\psi_1,\dots,\psi_k][ψ1​,…,ψk​] whose entries are lists (sequential goals).
  • A sequential goal is a finite list of sub-goals.
  • A cMDP MMM over states SSS and actions AAA carries a real-valued function P(s,a,s′)P(s,a,s')P(s,a,s′).
  • Whether PPP is nonnegative or sums to 111 is not visible in this file.

goalDepth. For a goal ψ=[ψ1,…,ψk]\psi = [\psi_1,\dots,\psi_k]ψ=[ψ1​,…,ψk​] (a list of sequential goals over S×AS \times AS×A), the depth is

depth(ψ)=max⁡(0,∣ψ1∣,…,∣ψk∣),\mathrm{depth}(\psi) = \max\bigl(0, |\psi_1|, \dots, |\psi_k|\bigr),depth(ψ)=max(0,∣ψ1​∣,…,∣ψk​∣),

where ∣ψi∣|\psi_i|∣ψi​∣ is the length (number of sub-goals) of the list ψi\psi_iψi​.

  • The empty goal (k=0k=0k=0) has depth 000.
  • So does any goal all of whose disjuncts are empty sequential goals.

goalWidth. The width of ψ=[ψ1,…,ψk]\psi = [\psi_1,\dots,\psi_k]ψ=[ψ1​,…,ψk​] is kkk, the length of the list. Repeated disjuncts are counted with multiplicity, and the empty goal has width 000.

PsiDepth. For n∈Nn \in \mathbb{N}n∈N, Ψn\Psi_nΨn​ is the set of all goals ψ\psiψ over S×AS\times AS×A with depth(ψ)=n\mathrm{depth}(\psi) = ndepth(ψ)=n exactly, not ≤n\le n≤n.

  • Ψ0\Psi_0Ψ0​ contains the empty goal.
  • Ψ0\Psi_0Ψ0​ also contains every goal whose disjuncts are all empty.

PsiDepthWidth. For n,k∈Nn,k \in \mathbb{N}n,k∈N, Ψn,k\Psi_{n,k}Ψn,k​ is the set of goals ψ\psiψ with depth(ψ)=n\mathrm{depth}(\psi) = ndepth(ψ)=n and width(ψ)=k\mathrm{width}(\psi) = kwidth(ψ)=k, both exactly.

  • Ψn,0\Psi_{n,0}Ψn,0​ is empty for n>0n>0n>0, since a width-000 goal is the empty list and has depth 000.
  • Ψ0,0\Psi_{0,0}Ψ0,0​ consists of the empty goal.

IsIncompatible. Two goals φ1,φ2\varphi_1,\varphi_2φ1​,φ2​ are called incompatible when, for every infinite sequence τ=(τ0,τ1,… )\tau = (\tau_0,\tau_1,\dots)τ=(τ0​,τ1​,…) of state–action pairs τt∈S×A\tau_t \in S\times Aτt​∈S×A, if τ\tauτ satisfies φ1\varphi_1φ1​ (in the sense of compSat\mathrm{compSat}compSat from the imported file), then τ\tauτ does not satisfy φ2\varphi_2φ2​. Only infinite sequences are quantified over; finite histories play no role.

visitSeq. Given states s,s′∈Ss, s' \in Ss,s′∈S, an action a∈Aa\in Aa∈A and a finite bit list w=[w1,…,wm]w = [w_1,\dots,w_m]w=[w1​,…,wm​], this is the sequential goal obtained by concatenating, for i=1,…,mi=1,\dots,mi=1,…,m, the two sub-goals

evVisit(s,a),nextIn(Bi),Bi={{s′}wi=true,S∖{s′}wi=false.\mathrm{evVisit}(s,a),\qquad \mathrm{nextIn}(B_i), \qquad B_i = \begin{cases}\{s'\} & w_i = \text{true},\\ S\setminus\{s'\} & w_i = \text{false}.\end{cases}evVisit(s,a),nextIn(Bi​),Bi​={{s′}S∖{s′}​wi​=true,wi​=false.​

The meanings of evVisit\mathrm{evVisit}evVisit and nextIn\mathrm{nextIn}nextIn come from the imported file. The result has length 2m2m2m, and is the empty sequential goal when www is empty.

onesCount. For n∈Nn\in\mathbb{N}n∈N and w:{0,…,n−1}→{true,false}w : \{0,\dots,n-1\} \to \{\text{true},\text{false}\}w:{0,…,n−1}→{true,false}, ∣w∣1|w|_1∣w∣1​ is the number of indices iii with wi=truew_i = \text{true}wi​=true. It is 000 when n=0n=0n=0.

StochPolicy. For a type XXX and a finite action type AAA, a stochastic policy π\piπ consists of a real number π(c∣h,x)\pi(c \mid h, x)π(c∣h,x) for every finite list h=[(x0,a0),…,(xt−1,at−1)]h = [(x_0,a_0),\dots,(x_{t-1},a_{t-1})]h=[(x0​,a0​),…,(xt−1​,at−1​)] of pairs in X×AX\times AX×A, every x∈Xx \in Xx∈X, and every c∈Ac\in Ac∈A, subject to:

π(c∣h,x)≥0,∑c∈Aπ(c∣h,x)=1for all h,x.\pi(c\mid h,x)\ge 0, \qquad \sum_{c\in A}\pi(c\mid h,x) = 1 \quad\text{for all } h, x.π(c∣h,x)≥0,c∈A∑​π(c∣h,x)=1for all h,x.

Further details:

  • It is defined on all finite lists, of every length, with no feasibility restriction.
  • If AAA is empty, the sum condition cannot hold, so no policy exists.

StochPolicy.IsDeterministic. A policy π\piπ is deterministic if for every history hhh and current element xxx there is some action ccc with π(c∣h,x)=1\pi(c\mid h,x) = 1π(c∣h,x)=1. Given the constraints above, all other actions then have probability 000.

GCStochPolicy. A goal-conditioned policy is an arbitrary function ψ↦πψ\psi \mapsto \pi_\psiψ↦πψ​ that assigns to every goal ψ\psiψ over S×AS\times AS×A a stochastic policy πψ\pi_\psiπψ​ reading histories over XXX with actions in AAA. No relation between policies for different goals is required.

histBefore. For a finite sequence u=(u0,…,uT−1)u = (u_0,\dots,u_{T-1})u=(u0​,…,uT−1​) and an index i<Ti<Ti<T, this is the list [u0,…,ui−1][u_0,\dots,u_{i-1}][u0​,…,ui−1​] of the entries strictly before position iii. It is empty when i=0i=0i=0.

prefixProb. Let SSS and AAA be finite, MMM a cMDP, π\piπ a policy over SSS, and s∈Ss\in Ss∈S. For T∈NT\in\mathbb{N}T∈N and a sequence u=((s0,a0),…,(sT−1,aT−1))u = ((s_0,a_0),\dots,(s_{T-1},a_{T-1}))u=((s0​,a0​),…,(sT−1​,aT−1​)), define

pM,π,s(u)=1[T=0 or s0=s]⋅∏i=0T−1(π(ai∣[(s0,a0),…,(si−1,ai−1)], si)⋅qi),p_{M,\pi,s}(u) = \mathbf{1}[T=0 \ \text{or}\ s_0 = s]\cdot \prod_{i=0}^{T-1} \Bigl(\pi\bigl(a_i \mid [(s_0,a_0),\dots,(s_{i-1},a_{i-1})],\, s_i\bigr)\cdot q_i\Bigr),pM,π,s​(u)=1[T=0 or s0​=s]⋅i=0∏T−1​(π(ai​∣[(s0​,a0​),…,(si−1​,ai−1​)],si​)⋅qi​),

where

qi={P(si,ai,si+1)i+1<T,1i=T−1.q_i = \begin{cases} P(s_i,a_i,s_{i+1}) & i+1<T,\\ 1 & i = T-1.\end{cases}qi​={P(si​,ai​,si+1​)1​i+1<T,i=T−1.​
  • For T=0T = 0T=0, the indicator is 111 and the empty product is 111, so the empty prefix has value 111.
  • No transition is taken out of the last state sT−1s_{T-1}sT−1​.

probUpTo. For a goal ψ\psiψ and T∈NT\in\mathbb{N}T∈N, define

Pr≤T(ψ∣π,s)=∑u∈(S×A)T1[Decides(ψ,[u0,…,uT−1])]  pM,π,s(u).\mathrm{Pr}_{\le T}(\psi\mid\pi,s) = \sum_{u\in(S\times A)^T} \mathbf{1}\bigl[\mathrm{Decides}(\psi,[u_0,\dots,u_{T-1}])\bigr]\; p_{M,\pi,s}(u).Pr≤T​(ψ∣π,s)=u∈(S×A)T∑​1[Decides(ψ,[u0​,…,uT−1​])]pM,π,s​(u).

Decides\mathrm{Decides}Decides is defined in the imported file. Its docstring describes it as "every history with this prefix satisfies ψ\psiψ". For T=0T=0T=0 the value is 111 if Decides(ψ,[ ])\mathrm{Decides}(\psi,[\,])Decides(ψ,[]) holds and 000 otherwise.

goalProb. Define

Pr(ψ∣π,s)=sup⁡T∈NPr≤T(ψ∣π,s),\mathrm{Pr}(\psi\mid\pi,s) = \sup_{T\in\mathbb{N}} \mathrm{Pr}_{\le T}(\psi\mid\pi,s),Pr(ψ∣π,s)=T∈Nsup​Pr≤T​(ψ∣π,s),

as a supremum of real numbers, not a limit.

  • Monotonicity in TTT is not asserted.
  • If the set {Pr≤T}T\{\mathrm{Pr}_{\le T}\}_T{Pr≤T​}T​ is unbounded above, the supremum is by convention the junk value 000.
  • Boundedness depends on the properties of PPP from the imported file.

optValue. Define

V∗(ψ,s)=sup⁡πPr(ψ∣π,s),V^*(\psi,s) = \sup_{\pi} \mathrm{Pr}(\psi\mid\pi,s),V∗(ψ,s)=πsup​Pr(ψ∣π,s),

over all stochastic history-dependent policies π\piπ over SSS, as a real supremum.

  • If the set of values is unbounded above, the value is 000.
  • If there are no policies (when AAA is empty), the value is also 000.

IsDeltaOptimal. Fix a finite cMDP MMM, a real number δ\deltaδ (unconstrained: it may be negative or ≥1\ge 1≥1), a set Φ\PhiΦ of goals, and a goal-conditioned policy φ↦πφ\varphi\mapsto\pi_\varphiφ↦πφ​ over states. The policy is δ\deltaδ-optimal for Φ\PhiΦ if

(1−δ) V∗(φ,s)  ≤  Pr(φ∣πφ,s)for every φ∈Φ and every s∈S.(1-\delta)\,V^*(\varphi,s) \;\le\; \mathrm{Pr}(\varphi\mid \pi_\varphi, s) \qquad \text{for every } \varphi\in\Phi \text{ and every } s\in S.(1−δ)V∗(φ,s)≤Pr(φ∣πφ​,s)for every φ∈Φ and every s∈S.

Degenerate cases:

  • The condition is vacuous if Φ\PhiΦ is empty or SSS is empty.
  • For δ≥1\delta \ge 1δ≥1 it holds automatically whenever V∗(φ,s)≥0V^*(\varphi,s)\ge 0V∗(φ,s)≥0 and Pr(φ∣πφ,s)≥0\mathrm{Pr}(\varphi\mid\pi_\varphi,s)\ge 0Pr(φ∣πφ​,s)≥0.
  • For δ<0\delta<0δ<0 it demands more than V∗V^*V∗.

POCMP. For finite SSS and finite OOO, a partially observable cMDP consists of:

  • a cMDP (S,A,P)(S,A,P)(S,A,P), with whatever fields and constraints the imported definition imposes;
  • real numbers Ω(o∣s)\Omega(o\mid s)Ω(o∣s) for s∈Ss\in Ss∈S and o∈Oo\in Oo∈O, satisfying
Ω(o∣s)≥0,∑o∈OΩ(o∣s)=1for every s.\Omega(o\mid s)\ge 0, \qquad \sum_{o\in O}\Omega(o\mid s) = 1 \quad \text{for every } s.Ω(o∣s)≥0,o∈O∑​Ω(o∣s)=1for every s.

If SSS is nonempty, OOO must be nonempty for these constraints to hold.

obsPrefixProb. For a POCMP MMM, a policy π\piπ over observations OOO (with actions AAA), s∈Ss\in Ss∈S, and u=((s0,a0),…,(sT−1,aT−1))u = ((s_0,a_0),\dots,(s_{T-1},a_{T-1}))u=((s0​,a0​),…,(sT−1​,aT−1​)), define

pM,π,sobs(u)=1[T=0 or s0=s]⋅∑(o0,…,oT−1)∈OT ∏i=0T−1(Ω(oi∣si)⋅π(ai∣[(o0,a0),…,(oi−1,ai−1)], oi)⋅qi),p^{\mathrm{obs}}_{M,\pi,s}(u) = \mathbf{1}[T=0\ \text{or}\ s_0=s]\cdot\sum_{(o_0,\dots,o_{T-1})\in O^T}\ \prod_{i=0}^{T-1}\Bigl(\Omega(o_i\mid s_i)\cdot \pi\bigl(a_i \mid [(o_0,a_0),\dots,(o_{i-1},a_{i-1})],\, o_i\bigr)\cdot q_i\Bigr),pM,π,sobs​(u)=1[T=0 or s0​=s]⋅(o0​,…,oT−1​)∈OT∑​ i=0∏T−1​(Ω(oi​∣si​)⋅π(ai​∣[(o0​,a0​),…,(oi−1​,ai−1​)],oi​)⋅qi​),

with qiq_iqi​ as in prefixProb. Here the policy at step iii sees only the past observations, its own past actions, and the current observation oio_ioi​. It does not see the states. For T=0T=0T=0 the value is 111.

obsProbUpTo. Define

Pr≤Tobs(ψ∣π,s)=∑u∈(S×A)T1[Decides(ψ,[u0,…,uT−1])]  pM,π,sobs(u).\mathrm{Pr}^{\mathrm{obs}}_{\le T}(\psi\mid\pi,s) = \sum_{u\in(S\times A)^T}\mathbf{1}\bigl[\mathrm{Decides}(\psi,[u_0,\dots,u_{T-1}])\bigr]\;p^{\mathrm{obs}}_{M,\pi,s}(u).Pr≤Tobs​(ψ∣π,s)=u∈(S×A)T∑​1[Decides(ψ,[u0​,…,uT−1​])]pM,π,sobs​(u).

The goal ψ\psiψ is evaluated on the true state–action pairs, not on the observations.

obsGoalProb. Define

Probs(ψ∣π,s)=sup⁡T∈NPr≤Tobs(ψ∣π,s).\mathrm{Pr}^{\mathrm{obs}}(\psi\mid\pi,s) = \sup_{T\in\mathbb{N}}\mathrm{Pr}^{\mathrm{obs}}_{\le T}(\psi\mid\pi,s).Probs(ψ∣π,s)=T∈Nsup​Pr≤Tobs​(ψ∣π,s).

This is a real supremum, taking the value 000 if the set is unbounded above.

obsOptValue. Define

V∗,obs(ψ,s)=sup⁡πProbs(ψ∣π,s),V^{*,\mathrm{obs}}(\psi,s) = \sup_\pi \mathrm{Pr}^{\mathrm{obs}}(\psi\mid\pi,s),V∗,obs(ψ,s)=πsup​Probs(ψ∣π,s),

over observation-based policies π\piπ only. It is 000 if the set of values is unbounded above or if no policy exists.

IsObsDeltaOptimal. For a POCMP MMM, real δ\deltaδ (unconstrained), a set of goals Φ\PhiΦ, and a goal-conditioned observation-based policy φ↦πφ\varphi\mapsto\pi_\varphiφ↦πφ​, the policy is δ\deltaδ-optimal if

(1−δ) V∗,obs(φ,s)≤Probs(φ∣πφ,s)for every φ∈Φ and every s∈S.(1-\delta)\,V^{*,\mathrm{obs}}(\varphi,s)\le \mathrm{Pr}^{\mathrm{obs}}(\varphi\mid\pi_\varphi,s)\qquad\text{for every }\varphi\in\Phi \text{ and every } s\in S.(1−δ)V∗,obs(φ,s)≤Probs(φ∣πφ​,s)for every φ∈Φ and every s∈S.
  • The benchmark is the supremum over observation-based policies, not over state-based ones.
  • The same vacuity cases apply as for IsDeltaOptimal: Φ\PhiΦ empty, SSS empty, or δ≥1\delta\ge1δ≥1 with nonnegative values.
Human review
  • Endorsed by Shuze Chen · Nov 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 24, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me