Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 3: counterfactual error amplification

Proved
ControlledWorldModels.counterfactual_error_amplification

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

hermite-expansionidentifiabilityjepalinear-gaussian-dynamicsworld-models

Assume Assumptions 1–3 with γrep(π)>0\gamma_{\rm rep}(\pi)>0γrep​(π)>0 and ρtr(π)>0\rho_{\rm tr}(\pi)>0ρtr​(π)>0. Fix identified coordinates y=Qzy=Qzy=Qz, Q∈O(d)Q\in O(d)Q∈O(d), and let F⋆(y,a)=QAQ⊤y+QBaF^\star(y,a)=QAQ^\top y+QBaF⋆(y,a)=QAQ⊤y+QBa and μπ(z)=Eπ[at∣zt=z]\mu_\pi(z)=\mathbb E_\pi[a_t\mid z_t=z]μπ​(z)=Eπ​[at​∣zt​=z]. Suppose the predictor class F\mathcal FF contains

F⋆(y,a)+D(a−μπ(Q⊤y))F^\star(y,a)+D\big(a-\mu_\pi(Q^\top y)\big)F⋆(y,a)+D(a−μπ​(Q⊤y))

for every matrix D∈Rd×mD\in\mathbb{R}^{d\times m}D∈Rd×m. Then for every δ>0\delta>0δ>0 the class contains a continuous predictor FδF_\deltaFδ​ with

Eπ(Fδ)=δ,Ecf(Fδ)=δρtr(π).\mathcal E_\pi(F_\delta)=\delta,\qquad\mathcal E_{\rm cf}(F_\delta)=\frac{\delta}{\rho_{\rm tr}(\pi)}.Eπ​(Fδ​)=δ,Ecf​(Fδ​)=ρtr​(π)δ​.

A small on-policy excess risk is therefore compatible with a counterfactual error larger by the factor 1/ρtr(π)1/\rho_{\rm tr}(\pi)1/ρtr​(π).

Formalization Note μπ\mu_\piμπ​ is the linear version z↦E[atzt⊤]zz\mapsto\mathbb E[a_tz_t^\top]zz↦E[at​zt⊤​]z of the conditional mean, as used in the paper's proof. The statement holds for every Q∈O(d)Q\in O(d)Q∈O(d). It therefore generalizes the paper's statement, which concerns the QQQ identified by a minimizer; it is not merely equivalent to it.

Preamble
import Mathlib
import Definitions.Def_ControlledWorldModels_Basic

open MeasureTheory ProbabilityTheory
Formal statement
namespace ControlledWorldModels

theorem counterfactual_error_amplification {d m : ℕ} (A : Matrix (Fin d) (Fin d) ℝ) (B : Matrix (Fin d) (Fin m) ℝ)
    (μ : Measure ((Fin d → ℝ) × (Fin m → ℝ))) (ν : Measure (Fin d → ℝ))
    (hpol : IsJointGaussianPolicy μ) (htr : IsStationaryTransition A B μ ν)
    (Fc : Set ((Fin d → ℝ) → (Fin m → ℝ) → Fin d → ℝ)) (hFc : IsRichPredictorClass A B μ ν Fc)
    (hrep : 0 < repMargin A B μ) (hexc : 0 < transMargin μ)
    (Q : Matrix.orthogonalGroup (Fin d) ℝ)
    (hcls : ∀ D : Matrix (Fin d) (Fin m) ℝ,
      (fun y a => trueMean A B (Q : Matrix (Fin d) (Fin d) ℝ) y a +
        D.mulVec (a - condMeanAct μ ((Q : Matrix (Fin d) (Fin d) ℝ).transpose.mulVec y))) ∈ Fc)
    (δ : ℝ) (hδ : 0 < δ) :
    ∃ F ∈ Fc, Continuous (Function.uncurry F) ∧
      onPolicyExcess A B μ ν (Q : Matrix (Fin d) (Fin d) ℝ) F = ENNReal.ofReal δ ∧
      cfError A B μ (Q : Matrix (Fin d) (Fin d) ℝ) F = ENNReal.ofReal (δ / transMargin μ) := by sorry

end ControlledWorldModels
Source
Zhang, Guan, Zhang, Li, Zhang and Li, On the Identifiability of Controlled World Models, arXiv:2607.22430v2 (2026), Section 3.4, Theorem 3, eqs. (5)-(6), p. 5; proof in Appendix C, p. 10
Read-back

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

