Samplinglib
Lean gate not recorded for this source state main · 0e31a3cda412
ASTIS mathematical exposition

Actual finite-output KL with terminal residual discharged

AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedFiniteOutputKL.finite_output_kl · theorem · Teaching coverage

Statement

muV is a probability measure. There exist Markov kernels Lt:S->E,P:S->S,TG:S->E and H:S->E such that P_s=dirac_s when B^(-1)<=b_s and otherwise P_s is the law of U(s,(X,Z)) under M_s times standardGaussian; the actual terminal stream output law (rho_s).map O_s equals Lt_s; TG_s=muV.tilted(x->-(b_s/2)*norm(x-u_s)^2); and H_s=G(TG_s,sqrt(v_s)). Define Q_s=G(M_s,sqrt(tau_s/(1+b_s))) and e(s)=0 when B^(-1)<=b_s,otherwise KL(Q_s||H_s). Then e is measurable,and for every natural m,KL((Lt composed P^(J+m))(s0)||TG_s0)<=sum(j<J,the nonnegative integral of e under(P^j)(s0))+Delta^2/(J+1). The final real term is embedded in the extended nonnegative reals.

\[\operatorname{KL}((L_t\circ P^{J+m})(s_0)\Vert T_{s_0})\le\sum_{j=0}^{J-1}\int e(s)\,P^j(s_0,ds)+\frac{\Delta^2}{J+1},\qquad m\in\mathbb N.\]

All objects and hypotheses

  • E is a positive-dimensional finite-dimensional real inner-product Borel space; d=dim_R E. The nonnegative real kappa satisfies kappa>=1. V:E->R is C2 and kappa^(-1)*norm(w)^2<=D2V(x)[w,w]<=norm(w)^2 for every x,w. This is the normalized beta=1 setting.
  • The full state S=NNReal x E x E x Nat x (Nat->E) is written s=(b,u,xref,k,history). eta:S->R is measurable,0<eta_s<=c,0<c<1/4,0<Delta<=1/2. The initial state s0 is arbitrary and M:S->E is any actual Markov kernel. No initial-history origin,reference admissibility,stage approximation or moment guarantee is assumed.
  • Write K(r)=(1+r)/(kappa^(-1)+r),tau_s=K(b_s) if K(b_s)>=2 and c otherwise,L=2+log(K(b_s0)*d*2/Delta),B=(1/1024)/(sqrt(d*L)+L),J=ceil(8*log(exp(1)*K(b_s0)/B)),eps=Delta/sqrt(J+1). Real inverses and square roots use their total Lean definitions; the proof establishes the required positive denominators.
  • For p=(s,(x,z)),set v_s=(eta_s+tau_s)/(1+b_s),bp_s=b_s+toNNReal(v_s^(-1)),obs(p)=x+sqrt(tau_s/(1+b_s))*z,center(p)=bp_s^(-1)*(b_s*u_s+v_s^(-1)*obs(p)),F_p(w)=V(w)+bp_s/2*norm(w-center(p))^2 and D_p(w)=w-(1+bp_s)^(-1)*grad F_p(w). N_p is the least n with norm(grad F_p(D_p^n(x)))^2<=(kappa^(-1)+bp_s)*d,or0 if no such n exists. U(p)=(bp_s,center(p),D_p^N_p(x),k+1,prepend(obs(p),history)). The actual reference starts at the pre-noise x.
  • For the terminal program,bb_s=max(b_s,B^(-1)),A_s=bb_s^(-1),TF_s(w)=V(w)+bb_s/2*norm(w-u_s)^2 and TD_s(w)=w-(1+bb_s)^(-1)*grad TF_s(w). TN_s is the least n with norm(grad TF_s(TD_s^n(xref_s)))^2<=d*bb_s,or0 if none exists. Put xp_s=TD_s^TN_s(xref_s),g_s=grad V(xp_s),h_s=u_s-A_s*g_s.
  • For an auxiliary draw a=(t,z) and terminal candidate x,let theta=pi*t/2 and Z=sqrt(A_s)*z. Define W_s(x,a)=clip[-1,1](inner((pi/2)*(cos(theta)*(x-h_s)-sin(theta)*Z),g_s-grad V(h_s+sin(theta)*(x-h_s)+cos(theta)*Z))). The auxiliary law nu is volume restricted to(0,1] times standardGaussian; the proposal q_s is the law of h_s+sqrt(A_s)*Z0 for standardGaussian Z0.
  • One terminal attempt independently draws X~q_s,N~Poisson(2),an infinite iid nu sequence a_i,and U~Uniform[0,1]. It accepts when U<=product(i<N,(1+W_s(X,a_i))/2),with empty product1. rho_s is the law of an infinite iid sequence of such attempts. O_s returns X from the first accepted attempt,or the zero vector if no attempt accepts. This is the actual terminal stream program,with its full independent-product law.
  • Let muV=volume.tilted(-V),using canonical volume. Gaussian smoothing G(mu,sigma) is the law of X+sigma*Z under mu times standardGaussian. Tilt is the total normalized exponential reweighting operation; probability is proved,not implicit. Kernel composition Lt composed P first draws a state from P then an output from Lt. KL and nonnegative integrals take extended nonnegative values,possibly infinity.

