Skip to content

Port weighted diffusion transition kernels - #1067

Merged
Vilin97 merged 1 commit into
mainfrom
vilin/cutoff-transition-kernels-20261128
Nov 28, 2026
Merged

Vilin97 merged 1 commit into
mainfrom
vilin/cutoff-transition-kernels-20261128

Conversation

@Vilin97

@Vilin97 Vilin97 commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

This ports the transition-kernel construction used in the Riemannian part of Chafaï and Fathi’s cutoff-rigidity development. It connects the weighted Friedrichs semigroup already in Lean Pool to pointwise transition measures.

Mathematics and scope

  • A bounded real L² operator with continuous output representatives has uniformly bounded evaluations on compact sets when the reference measure has full support. The proof uses the closed graph theorem on a compact neighborhood. Riesz representation then gives an L² density at each point.
  • For a positive operator on a finite measure space, the density yields a measurable kernel. Integration against the kernel recovers the continuous output. Fixing one gives probability transitions, and preserving the reference integral gives invariance. The composition proof reuses the integral representation and absolute continuity.
  • The weighted Riemannian specialization takes continuous representatives at positive time as an explicit hypothesis. It proves the identity at zero, the Chapman–Kolmogorov law, positive-time absolute continuity, and, in the complete connected setting, the Markov and invariant-measure properties. The smoothing theorem, Dynkin identity, and Wasserstein estimates remain part of Propose project: cutoff-rigidity-diffusions (Chafaï–Fathi, cutoff via rigidity for curved diffusions, CRAS 2025) #924. Paper §1.6

Source and port

  • Djalil Chafaï’s Apache-2.0 formalization first appeared on 2026-10-25 at 07:59:31 UTC. This port uses revision f3bf3663cfe743aaf74cd76bb2a7076c816a176f. Chafaï directed the AI proof work and checked the Palomar statements against the corrected paper. First formalization commit · Pinned license · Palomar record
  • Three modules adapt DiffKer1–5. The first two use only Mathlib. The specialization reuses the existing weighted volume, positivity and conservativity proofs. The port keeps the abstract kernel construction independent of manifold geometry and stochastic library dependencies.
  • The pinned build uses Lean 4.36.0, Mathlib fc4f59e577feb1a4956671bc04ac18aaaf8cd842 and Tau Ceti 0642eae29e0a59ef798d04de325386445906e755.

Measurements and validation

Two interleaved Azure VM trials per revision used warm pinned dependencies, fresh outputs for all three new modules, and LC_ALL=C LEAN_NUM_THREADS=4 /usr/bin/time -f 'elapsed=%e maxrss=%M' lake --no-ansi build +LeanPool.CutoffRigidity.Friedrichs.DiffusionTransitionKernel. Baseline was 7.67 s and 6.53 s. The optimized port took 6.32 s and 5.83 s. The final per-module times were 1.5, 1.4 and 1.4 seconds. Peak process RSS was about 1.53 GiB in both variants. The revisions replace the manual convergence-in-measure argument with Mathlib’s Lp theorem, use direct arithmetic for the negative part, and narrow the imports exported by the kernel module.

The warning-free project build and generated-index check passed locally. Declaration lint covered 2,544 declarations in 182 modules. The scoped Mathlib text-style check, card endpoint resolution, project-wide axiom and forbidden-mechanism audits, and compiler-message audit also passed.

Part of #924

@Vilin97 Vilin97 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source review passed for d20fd36ed6b83dcc16667a2d6c7a5b2e48b35711.

  • The closed graph argument bounds point evaluations on compact sets from the assumed continuous output representatives. Riesz representation then gives a density at each point. Measurability follows by evaluating on indicators of measurable sets.
  • The composition proof uses the absolute continuity of the first kernel to integrate an almost-everywhere representative. The weighted specialization gives the identity kernel at time zero and the composition law at all times. The integral representation and absolute continuity apply at positive times, and the Markov and invariance results use the complete, connected setting.
  • The port preserves the scope of the pinned development. Positive-time regularity is an explicit input, and the source headers identify the adapted modules. In the module introduction, it would be clearer to qualify “Markov kernels” with the completeness and connectedness assumptions used by the probability statement. Pinned Lean source · Paper §1.6

Required Lean CI is still running. Lean Action CI

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict.

No blocking code issue was found in the conditional kernel construction.RetriggerView in Greptile

[Medium impact] No blocking code issue was found in the conditional kernel construction.

Summary

Adds compact bounds for continuous L² representatives, constructs kernels from positive operators, and applies the construction to the weighted Friedrichs semigroup.

  • Continuous outputs from L² operators stay bounded on compact sets.
  • Positive L² operators with continuous outputs now define transition measures.
  • Weighted diffusion transitions now compose and preserve weighted volume.

