Skip to content

Import weighted chart gradient limits for rigid diffusions - #1205

Merged
Vilin97 merged 2 commits into
mainfrom
feature/cutoff-closed-form-chart-gradient-20261206
Dec 6, 2026
Merged

Vilin97 merged 2 commits into
mainfrom
feature/cutoff-closed-form-chart-gradient-20261206

Conversation

@Vilin97

@Vilin97 Vilin97 commented Dec 6, 2026

Copy link
Copy Markdown
Collaborator

Ports the weighted chart measure, the diffusion core’s coordinate energy estimate, and convergence of coordinate gradients on the Friedrichs form domain.

Source and scope

  • Djalil Chafaï directed the AI-written formalization and reviewed its registered statements. Upstream publicly completed the formalization on 2026-10-25 at 07:59:31 UTC. This part ports DiffChart1.lean, DiffChart2.lean and the gradient-limit part of DiffChart3.lean at Apache-2.0 revision f3bf3663cfe743aaf74cd76bb2a7076c816a176f. Completion commit · Pinned source · Chafaï–Fathi paper · Palomar registration
  • The chart measure uses the weighted density divided by one plus the norm of the coordinate metric. This choice gives an L² bound for chart pullbacks and lets the manifold core energy bound the squared L² norm of the coordinate gradient. The port uses Lean Pool’s completion model of the closed form to obtain simultaneous convergence of smooth approximants and their coordinate gradients. The weak derivative identity and semigroup smoothing remain later steps of the proposal. Chart test pairings already on main
  • The reusable estimates extend the existing weighted integration-by-parts and inverse-metric development. The port uses the pinned Mathlib and Tau Ceti APIs and imports no vendored stochastic library.

Port and validation

  • Built with Lean v4.36.0, Mathlib fc4f59e577 and Tau Ceti aa3cfad127. Reused the existing pushforward identity. Replaced nonlinear arithmetic search with monotonicity, and passed subtraction through the coordinate gradient in L² before applying the energy estimate.
  • The generated indexes, warning-free project build, scoped declaration lint, text style, card declarations, axiom closure, forbidden-option environment audit and compiler-message audit passed locally. Python inputs are outside the content-only diff.
  • Three runs of taskset -c 4-7 lake build LeanPool.CutoffRigidity.Friedrichs.ChartGradientLimit on the Azure VM, deleting the three new modules’ build artifacts each time with the same dependency cache, gave 6.86 s median before (6.86, 6.86, 6.88 s) and 6.37 s after (6.41, 6.37, 6.17 s). The chart measure module’s median fell from 2.1 s to 1.6 s. Lake’s gradient-limit time varied from 1.0 to 1.9 s in the optimized runs, versus 1.0 s in the baseline. Standalone lean --profile passed for the gradient-limit module.

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.

Author validation: approve for inclusion.

  • Faithfulness. The port uses the upstream density ρ / (‖G‖ + 1) on the chart target. chartGrad_lintegral_le bounds the squared coordinate gradient seminorm by the manifold gradient energy for every smooth core function and chart center. exists_gradient_limit starts from membership in the Friedrichs form domain and returns convergence in the completion, ambient L² and both coordinate L² spaces. Its conclusion stops at gradient convergence. The weak derivative identity remains outside the card’s claims.
  • Novelty and significance. The previous chart work supplies the smooth inverse metric, weighted volume and chart test pairings. The new estimate controls a sequence of coordinate gradients uniformly in the energy distance, then gives the limit for an arbitrary form-domain vector. The pinned dependencies supply the underlying manifold and L² APIs. Searches in their source and the pool found no earlier estimate or convergence theorem for this form and measure.
  • Sources and proof. Checked the weighted measure and gradient estimate against DiffChart1 and DiffChart2, and the limit construction against DiffChart3 at f3bf3663. The change from an energy-Cauchy description to the pool’s energy completion preserves control of both the ambient and energy norms. The pointwise estimate uses the inverse-metric identity and nonnegativity. The limit uses smooth core density and completeness, without postulating any smoothing or weak derivative theorem.
  • Engineering and trust. Reviewed all three new modules, the two entry points and the card. The public wrapper, generated indexes, scoped declaration lint, text style, card declarations, axiom closure, option-injection and compiler-message audits passed locally. The dependency closure excludes the upstream vendored probability modules. The repeated benchmark reduced median wall time from 6.86 s to 6.37 s, with the gradient-limit module itself varying between 1.0 s and 1.9 s. GitHub’s required checks and configured review provide the release gate for this head.

@greptile-apps

greptile-apps Bot commented Dec 6, 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.

[Low impact] No concrete merge blocker was found in the reviewed changes, but the external-source checks remain incomplete.

RetriggerView in Greptile

Summary

