proofs
Provedattentionresidual-seriesexternal-review-4

Residual series: complete finite-history probability, mean and variance

For all J∈Type⁡\htmlData{mx=1}{J \in \htmlData{mx=0}{\operatorname{Type}}}, r,h,R:J→R\htmlData{mx=3}{r, h, R : \htmlData{mx=0}{J} \mathrel{\htmlData{mx=2}{\to}} \htmlData{mx=1}{\mathbb{R}}} and ρ,θ,q,d,V∈R\htmlData{mx=1}{\rho, \theta, q, d, V \in \htmlData{mx=0}{\mathbb{R}}}, if ∀j, 0≤r(j)\htmlData{mx=4}{\forall j,\ 0 \mathrel{\htmlData{mx=3}{\leq}} \htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})}}, ∑jr(j)=1\htmlData{mx=3}{\sum_{j} \htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})}} \mathrel{\htmlData{mx=4}{=}} 1, 0<ρ0 \mathrel{\htmlData{mx=1}{<}} \htmlData{mx=0}{\rho}, ρ<1\htmlData{mx=0}{\rho} \mathrel{\htmlData{mx=1}{<}} 1, ∑jr(j)⋅h(j)=θ\htmlData{mx=7}{\sum_{j} \htmlData{mx=6}{\htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})} \cdot \htmlData{mx=5}{\htmlData{mx=3}{h}(\htmlData{mx=4}{j})}}} \mathrel{\htmlData{mx=9}{=}} \htmlData{mx=8}{\theta}, ∑jr(j)⋅R(j)=(1−θ)⋅d\htmlData{mx=7}{\sum_{j} \htmlData{mx=6}{\htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})} \cdot \htmlData{mx=5}{\htmlData{mx=3}{R}(\htmlData{mx=4}{j})}}} \mathrel{\htmlData{mx=12}{=}} \htmlData{mx=11}{(\htmlData{mx=9}{1 - \htmlData{mx=8}{\theta}}) \cdot \htmlData{mx=10}{d}}, ∑jr(j)⋅h(j)2=ρ⋅q\htmlData{mx=8}{\sum_{j} \htmlData{mx=7}{\htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})} \cdot \htmlData{mx=6}{\htmlData{mx=5}{\htmlData{mx=3}{h}(\htmlData{mx=4}{j})}^{2}}}} \mathrel{\htmlData{mx=12}{=}} \htmlData{mx=11}{\htmlData{mx=9}{\rho} \cdot \htmlData{mx=10}{q}} and ∑jr(j)⋅R(j)21−ρ=(1−q)⋅(V+d2)\htmlData{mx=11}{\frac{\htmlData{mx=8}{\sum_{j} \htmlData{mx=7}{\htmlData{mx=2}{\htmlData{mx=0}{r}(\htmlData{mx=1}{j})} \cdot \htmlData{mx=6}{\htmlData{mx=5}{\htmlData{mx=3}{R}(\htmlData{mx=4}{j})}^{2}}}}}{\htmlData{mx=10}{1 - \htmlData{mx=9}{\rho}}}} \mathrel{\htmlData{mx=19}{=}} \htmlData{mx=18}{(\htmlData{mx=13}{1 - \htmlData{mx=12}{q}}) \cdot (\htmlData{mx=17}{\htmlData{mx=14}{V} + \htmlData{mx=16}{\htmlData{mx=15}{d}^{2}}})} (given Fintype⁡ J\htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fintype}}\,\htmlData{mx=1}{J}}), then