Reviews (1) · Last reviewed commit: "Port transition kernels for the weighted..." · Reviewed by Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

lake build wall time (changed modules): 409.17 s (= 6.82 min) — user 1372.14 s, sys 111.80 s.

This build covers the changed modules and their dependency cones on top of the restored cache. The serial per-file sums below are useful for ranking slow files, not as a build budget.

A base→head comparison was attempted but its measurements are unavailable (see the run log); modified files are omitted from the tables below.

Statement changes

✅ No statements changed — all 0 tracked declarations across 2 modified files kept their type; only proofs / definition bodies changed.

Statements are compared textually against the merge base (comments and whitespace ignored; by proof terms embedded in a type are treated as proof-irrelevant), the same method as physlib's /check-golf. Anonymous instances and examples are not tracked.

Total heartbeats: 116,073 maxHeartbeats units across 3 valid files (504 added LOC).

Sum of lean --profile: 10275.3 ms (= 10.28 s) across 3 valid files. Import-excluded time: 5869.3 ms (= 5.87 s).

Count-heartbeats wall-clock total: 26.86 s. Repeated import cost inside lean --profile: 4406.0 ms (= 4.41 s).

Heartbeat values sum disjoint root command traces with trace.profiler.useHeartbeats and synchronous elaboration, converted from raw allocations to maxHeartbeats units by dividing by 1000. They include command elaboration and kernel checking, exclude imports, and include profiler overhead; they are not comparable to the deprecated linter's totals. Per-file wall clocks are measured under parallel load and are noisier than heartbeats.

LOC counts added lines in the profiled Lean files from this PR diff.

File LOC Heartbeats (maxHB) Count wall (s) lean --profile (s) Without import (s) Import (s) Commands Errors
LeanPool/CutoffRigidity/Friedrichs/DiffusionTransitionKernel.lean 122 43,607 8.19 2.81 1.57 1.24 19 0
LeanPool/CutoffRigidity/Friedrichs/TransitionKernel.lean 233 37,132 9.55 3.36 2.50 0.86 34 0
LeanPool/CutoffRigidity/Friedrichs/ContinuousRepresentatives.lean 138 35,334 9.12 4.11 1.80 2.31 22 0
LeanPool/CutoffRigidity.lean 8 — — — — — 0 1
LeanPool/CutoffRigidity/Imports.lean 3 — — — — — 0 1
Total 504 116,073 26.86 10.28 5.87 4.41 75 2

Aggregate phase totals

Phase Time
import 4406.0 ms (= 4.41 s)
typeclass inference 2339.0 ms (= 2.34 s)
interpretation 944.0 ms (= 0.94 s)
tactic execution 720.0 ms (= 0.72 s)
elaboration 637.0 ms (= 0.64 s)
type checking 636.0 ms (= 0.64 s)
simp 142.3 ms (= 0.14 s)
initialization 109.3 ms (= 0.11 s)
linting 65.0 ms (= 0.07 s)
process pre-definitions 51.8 ms (= 0.05 s)
dsimp 39.6 ms (= 0.04 s)
declTypeLinter 35.2 ms (= 0.04 s)

Slowest changed modules (from lake build)

Changed module Lake time
LeanPool.CutoffRigidity.Friedrichs.ContinuousRepresentatives 6.50 s
LeanPool.CutoffRigidity.Friedrichs.TransitionKernel 4.30 s
LeanPool.CutoffRigidity.Friedrichs.DiffusionTransitionKernel 2.10 s
Per-file `lean --profile` output

LeanPool/CutoffRigidity/Friedrichs/ContinuousRepresentatives.lean

import took 2.31s
cumulative profiling times:
	attribute application 2.53ms
	congr simp thm 7.48ms
	declTypeLinter 6.8ms
	dsimp 18.3ms
	elaboration 119ms
	fix level params 2.2ms
	import 2.31s
	initialization 39.1ms
	instantiate metavars 1.43ms
	interpretation 290ms
	let-to-have transformation 0.459ms
	linting 17.8ms
	module linting 0.0313ms
	parsing 7.85ms
	process pre-definitions 14.3ms
	share common exprs 5.38ms
	simp 54ms
	tactic execution 156ms
	tacticAnalysis 3.18ms
	type checking 180ms
	typeclass inference 874ms
real 4.43
user 2.67
sys 1.07

LeanPool/CutoffRigidity/Friedrichs/DiffusionTransitionKernel.lean

