Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 4, first claim (as proved): optimal deterministic agents on width-2 goals recover transitions with error O(log⁡n/n)O(\log n/n)O(logn/n)

Proved
GeneralAgentsPO.theorem4_width_two_optimal

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

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

Let S,A\mathcal S,\mathcal AS,A be finite sets with ∣A∣≥2|\mathcal A|\ge2∣A∣≥2, and fix s,s′∈Ss,s'\in\mathcal Ss,s′∈S and a∈Aa\in\mathcal Aa∈A. Then there are constants CCC and NNN with the following property. For every n≥Nn\ge Nn≥N there is an estimator P^n\hat P_nP^n​, a function of the goal-conditioned policy alone, such that for every communicating cMDP (S,A,P)(\mathcal S,\mathcal A,P)(S,A,P) and every deterministic goal-conditioned policy π\piπ that is optimal on Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​ (the goals of depth 2n+12n+12n+1 and width 222),

∣P^n(π)−P(s′∣s,a)∣≤C log⁡nn.\big|\hat P_n(\pi)-P(s'\mid s,a)\big|\le C\,\frac{\log n}{n}.​P^n​(π)−P(s′∣s,a)​≤Cnlogn​.

So optimality on a set of goals far smaller than Ψ2n+1\Psi_{2n+1}Ψ2n+1​ already determines the world model, at a faster rate than Theorem 1.

Formalization Note "Error scaling as O(log⁡n/n)O(\log n/n)O(logn/n)" is written with explicit constants C,NC,NC,N that may depend on S,A,s,s′,a\mathcal S,\mathcal A,s,s',aS,A,s,s′,a but not on PPP, π\piπ or nnn. "Optimal" is 000-optimal. The hypothesis ∣A∣≥2|\mathcal A|\ge2∣A∣≥2 is added: with a single action every policy is optimal and carries no information. Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​ contains only goals of depth exactly 2n+12n+12n+1. Some goals queried in the paper's proof, such as ξ1,1\xi_{1,1}ξ1,1​, have smaller depth. The fix is routine: prepending ⊤[S×A]\top[\mathcal S\times\mathcal A]⊤[S×A] to a sequential goal raises its depth without changing its meaning or width, and ξn,n\xi_{n,n}ξn,n​ can replace ξ1,1\xi_{1,1}ξ1,1​ in the test p≤12p\le\frac12p≤21​.

Preamble
import Mathlib
import Definitions.Def_GeneralAgentsPO_Basic

open GeneralAgentsWorldModels
Formal statement
namespace GeneralAgentsPO

theorem theorem4_width_two_optimal {S A : Type*} [Fintype S] [DecidableEq S] [Fintype A]
    [DecidableEq A] (hA : 2 ≤ Fintype.card A) (s s' : S) (a : A) :
    ∃ C : ℝ, ∃ N : ℕ, ∀ n ≥ N, ∃ est : GCStochPolicy S S A → ℝ, ∀ M : CMP S A, M.IsCommunicating →
      ∀ π : GCStochPolicy S S A, (∀ ψ, (π ψ).IsDeterministic) →
        IsDeltaOptimal M 0 (PsiDepthWidth (2 * n + 1) 2) π →
          |est π - M.P s a s'| ≤ C * Real.log n / n := by sorry

end GeneralAgentsPO
Source
Cifuentes, General Agents Contain World Models, even under Partial Observability and Stochasticity, arXiv:2602.03146v1 (2026), Section 4.3, Theorem 4, p. 15; proof pp. 15-16
Read-back

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

Fix finite, nonempty types SSS (states) and AAA (actions), both with decidable equality, and assume ∣A∣≥2|A| \ge 2∣A∣≥2. Fix two states s,s′∈Ss, s' \in Ss,s′∈S and an action a∈Aa \in Aa∈A. The theorem asserts the following.

There exist a real constant CCC and a natural number NNN such that for every natural number n≥Nn \ge Nn≥N there exists a function p^n\widehat{p}_np​n​ with the property below. The function p^n\widehat{p}_np​n​ assigns a real number to every goal-conditioned stochastic policy.

For every controlled Markov process M=(S,A,P)M = (S, A, P)M=(S,A,P) that is communicating, and every goal-conditioned policy π\piπ satisfying the two hypotheses listed next, we have

∣ p^n(π)−P(s′∣s,a) ∣  ≤  C ln⁡nn.\bigl|\,\widehat{p}_n(\pi) - P(s' \mid s, a)\,\bigr| \;\le\; \frac{C \,\ln n}{n}.​p​n​(π)−P(s′∣s,a)​≤nClnn​.

The two hypotheses on π\piπ are:

  1. For every goal ψ\psiψ, the policy πψ\pi_\psiπψ​ is deterministic.
  2. π\piπ is exactly optimal (δ=0\delta = 0δ=0) on the class Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​.

The order of quantifiers matters:

  • CCC and NNN may depend only on S,A,s,s′,aS, A, s, s', aS,A,s,s′,a.
  • p^n\widehat{p}_np​n​ may depend on nnn (and on S,A,s,s′,aS, A, s, s', aS,A,s,s′,a), but not on MMM.
  • The same p^n\widehat{p}_np​n​ must work simultaneously for all communicating MMM and all qualifying π\piπ.
  • p^n\widehat{p}_np​n​ receives the entire goal-conditioned policy π\piπ as input, i.e. its behaviour on every goal and every history, not only on goals in Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​.
  • Nothing requires p^n\widehat{p}_np​n​ to be computable or to use only finitely many queries to π\piπ.
  • The notions "communicating", the transition probability P(s′∣s,a)P(s' \mid s, a)P(s′∣s,a), goals and their satisfaction come from an imported file not shown here.

Goals. A goal ψ\psiψ is a finite list (a disjunction) of sequential goals, each of which is a finite list of basic sub-goals.

  • The depth of ψ\psiψ is the maximum length of its sequential goals, and is 000 for the empty list.
  • The width of ψ\psiψ is the number of sequential goals in the list.
  • Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​ is the set of goals with exactly two sequential goals (counted as list entries, so repeats are allowed) whose longer member has length exactly 2n+12n+12n+1.

Policies. A stochastic policy σ\sigmaσ assigns to every finite history (x0,a0),…,(xt−1,at−1),xt(x_0,a_0),\dots,(x_{t-1},a_{t-1}), x_t(x0​,a0​),…,(xt−1​,at−1​),xt​ a probability distribution σ(⋅∣h)\sigma(\cdot \mid h)σ(⋅∣h) on AAA. It is deterministic if for every history some action has probability exactly 111. A goal-conditioned policy is a map ψ↦πψ\psi \mapsto \pi_\psiψ↦πψ​ from goals to stochastic policies on state histories.

Goal probabilities. For a policy σ\sigmaσ, start state s0∗s_0^\asts0∗​ 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​)), the prefix probability is

Pr⁡T(u∣σ,s0∗)=[ T=0 or s0=s0∗ ]∏i<Tσ(ai∣s0a0⋯si)∏i+1<TP(si+1∣si,ai).\Pr_T(u \mid \sigma, s_0^\ast) = [\,T=0 \text{ or } s_0 = s_0^\ast\,]\prod_{i<T} \sigma(a_i \mid s_0a_0\cdots s_i)\prod_{i+1<T} P(s_{i+1}\mid s_i,a_i).TPr​(u∣σ,s0∗​)=[T=0 or s0​=s0∗​]i<T∏​σ(ai​∣s0​a0​⋯si​)i+1<T∏​P(si+1​∣si​,ai​).

Next, Pr⁡≤T(ψ∣σ,s0∗)\Pr_{\le T}(\psi \mid \sigma, s_0^\ast)Pr≤T​(ψ∣σ,s0∗​) is the sum of these prefix probabilities over all length-TTT sequences uuu that "decide" ψ\psiψ. Here "decide" is a predicate from the imported file, described there as: every infinite history extending uuu satisfies ψ\psiψ.

The probability that σ\sigmaσ achieves ψ\psiψ from s0∗s_0^\asts0∗​ is

Pr⁡(ψ∣σ,s0∗)=sup⁡T∈NPr⁡≤T(ψ∣σ,s0∗).\Pr(\psi \mid \sigma, s_0^\ast) = \sup_{T \in \mathbb N} \Pr_{\le T}(\psi \mid \sigma, s_0^\ast).Pr(ψ∣σ,s0∗​)=T∈Nsup​≤TPr​(ψ∣σ,s0∗​).

The optimal value is

V∗(ψ,s0∗)=sup⁡σPr⁡(ψ∣σ,s0∗),V^\ast(\psi, s_0^\ast) = \sup_{\sigma} \Pr(\psi \mid \sigma, s_0^\ast),V∗(ψ,s0∗​)=σsup​Pr(ψ∣σ,s0∗​),

with the supremum taken over all stochastic, history-dependent policies. Both suprema are taken in R\mathbb RR, where the convention for a set that is not bounded above is the value 000.

Exact optimality. "π\piπ is 000-optimal on Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​" means that for every φ∈Ψ2n+1,2\varphi \in \Psi_{2n+1,2}φ∈Ψ2n+1,2​ and every state t∈St \in St∈S,

(1−0) V∗(φ,t)≤Pr⁡(φ∣πφ,t).(1-0)\, V^\ast(\varphi, t) \le \Pr(\varphi \mid \pi_\varphi, t).(1−0)V∗(φ,t)≤Pr(φ∣πφ​,t).

Edge cases.

  • In the bound, ln⁡\lnln is the real logarithm with the convention ln⁡0=0\ln 0 = 0ln0=0, and division by 000 yields 000. So for n=0n = 0n=0 the right-hand side is 000, and for n=1n = 1n=1 it is also 000, since ln⁡1=0\ln 1 = 0ln1=0. Either case would demand exact recovery of P(s′∣s,a)P(s'\mid s,a)P(s′∣s,a); however, NNN may be chosen large enough to exclude these nnn.
  • CCC is not required to be nonnegative.
  • If, for a given nnn, no communicating MMM admits a policy that is both deterministic on every goal and exactly optimal on Ψ2n+1,2\Psi_{2n+1,2}Ψ2n+1,2​, the conclusion for that nnn holds vacuously.
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