Mathematical proof

1. Use the actual full-state program

Instantiate EnhancedTerminalExecution at q=2. It supplies actual Lt and P,the complete retained-reference transition,the terminal retry law,terminal support at J,and exact output stability at J+m. The firstIndex,scaledCached,Attempt,attemptLaw,accepted and output definitions preserve the concrete parent program,including both fallback branches.

\[(\rho_s).\operatorname{map}(O_s)=L_t(s).\]
Corresponding Lean step

firstIndex,scaledCached,Attempt,attemptLaw,accepted,output; finite_output_kl: ht,Lt,P,hPs,hmass,hstable,hacc

2. Construct the same Gibbs targets and identify transitions

Set alpha=kappa inverse and beta=1;the source Hessian and dimension assumptions provide the exact parent inputs. Tau is measurable and positive. EnhancedKLOneStep produces actual Gibbs probability,TG,H,Pprime and the one-step interface. Convert threshold toNNReal(B inverse) to the real comparison. On both branches,compare the entire update law to prove Pprime=P;no witness or projection equality is assumed.

\[P^{\prime}=P,\qquad T_s=\mu_V.\mathrm{tilted}(-b_s\|\cdot-u_s\|^2/2).\]
Corresponding Lean step

finite_output_kl: hk0,ha0,ha1,hHm,hτm,hτ0,hs,hstop,hPeq,heq,he,hstep

3. Prove sufficient terminal precision

K(b0)>=1,d>=1 and Delta<=1/2 give K(b0)*d*2/Delta>=1. Hence L>=2 and B lies strictly between0 and1. Every state in the actual terminal support has b>=B inverse>1,which supplies the strict beta/b<1 needed by the existing Gaussian-density identification.

\[L\ge2,\quad 0<B<1,\quad b\ge B^{-1}>1.\]
Corresponding Lean step

terminal_precision_large; finite_output_kl: hd1,hBlarge,hb1,hb0,hbstep

4. Identify the actual terminal target

Actual Gibbs probability rules out a zero tilted measure. Since nonintegrable exp(-V) would make the tilt zero,it proves exponential integrability before tilted_tilted is used. Combine the two quadratic exponents and use the actual normalized-density equalities of IdealRGOIdentification. On terminal support bb=b,so the nested target TG is exactly tpi. Gradient Lipschitzness follows from the genuine Hessian through zero quadratic regularization.

\[T_s=\mathcal N(u_s,b_s^{-1}I).\mathrm{tilted}(-V)=\pi_s\quad(b_s\ge B^{-1}).\]
Corresponding Lean step

actual_terminal_target: hI,hi,heq,hvol,hf; finite_output_kl: hlip,heqt,hbs

5. Turn the correct RN second moment into KL

For probability mu absolutely continuous with respect to nu,set r=dmu/dnu. The RN API gives integrability of r and integral r=1. Given square integrability,expand(r-1)^2 and obtain integral(r-1)^2=integral r^2-1. For r>=0,log r<=r-1 gives klFun(r)<=(r-1)^2;the r=0 case is explicit. The nonnegative KL formula and a justified real-to-nonnegative integral conversion give KL(mu||nu)<=eps^2. Apply this to mu=Lt_s and nu=tpi_s,using the parent dLt/dtpi moment,not the reverse moment.

