Samplinglib
Lean gate not recorded for this source state main · 9bb7a7394ab0

Actual enhanced-state termination and terminal FORS execution

ASTIS expanded execution component for Fan Chen, Sinho Chewi, Jianfeng Lu and Matthew S. Zhang, Smoothed Picard Hamiltonian Monte Carlo. Actual kernel-power execution and terminal fiber guarantees, not a full main result.

arXiv:2609.06906v1 · Algorithm3.3,Section6.3 (6.4) and terminal stage · faithful paraphrase

Complete source statement (Samplinglib restatement)

B>0 and0<eps<=1/2. On D={s:b>=1/B}, bbar(s)=b. TN and txp are measurable; the true terminal gradient threshold is attained, every earlier iterate fails it, and norm(th-txp)<=sqrt(d*A). There exist Markov kernels Lt:S->E and P:S->S. P(s) is dirac(s) on D and otherwise the pushforward of M(s) product standardGaussian by update(s,·). (P^J)(s0)(D)=1, and for every natural m, (Lt composed with P^(J+m))(s0)=(Lt composed with P^J)(s0). For every state s, output_s is measurable, trho_s mapped by output_s equals this same Lt(s), never-success has trho_s measure zero, and the nonnegative integral of1+queryCount is at most1+2*exp(2). tpi_s is a probability mutually absolutely continuous with Lt(s); both RN q-powers are integrable under their respective denominator laws, with strictly positive integrals at most1+eps^2, and their logarithms divided by q-1 are at most eps^2.

  • E is a finite-dimensional real inner-product Borel space with positive dimension d. V:E->R is fixed and C2, with genuine Hessian between kappa^(-1)*norm(w)^2 and norm(w)^2, where kappa is a nonnegative real with kappa>=1. The baseline smoothness is one.
  • The full state space is S=NNReal x E x E x Nat x (Nat->E), with s=(b,u,xref,k,history). Fix any initial state s0. M is an actual Markov kernel S->E. eta:S->R is measurable and satisfies0<eta(s)<=c with0<c<1/4. M and eta may depend on all state coordinates. Fix q>=2 and0<Delta<=1/2. Delta is the current recursive-call accuracy; no source accuracy, moment, reference-admissibility or history-validity premise is imposed on M or s0.
  • Define K(r)=(1+r)/(1/kappa+r), tau(s)=K(b) if K(b)>=2 and c otherwise, v(s)=(eta(s)+tau(s))/(1+b). Put L=q+log(K(b0)*d*q/Delta), B=(1/1024)/(sqrt(d*L)+L), J=ceil(8*log(exp(1)*K(b0)/B)), and eps=Delta/sqrt(J+1). These parameters remain fixed after choosing s0. The numerical8 and1/1024 are local sufficient constants, not quoted source constants.
  • For z=(x,zeta), obs(s,z)=x+sqrt(tau(s)/(1+b))*zeta, bplus=b+toNNReal(1/v(s)) and uplus=bplus^(-1)*(b*u+v(s)^(-1)*obs). Define F(s,z)(w)=V(w)+bplus/2*norm(w-uplus)^2 and T(s,z)(w)=w-(1+bplus)^(-1)*grad F(s,z)(w). N(s,z) is the least n whose true gradient square at T^n(x) is at most(1/kappa+bplus)*d, with fallback zero if no index exists. update(s,z)=(bplus,uplus,T^N(x),k+1,prepend(obs,history)). The pre-noise sample x initializes this actual inner first hit.
  • For the terminal extension put bbar(s)=max(b,B^(-1)), A(s)=1/bbar(s), TF_s(w)=V(w)+bbar(s)/2*norm(w-u)^2, TT_s(w)=w-(1+bbar(s))^(-1)*grad TF_s(w). TN(s) is the least n with norm(grad TF_s(TT_s^n(xref)))^2<=d*bbar(s), with fallback zero. Set txp=TT^TN(xref), tg=grad V(txp), th=u-A*tg. This terminal threshold is distinct from the inner threshold.
  • Let nu be Lebesgue measure restricted to(0,1] product standardGaussian. The proposal tproposal_s is the law of th+sqrt(A)*Z. For p=(x,(t,Z)), put zeta=sqrt(A)*Z and w=inner((pi/2)*(cos(pi*t/2)*(x-th)-sin(pi*t/2)*zeta),tg-grad V(th+sin(pi*t/2)*(x-th)+cos(pi*t/2)*zeta)). tW_s(p)=min(1,max(-1,w)). Each attempt consists of a proposal, an independent Poisson(2) batch size, an independent infinite nu sequence and an independent acceptance uniform on[0,1]. It accepts iff that uniform is at most the product over i:Fin batchSize of(1+tW_s(proposal,aux_i))/2.
  • trho_s is the infinite independent attempt law. output_s is the proposal at the first accepting attempt, or zero if there is no success. queryCount is the sum of every batch size whose earlier attempts all failed, including the successful batch. The sampling-only charged count is1+queryCount. tpi_s is the Gaussian law u+sqrt(A)*Z exponentially tilted by -V. Kernel multiplication/powers use the actual full-state transition; Lt composed with P^n is the resulting output law.

Actual finite execution with source terminal precision

\[\varepsilon=\frac{\Delta}{\sqrt{J+1}},\quad P^J(s_0,D)=1,\quad (L_t\circ P^{J+m})(s_0)=(L_t\circ P^J)(s_0).\]

Read the formalized proofs

Each statement and proof below has its own closed Lean disclosure. Samplinglib parents, Mathlib calls and external mathematical sources are distinguished in each proof.