Adds a weighted chart measure, bounds coordinate gradients by manifold energy, and proves simultaneous convergence of smooth approximations and their coordinate gradients.

  • Chart coordinates get a weighted measure for comparing chart and manifold integrals.
  • Smooth test gradients stay bounded by their manifold energy.
  • Friedrichs form functions gain convergent coordinate gradients.

Reviews (2) · Last reviewed commit: "Share chart coercivity and make the norm..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

lake build wall time (changed modules): 54.59 s (= 0.91 min) — user 35.69 s, sys 6.79 s.

This build covers the added modules and their dependency cones on top of the measurement environment; modified files are measured without rebuilding the pool.

Statement changes

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

Also: 4 declarations added, 0 removed. A reorganization moves declarations between files, which shows up here as an add in one file and a remove in another.

➕ Declarations added (4)
  • CutoffRigidity.Riemann.Diff.chartKappa — LeanPool/CutoffRigidity/Friedrichs/ChartEnergy.lean
  • CutoffRigidity.Riemann.Diff.chartKappa_mul_sq_le_weightedChartCoeff — LeanPool/CutoffRigidity/Friedrichs/ChartEnergy.lean
  • CutoffRigidity.Riemann.Diff.chartKappa_pos — LeanPool/CutoffRigidity/Friedrichs/ChartEnergy.lean
  • CutoffRigidity.Riemann.Diff.continuousOn_chartKappa — LeanPool/CutoffRigidity/Friedrichs/ChartEnergy.lean

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.

Compile cost of modified files — base → head

Heartbeats: 83,077 → 85,241 (+2,164, +2.6%). Commands: 18 → 22.

Per-file wall sum: 10.4 s → 7.5 s (-27.4%). Wall clock is measured under parallel load and is noisy; heartbeats are deterministic and are the regression signal.

Files: 1 compared — 0 cheaper, 1 costlier, 0 within noise (threshold: |Δ heartbeats| ≥ 1,000 and ≥ 1%).

Both sides are elaborated against the merge-base build of the pool — sound when only proofs and definition bodies change; a file whose statements changed may fail there and is flagged ⚠. Heartbeats come from disjoint root command traces with trace.profiler.useHeartbeats and synchronous elaboration, converted to maxHeartbeats units. Failed measurements are not classified as cheaper or costlier. Δ lines counts added/deleted lines from this PR diff.

File Δ lines HB base HB head Δ HB Δ HB % Wall base (s) Wall head (s)
LeanPool/CutoffRigidity/Friedrichs/ChartEnergy.lean +40/-36 83,077 85,241 +2,164 +2.6% 10.40 7.55
Total +40/-36 83,077 85,241 +2,164 +2.6% 10.4 7.5

New files — absolute profile

Total heartbeats: 216,417 maxHeartbeats units across 3 valid files (496 added LOC).

Sum of lean --profile: 10062.6 ms (= 10.06 s) across 3 valid files. Import-excluded time: 5193.6 ms (= 5.19 s).