\[\operatorname{KL}(\mu\Vert\nu)\le\int(r-1)^2\,d\nu=\int r^2\,d\nu-1\le\varepsilon^2.\]
Corresponding Lean step

klFun_le_square; kl_le_second_moment: hr,hmass,h2,hlin,hpoly,hsq,hint; finite_output_kl: hterminal,hac,hI,hbound

6. Accumulate along actual kernel powers

Induct the all-ENNReal recurrence with nonnegative kernel integration. At zero steps,the Dirac integral is the terminal residual. The induction shifts each prior observation integral from P^j to P^(j+1) using composition. Instantiate the remaining-output kernel with Lt composed P^n;its Markov property and exact composition associativity yield the finite enhanced-state bound. No finite observation error is required.

\[\operatorname{KL}((L_t\circ P^n)_s\Vert T_s)\le\sum_{j<n}\int e\,dP^j_s+\int\operatorname{KL}(L_t(t)\Vert T_t)\,P^n_s(dt).\]
Corresponding Lean step

kernel_error_sum: hp,hi,hei,hti; composed_error_sum; finite_output_kl: hf

7. Discharge the residual on actual terminal support

The parent proves(P^J)(s0)(D)=1 for D={b>=B inverse}. Measurability of the precision coordinate and the probability measure complement identity give almost-everywhere membership. Only there apply the terminal target equality and KL bound. Nonnegative integral monotonicity and mass one then bound the residual by eps squared.

\[P^J(s_0,D)=1\Longrightarrow\int\operatorname{KL}(L_t(s)\Vert T_s)\,P^J(s_0,ds)\le\varepsilon_J^2.\]
Corresponding Lean step

finite_output_kl: hPJ,hD,hbMeas,hm,hresidual

8. Keep the exact precision and cap output

The positive denominator gives eps squared=Delta squared/(J+1) by the square-root identity. Use the parent actual cap output law to reduce Lt composed P^(J+m) to Lt composed P^J. Add the bounded terminal residual to the unchanged first-J observation sum. This is an actual finite-output inequality;the separate stage budget is still needed before deducing a numerical final error.

\[\varepsilon_J^2=\frac{\Delta^2}{J+1},\qquad (L_t\circ P^{J+m})(s_0)=(L_t\circ P^J)(s_0).\]
Corresponding Lean step

finite_output_kl: hepssq,hstable,hf

Lean statement · finite_output_kl

Actual terminal stream,full retained-state transition,Gibbs targets and finite output KL at J+m.

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 finite_output_kl {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 Δ : ℝ)
    (hc : 0 < c) (hc1 : c < 1/4) (hη : ∀ s, 0 < η s ∧ η s ≤ c)
    (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 := (2:ℝ)+Real.log (K s0.1*d*(2:ℝ)/Δ)
    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)
    let μV := (volume : Measure E).tilted (fun x => -V x)
    IsProbabilityMeasure μV ∧
    ∃ (Lt : Kernel S E) (P : Kernel S S) (TG H : Kernel S E),
      IsMarkovKernel Lt ∧ IsMarkovKernel P ∧ IsMarkovKernel TG ∧ IsMarkovKernel H ∧
      (∀ s, P s=if B⁻¹ ≤ (s.1:ℝ) then Measure.dirac s else
        ((M s).prod (stdGaussian E)).map (fun z => update (s,z))) ∧
      (∀ s, (trho s).map (output (tW s) 1 0)=Lt s) ∧
      (∀ s, TG s=μV.tilted (fun x => -((s.1:ℝ)/2)*‖x-s.2.1‖^2)) ∧
      (∀ s, H s=AutoSamplingTheory.TechnicalLemmas.Measure.GaussianSmoothing.gaussianSmoothing
        (TG s) (Real.sqrt (v s))) ∧
      let Q := fun s => AutoSamplingTheory.TechnicalLemmas.Measure.GaussianSmoothing.gaussianSmoothing
        (M s) (Real.sqrt (τ s/(1+s.1)))
      let e := fun s => if B⁻¹ ≤ (s.1:ℝ) then 0 else klDiv (Q s) (H s)
      Measurable e ∧ ∀ m : ℕ,
        klDiv ((Lt ∘ₖ (P^(J+m))) s0) (TG s0) ≤
          (∑ j ∈ Finset.range J, ∫⁻ s, e s ∂(P^j) s0)+
          ENNReal.ofReal (Δ^2/((J:ℝ)+1))

Exact module and namespace context

Lean proof · finite_output_kl

Same actual P,derived target identity and RN-moment terminal KL,finite actual-chain accumulation and support/cap reduction.

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 finite_output_kl {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 Δ : ℝ)
    (hc : 0 < c) (hc1 : c < 1/4) (hη : ∀ s, 0 < η s ∧ η s ≤ c)
    (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 := (2:ℝ)+Real.log (K s0.1*d*(2:ℝ)/Δ)
    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)
    let μV := (volume : Measure E).tilted (fun x => -V x)
    IsProbabilityMeasure μV ∧
    ∃ (Lt : Kernel S E) (P : Kernel S S) (TG H : Kernel S E),
      IsMarkovKernel Lt ∧ IsMarkovKernel P ∧ IsMarkovKernel TG ∧ IsMarkovKernel H ∧
      (∀ s, P s=if B⁻¹ ≤ (s.1:ℝ) then Measure.dirac s else
        ((M s).prod (stdGaussian E)).map (fun z => update (s,z))) ∧
      (∀ s, (trho s).map (output (tW s) 1 0)=Lt s) ∧
      (∀ s, TG s=μV.tilted (fun x => -((s.1:ℝ)/2)*‖x-s.2.1‖^2)) ∧
      (∀ s, H s=AutoSamplingTheory.TechnicalLemmas.Measure.GaussianSmoothing.gaussianSmoothing
        (TG s) (Real.sqrt (v s))) ∧
      let Q := fun s => AutoSamplingTheory.TechnicalLemmas.Measure.GaussianSmoothing.gaussianSmoothing
        (M s) (Real.sqrt (τ s/(1+s.1)))
      let e := fun s => if B⁻¹ ≤ (s.1:ℝ) then 0 else klDiv (Q s) (H s)
      Measurable e ∧ ∀ m : ℕ,
        klDiv ((Lt ∘ₖ (P^(J+m))) s0) (TG s0) ≤
          (∑ j ∈ Finset.range J, ∫⁻ s, e s ∂(P^j) s0)+
          ENNReal.ofReal (Δ^2/((J:ℝ)+1)) := 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 μV
  have ht := AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedTerminalExecution.enhanced_terminal_execution
    κ hκ hV hH hd η hηm c 2 Δ hc hc1 hη (by norm_num) hΔ hΔ1 s0 M
  obtain ⟨hB,heps,heps1,hbb,hn,hxp,hres,Lt,P,hLt,hP,hPs,hmass,hstable,hacc⟩ := ht
  let := hLt
  let := hP
  have hk0 : (0:ℝ≥0) < κ := lt_of_lt_of_le (by norm_num) hκ
  have ha0 : (0:ℝ≥0) < κ⁻¹ := inv_pos.2 hk0
  have ha1 : κ⁻¹ ≤ (1:ℝ≥0) := (inv_le_one₀ hk0).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 hdR : 0 < (Module.finrank ℝ E:ℝ) := by exact_mod_cast hd
  have hτm : Measurable τ := by
    have hKm : Measurable (fun s : S => K s.1) := by dsimp [K]; fun_prop
    exact Measurable.ite (measurableSet_le measurable_const hKm) hKm measurable_const
  have hτ0 (s : S) : 0 < τ s := by
    dsimp only [τ]
    split_ifs with h
    · linarith
    · exact hc
  have hs := AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedKLOneStep.one_step_kl_error
    ha0 ha1 hV hHm hdR η τ hηm hτm (fun s => (hη s).1) hτ0 M (Real.toNNReal B⁻¹)
  obtain ⟨hμ,TG,H,P',hTG,hHG,hP',hTGf,hHf,hPsf,he',hsteps⟩ := hs
  let := hμ
  let := hTG
  let := hHG
  let := hP'
  have hstop (s : S) : Real.toNNReal B⁻¹ ≤ s.1 ↔ B⁻¹ ≤ (s.1:ℝ) := by
    change ((Real.toNNReal B⁻¹:ℝ≥0):ℝ) ≤ (s.1:ℝ) ↔ B⁻¹ ≤ (s.1:ℝ)
    rw [Real.coe_toNNReal _ (inv_pos.2 hB).le]
  have hPeq : P'=P := by
    apply Kernel.ext
    intro s
    have hx := hPsf s
    simp only [NNReal.coe_one,NNReal.coe_inv] at hx
    have hy : P s=if B⁻¹ ≤ (s.1:ℝ) then Measure.dirac s else
        ((M s).prod (stdGaussian E)).map (fun z => update (s,z)) := hPs s
    by_cases hs : B⁻¹ ≤ (s.1:ℝ)
    · have hs' := (hstop s).2 hs
      simp only [if_pos hs'] at hx
      simp only [if_pos hs] at hy
      exact hx.trans hy.symm
    · have hs' : ¬Real.toNNReal B⁻¹ ≤ s.1 := fun h => hs ((hstop s).1 h)
      simp only [if_neg hs'] at hx
      simp only [if_neg hs] at hy
      exact hx.trans hy.symm
  subst P'
  refine ⟨hμ,Lt,P,TG,H,hLt,hP,hTG,hHG,hPs,?_,hTGf,?_,?_⟩
  · intro s
    exact (hacc s).1.2.1
  · intro s
    simpa only [NNReal.coe_one] using hHf s
  intro Q e
  have heq : (fun s : S => if Real.toNNReal B⁻¹ ≤ s.1 then 0 else
      klDiv (AutoSamplingTheory.TechnicalLemmas.Measure.GaussianSmoothing.gaussianSmoothing
        (M s) (Real.sqrt (τ s/(1+s.1)))) (H s)) = e := by
    funext s
    by_cases hs : B⁻¹ ≤ (s.1:ℝ)
    · have hs' := (hstop s).2 hs
      simp only [if_pos hs',e,if_pos hs]
    · have hs' : ¬Real.toNNReal B⁻¹ ≤ s.1 := fun h => hs ((hstop s).1 h)
      simp only [if_neg hs',e,Q,if_neg hs]
  have he : Measurable e := by
    simp only [NNReal.coe_one] at he'
    rw [heq] at he'
    exact he'
  have hstep : ∀ R : Kernel S E, IsMarkovKernel R →
      Measurable (fun s => klDiv (R s) (TG s)) ∧
      ∀ s, klDiv ((R ∘ₖ P) s) (TG s) ≤ e s+∫⁻ t, klDiv (R t) (TG t) ∂P s := by
    intro R hR
    let := hR
    have hh := hsteps R
    simp only [NNReal.coe_one] at hh
    refine ⟨hh.1,fun s => ?_⟩
    have hh' := hh.2 s
    have heqs := congrFun heq s
    rw [heqs] at hh'
    exact hh' 
  refine ⟨he,?_⟩
  have hd1 : 1 ≤ d := by
    have hn1 : 1 ≤ Module.finrank ℝ E := hd
    dsimp only [d]
    exact_mod_cast hn1
  have hBlarge : 1 < B⁻¹ := (terminal_precision_large κ s0.1 hκ d Δ hd1 hΔ hΔ1).2
  have hlip : LipschitzWith (1:ℝ≥0) (gradient V) := by
    have hh := (AutoSamplingTheory.TechnicalLemmas.Analysis.QuadraticRegularization.strongConvexOn_and_lipschitzWith_gradient_add_quadratic
      (r:=0) hV hHm (0:E)).2
    simpa using hh
  have hterminal (s : S) (hs : B⁻¹ ≤ (s.1:ℝ)) : klDiv (Lt s) (TG s) ≤ ENNReal.ofReal (eps^2) := by
    have hb1 : 1 < (s.1:ℝ) := lt_of_lt_of_le hBlarge hs
    have hb0 : 0 < (s.1:ℝ) := lt_trans zero_lt_one hb1
    have hbstep : ((1:ℝ≥0):ℝ)*(s.1:ℝ)⁻¹ < 1 := by
      simpa using (inv_lt_one₀ hb0).2 hb1
    have heqt : TG s=tpi s := by
      rw [hTGf]
      have hh := actual_terminal_target V (hV.differentiable (by norm_num)) 1 hlip
        (s.1:ℝ) hb0 hbstep s.2.1
      have hbs : bb s=(s.1:ℝ) := hbb s hs
      dsimp only [tpi,TA]
      rw [hbs]
      simpa only [neg_div] using hh
    obtain ⟨_,hpi,_,hac,_,hI,_,_,_,hbound,_,_⟩ := hacc s
    let := hpi
    rw [heqt]
    apply kl_le_second_moment (Lt s) (tpi s) hac eps
    · simpa only [Real.rpow_two] using hI
    · simpa only [Real.rpow_two] using hbound
  have hPJ : IsMarkovKernel (P^J) := by
    induction J with
    | zero => change IsMarkovKernel Kernel.id; infer_instance
    | succ n ih =>
      let := ih
      rw [pow_succ]
      change IsMarkovKernel ((P^n) ∘ₖ P)
      infer_instance
  let := hPJ
  have hD : ∀ᵐ s ∂(P^J) s0, B⁻¹ ≤ (s.1:ℝ) := by
    rw [ae_iff]
    have hbMeas : Measurable (fun s : S => (s.1:ℝ)) := by fun_prop
    have hm : MeasurableSet {s : S | B⁻¹ ≤ (s.1:ℝ)} := measurableSet_le measurable_const hbMeas
    change (P^J) s0 {s : S | B⁻¹ ≤ (s.1:ℝ)}ᶜ=0
    rw [measure_compl hm (measure_ne_top _ _), hmass, measure_univ, tsub_self]
  have hresidual : (∫⁻ s, klDiv (Lt s) (TG s) ∂(P^J) s0) ≤ ENNReal.ofReal (eps^2) := by
    calc
      _ ≤ ∫⁻ _s, ENNReal.ofReal (eps^2) ∂(P^J) s0 :=
        lintegral_mono_ae (hD.mono fun s hs => hterminal s hs)
      _ = _ := by rw [lintegral_const, measure_univ, mul_one]
  have hepssq : eps^2=Δ^2/((J:ℝ)+1) := by
    dsimp only [eps]
    rw [div_pow, Real.sq_sqrt (by positivity)]
  intro m
  rw [hstable m]
  have hf := composed_error_sum P TG Lt e he hstep J s0
  exact hf.trans (add_le_add le_rfl (by simpa only [hepssq] using hresidual))

end AutoSamplingTheory.ExampleCases.SmoothedPicardHMC.EnhancedFiniteOutputKL

Exact module and namespace context

Scope and omitted-condition boundaries

  • Actual q=2 finite output for the Section6.3 A1 recursion and terminal base case. Genuine C2 Hessian bounds and normalized beta=1,kappa>=1 are explicit. Arbitrary actual M has no stage accuracy or cost guarantee;observation KL and its sum may be infinite. Arbitrary initial reference/history need not be a legally produced history. The actual terminal output pushforward and full P law are returned. Terminal support,cap law equality,first-hit criteria,output measurability and costs are consumed parent facts,not all separately returned conjuncts. Capped bb is a terminal-program extension outside support;TG=tpi is used only on terminal support. The exact residual is Delta^2/(J+1). No numerical(6.5)stage budget,final Delta^2 accuracy,initialization/total cost,actual M construction or complete main result is claimed.

Source and reuse

ASTIS parents called

Mathlib API called (external library)

  • InformationTheory.klDiv_eq_lintegral_klFun_of_ac
  • MeasureTheory.Measure.integral_toReal_rnDeriv
  • MeasureTheory.Measure.integrableOn_toReal_rnDeriv
  • MeasureTheory.tilted_tilted
  • MeasureTheory.tilted_of_not_integrable
  • MeasureTheory.ofReal_integral_eq_lintegral_ofReal
  • ProbabilityTheory.Kernel.lintegral_comp

Mathematical sources

  • SPHMC Section6.3 A1 recursion and terminal stage — Actual q=2 finite output for the Section6.3 A1 recursion and terminal base case. Genuine C2 Hessian bounds and normalized beta=1,kappa>=1 are explicit. Arbitrary actual M has no stage accuracy or cost guarantee;observation KL and its sum may be infinite. Arbitrary initial reference/history need not be a legally produced history. The actual terminal output pushforward and full P law are returned. Terminal support,cap law equality,first-hit criteria,output measurability and costs are consumed parent facts,not all separately returned conjuncts. Capped bb is a terminal-program extension outside support;TG=tpi is used only on terminal support. The exact residual is Delta^2/(J+1). No numerical(6.5)stage budget,final Delta^2 accuracy,initialization/total cost,actual M construction or complete main result is claimed.

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