Samplinglib mathematical lesson

Actual enhanced-state termination and terminal FORS execution

AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedTerminalExecution.enhanced_terminal_execution · theorem · Teaching coverage

Read this first

Mathematical statement

B>0 and0<eps≤1/2. On D={s:b≥1/B}, bbar(s)=b. TN and txp are measurable; the true terminal gradient threshold is attained, every earlier iterate fails it, and norm(th-txp)≤sqrt(d*A). There exist Markov kernels Lt:S→E and P:S→S. P(s) is dirac(s) on D and otherwise the pushforward of M(s) product standardGaussian by update(s,·). (P^J)(s0)(D)=1, and for every natural m, (Lt composed with P^(J+m))(s0)=(Lt composed with P^J)(s0). For every state s, output_s is measurable, trho_s mapped by output_s equals this same Lt(s), never-success has trho_s measure zero, and the nonnegative integral of1+queryCount is at most1+2*exp(2). tpi_s is a probability mutually absolutely continuous with Lt(s); both RN q-powers are integrable under their respective denominator laws, with strictly positive integrals at most1+eps^2, and their logarithms divided by q-1 are at most eps^2.

\[\varepsilon=\frac{\Delta}{\sqrt{J+1}},\quad P^J(s_0,D)=1,\quad (L_t\circ P^{J+m})(s_0)=(L_t\circ P^J)(s_0).\]
Lean statement · enhanced_terminal_execution

Actual retained-state transition, derived terminal parameters, probability-one terminal support and constructed FORS output law with fiber guarantees.

Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

theorem enhanced_terminal_execution {V : E → ℝ} (κ : ℝ≥0) (hκ : 1 ≤ κ)
    (hV : ContDiff ℝ 2 V)
    (hH : ∀ x w : E, (κ:ℝ)⁻¹*‖w‖^2 ≤ fderiv ℝ (fderiv ℝ V) x w w ∧
      fderiv ℝ (fderiv ℝ V) x w w ≤ ‖w‖^2)
    (hd : 0 < Module.finrank ℝ E)
    (η : S → ℝ) (hηm : Measurable η) (c q Δ : ℝ)
    (hc : 0 < c) (hc1 : c < 1/4) (hη : ∀ s, 0 < η s ∧ η s ≤ c)
    (hq : 2 ≤ q) (hΔ : 0 < Δ) (hΔ1 : Δ ≤ 1/2)
    (s0 : S) (M : Kernel S E) [IsMarkovKernel M] :
    let d : ℝ := Module.finrank ℝ E
    let K := fun r : ℝ => (1+r)/((κ:ℝ)⁻¹+r)
    let τ := fun s : S => if 2 ≤ K s.1 then K s.1 else c
    let L := q+Real.log (K s0.1*d*q/Δ)
    let B := (1/1024)/(Real.sqrt (d*L)+L)
    let J := Nat.ceil (8*Real.log (Real.exp 1*K s0.1/B))
    let eps := Δ/Real.sqrt ((J:ℝ)+1)
    let v := fun s : S => (η s+τ s)/(1+s.1)
    let bp := fun s : S => s.1+Real.toNNReal (v s)⁻¹
    let obs := fun p : S × (E × E) => p.2.1+Real.sqrt (τ p.1/(1+p.1.1)) • p.2.2
    let center := fun p : S × (E × E) => (bp p.1:ℝ)⁻¹ •
      ((p.1.1:ℝ) • p.1.2.1+(v p.1)⁻¹ • obs p)
    let F := fun p x => V x+(bp p.1:ℝ)/2*‖x-center p‖^2
    let T := fun p x => x-(1+(bp p.1:ℝ))⁻¹ • gradient (F p) x
    let Qn := fun n p => ‖gradient (F p) ((T p)^[n] p.2.1)‖^2
    let N := firstIndex Qn (fun p => ((κ:ℝ)⁻¹+bp p.1)*d)
    let update := fun p : S × (E × E) =>
      (bp p.1,center p,(T p)^[N p] p.2.1,p.1.2.2.2.1+1,
        fun n => Nat.casesOn n (obs p) p.1.2.2.2.2)
    let bb := fun s : S => max (s.1:ℝ) B⁻¹
    let TF := fun s x => V x+bb s/2*‖x-s.2.1‖^2
    let TT := fun s x => x-(1+bb s)⁻¹ • gradient (TF s) x
    let TQn := fun n s => ‖gradient (TF s) ((TT s)^[n] (s.2.2.1))‖^2
    let TN := firstIndex TQn (fun s => d*bb s)
    let txp := fun s => (TT s)^[TN s] (s.2.2.1)
    let TA := fun s => (bb s)⁻¹
    let tg := fun s => gradient V (txp s)
    let th := fun s => s.2.1-TA s • tg s
    let tnu := (volume.restrict (Ioc (0 : ℝ) 1)).prod (stdGaussian E)
    let tW := fun s (p : E × (ℝ × E)) => min 1 (max (-1) (scaledCached V TA th tg ((s,p.1),p.2)))
    let tproposal := fun s => (stdGaussian E).map (fun z => th s+Real.sqrt (TA s) • z)
    let trho := fun s => Measure.infinitePi (fun _ : ℕ => attemptLaw (tproposal s) tnu 1 (by norm_num))
    let tpi := fun s => ((stdGaussian E).map (fun z => s.2.1+Real.sqrt (TA s) • z)).tilted (fun x => -V x)
    0 < B ∧ 0 < eps ∧ eps ≤ 1/2 ∧
    (∀ s : S, B⁻¹ ≤ (s.1:ℝ) → bb s=(s.1:ℝ)) ∧
    Measurable TN ∧ Measurable txp ∧
    (∀ s, TQn (TN s) s ≤ d*bb s ∧ (∀ j < TN s, d*bb s < TQn j s) ∧
      ‖th s-txp s‖ ≤ Real.sqrt (d*TA s)) ∧
    ∃ (Lt : Kernel S E) (P : Kernel S S), IsMarkovKernel Lt ∧ IsMarkovKernel P ∧
      (∀ s, P s=if B⁻¹ ≤ (s.1:ℝ) then Measure.dirac s else
        ((M s).prod (stdGaussian E)).map (fun z => update (s,z))) ∧
      (P^J) s0 {s | B⁻¹ ≤ (s.1:ℝ)}=1 ∧
      (∀ m, (Lt ∘ₖ (P^(J+m))) s0=(Lt ∘ₖ (P^J)) s0) ∧
      ∀ s,
      (Measurable (output (tW s) 1 0) ∧ (trho s).map (output (tW s) 1 0)=Lt s ∧
        trho s {ω | ∀ n, ω n ∉ accepted (tW s) 1}=0 ∧
        (∫⁻ ω, 1+queryCount (tW s) 1 ω ∂trho s) ≤ ENNReal.ofReal (1+2*Real.exp 2)) ∧
      IsProbabilityMeasure (tpi s) ∧ tpi s ≪ Lt s ∧ Lt s ≪ tpi s ∧
      Integrable (fun x => ((tpi s).rnDeriv (Lt s) x).toReal^q) (Lt s) ∧
      Integrable (fun x => ((Lt s).rnDeriv (tpi s) x).toReal^q) (tpi s) ∧
      0 < (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s) ∧
      0 < (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s) ∧
      (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s) ≤ 1+eps^2 ∧
      (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s) ≤ 1+eps^2 ∧
      Real.log (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s)/(q-1) ≤ eps^2 ∧
      Real.log (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s)/(q-1) ≤ eps^2