import took 1.24s
cumulative profiling times:
	attribute application 1.11ms
	congr simp thm 2.64ms
	declTypeLinter 15.5ms
	elaboration 201ms
	fix level params 0.898ms
	import 1.24s
	initialization 30.1ms
	instantiate metavars 0.917ms
	interpretation 271ms
	let-to-have transformation 13ms
	linting 15.6ms
	module linting 0.0357ms
	parsing 6.86ms
	process pre-definitions 14.7ms
	share common exprs 5.82ms
	simp 22.6ms
	tactic execution 190ms
	tacticAnalysis 4.39ms
	type checking 182ms
	typeclass inference 589ms
real 3.01
user 2.41
sys 0.98

LeanPool/CutoffRigidity/Friedrichs/TransitionKernel.lean

import took 856ms
cumulative profiling times:
	attribute application 0.204ms
	congr simp thm 20.6ms
	declTypeLinter 12.9ms
	dsimp 21.3ms
	elaboration 317ms
	fix level params 4.11ms
	import 856ms
	initialization 40.1ms
	instantiate metavars 2.52ms
	interpretation 383ms
	let-to-have transformation 20.1ms
	linting 31.6ms
	module linting 0.0339ms
	parsing 17ms
	process pre-definitions 22.8ms
	share common exprs 13ms
	simp 65.7ms
	tactic execution 374ms
	tacticAnalysis 6.35ms
	type checking 274ms
	typeclass inference 876ms
real 2.78
user 3.36
sys 0.84

Advisory only — never blocks merge. Full log uploaded as the proof-profile artifact.

@Vilin97 Vilin97 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve the conditional transition-kernel port.

Statement and source

I checked all three proof modules, both entry points and the card against pinned upstream DiffKer1–5. The compact bound uses closedness of the graph of restriction to a compact neighborhood. The full-support measure promotes almost-everywhere equality to pointwise equality there. The next module uses bounded evaluation and Riesz representation, tests the density against its negative part, and uses measurable indicators to build the kernel. Upstream source

The composition law uses absolute continuity to replace an L² vector by its continuous representative in the inner transition integral. The identity at zero is a separate branch. Positive-time regularity is an input of the weighted specialization. Completeness and connectedness enter the Markov and invariance lemmas through the previous conservativity results. The scope is accurately recorded in the card and supports the approach to the diffusion in §1.6. Paper

Reuse and validation

The two abstract modules are independent of the project's Riemannian code. I found no equivalent combined construction in the pinned dependencies or prior pool imports. The port retains Chafaï's Apache-2.0 attribution and uses the existing weighted-volume and semigroup proofs. Per-file build and memory limits passed locally for every changed Lean file. The declaration, statement, axiom, mechanism and compiler-message checks passed for all 182 project modules. The interleaved build trials show stable or lower cost after the narrower imports and simpler proof steps.

Hosted Lean CI and content separation passed at d20fd36ed6. The scoped documentation, exposition, Python and workflow checks skipped these content-only changes. The hosted profiler measured the three proof modules without errors. Its standalone wrapper runs were missing compiled dependencies. Both wrappers passed the same synchronous profiling invocation locally after Lake built those dependencies. Lean CI · Hosted profile

@Vilin97

Vilin97 commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 LLM review — refactor (gpt-6.2-sol)

Reviewed head: d20fd36ed6b83dcc16667a2d6c7a5b2e48b35711

Verdict: ✅ approve

The port constructs measurable transition kernels from continuous L² representatives and applies the construction to the existing weighted Friedrichs semigroup under an explicit positive-time regularity hypothesis. The kernel target and both CutoffRigidity import modules built with the pinned dependencies. The proof profile has no base-to-head timing comparison.

Aspect Value
Scope transition-kernel port
Introduces tech debt 🛑 yes
Maintainability ✅ improved
Brittleness ➖ unchanged
Risk ✅ low

The port keeps the analytic proofs explicit and reusable, with two localized API issues that can be addressed independently.

Findings (2)

  • reusability-lost — LeanPool/CutoffRigidity/Friedrichs/ContinuousRepresentatives.lean:73
    [BorelSpace X] excludes completed reference measures whose measurable sets strictly contain the Borel sets. Both abstract modules elaborate with [OpensMeasurableSpace X] and the existing proof bodies. Use that weaker assumption for the compact bound and kernel construction.
  • lost-structure — LeanPool/CutoffRigidity/Friedrichs/DiffusionTransitionKernel.lean:63
    Five proofs unfold the positive-time branch separately. A downstream import also has to reconstruct the measurable-set formula from the integral and absolute-continuity lemmas. Factor the branch rewrite into one lemma and expose the measurable-set formula using kernel_apply.

Tokens: 4,398,590 in / 21,302 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $17.9139 (Standard API equivalent; uncached input) (long-context rate)
Automated review against .github/REFACTOR_REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.

@Vilin97
Vilin97 added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 7f56a10 Nov 28, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant