Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 3 (proof, eq. (5)): the uniformly random observation-based policy achieves φw\varphi_wφw​ with probability p∣w∣1(1−p)n−∣w∣1p^{|w|_1}(1-p)^{n-|w|_1}p∣w∣1​(1−p)n−∣w∣1​

Proved
GeneralAgentsPO.theorem3_uniform_policy_visit_probability

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

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

Let (S,A,P,O,Ω)(\mathcal S,\mathcal A,P,O,\Omega)(S,A,P,O,Ω) be a finite partially observable cMDP whose cMDP is communicating, and let π\piπ be the observation-based policy that always picks an action uniformly at random: Pr⁡(π(o0a0…ot)=c)=1/∣A∣\Pr(\pi(o_0a_0\dots o_t)=c)=1/|\mathcal A|Pr(π(o0​a0​…ot​)=c)=1/∣A∣ for every finite observation history and every c∈Ac\in\mathcal Ac∈A. Let s,s′∈Ss,s'\in\mathcal Ss,s′∈S, a∈Aa\in\mathcal Aa∈A, p=P(s′∣s,a)p=P(s'\mid s,a)p=P(s′∣s,a), and for w∈{0,1}nw\in\{0,1\}^nw∈{0,1}n let φw=⟨φ2,φ3w1,…,φ2,φ3wn⟩\varphi_w=\langle\varphi_2,\varphi_3^{w_1},\dots,\varphi_2,\varphi_3^{w_n}\rangleφw​=⟨φ2​,φ3w1​​,…,φ2​,φ3wn​​⟩. Then for every start state s0s_0s0​

Pr⁡(φw∣π,s0)=p∣w∣1(1−p)n−∣w∣1.\Pr(\varphi_w\mid\pi,s_0)=p^{|w|_1}(1-p)^{n-|w|_1}.Pr(φw​∣π,s0​)=p∣w∣1​(1−p)n−∣w∣1​.

This is the step of the proof of Theorem 3 (built on eq. (5)) showing that, for goals phrased in states, the observation kernel plays no role for a policy that ignores its observations. In a finite communicating cMDP the uniformly random policy visits (s,a)(s,a)(s,a) infinitely often.

Preamble
import Mathlib
import Definitions.Def_GeneralAgentsPO_Basic

open GeneralAgentsWorldModels
Formal statement
namespace GeneralAgentsPO

theorem theorem3_uniform_policy_visit_probability {S A O : Type*} [Fintype S] [DecidableEq S]
    [Fintype A] [DecidableEq A] [Fintype O] (M : POCMP S A O) (hM : M.toCMP.IsCommunicating)
    (π : StochPolicy O A) (hπ : ∀ h o c, π.act h o c = 1 / Fintype.card A)
    (s s' : S) (a : A) (n : ℕ) (w : Fin n → Bool) (s₀ : S) :
    obsGoalProb M π [visitSeq s a s' (List.ofFn w)] s₀ =
      M.P s a s' ^ onesCount w * (1 - M.P s a s') ^ (n - onesCount w) := by sorry

end GeneralAgentsPO
Source
Cifuentes, General Agents Contain World Models, even under Partial Observability and Stochasticity, arXiv:2602.03146v1 (2026), Section 4.2, proof of Theorem 3, eq. (5), pp. 13-14
Read-back

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

Setting. Let SSS, AAA, OOO be types (states, actions, observations). All three are finite, and SSS and AAA have decidable equality. Let MMM be a partially observable controlled Markov process on (S,A,O)(S, A, O)(S,A,O), consisting of:

  • an underlying controlled Markov process with transition function P(⋅∣s,a)P(\cdot \mid s, a)P(⋅∣s,a). Its structure and the axioms on PPP come from an imported definitions file that is not shown here.
  • an observation kernel Ω(o∣s)\Omega(o \mid s)Ω(o∣s) with Ω(o∣s)≥0\Omega(o \mid s) \ge 0Ω(o∣s)≥0 and ∑o∈OΩ(o∣s)=1\sum_{o \in O} \Omega(o \mid s) = 1∑o∈O​Ω(o∣s)=1 for every sss.

Since a state sss is supplied below, SSS is nonempty. A nonempty SSS forces OOO to be nonempty, because otherwise the normalisation ∑oΩ(o∣s)=1\sum_o \Omega(o \mid s) = 1∑o​Ω(o∣s)=1 is impossible.

Hypotheses.

  • Communicating. The underlying controlled Markov process is assumed to be communicating. This notion is defined in the imported file, which is not shown.
  • Uniform policy. π\piπ is an observation-based stochastic policy. For every finite history h=((o0,a0),…,(ot−1,at−1))h = ((o_0, a_0), \dots, (o_{t-1}, a_{t-1}))h=((o0​,a0​),…,(ot−1​,at−1​)) of observation–action pairs, every current observation ooo and every action ccc, it assigns probability Pr⁡(π(h o)=c)≥0\Pr(\pi(h\,o) = c) \ge 0Pr(π(ho)=c)≥0, with these probabilities summing to 111 over c∈Ac \in Ac∈A. The hypothesis requires
Pr⁡(π(h o)=c)=1∣A∣for all h,o,c,\Pr(\pi(h\,o) = c) = \frac{1}{|A|} \quad \text{for all } h, o, c,Pr(π(ho)=c)=∣A∣1​for all h,o,c,

so π\piπ is the uniform policy, ignoring both history and observation.

  • Empty action set. If AAA is empty, then 1/∣A∣1/|A|1/∣A∣ is the junk value 1/0=01/0 = 01/0=0. In that case no policy can exist at all, because the empty sum cannot equal 111, and the statement is vacuously true.
  • Remaining data. The remaining data are arbitrary:
    • states s,s′∈Ss, s' \in Ss,s′∈S;
    • an action a∈Aa \in Aa∈A;
    • a natural number nnn (possibly 000);
    • a word w=(w0,…,wn−1)∈{0,1}nw = (w_0, \dots, w_{n-1}) \in \{0,1\}^nw=(w0​,…,wn−1​)∈{0,1}n;
    • an arbitrary initial state s0∈Ss_0 \in Ss0​∈S, with no relation to sss assumed.

The goal. The goal ψ\psiψ is a disjunction with exactly one disjunct, namely the sequential goal

⟨ φ2, φ3w0, φ2, φ3w1, …, φ2, φ3wn−1 ⟩,\big\langle\, \varphi_2,\ \varphi_3^{w_0},\ \varphi_2,\ \varphi_3^{w_1},\ \dots,\ \varphi_2,\ \varphi_3^{w_{n-1}} \,\big\rangle,⟨φ2​, φ3w0​​, φ2​, φ3w1​​, …, φ2​, φ3wn−1​​⟩,

of length 2n2n2n. Here:

  • φ2=evVisit(s,a)\varphi_2 = \texttt{evVisit}(s, a)φ2​=evVisit(s,a);
  • φ3wi=nextIn(Ti)\varphi_3^{w_i} = \texttt{nextIn}(T_i)φ3wi​​=nextIn(Ti​), where Ti={s′}T_i = \{s'\}Ti​={s′} if wi=1w_i = 1wi​=1 and Ti=S∖{s′}T_i = S \setminus \{s'\}Ti​=S∖{s′} if wi=0w_i = 0wi​=0.

The meanings of evVisit, nextIn, of satisfying a sequential/composite goal, and of the finite-prefix test "decides" are in the imported file, which is not shown. According to the comments, φ2\varphi_2φ2​ reads "eventually the state is sss and the action is aaa", and nextIn(T)\texttt{nextIn}(T)nextIn(T) reads "at the next step the state lies in TTT". For n=0n = 0n=0 the sequential goal is the empty sequence.

The probability being computed. Let p=P(s′∣s,a)p = P(s' \mid s, a)p=P(s′∣s,a) and k=∣w∣1=∣{i<n:wi=1}∣k = |w|_1 = |\{i < n : w_i = 1\}|k=∣w∣1​=∣{i<n:wi​=1}∣, so 0≤k≤n0 \le k \le n0≤k≤n. The left-hand side is the observation-based goal probability

Pr⁡(ψ∣π,s0)=sup⁡T∈N ∑u=((s0′,a0),…,(sT−1′,aT−1))∈(S×A)Tu decides ψPr⁡T(u).\Pr(\psi \mid \pi, s_0) = \sup_{T \in \mathbb N} \ \sum_{\substack{u = ((s_0', a_0), \dots, (s_{T-1}', a_{T-1})) \in (S \times A)^T \\ u \text{ decides } \psi}} \Pr_T(u).Pr(ψ∣π,s0​)=T∈Nsup​ u=((s0′​,a0​),…,(sT−1′​,aT−1​))∈(S×A)Tu decides ψ​∑​TPr​(u).

Here "uuu decides ψ\psiψ" is the imported finite-prefix test, described in comments as "every history with this prefix satisfies ψ\psiψ". The prefix probability is

Pr⁡T(u)=[ T=0 or s0′=s0 ]⋅∑(o0,…,oT−1)∈OT ∏i<TΩ(oi∣si′) Pr⁡ ⁣(π(o0a0…oi−1ai−1 oi)=ai) ⋅{P(si+1′∣si′,ai)i+1<T,1i+1=T.\Pr_T(u) = [\,T = 0 \text{ or } s_0' = s_0\,] \cdot \sum_{(o_0, \dots, o_{T-1}) \in O^T} \ \prod_{i<T} \Omega(o_i \mid s_i')\, \Pr\!\big(\pi(o_0 a_0 \dots o_{i-1} a_{i-1}\, o_i) = a_i\big)\, \cdot \begin{cases} P(s_{i+1}' \mid s_i', a_i) & i + 1 < T, \\ 1 & i + 1 = T. \end{cases}TPr​(u)=[T=0 or s0′​=s0​]⋅(o0​,…,oT−1​)∈OT∑​ i<T∏​Ω(oi​∣si′​)Pr(π(o0​a0​…oi−1​ai−1​oi​)=ai​)⋅{P(si+1′​∣si′​,ai​)1​i+1<T,i+1=T.​

The supremum is taken in the real numbers. If the family were unbounded above, the supremum would take the junk value 000.

Conclusion. Under these hypotheses, the theorem asserts the exact equality

Pr⁡(ψ∣π,s0)=p k (1−p) n−k.\Pr(\psi \mid \pi, s_0) = p^{\,k}\,(1 - p)^{\,n - k}.Pr(ψ∣π,s0​)=pk(1−p)n−k.

In particular:

  • The value is independent of s0s_0s0​, of Ω\OmegaΩ, and of which positions of www carry the ones.
  • For n=0n = 0n=0 the right-hand side is 111.
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