Exact module and namespace context

Proof roadmap

  1. 1Fix the source terminal precision

    With L≥2, the depth bound at C=8 and gamma=1/1024 gives J≤64L because log1024≤10. Thus J+1≤65L. Monotonicity of log, log65≤7 and log L≤L-1 imply log(J+1)≤4L. Since K(b0)*d*q≥1, q+log(1/Delta)≤L. Therefore H=q+log(1/eps)≤3L for the actual eps=Delta/sqrt(J+1). Positivity and eps≤1/2 follow from sqrt(J+1)≥1.

  2. 2Derive the sufficient terminal threshold

    The bound H≤3L yields sqrt(dH)≤3sqrt(dL), a sufficient loose bound. Hence64(sqrt(dH)+H)≤192(sqrt(dL)+L)≤1024(sqrt(dL)+L)=1/B. Actual LogarithmicDepth supplies L≥2 and the depth upper bound; compatibility is proved rather than assumed. Its constant eta=c invocation obtains scalar bounds only, while stopping of the actual state-dependent schedule is proved separately below.

  3. 3Construct the real reference-carrying transition

    The piecewise tau is measurable and positive. Apply ReferenceCarryingKernel with alpha=1/kappa,beta=1 and threshold1/B. Its actual inner first hit starts at the pre-noise sample, updates the precision and center using the noisy observation, and retains the new reference,count and history. The update is jointly measurable; its sampling law is M_s times fresh Gaussian. The new precision is b+1/v; no projected-state Markov claim is used.

  4. 4Compare each absorbed path with its scalar schedule

    For an arbitrary observation sequence define the full absorbed path x_n. Choose the scalar schedule eta_n=eta(x_n); it obeys the same bounds even though it depends on the retained reference/history. Induction shows that either x_n is already terminal or its precision equals the unabsorbed scalar recurrence r_n. Once terminal, the path stays fixed. Applying LogarithmicDepth to this particular schedule forces terminal membership at J.

  5. 5Turn pathwise termination into actual probability-one support

    Represent the absorbing kernel as the pushforward of Q_s=M_s times Gaussian by the absorbed update G_s. Induct on the remaining path length: the endpoint lies inD for every continuation, so the inner kernel probability is one at each first observation. Kernel composition and the pushforward nonnegative-integral formula integrate this constant one. This proves the endpoint mass without inventing a trajectory measure.

  6. 6Prove stability under extra finite caps

    For s inD, P_s is dirac(s), so induction gives (Lt composed with P^n)(s)=Lt(s). The probability-one terminal support means the state after J belongs toD almost everywhere. Split P^(J+m) into powers, use associativity and bind congruence, and replace the remaining output law on this full-measure set. This works for each Markov Lt; the final theorem instantiates the actual one constructed below.

  7. 7Extend terminal parameters measurably and construct the terminal reference

    bbar=max(b,1/B) is measurable and positive and meets the derived terminal64 condition everywhere. OnD it equals b, so all terminal parameters agree with the genuine ones there. Apply TerminalFORSKernel to bbar, the actual center and retained reference. It proves measurable TN/txp, least terminal threshold attainment and the center residual; no terminal reference is supplied freely.

  8. 8Use the actual same terminal retry program

    The scaled cached arc estimator, Poisson attempts and first-success output are the concrete definitions used by TerminalFORSKernel. Its kernel Lt has exactly that output pushforward and zero never-success probability. The count includes every attempted full batch, including the successful batch, and one cached gradient charge. The bound1+2exp2 excludes terminal GD and all earlier stage work.

  9. 9Retain both denominator laws in terminal accuracy

    For each state, the same terminal theorem makes tpi a probability and gives mutual absolute continuity. The q-power of d tpi/d Lt is integrated under Lt; the reverse derivative is integrated under tpi. Both integrals are finite,positive,at most1+eps^2, with normalized log bounds eps^2. OnD these are the actual terminal targets. No mixture or recursive accuracy conclusion follows merely from these fiber bounds.

  10. 10Close the concrete execution consumer

    First derive the terminal parameter certificate, construct Lt at precisely those parameters, then instantiate the actual enhanced-state execution with this Lt. The resulting P uses the original M and retained-state update; its support and cap-stability conclusions concern the same constructed terminal program. Initial admissibility, M approximation guarantees, final mixed-output accuracy and cumulative query costs remain separate proof obligations.

Full assumptions and notation

All objects and hypotheses

  • E is a finite-dimensional real inner-product Borel space with positive dimension d. V:E→R is fixed and C2, with genuine Hessian between kappa^(-1)*norm(w)^2 and norm(w)^2, where kappa is a nonnegative real with kappa≥1. The baseline smoothness is one.
  • The full state space is S=NNReal x E x E x Nat x (Nat→E), with s=(b,u,xref,k,history). Fix any initial state s0. M is an actual Markov kernel S→E. eta:S→R is measurable and satisfies0<eta(s)≤c with0<c<1/4. M and eta may depend on all state coordinates. Fix q≥2 and0<Delta≤1/2. Delta is the current recursive-call accuracy; no source accuracy, moment, reference-admissibility or history-validity premise is imposed on M or s0.
  • Define K(r)=(1+r)/(1/kappa+r), tau(s)=K(b) if K(b)≥2 and c otherwise, v(s)=(eta(s)+tau(s))/(1+b). Put L=q+log(K(b0)*d*q/Delta), B=(1/1024)/(sqrt(d*L)+L), J=ceil(8*log(exp(1)*K(b0)/B)), and eps=Delta/sqrt(J+1). These parameters remain fixed after choosing s0. The numerical8 and1/1024 are local sufficient constants, not quoted source constants.
  • For z=(x,zeta), obs(s,z)=x+sqrt(tau(s)/(1+b))*zeta, bplus=b+toNNReal(1/v(s)) and uplus=bplus^(-1)*(b*u+v(s)^(-1)*obs). Define F(s,z)(w)=V(w)+bplus/2*norm(w-uplus)^2 and T(s,z)(w)=w-(1+bplus)^(-1)*grad F(s,z)(w). N(s,z) is the least n whose true gradient square at T^n(x) is at most(1/kappa+bplus)*d, with fallback zero if no index exists. update(s,z)=(bplus,uplus,T^N(x),k+1,prepend(obs,history)). The pre-noise sample x initializes this actual inner first hit.
  • For the terminal extension put bbar(s)=max(b,B^(-1)), A(s)=1/bbar(s), TF_s(w)=V(w)+bbar(s)/2*norm(w-u)^2, TT_s(w)=w-(1+bbar(s))^(-1)*grad TF_s(w). TN(s) is the least n with norm(grad TF_s(TT_s^n(xref)))^2≤d*bbar(s), with fallback zero. Set txp=TT^TN(xref), tg=grad V(txp), th=u-A*tg. This terminal threshold is distinct from the inner threshold.
  • Let nu be Lebesgue measure restricted to(0,1] product standardGaussian. The proposal tproposal_s is the law of th+sqrt(A)*Z. For p=(x,(t,Z)), put zeta=sqrt(A)*Z and w=inner((pi/2)*(cos(pi*t/2)*(x-th)-sin(pi*t/2)*zeta),tg-grad V(th+sin(pi*t/2)*(x-th)+cos(pi*t/2)*zeta)). tW_s(p)=min(1,max(-1,w)). Each attempt consists of a proposal, an independent Poisson(2) batch size, an independent infinite nu sequence and an independent acceptance uniform on[0,1]. It accepts iff that uniform is at most the product over i:Fin batchSize of(1+tW_s(proposal,aux_i))/2.
  • trho_s is the infinite independent attempt law. output_s is the proposal at the first accepting attempt, or zero if there is no success. queryCount is the sum of every batch size whose earlier attempts all failed, including the successful batch. The sampling-only charged count is1+queryCount. tpi_s is the Gaussian law u+sqrt(A)*Z exponentially tilted by -V. Kernel multiplication/powers use the actual full-state transition; Lt composed with P^n is the resulting output law.

Mathematical proof

1. Fix the source terminal precision

With L≥2, the depth bound at C=8 and gamma=1/1024 gives J≤64L because log1024≤10. Thus J+1≤65L. Monotonicity of log, log65≤7 and log L≤L-1 imply log(J+1)≤4L. Since K(b0)*d*q≥1, q+log(1/Delta)≤L. Therefore H=q+log(1/eps)≤3L for the actual eps=Delta/sqrt(J+1). Positivity and eps≤1/2 follow from sqrt(J+1)≥1.

\[H=q+\log(1/\varepsilon)\le L+\tfrac12\log(J+1)\le3L.\]
Corresponding Lean step

Precision.compatible: hs0,hs1,heps0,heps1,hlog1024,hj64,hj65,hjlog,hbase,hH,hH3

2. Derive the sufficient terminal threshold