∀L∈N,(∀f:Fin⁡ L→J×Bool⁡, 0≤∏ir(f(i))1⋅({ρif f(i)21−ρotherwise))∧(∑f:Fin⁡ L→J×Bool⁡∏ir(f(i))1⋅({ρif f(i)21−ρotherwise))=1∧(∑f:Fin⁡ L→J×Bool⁡(∏ir(f(i))1⋅({ρif f(i)21−ρotherwise))⋅foldr⁡(ofFn⁡(f))(z,tail↦{h(z1)ρ⋅tailif z2R(z1)1−ρotherwise,d))=d∧(∑f:Fin⁡ L→J×Bool⁡(∏ir(f(i))1⋅({ρif f(i)21−ρotherwise))⋅(foldr⁡(ofFn⁡(f))(z,tail↦{h(z1)ρ⋅tailif z2R(z1)1−ρotherwise,d)−d)2)=(1−qL)⋅V\begin{aligned} & \htmlData{mx=0}{\forall} L \in \htmlData{mx=1}{\mathbb{N}}, \\ & \quad \left(\htmlData{mx=27}{\forall f : \htmlData{mx=22}{\htmlData{mx=20}{\operatorname{Fin}}\,\htmlData{mx=21}{L}} \mathrel{\htmlData{mx=26}{\to}} \htmlData{mx=25}{\htmlData{mx=23}{J} \times \htmlData{mx=24}{\operatorname{Bool}}},\ 0 \mathrel{\htmlData{mx=19}{\leq}} \htmlData{mx=18}{\prod_{i} \htmlData{mx=17}{\htmlData{mx=8}{\htmlData{mx=7}{\htmlData{mx=3}{r}(\htmlData{mx=6}{\htmlData{mx=4}{f}(\htmlData{mx=5}{i})})}_{1}} \cdot \left(\htmlData{mx=16}{\begin{cases} \htmlData{mx=9}{\rho} & \text{if } \htmlData{mx=13}{\htmlData{mx=12}{\htmlData{mx=10}{f}(\htmlData{mx=11}{i})}_{2}} \\ \htmlData{mx=15}{1 - \htmlData{mx=14}{\rho}} & \text{otherwise} \end{cases}}\right)}}}\right) \\ & \quad \htmlData{mx=2}{\land} \left(\htmlData{mx=51}{\sum_{f : \htmlData{mx=30}{\htmlData{mx=28}{\operatorname{Fin}}\,\htmlData{mx=29}{L}} \mathrel{\htmlData{mx=34}{\to}} \htmlData{mx=33}{\htmlData{mx=31}{J} \times \htmlData{mx=32}{\operatorname{Bool}}}} \htmlData{mx=50}{\prod_{i} \htmlData{mx=49}{\htmlData{mx=40}{\htmlData{mx=39}{\htmlData{mx=35}{r}(\htmlData{mx=38}{\htmlData{mx=36}{f}(\htmlData{mx=37}{i})})}_{1}} \cdot \left(\htmlData{mx=48}{\begin{cases} \htmlData{mx=41}{\rho} & \text{if } \htmlData{mx=45}{\htmlData{mx=44}{\htmlData{mx=42}{f}(\htmlData{mx=43}{i})}_{2}} \\ \htmlData{mx=47}{1 - \htmlData{mx=46}{\rho}} & \text{otherwise} \end{cases}}\right)}}}\right) \mathrel{\htmlData{mx=52}{=}} 1 \\ & \quad \htmlData{mx=2}{\land} \left(\htmlData{mx=153}{\sum_{f : \htmlData{mx=106}{\htmlData{mx=104}{\operatorname{Fin}}\,\htmlData{mx=105}{L}} \mathrel{\htmlData{mx=110}{\to}} \htmlData{mx=109}{\htmlData{mx=107}{J} \times \htmlData{mx=108}{\operatorname{Bool}}}} \htmlData{mx=152}{\left(\htmlData{mx=126}{\prod_{i} \htmlData{mx=125}{\htmlData{mx=116}{\htmlData{mx=115}{\htmlData{mx=111}{r}(\htmlData{mx=114}{\htmlData{mx=112}{f}(\htmlData{mx=113}{i})})}_{1}} \cdot \left(\htmlData{mx=124}{\begin{cases} \htmlData{mx=117}{\rho} & \text{if } \htmlData{mx=121}{\htmlData{mx=120}{\htmlData{mx=118}{f}(\htmlData{mx=119}{i})}_{2}} \\ \htmlData{mx=123}{1 - \htmlData{mx=122}{\rho}} & \text{otherwise} \end{cases}}\right)}}\right) \cdot \htmlData{mx=151}{\htmlData{mx=133}{\operatorname{foldr}\left(\htmlData{mx=132}{\htmlData{mx=130}{\operatorname{ofFn}}(\htmlData{mx=131}{f})}\right)}\left(\htmlData{mx=149}{z, \mathit{tail} \mapsto \htmlData{mx=148}{\begin{cases} \htmlData{mx=140}{\htmlData{mx=138}{\frac{\htmlData{mx=136}{\htmlData{mx=134}{h}(\htmlData{mx=135}{z_{1}})}}{\htmlData{mx=137}{\rho}}} \cdot \htmlData{mx=139}{\mathit{tail}}} & \text{if } \htmlData{mx=141}{z_{2}} \\ \htmlData{mx=147}{\frac{\htmlData{mx=144}{\htmlData{mx=142}{R}(\htmlData{mx=143}{z_{1}})}}{\htmlData{mx=146}{1 - \htmlData{mx=145}{\rho}}}} & \text{otherwise} \end{cases}}}, \htmlData{mx=150}{d}\right)}}}\right) \\ & \quad \quad \htmlData{mx=53}{=} \htmlData{mx=154}{d} \\ & \quad \htmlData{mx=2}{\land} \left(\htmlData{mx=261}{\sum_{f : \htmlData{mx=211}{\htmlData{mx=209}{\operatorname{Fin}}\,\htmlData{mx=210}{L}} \mathrel{\htmlData{mx=215}{\to}} \htmlData{mx=214}{\htmlData{mx=212}{J} \times \htmlData{mx=213}{\operatorname{Bool}}}} \htmlData{mx=260}{\left(\htmlData{mx=231}{\prod_{i} \htmlData{mx=230}{\htmlData{mx=221}{\htmlData{mx=220}{\htmlData{mx=216}{r}(\htmlData{mx=219}{\htmlData{mx=217}{f}(\htmlData{mx=218}{i})})}_{1}} \cdot \left(\htmlData{mx=229}{\begin{cases} \htmlData{mx=222}{\rho} & \text{if } \htmlData{mx=226}{\htmlData{mx=225}{\htmlData{mx=223}{f}(\htmlData{mx=224}{i})}_{2}} \\ \htmlData{mx=228}{1 - \htmlData{mx=227}{\rho}} & \text{otherwise} \end{cases}}\right)}}\right) \cdot \htmlData{mx=259}{\left(\htmlData{mx=258}{\htmlData{mx=256}{\htmlData{mx=238}{\operatorname{foldr}\left(\htmlData{mx=237}{\htmlData{mx=235}{\operatorname{ofFn}}(\htmlData{mx=236}{f})}\right)}\left(\htmlData{mx=254}{z, \mathit{tail} \mapsto \htmlData{mx=253}{\begin{cases} \htmlData{mx=245}{\htmlData{mx=243}{\frac{\htmlData{mx=241}{\htmlData{mx=239}{h}(\htmlData{mx=240}{z_{1}})}}{\htmlData{mx=242}{\rho}}} \cdot \htmlData{mx=244}{\mathit{tail}}} & \text{if } \htmlData{mx=246}{z_{2}} \\ \htmlData{mx=252}{\frac{\htmlData{mx=249}{\htmlData{mx=247}{R}(\htmlData{mx=248}{z_{1}})}}{\htmlData{mx=251}{1 - \htmlData{mx=250}{\rho}}}} & \text{otherwise} \end{cases}}}, \htmlData{mx=255}{d}\right)} - \htmlData{mx=257}{d}}\right)^{2}}}}\right) \\ & \quad \quad \htmlData{mx=155}{=} \htmlData{mx=267}{(\htmlData{mx=265}{1 - \htmlData{mx=264}{\htmlData{mx=262}{q}^{\htmlData{mx=263}{L}}}}) \cdot \htmlData{mx=266}{V}} \end{aligned}
What the notation means · or point at any symbol
Type
Type: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Type)
Fintype
Fintype: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fintype)
f(x)Function application
Fintype applied to J. Lean writes f x; papers write f(x). (Fintype J)
⟹Implies
If J, then ℝ. (Between types, A → B is the type of functions from A to B.) (J → ℝ)
x : TVariables
r, h, R range over J → ℝ: the statement must hold for every choice. ((r h R : J → ℝ))
x ∈ TVariables
ρ, θ, q, d, V range over real numbers: the statement must hold for every choice. ((ρ θ q d V : ℝ))
∀For all
The statement after the comma holds for every j. (∀ j, 0 ≤ r j)
∑Summation
Add up r(j) for every j. (∑ j, r j)
=Equality
∑ j, r(j) and 1 are the same. (∑ j, r j = 1)
<Less than
0 is strictly smaller than ρ. (0 < ρ)
a/bDivision
∑ j, r(j) · R(j)^2 divided by 1 − ρ. In Lean, dividing by 0 gives 0. ((∑ j, r j * R j ^ 2) / (1 - ρ))
RReal numbers
The real numbers: every point on the number line. (ℝ)
≤At most
0 is less than or equal to r(j). (0 ≤ r j)
·Multiplication
r(j) times h(j). (r j * h j)
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
aᵇPower
h(j) raised to the power 2. (h j ^ 2)
Fin
Fin: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fin)
-Subtraction
1 minus θ. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (1 - θ)
×Product
Pairs of an element of J and an element of Bool. (J × Bool)
Bool
Bool: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Bool)
∏Product
Multiply together r(f(i)).1 · ρ if f(i).2, else 1 − ρ for every i. (∏ i, r (f i).1 * (if (f i).2 then ρ els…)
p₁Component
Component 1 of r(f(i)) (the first). (r (f i).1)
+Addition
V plus d^2. (V + d ^ 2)
{ a if c; b otherwiseCases (if … then … else)
ρ when f(i).2, and 1 − ρ otherwise. (if (f i).2 then ρ else 1 - ρ)
∧And
Both hold: (∑ f, (∏ i, r(f(i)).1 · ρ if f(i).2, else 1 − ρ) · foldr(o…, and (∑ f, (∏ i, r(f(i)).1 · ρ if f(i).2, else 1 − ρ) · (foldr(…. ((∑ f : Fin L → J × Bool, (∏ i, r (f i).…)
e.ffoldr
foldr of ofFn(f): Lean's dot notation e.foldr means foldr applied to e. ((List.ofFn f).foldr)
ofFn
List.ofFn: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (List.ofFn)
x ↦ f(x)Function (λ-abstraction)
The function sending z, tail to h(z.1)/ρ · tail if z.2, else R(z.1)/(1 − ρ). Lean writes fun x => …; papers write x ↦ …. (fun z tail => if z.2 then (h z.1 / ρ) *…)

Defines actual finite independent reference-key/geometric-branch path probabilities and terminal/prefix/dense-tail fold. Proves nonnegative normalized weights, exact mean and centered second moment for every deadline. The stationary variance parameter is explicitly related to one-step raw moments; the unbounded probability space and vector variance remain paper proofs.

How it was proved

Proved
6 October 2026
By
Ajax
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
85 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements