Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

REACH is unbiased

Proved
FormalizedScopeReach.reach_unbiased

by burkh4rt · Sep 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

monte-carloprobabilitystatistics

Assume a countable vocabulary, normalized original and outcome-avoiding path laws, and unequal outcome and threshold times almost surely under the original law. For every positive sample count, the REACH average under independent outcome-avoiding sampling is integrable and has expectation equal to the original probability of an outcome before the threshold. Neither path law is required to have bounded lengths or finite expected length.

Preamble
import Definitions.Def_FormalizedScopeReach_Trials

open scoped BigOperators ENNReal
open MeasureTheory ProbabilityTheory
Formal statement
namespace FormalizedScopeReach

theorem reach_unbiased {V : Type} [Countable V] (M : Model V)
    [IsProbabilityMeasure (originalLaw M)] [IsProbabilityMeasure (avoidingLaw M)]
    (hne : ∀ᵐ x ∂originalLaw M, T_O M x ≠ T_E M x) (n : ℕ) (hn : 0 < n) :
    Integrable (ℛ M n) (iidLaw (avoidingLaw M) n) ∧
      (∫ xs, ℛ M n xs ∂iidLaw (avoidingLaw M) n) = targetProbability M := by sorry

end FormalizedScopeReach
Source
Solo et al., Efficient Generative Prediction for EHR Foundation Models: The SCOPE and REACH Estimators, arXiv:2602.03730v2 (2026), https://arxiv.org/abs/2602.03730v2, Section 4.3 and Appendix C
Read-back

What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)

Read-back of reach_unbiased

For every countable type VVV and every model consisting of a distinguished element o∈Vo\in Vo∈V, a probability mass function ph:V→[0,∞]p_h:V\to[0,\infty]ph​:V→[0,∞] for each finite list hhh of elements of VVV (so ∑a∈Vph(a)=1\sum_{a\in V}p_h(a)=1∑a∈V​ph​(a)=1), and a predicate SSS on finite lists satisfying ¬S([])\neg S([])¬S([]), the following assertion holds. A timeline is any finite list x=(x0,…,xℓ−1)x=(x_0,\ldots,x_{\ell-1})x=(x0​,…,xℓ−1​) of elements of VVV, equipped with the discrete measurable structure in which every set of timelines is measurable; write x<ix_{<i}x<i​ for its first iii entries. Call xxx terminal when S(x)S(x)S(x) holds and S(x<i)S(x_{<i})S(x<i​) fails for every 0≤i<ℓ0\le i<\ell0≤i<ℓ. Define an extended nonnegative weight w(x)w(x)w(x) to equal ∏i=0ℓ−1px<i(xi)\prod_{i=0}^{\ell-1}p_{x_{<i}}(x_i)∏i=0ℓ−1​px<i​​(xi​) if xxx is terminal, and to equal 000 otherwise, and define the measure μ=∑xw(x)δx\mu=\sum_x w(x)\delta_xμ=∑x​w(x)δx​, where δx\delta_xδx​ is unit point mass at xxx and the sum is over all finite timelines. Define qh(o)=0q_h(o)=0qh​(o)=0 and qh(a)=ph(a)/(1−ph(o))q_h(a)=p_h(a)/(1-p_h(o))qh​(a)=ph​(a)/(1−ph​(o)) for a≠oa\ne oa=o, with subtraction and division in the extended nonnegative real numbers. Define v(x)v(x)v(x) to equal ∏i=0ℓ−1qx<i(xi)\prod_{i=0}^{\ell-1}q_{x_{<i}}(x_i)∏i=0ℓ−1​qx<i​​(xi​) when xxx is terminal and contains no occurrence of ooo, and to equal 000 otherwise, and define ν=∑xv(x)δx\nu=\sum_x v(x)\delta_xν=∑x​v(x)δx​. Assume separately that both μ\muμ and ν\nuν are probability measures, meaning that each assigns total mass 111 to the space of all finite timelines. For any timeline xxx, let TO(x)T_O(x)TO​(x) be the position of its first occurrence of ooo, counted starting at 111, or ∞\infty∞ if it has no such occurrence; let TE(x)T_E(x)TE​(x) be the least natural number kkk with 0≤k≤ℓ0\le k\le\ell0≤k≤ℓ and S(x<k)S(x_{<k})S(x<k​), or ∞\infty∞ if no such kkk exists, with both times taking values in N∪{∞}\mathbb N\cup\{\infty\}N∪{∞}. Assume that TO(x)≠TE(x)T_O(x)\ne T_E(x)TO​(x)=TE​(x) for μ\muμ-almost every timeline xxx. For every natural number nnn satisfying 0<n0<n0<n, let ν⊗n\nu^{\otimes n}ν⊗n be the product probability measure on indexed families (xj)0≤j<n(x_j)_{0\le j<n}(xj​)0≤j<n​ of timelines, with each coordinate having law ν\nuν, let h(y)h(y)h(y) be the ordinary real value of py(o)p_y(o)py​(o), and define the real-valued function