The bound H≤3L yields sqrt(dH)≤3sqrt(dL), a sufficient loose bound. Hence64(sqrt(dH)+H)≤192(sqrt(dL)+L)≤1024(sqrt(dL)+L)=1/B. Actual LogarithmicDepth supplies L≥2 and the depth upper bound; compatibility is proved rather than assumed. Its constant eta=c invocation obtains scalar bounds only, while stopping of the actual state-dependent schedule is proved separately below.

\[64(\sqrt{dH}+H)\le1024(\sqrt{dL}+L)=B^{-1}.\]
Corresponding Lean step

Precision.compatible: hs; Actual.execution: hdepth,hK0,hdc,hprec,hthreshold

3. Construct the real reference-carrying transition

The piecewise tau is measurable and positive. Apply ReferenceCarryingKernel with alpha=1/kappa,beta=1 and threshold1/B. Its actual inner first hit starts at the pre-noise sample, updates the precision and center using the noisy observation, and retains the new reference,count and history. The update is jointly measurable; its sampling law is M_s times fresh Gaussian. The new precision is b+1/v; no projected-state Markov claim is used.

\[P_s=\begin{cases}\delta_s,&s\in D,\\(\mathrm{update}_s)_\#(M_s\otimes\gamma_E),&s\notin D.\end{cases}\]
Corresponding Lean step

Actual.firstIndex; Actual.execution: htm,ht0,href,hum,hPs,Q,hstep

4. Compare each absorbed path with its scalar schedule

For an arbitrary observation sequence define the full absorbed path x_n. Choose the scalar schedule eta_n=eta(x_n); it obeys the same bounds even though it depends on the retained reference/history. Induction shows that either x_n is already terminal or its precision equals the unabsorbed scalar recurrence r_n. Once terminal, the path stays fixed. Applying LogarithmicDepth to this particular schedule forces terminal membership at J.

\[x_n\in D\quad\text{or}\quad b(x_n)=r_n;\qquad x_J\in D.\]
Corresponding Lean step

Paths.termination: statePath,statePath_shift,absorbed_precision_path,pathwise_log_depth

5. Turn pathwise termination into actual probability-one support

Represent the absorbing kernel as the pushforward of Q_s=M_s times Gaussian by the absorbed update G_s. Induct on the remaining path length: the endpoint lies inD for every continuation, so the inner kernel probability is one at each first observation. Kernel composition and the pushforward nonnegative-integral formula integrate this constant one. This proves the endpoint mass without inventing a trajectory measure.

\[(P^J)(s_0,D)=\int 1\,dQ_{s_0}=1.\]
Corresponding Lean step

Paths.termination: path_endpoint_mass,hPmap,hmass; Actual.execution: hQ,hpath,hPf

6. Prove stability under extra finite caps

For s inD, P_s is dirac(s), so induction gives (Lt composed with P^n)(s)=Lt(s). The probability-one terminal support means the state after J belongs toD almost everywhere. Split P^(J+m) into powers, use associativity and bind congruence, and replace the remaining output law on this full-measure set. This works for each Markov Lt; the final theorem instantiates the actual one constructed below.

\[(L_t\circ P^{J+m})(s_0)=\int_D L_t(s)\,P^J(s_0,ds)=(L_t\circ P^J)(s_0).\]
Corresponding Lean step

Paths.termination: finite_output_stability,hstop,hp; Actual.execution

7. Extend terminal parameters measurably and construct the terminal reference

bbar=max(b,1/B) is measurable and positive and meets the derived terminal64 condition everywhere. OnD it equals b, so all terminal parameters agree with the genuine ones there. Apply TerminalFORSKernel to bbar, the actual center and retained reference. It proves measurable TN/txp, least terminal threshold attainment and the center residual; no terminal reference is supplied freely.

\[\bar b_s=\max(b_s,B^{-1}),\quad s\in D\Rightarrow\bar b_s=b_s,\quad\|t h_s-t x_{p,s}\|\le\sqrt{d/\bar b_s}.\]
Corresponding Lean step

firstIndex; terminal_extension: hbb,hbb0,hbstep,ht,hn,hx,hres

8. Use the actual same terminal retry program

The scaled cached arc estimator, Poisson attempts and first-success output are the concrete definitions used by TerminalFORSKernel. Its kernel Lt has exactly that output pushforward and zero never-success probability. The count includes every attempted full batch, including the successful batch, and one cached gradient charge. The bound1+2exp2 excludes terminal GD and all earlier stage work.

\[(\mathrm{output}_s)_\#\rho_s=L_t(s),\quad\rho_s(\text{never success})=0,\quad\int^-(1+C_s)d\rho_s\le1+2e^2.\]
Corresponding Lean step

scaledCached; Attempt; attemptLaw; accepted; output; queryCount; terminal_extension: hprog

9. Retain both denominator laws in terminal accuracy

For each state, the same terminal theorem makes tpi a probability and gives mutual absolute continuity. The q-power of d tpi/d Lt is integrated under Lt; the reverse derivative is integrated under tpi. Both integrals are finite,positive,at most1+eps^2, with normalized log bounds eps^2. OnD these are the actual terminal targets. No mixture or recursive accuracy conclusion follows merely from these fiber bounds.

\[0<\int(d\pi_s/dL_t(s))^q\,dL_t(s)\le1+\varepsilon^2\quad\text{and reverse}.\]
Corresponding Lean step

terminal_extension: hpi,hab,hba,hI1,hI2,hp1,hp2,hu1,hu2,hlog1,hlog2

10. Close the concrete execution consumer

First derive the terminal parameter certificate, construct Lt at precisely those parameters, then instantiate the actual enhanced-state execution with this Lt. The resulting P uses the original M and retained-state update; its support and cap-stability conclusions concern the same constructed terminal program. Initial admissibility, M approximation guarantees, final mixed-output accuracy and cumulative query costs remain separate proof obligations.

\[\nu_{\rm out}=(L_t\circ P^J)(s_0),\qquad\varepsilon^2=\Delta^2/(J+1).\]
Corresponding Lean step

enhanced_terminal_execution: hfirst,hbound,ht,hactual,hacc

Lean verification

The exact proof begins folded immediately after the mathematical argument; the statement is folded beside the claim above.

Lean proof · enhanced_terminal_execution

Source precision bound, full-state absorbed path comparison, kernel support induction, actual terminal construction and finite cap stability.

Braces mark parameters Lean can infer; square brackets request structures such as a measurable space or probability measure. Named hypotheses are mathematical premises, not facts established by this declaration. Section parameters are described in the mathematical hypotheses above; the module link retains their exact source context.

Download module (.lean)
theorem enhanced_terminal_execution {V : E → ℝ} (κ : ℝ≥0) (hκ : 1 ≤ κ)
    (hV : ContDiff ℝ 2 V)
    (hH : ∀ x w : E, (κ:ℝ)⁻¹*‖w‖^2 ≤ fderiv ℝ (fderiv ℝ V) x w w ∧
      fderiv ℝ (fderiv ℝ V) x w w ≤ ‖w‖^2)
    (hd : 0 < Module.finrank ℝ E)
    (η : S → ℝ) (hηm : Measurable η) (c q Δ : ℝ)
    (hc : 0 < c) (hc1 : c < 1/4) (hη : ∀ s, 0 < η s ∧ η s ≤ c)
    (hq : 2 ≤ q) (hΔ : 0 < Δ) (hΔ1 : Δ ≤ 1/2)
    (s0 : S) (M : Kernel S E) [IsMarkovKernel M] :
    let d : ℝ := Module.finrank ℝ E
    let K := fun r : ℝ => (1+r)/((κ:ℝ)⁻¹+r)
    let τ := fun s : S => if 2 ≤ K s.1 then K s.1 else c
    let L := q+Real.log (K s0.1*d*q/Δ)
    let B := (1/1024)/(Real.sqrt (d*L)+L)
    let J := Nat.ceil (8*Real.log (Real.exp 1*K s0.1/B))
    let eps := Δ/Real.sqrt ((J:ℝ)+1)
    let v := fun s : S => (η s+τ s)/(1+s.1)
    let bp := fun s : S => s.1+Real.toNNReal (v s)⁻¹
    let obs := fun p : S × (E × E) => p.2.1+Real.sqrt (τ p.1/(1+p.1.1)) • p.2.2
    let center := fun p : S × (E × E) => (bp p.1:ℝ)⁻¹ •
      ((p.1.1:ℝ) • p.1.2.1+(v p.1)⁻¹ • obs p)
    let F := fun p x => V x+(bp p.1:ℝ)/2*‖x-center p‖^2
    let T := fun p x => x-(1+(bp p.1:ℝ))⁻¹ • gradient (F p) x
    let Qn := fun n p => ‖gradient (F p) ((T p)^[n] p.2.1)‖^2
    let N := firstIndex Qn (fun p => ((κ:ℝ)⁻¹+bp p.1)*d)
    let update := fun p : S × (E × E) =>
      (bp p.1,center p,(T p)^[N p] p.2.1,p.1.2.2.2.1+1,
        fun n => Nat.casesOn n (obs p) p.1.2.2.2.2)
    let bb := fun s : S => max (s.1:ℝ) B⁻¹
    let TF := fun s x => V x+bb s/2*‖x-s.2.1‖^2
    let TT := fun s x => x-(1+bb s)⁻¹ • gradient (TF s) x
    let TQn := fun n s => ‖gradient (TF s) ((TT s)^[n] (s.2.2.1))‖^2
    let TN := firstIndex TQn (fun s => d*bb s)
    let txp := fun s => (TT s)^[TN s] (s.2.2.1)
    let TA := fun s => (bb s)⁻¹
    let tg := fun s => gradient V (txp s)
    let th := fun s => s.2.1-TA s • tg s
    let tnu := (volume.restrict (Ioc (0 : ℝ) 1)).prod (stdGaussian E)
    let tW := fun s (p : E × (ℝ × E)) => min 1 (max (-1) (scaledCached V TA th tg ((s,p.1),p.2)))
    let tproposal := fun s => (stdGaussian E).map (fun z => th s+Real.sqrt (TA s) • z)
    let trho := fun s => Measure.infinitePi (fun _ : ℕ => attemptLaw (tproposal s) tnu 1 (by norm_num))
    let tpi := fun s => ((stdGaussian E).map (fun z => s.2.1+Real.sqrt (TA s) • z)).tilted (fun x => -V x)
    0 < B ∧ 0 < eps ∧ eps ≤ 1/2 ∧
    (∀ s : S, B⁻¹ ≤ (s.1:ℝ) → bb s=(s.1:ℝ)) ∧
    Measurable TN ∧ Measurable txp ∧
    (∀ s, TQn (TN s) s ≤ d*bb s ∧ (∀ j < TN s, d*bb s < TQn j s) ∧
      ‖th s-txp s‖ ≤ Real.sqrt (d*TA s)) ∧
    ∃ (Lt : Kernel S E) (P : Kernel S S), IsMarkovKernel Lt ∧ IsMarkovKernel P ∧
      (∀ s, P s=if B⁻¹ ≤ (s.1:ℝ) then Measure.dirac s else
        ((M s).prod (stdGaussian E)).map (fun z => update (s,z))) ∧
      (P^J) s0 {s | B⁻¹ ≤ (s.1:ℝ)}=1 ∧
      (∀ m, (Lt ∘ₖ (P^(J+m))) s0=(Lt ∘ₖ (P^J)) s0) ∧
      ∀ s,
      (Measurable (output (tW s) 1 0) ∧ (trho s).map (output (tW s) 1 0)=Lt s ∧
        trho s {ω | ∀ n, ω n ∉ accepted (tW s) 1}=0 ∧
        (∫⁻ ω, 1+queryCount (tW s) 1 ω ∂trho s) ≤ ENNReal.ofReal (1+2*Real.exp 2)) ∧
      IsProbabilityMeasure (tpi s) ∧ tpi s ≪ Lt s ∧ Lt s ≪ tpi s ∧
      Integrable (fun x => ((tpi s).rnDeriv (Lt s) x).toReal^q) (Lt s) ∧
      Integrable (fun x => ((Lt s).rnDeriv (tpi s) x).toReal^q) (tpi s) ∧
      0 < (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s) ∧
      0 < (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s) ∧
      (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s) ≤ 1+eps^2 ∧
      (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s) ≤ 1+eps^2 ∧
      Real.log (∫ x, ((tpi s).rnDeriv (Lt s) x).toReal^q ∂Lt s)/(q-1) ≤ eps^2 ∧
      Real.log (∫ x, ((Lt s).rnDeriv (tpi s) x).toReal^q ∂tpi s)/(q-1) ≤ eps^2 := by
  classical
  intro d K τ L B J eps v bp obs center F T Qn N update bb TF TT TQn TN txp TA tg th tnu tW tproposal trho tpi
  let L0 : Kernel S E := Kernel.const _ (stdGaussian E)
  have hL0 : IsMarkovKernel L0 := by dsimp [L0]; infer_instance
  have hfirst := AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedTerminalExecution.Actual.execution κ hκ hV hH hd η hηm c q Δ hc hc1 hη hq hΔ hΔ1 s0 M L0
  obtain ⟨hB,heps,heps1,hstep,_⟩ := hfirst
  have hκ0 : (0:ℝ≥0) < κ := lt_of_lt_of_le (by norm_num) hκ
  have hαβ : κ⁻¹ ≤ (1:ℝ≥0) := (inv_le_one₀ hκ0).2 hκ
  have hHm : ∀ x w : E, ((κ⁻¹:ℝ≥0):ℝ)*‖w‖^2 ≤ fderiv ℝ (fderiv ℝ V) x w w ∧
      fderiv ℝ (fderiv ℝ V) x w w ≤ ((1:ℝ≥0):ℝ)*‖w‖^2 := by simpa using hH
  have hbound : 64*((1:ℝ≥0):ℝ)*(Real.sqrt (d*(q+Real.log (1/eps)))+(q+Real.log (1/eps))) ≤ B⁻¹ := by
    simpa only [NNReal.coe_one,mul_one] using hstep
  have ht := terminal_extension hV hHm hαβ (by norm_num)
    (show 0 < (Module.finrank ℝ E:ℝ) by exact_mod_cast hd)
    (fun s : S => (s.1:ℝ)) (fun s : S => s.2.1) (fun s : S => s.2.2.1)
    (by fun_prop) (by fun_prop) (by fun_prop) B⁻¹ q eps (inv_pos.2 hB) hq heps heps1 hbound
  obtain ⟨heq,hn,hx,hres,Lt,hLt,hacc⟩ := ht
  let := hLt
  have hactual := AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedTerminalExecution.Actual.execution κ hκ hV hH hd η hηm c q Δ hc hc1 hη hq hΔ hΔ1 s0 M Lt
  obtain ⟨_,_,_,_,P,hP,hPs,hmass,hstable⟩ := hactual
  exact ⟨hB,heps,heps1,heq,hn,hx,hres,Lt,P,hLt,hP,hPs,hmass,hstable,hacc⟩
end AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedTerminalExecution

Exact module and namespace context

Source assumptions versus formal assumptions

SourceActual LeanDifference kindWhy it matters
Source uses normalized smooth strongly convex Euclidean potentials.Coordinate-free positive finite dimension, C2 and genuine Hessian bounds1/kappa and1.API-limitationThe differential API requires stronger regularity; normalization is retained.
Source fixed small threshold and large depth constants.C=8,gamma=1/1024 and terminal64 compatibility are explicitly proved sufficient.source-implicitThese numbers are not source quotations.
Section6.3 uses ell=q and terminal Delta/sqrt(J+1).Exactly these parameters, with q>=2 and0<Delta<=1/2.sameDelta is the current recursive-call precision; A1 instantiatesq=2.
Source M implements a particular smoothed sampler with approximation guarantees.M is any actual full-state Markov kernel.API-limitationExecution and termination need no accuracy; source approximation and mixed-output accuracy are not concluded.
Source execution carries an admissible reference and produced history.Arbitrary initial reference,count and history; actual first-hit updates are retained.generalizationNo initial admissibility or prehistory-origin claim, and hence no borrowed source cost/accuracy.
Terminal sampler is called only inside the terminal domain.Measurable extension bbar=max(b,1/B), equal to b onD; P^J has full mass inD.source-implicitOutside-domain target and initialization differ; no arbitrary-extension comparison theorem is returned.
Source describes recursive execution.Actual full-state kernel powers and stability for all finite caps afterJ.source-implicitNo projected autonomous Markov assumption, separate R_n recursive interface or trajectory measure is returned.
Source main results provide accuracy and query complexity.Terminal fiber RN and sampling-only expected count; no whole-output accuracy or cumulative costs.API-limitationGD initialization, stage totals, high-probability cost and global integrability remain open; TV does not transfer unbounded cost.

Actual full-state kernel-power execution and terminal fiber guarantees, not Theorem6.5 or either complete paper. C2 genuine Hessian bounds strengthen source regularity; baseline beta=1,positive dimension,kappa>=1. Source ell=q and eps=Delta/sqrt(J+1) are used; A1 requiresq=2. Local8,1/1024 and terminal64 are sufficient constants. M is an arbitrary actual Markov kernel with no accuracy/moment guarantee; initial reference,count,history are arbitrary. bbar=max(b,1/B) changes outside-domain target/initialization and equals b only onD; no comparison theorem for arbitrary extensions is returned. The theorem gives kernel powers and cap stability, not a separate recursive R_n interface or trajectory measure. Terminal RN/cost are fiberwise, not final mixed-output accuracy or whole-execution cost. Sampling count excludes GD initialization, stage queries and cache discounts; no source high-probability count, global cost integrability or TV cost transfer.

Encoder–denoiser: accepted · domain-mismatch

Detected semantic differences

  • assumptions: C2/Hessian regularity and coordinate-domain difference disclosed. — Independent formal reviewer accepted: C2/Hessian regularity and coordinate-domain difference disclosed.
  • constant_dependencies: Numericalconstants are proved sufficient,not sourcequoted. — Independent formal reviewer accepted: Numericalconstants are proved sufficient,not sourcequoted.
  • constant_dependencies: Source terminalorder and epsilon match exactly. — Independent formal reviewer accepted: Source terminalorder and epsilon match exactly.
  • assumptions: ArbitraryactualM supports execution only,no sourceaccuracy borrowed. — Independent formal reviewer accepted: ArbitraryactualM supports execution only,no sourceaccuracy borrowed.
  • domains: Arbitrary initialreference/count/history carries no sourceguarantee. — Independent formal reviewer accepted: Arbitrary initialreference/count/history carries no sourceguarantee.
  • domains: Maxextension restoresactualparams onlyonD;outside target differs. — Independent formal reviewer accepted: Maxextension restoresactualparams onlyonD;outside target differs.
  • scopes: Kernelpowers not projectedMarkovness,independentrecursiveinterface or trajectorytheorem. — Independent formal reviewer accepted: Kernelpowers not projectedMarkovness,independentrecursiveinterface or trajectorytheorem.
  • conclusion: Terminalfiberaccuracy/samplingcost not globalerror/totalcost. — Independent formal reviewer accepted: Terminalfiberaccuracy/samplingcost not globalerror/totalcost.

A generalization is not a source correction. Proposed missing conditions require separate independent repair review. No proposed repair silently changes the original theorem.

Scope and omitted-condition boundaries
  • Actual full-state kernel-power execution and terminal fiber guarantees, not Theorem6.5 or either complete paper. C2 genuine Hessian bounds strengthen source regularity; baseline beta=1,positive dimension,kappa≥1. Source ell=q and eps=Delta/sqrt(J+1) are used; A1 requiresq=2. Local8,1/1024 and terminal64 are sufficient constants. M is an arbitrary actual Markov kernel with no accuracy/moment guarantee; initial reference,count,history are arbitrary. bbar=max(b,1/B) changes outside-domain target/initialization and equals b only onD; no comparison theorem for arbitrary extensions is returned. The theorem gives kernel powers and cap stability, not a separate recursive R_n interface or trajectory measure. Terminal RN/cost are fiberwise, not final mixed-output accuracy or whole-execution cost. Sampling count excludes GD initialization, stage queries and cache discounts; no source high-probability count, global cost integrability or TV cost transfer.
Sources, dependencies, and reuse

Source and reuse

Samplinglib parents called

Mathlib API called (external library)

  • Real.log_le_log
  • Real.log_pow
  • Real.sqrt_le_sqrt
  • ProbabilityTheory.Kernel.comp_apply
  • MeasureTheory.lintegral_map
  • MeasureTheory.Measure.bind_congr_right
  • MeasureTheory.mem_ae_iff_prob_eq_one

Mathematical sources

  • SPHMC Algorithm3.3 and Section6.3 — Actual full-state kernel-power execution and terminal fiber guarantees, not Theorem6.5 or either complete paper. C2 genuine Hessian bounds strengthen source regularity; baseline beta=1,positive dimension,kappa>=1. Source ell=q and eps=Delta/sqrt(J+1) are used; A1 requiresq=2. Local8,1/1024 and terminal64 are sufficient constants. M is an arbitrary actual Markov kernel with no accuracy/moment guarantee; initial reference,count,history are arbitrary. bbar=max(b,1/B) changes outside-domain target/initialization and equals b only onD; no comparison theorem for arbitrary extensions is returned. The theorem gives kernel powers and cap stability, not a separate recursive R_n interface or trajectory measure. Terminal RN/cost are fiberwise, not final mixed-output accuracy or whole-execution cost. Sampling count excludes GD initialization, stage queries and cache discounts; no source high-probability count, global cost integrability or TV cost transfer.

Samplinglib prose is not a quotation or a source-equivalence certificate. Definitions and aliases are explained as constructions, not counted as new mathematical proofs.

Which proof obligations and prerequisites are covered?

  • Formalized proof edge; source adapter/review separate Actual enhanced-state termination and terminal FORS execution