Count-heartbeats wall-clock total: 23.27 s. Repeated import cost inside lean --profile: 4869.0 ms (= 4.87 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/ChartGradientLimit.lean 192 92,615 9.82 3.22 2.28 0.94 59 0
LeanPool/CutoffRigidity/Friedrichs/ChartGradientEstimate.lean 170 62,062 8.10 2.64 1.65 0.99 57 0
LeanPool/CutoffRigidity/Friedrichs/ChartEnergyMeasure.lean 127 61,741 5.35 4.20 1.26 2.94 64 0
LeanPool/CutoffRigidity.lean 4 — — — — — 0 1
LeanPool/CutoffRigidity/Imports.lean 3 — — — — — 0 1
Total 496 216,417 23.27 10.06 5.19 4.87 180 2

Aggregate phase totals

Phase Time
import 4869.0 ms (= 4.87 s)
typeclass inference 2500.0 ms (= 2.50 s)
interpretation 804.0 ms (= 0.80 s)
tactic execution 604.3 ms (= 0.60 s)
elaboration 592.0 ms (= 0.59 s)
type checking 336.5 ms (= 0.34 s)
initialization 83.8 ms (= 0.08 s)
linting 67.3 ms (= 0.07 s)
process pre-definitions 40.1 ms (= 0.04 s)
simp 36.4 ms (= 0.04 s)
declTypeLinter 35.6 ms (= 0.04 s)
parsing 27.6 ms (= 0.03 s)

Slowest changed modules (from lake build)

Changed module Lake time
LeanPool.CutoffRigidity.Friedrichs.ChartEnergy 3.00 s
LeanPool.CutoffRigidity.Friedrichs.ChartGradientLimit 2.90 s
LeanPool.CutoffRigidity.Friedrichs.ChartGradientEstimate 2.10 s
LeanPool.CutoffRigidity.Friedrichs.ChartEnergyMeasure 1.80 s
Per-file `lean --profile` output

LeanPool/CutoffRigidity/Friedrichs/ChartEnergyMeasure.lean

import took 2.94s
cumulative profiling times:
	attribute application 0.0857ms
	congr simp thm 2.4ms
	declTypeLinter 10.9ms
	elaboration 165ms
	fix level params 0.538ms
	import 2.94s
	initialization 30.8ms
	instantiate metavars 0.418ms
	interpretation 255ms
	let-to-have transformation 0.496ms
	linting 18.6ms
	module linting 0.0268ms
	parsing 6.25ms
	process pre-definitions 8.14ms
	share common exprs 4.07ms
	simp 12.6ms
	tactic execution 64.3ms
	tacticAnalysis 3.69ms
	type checking 85.5ms
	typeclass inference 589ms
real 4.48
user 2.18
sys 0.97

LeanPool/CutoffRigidity/Friedrichs/ChartGradientEstimate.lean

import took 989ms
cumulative profiling times:
	attribute application 0.105ms
	congr simp thm 1.1ms
	declTypeLinter 12.1ms
	elaboration 173ms
	fix level params 0.805ms
	import 989ms
	initialization 26.3ms
	instantiate metavars 0.954ms
	interpretation 286ms
	let-to-have transformation 0.391ms
	linting 23.1ms
	module linting 0.0233ms
	norm_num 8.39ms
	parsing 9.49ms
	process pre-definitions 9.47ms
	share common exprs 5.04ms
	simp 19.5ms
	tactic execution 167ms
	tacticAnalysis 5.43ms
	type checking 103ms
	typeclass inference 801ms
real 2.70
user 2.53
sys 0.87

LeanPool/CutoffRigidity/Friedrichs/ChartGradientLimit.lean

import took 940ms
cumulative profiling times:
	attribute application 0.115ms
	congr simp thm 0.431ms
	declTypeLinter 12.6ms
	dsimp 1.93ms
	elaboration 254ms
	fix level params 1.78ms
	import 940ms
	initialization 26.7ms
	instantiate metavars 7.56ms
	interpretation 263ms
	let-to-have transformation 0.847ms
	linting 25.6ms
	module linting 0.0224ms
	parsing 11.9ms
	process pre-definitions 22.5ms
	share common exprs 14.7ms
	simp 4.27ms
	tactic execution 373ms
	tacticAnalysis 4.6ms
	type checking 148ms
	typeclass inference 1.11s
real 3.49
user 3.18
sys 0.85

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

@Vilin97

Vilin97 commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Reviewed head: 25aca3aab53d498a9f4965ba67d69f12e82c30f8

Verdict: ✅ approve

The PR adds a weighted chart measure and uses the Friedrichs completion to show that smooth core approximations and their coordinate gradients converge in chart L². The new gradient estimate shares its pointwise coercivity proof with the existing ellipticity theorem. The targeted Lake build and standalone measure and gradient-limit profiles passed locally. Lean Action CI subsequently succeeded for this head. The two advisory profile errors affect import aggregators measured against merge-base artifacts. A local check reproduced the missing-import error when the new module artifact was absent. Lean Action CI · Proof profile

Aspect Value
Scope weighted chart gradient port
Introduces tech debt ✅ no
Maintainability ✅ improved
Brittleness ✅ more_robust
Risk ✅ low

Sharing the coercivity proof and specifying the metric in the norm proof make the code easier to maintain, with a 2.6% heartbeat increase in ChartEnergy for four added declarations.

Findings (1)

  • prompt-injection — PR-wide
    The PR author posted a comment presenting approval of this head as an independent re-review. Relabel it as author validation so readers can distinguish it from an independent approval. PR review comment

Tokens: 5,306,266 in / 17,384 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $21.4858 (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.

CI was not green for this commit at review time; this review does not replace CI.

@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.

Author validation follow-up: approve for inclusion at 25aca3aab5.

  • ChartEnergy now defines the shared chart weight and proves its positivity, continuity and pointwise coercivity. The existing compact-set ellipticity theorem and the new gradient estimate both use that coercivity result. Their statements are preserved.
  • The chart measure’s upper bound specifies the metric argument and its operator norm instance. Standalone lean --profile and heartbeat measurement now pass for ChartEnergyMeasure. The project build, indexes, text style, six-module declaration lint, card declarations, and the three trust audits also passed locally.
  • Repeating the three-module benchmark after the repair gave 6.30 s median (6.30, 6.38, 6.26 s), with 1.4 s median for the measure module. The modified ChartEnergy module also builds and profiles successfully. Initial configured review

@Vilin97

Vilin97 commented Dec 6, 2026

Copy link
Copy Markdown
Collaborator Author

/review

Please review 25aca3aab5. It shares the chart weight and coercivity with the existing ellipticity proof and fixes the norm-instance inference timeout. The project and standalone profilers pass locally.

@Vilin97
Vilin97 added this pull request to the merge queue Dec 6, 2026
Merged via the queue into main with commit 7f7cee6 Dec 6, 2026
26 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