Rn(x0,…,xn−1)=1n∑j=0n−1(1−∏i=0∣xj∣−1(1−h((xj)<i))).R_n(x_0,\ldots,x_{n-1}) =\frac1n\sum_{j=0}^{n-1} \left(1-\prod_{i=0}^{|x_j|-1}\bigl(1-h((x_j)_{<i})\bigr)\right).Rn​(x0​,…,xn−1​)=n1​j=0∑n−1​​1−i=0∏∣xj​∣−1​(1−h((xj​)<i​))​.

The assertion is the conjunction that RnR_nRn​ is integrable with respect to ν⊗n\nu^{\otimes n}ν⊗n (it is almost everywhere strongly measurable and its absolute value has finite integral) and that

∫Rn dν⊗n=toReal⁡ ⁣(μ{x:TO(x)<TE(x)}).\int R_n\,d\nu^{\otimes n} =\operatorname{toReal}\!\left(\mu\{x:T_O(x)<T_E(x)\}\right).∫Rn​dν⊗n=toReal(μ{x:TO​(x)<TE​(x)}).

Here toReal⁡\operatorname{toReal}toReal converts a finite extended nonnegative real number to its real value and sends ∞\infty∞ to 000; the probability-measure assumption makes the event measure finite, and each py(o)≤1p_y(o)\le1py​(o)≤1 is finite as well, so the conversion to a real number does not encounter ∞\infty∞ in either use. The comparison on the right is strictly less than, with every finite time less than ∞\infty∞ and ∞<∞\infty<\infty∞<∞ false. All finite lists are in the underlying space, including empty lists, lists containing ooo, and lists that are not terminal, although the specified measures give mass only to their respective permitted terminal lists. On any terminal list, TE(x)=∣x∣T_E(x)=|x|TE​(x)=∣x∣; thus the almost-everywhere hypothesis excludes positive μ\muμ-mass on terminal lists whose first occurrence of ooo is their last entry. It imposes this exclusion under μ\muμ, not under ν\nuν, and is an almost-everywhere condition rather than a condition on every list. The empty list has both times equal to ∞\infty∞, is not terminal because ¬S([])\neg S([])¬S([]), has zero mass under both measures, and has score 1−1=01-1=01−1=0 by the empty-product convention. A stop predicate is otherwise arbitrary: no monotonicity or numerical time parameter is assumed, and transitions are specified even for histories that already satisfy the stop predicate or contain ooo. The measures sum only over finite lists and do not include infinite trajectories; their normalization is an explicit hypothesis. For example, a model with SSS always false cannot satisfy either probability-measure hypothesis, and an empty type VVV admits no model because a distinguished element is required. No strict upper bound ph(o)<1p_h(o)<1ph​(o)<1 is assumed: if ph(o)=1p_h(o)=1ph​(o)=1, then 1−ph(o)=01-p_h(o)=01−ph​(o)=0 and all ph(a)p_h(a)ph​(a) for a≠oa\ne oa=o are zero, so the displayed ratios for these aaa are 0/0=00/0=00/0=0 in extended nonnegative arithmetic; in general a nonzero extended nonnegative numerator divided by zero is ∞\infty∞. Thus the locally defined qhq_hqh​ need not itself have total mass 111 for every history. The theorem covers only n≥1n\ge1n≥1; its definition would give a zero estimator at n=0n=0n=0 by empty summation and real division by zero, but this case is excluded by its hypothesis.

Human review
  • Endorsed by Shuze Chen · Sep 15, 2026

  • Endorsed by burkh4rt · Sep 15, 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