Setting. Fix natural numbers d,md, md,m and real matrices A∈Rd×dA \in \mathbb{R}^{d\times d}A∈Rd×d and B∈Rd×mB \in \mathbb{R}^{d\times m}B∈Rd×m. Let μ\muμ be a measure on Rd×Rm\mathbb{R}^d \times \mathbb{R}^mRd×Rm, with generic point (z,a)(z,a)(z,a) (state, action), and let ν\nuν be a measure on Rd\mathbb{R}^dRd, with generic point ξ\xiξ (noise). A sample is ω=((z,a),ξ)\omega = ((z,a),\xi)ω=((z,a),ξ) drawn from the product measure μ⊗ν\mu\otimes\nuμ⊗ν, so (z,a)(z,a)(z,a) and ξ\xiξ are independent. The next state is

z′=Az+Ba+ξ.z' = Az + Ba + \xi.z′=Az+Ba+ξ.

Throughout, ∥v∥2=∑ivi2\|v\|^2 = \sum_i v_i^2∥v∥2=∑i​vi2​, and N(0,In)N(0,I_n)N(0,In​) is the product of nnn standard real Gaussians.

Hypotheses. The theorem assumes all of the following:

  1. Policy law. μ\muμ is a Gaussian measure in Mathlib's sense, so it is a probability measure all of whose one-dimensional linear projections are real Gaussian, possibly degenerate. Its mean ∫(z,a) dμ\int (z,a)\,d\mu∫(z,a)dμ is 000, and its first marginal (the law of zzz) is exactly N(0,Id)N(0,I_d)N(0,Id​). The action may depend on zzz, and its covariance may be singular.

  2. Transition. ν\nuν is Gaussian with mean 000, and the pushforward of μ⊗ν\mu\otimes\nuμ⊗ν under ((z,a),ξ)↦Az+Ba+ξ((z,a),\xi)\mapsto Az+Ba+\xi((z,a),ξ)↦Az+Ba+ξ equals N(0,Id)N(0,I_d)N(0,Id​).

  3. Predictor class. F\mathcal FF is a set of functions F:Rd×Rm→RdF:\mathbb{R}^d\times\mathbb{R}^m\to\mathbb{R}^dF:Rd×Rm→Rd satisfying two conditions:

    • every F∈FF\in\mathcal FF∈F is jointly measurable;
    • for every admissible encoder e:Rd→Rde:\mathbb{R}^d\to\mathbb{R}^de:Rd→Rd (measurable, with e#N(0,Id)=N(0,Id)e_\# N(0,I_d) = N(0,I_d)e#​N(0,Id​)=N(0,Id​)), some F∈FF\in\mathcal FF∈F satisfies, μ⊗ν\mu\otimes\nuμ⊗ν-almost surely,
F(e(z),a)=E[e(z′) ∣ σ(e(z),a)].F(e(z),a) = \mathbb{E}\big[e(z') \,\big|\, \sigma(e(z),a)\big].F(e(z),a)=E[e(z′)​σ(e(z),a)].

The conditional expectation is the measure-theoretic one under μ⊗ν\mu\otimes\nuμ⊗ν. By convention it is the zero function if e(z′)e(z')e(z′) is not integrable.

  1. Representation margin. Let R=Cov⁡μ(Az+Ba)R = \operatorname{Cov}_\mu(Az+Ba)R=Covμ​(Az+Ba), with entries
Rij=∫(Xi−∫Xi dμ)(Xj−∫Xj dμ) dμ,X=Az+Ba.R_{ij} = \int (X_i - \textstyle\int X_i\,d\mu)(X_j-\int X_j\,d\mu)\,d\mu, \qquad X = Az+Ba.Rij​=∫(Xi​−∫Xi​dμ)(Xj​−∫Xj​dμ)dμ,X=Az+Ba.

These integrals are Bochner integrals, which are set to 000 when the integrand is not integrable. The hypothesis is

0<λmin⁡(R)−λmax⁡(R)2.0 < \lambda_{\min}(R) - \lambda_{\max}(R)^2.0<λmin​(R)−λmax​(R)2.

Here λmax⁡(M)\lambda_{\max}(M)λmax​(M) and λmin⁡(M)\lambda_{\min}(M)λmin​(M) are defined as the supremum and infimum of the Rayleigh quotient x⊤Mxx^\top M xx⊤Mx over unit vectors x∈Rdx\in\mathbb{R}^dx∈Rd. When d=0d=0d=0 the unit sphere is empty and both values are 000 by convention, so this hypothesis cannot hold. The theorem is therefore vacuous for d=0d=0d=0.

  1. Transition margin. Let Σtr∈Rm×m\Sigma_{\mathrm{tr}}\in\mathbb{R}^{m\times m}Σtr​∈Rm×m have entries
(Σtr)ij=∫(ai−Eμ[ai∣z])(aj−Eμ[aj∣z]) dμ,(\Sigma_{\mathrm{tr}})_{ij} = \int \big(a_i - \mathbb{E}_\mu[a_i\mid z]\big)\big(a_j-\mathbb{E}_\mu[a_j\mid z]\big)\,d\mu,(Σtr​)ij​=∫(ai​−Eμ​[ai​∣z])(aj​−Eμ​[aj​∣z])dμ,

where the conditional expectations are taken given σ(z)\sigma(z)σ(z) under μ\muμ. Define ρtr=λmin⁡(Σtr)\rho_{\mathrm{tr}} = \lambda_{\min}(\Sigma_{\mathrm{tr}})ρtr​=λmin​(Σtr​), again as the infimum of the Rayleigh quotient over unit vectors of Rm\mathbb{R}^mRm. The hypothesis is ρtr>0\rho_{\mathrm{tr}}>0ρtr​>0. When m=0m=0m=0 this infimum is 000 by convention, so the theorem is also vacuous for m=0m=0m=0.

  1. Rotation. QQQ is a real orthogonal d×dd\times dd×d matrix, meaning Q⊤Q=QQ⊤=IdQ^\top Q = QQ^\top = I_dQ⊤Q=QQ⊤=Id​.

  2. Closure of the class. Let M∈Rm×dM\in\mathbb{R}^{m\times d}M∈Rm×d have entries Mij=∫aizj dμM_{ij} = \int a_i z_j\,d\muMij​=∫ai​zj​dμ, and let

F⋆(y,a)=QAQ⊤y+QBa.F^\star(y,a) = QAQ^\top y + QBa.F⋆(y,a)=QAQ⊤y+QBa.

For every matrix D∈Rd×mD\in\mathbb{R}^{d\times m}D∈Rd×m, the function

(y,a)  ↦  F⋆(y,a)+D(a−MQ⊤y)(y,a)\;\mapsto\; F^\star(y,a) + D\big(a - M Q^\top y\big)(y,a)↦F⋆(y,a)+D(a−MQ⊤y)

belongs to F\mathcal FF.

  1. Excess level. δ\deltaδ is a real number with δ>0\delta>0δ>0.

Conclusion. Under these hypotheses, there exists F∈FF\in\mathcal FF∈F such that:

  • (i) Continuity. (y,a)↦F(y,a)(y,a)\mapsto F(y,a)(y,a)↦F(y,a) is jointly continuous.

  • (ii) On-policy excess equals δ\deltaδ. With z,a,ξ,z′z,a,\xi,z'z,a,ξ,z′ as above under μ⊗ν\mu\otimes\nuμ⊗ν,

E ∥Qz′−F(Qz,a)∥2  −˙  E ∥Qz′−F⋆(Qz,a)∥2=δ.\mathbb{E}\,\|Qz' - F(Qz,a)\|^2 \;\dot-\; \mathbb{E}\,\|Qz' - F^\star(Qz,a)\|^2 = \delta.E∥Qz′−F(Qz,a)∥2−˙​E∥Qz′−F⋆(Qz,a)∥2=δ.

Both expectations are computed in [0,∞][0,\infty][0,∞]. The symbol −˙\dot-−˙​ is truncated subtraction in [0,∞][0,\infty][0,∞]: the result is 000 whenever the first term does not exceed the second, including the case where both are +∞+\infty+∞.

  • (iii) Counterfactual error equals δ/ρtr\delta/\rho_{\mathrm{tr}}δ/ρtr​. Let z∼N(0,Id)z\sim N(0,I_d)z∼N(0,Id​) and η∼N(0,Im)\eta\sim N(0,I_m)η∼N(0,Im​) be independent, and set acf=Mz+ηa_{\mathrm{cf}} = Mz+\etaacf​=Mz+η. Then
E ∥F(Qz,acf)−F⋆(Qz,acf)∥2=δρtr,\mathbb{E}\,\big\|F(Qz,a_{\mathrm{cf}}) - F^\star(Qz,a_{\mathrm{cf}})\big\|^2 = \frac{\delta}{\rho_{\mathrm{tr}}},E​F(Qz,acf​)−F⋆(Qz,acf​)​2=ρtr​δ​,

with the expectation computed in [0,∞][0,\infty][0,∞].

The statement asserts existence for the single given δ\deltaδ. It says nothing about which element of F\mathcal FF attains these values, beyond continuity and membership in F\mathcal FF.

Human review
  • Endorsed by Shuze Chen · Nov 23, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 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