Skip to content

Split over-long proofs in PLAcceleratedNesterovLean - #757

Merged
Vilin97 merged 2 commits into
mainfrom
claude/split-long-proofs-placceleratednesterovlean
Nov 5, 2026
Merged

Vilin97 merged 2 commits into
mainfrom
claude/split-long-proofs-placceleratednesterovlean

Conversation

@Vilin97

@Vilin97 Vilin97 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Prerequisite for #712 (syntax-aware proof-length linter). That linter correctly finds 8 proofs in PLAcceleratedNesterovLean over the 200-line cap; the old text-based checker missed them because they were carried by private abbrevs.

  • Each long proof is split into named private helper lemmas (largest, localFiberwiseGeometryProof, 663 → 79 lines; every proof now ≤ 176).
  • The two near-duplicate Lyapunov contraction proofs (434 lines each) now share one single-step theorem, lyapunov_contraction_of_state; the two public theorems are short wrappers. Likewise the two bootstrap displacement proofs share one induction lemma.
  • Proof-carrying private abbrevs become private theorems. Unused intermediate facts and redundant imports were dropped.
  • No public statement, name or type changes; no set_option, sorry, native_decide or nolints.

Verified locally against current main with #712's linter enabled: lake build LeanPool.PLAcceleratedNesterovLean.Imports emits zero warnings; scripts/ci/lint-project.lean passes on all 63 modules (721 declarations); lake exe lint-style LeanPool passes.

Refs #723

🤖 Generated with Claude Code

Refactor every proof over 200 lines (as measured by the syntax-aware
long-proof linter in #712) into named helper lemmas. Proof carriers
disguised as PLift-valued defs or private abbrevs become theorems.
Statements and public declarations are unchanged.

Refs #723

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

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

RetriggerView in Greptile

[Low impact] No actionable regression was found in the reviewed proof refactor.

Summary

Splits long proofs into named helpers and shares the contraction and bootstrap arguments.

  • Bootstrap proofs share one induction for both sequence types.
  • Local geometry proofs build the same bounds from named steps.
  • Ordinary and arbitrary-state sequences share one contraction theorem.
  • Generalized local convergence uses named steps for its geometry and motion bounds.

Reviews (2) · Last reviewed commit: "Extract fderiv_kills_normal_of_eqOn from..." · Reviewed by Greptile

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

{
"summary": "The seven-file refactor decomposes the eight long Nesterov proofs into named mathematical steps and shares the bootstrap induction and state-level contraction argument while preserving existing public contracts. This is a source verdict; current normal CI and execution of the intended semantic checker remain pending.",
"assessment": {
"scope": "Proof decomposition and reuse in the existing PLAcceleratedNesterovLean project.",
"introduces_tech_debt": false,
"maintainability": "improved",
"brittleness": "more_robust",
"risk": "low",
"assessment_one_sentence": "Named geometry, displacement and contraction lemmas replace long duplicated proof bodies without changing the existing public hypotheses or conclusions."
},
"verdict": "approve",
"findings": []
}

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

Statement changes

⚠️ 9 declarations changed their statement across 5 files — a statement change is more than a refactor. Confirm each one is intended.

⚠️ Statements changed (9)
  • PLAcceleratedNesterovLean.bootstrapTotalDisplacementGenProof — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.bootstrapTotalDisplacementProof — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.localConvergenceAtBasePointGenProof — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.fiber_path_hessian_lower_bound — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.localFiberwiseGeometryProof — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.smooth_embedding_local_graph — LeanPool/PLAcceleratedNesterovLean/Core/EmbeddedManifold.lean
  • PLAcceleratedNesterovLean.hasFDerivAt_of_isLittleO_sub — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
  • PLAcceleratedNesterovLean.phi_lipschitzOn_near_zero — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
  • PLAcceleratedNesterovLean.tubularProj_hasFDerivAt_starProjection — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean

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

➕ Declarations added (38)
  • PLAcceleratedNesterovLean.bootstrap_displacement_induction — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.contraction_factor_bounds — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.dist_add_le_dist_add_norm — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.dist_sub_le_dist_add_norm — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.geometric_displacement_le — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.sqrt_pow_eq_pow_sqrt — LeanPool/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean
  • PLAcceleratedNesterovLean.exists_ball_differentiableAt_of_eqOn — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.fderiv_apply_fderiv_of_idempotent — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.fderiv_kills_normal_of_eqOn — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.inner_gradient_ge_of_hessian_lower_on_segment — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.mul_le_sqrt_mul_of_le_sqrt_div — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.nesterov_step_motion_bounds — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.norm_apply_le_of_pythagorean — LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean
  • PLAcceleratedNesterovLean.exists_compact_local_piece — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.exists_fiber_saturated_ball — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.exists_hessian_lower_neighborhood — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.exists_normal_hessian_neighborhood — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.fderiv_apply_eq_self_of_mem_tangent — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.fiber_growth_and_aiming — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.fiber_path_deriv_eq_inner — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.fiber_path_regularity — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.hessianQuadForm_continuousOn — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.hessianQuadForm_ge_of_unit_sphere — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.normal_hessian_bound_at_minimizer — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.projection_eq_of_isTubular — LeanPool/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean
  • PLAcceleratedNesterovLean.descent_at_lookahead — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.flat_case_bound — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.lyapunovOfState_step_le — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.lyapunov_contraction_of_state — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.nesterovStep_dist_le_two_mul — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.nesterovStep_lookahead_dist_lt — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.contDiffAt_comp_extChartAt_symm_of_smoothEmbedding — LeanPool/PLAcceleratedNesterovLean/Core/EmbeddedManifold.lean
  • PLAcceleratedNesterovLean.exists_contDiff_eventuallyEq_of_contDiffAt_zero — LeanPool/PLAcceleratedNesterovLean/Core/EmbeddedManifold.lean
  • PLAcceleratedNesterovLean.injective_fderiv_comp_extChartAt_symm_of_smoothEmbedding — LeanPool/PLAcceleratedNesterovLean/Core/EmbeddedManifold.lean
  • PLAcceleratedNesterovLean.chart_difference_final_bound — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
  • PLAcceleratedNesterovLean.chart_nearest_point_difference_le — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
  • PLAcceleratedNesterovLean.nearest_point_core_bound — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
  • PLAcceleratedNesterovLean.tubularProj_sub_chart_le — LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean
➖ Declarations removed (2)
  • PLAcceleratedNesterovLean.lyapunovContractionGenProof — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean
  • PLAcceleratedNesterovLean.lyapunovContractionProof — LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/Main.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: 1,276,241 → 1,025,562 (-250,680, -19.6%). Commands: 84 → 109.

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

Files: 4 compared — 4 cheaper, 0 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/PLAcceleratedNesterovLean/Convergence/Bootstrap/Main.lean +165/-425 310,382 127,387 -182,994 -59.0% 60.78 25.33
LeanPool/PLAcceleratedNesterovLean/MorseBott/TubularProjection/Derivative.lean +253/-229 286,734 247,262 -39,472 -13.8% 44.76 17.26
LeanPool/PLAcceleratedNesterovLean/Convergence/GenLocalArgument.lean +312/-263 92,897 74,794 -18,103 -19.5% 24.03 13.12
LeanPool/PLAcceleratedNesterovLean/Core/EmbeddedManifold.lean +194/-158 586,229 576,119 -10,110 -1.7% 88.23 41.52
Total +924/-1,075 1,276,241 1,025,562 -250,680 -19.6% 217.8 97.2

New files — absolute profile

Total heartbeats: 330,323 maxHeartbeats units across 2 valid files (930 added LOC).

Sum of lean --profile: — across 0 valid files. Import-excluded time: —.

Count-heartbeats wall-clock total: 46.60 s. Repeated import cost inside lean --profile: —.

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/PLAcceleratedNesterovLean/Convergence/LocalGeometry/Main.lean 494 172,377 31.10 — — — 23 0
LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/GenMain.lean 429 157,946 15.50 — — — 15 0
LeanPool/PLAcceleratedNesterovLean/Convergence/LyapunovContraction/Main.lean 7 — — — — — 9 1
Total 930 330,323 46.60 — — — 47 1

Aggregate phase totals

Phase Time
Unavailable —

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

Main's text-based proof-size check counted the statement's let-bindings as
proof and reached 201 lines; extracting this self-contained step brings it
comfortably under the limit for both checkers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

{
"summary": "The current follow-up extracts the private derivative-equality step without changing any existing contract. The seven-file refactor preserves public hypotheses and conclusions while sharing bootstrap and contraction arguments and decomposing the eight long proofs. Current-head normal CI and execution of the intended semantic checker remain pending.",
"assessment": {
"scope": "proof decomposition and shared mathematical arguments",
"introduces_tech_debt": false,
"maintainability": "improved",
"brittleness": "unchanged",
"risk": "low",
"assessment_one_sentence": "The current exact-head continuation preserves the accepted mathematical contracts and proof structure."
},
"verdict": "approve",
"findings": []
}

@Vilin97

Vilin97 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

/review

Please review the current published head 3ce4c27. The independent source continuation is posted; older-head reviews and checks remain dated.

@Vilin97

Vilin97 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

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

Reviewed head: 3ce4c27cbc39c1ad5952f013b67acb0526350321

Verdict: ✅ approve

The refactor extracts named geometry and derivative helpers and shares the contraction and bootstrap arguments between sequence variants. It retains explicit estimates, intermediate facts, and targeted rewrites while removing duplicated reasoning. No actionable maintainability regression was found. Validation remains incomplete: the targeted project build stopped before compilation because fetching pinned Mathlib returned HTTP 403; published build and profiling jobs remain queued, with no compile-cost measurements available.

Aspect Value
Scope proof extraction and deduplication
Introduces tech debt ✅ no
Maintainability ✅ improved
Brittleness ➖ unchanged
Risk ✅ low

The shared proofs and named helpers reduce maintenance duplication while preserving the mathematical structure and existing tactic discipline.


Tokens: 3,676,482 in / 6,657 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $14.8058 (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 commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

Targeted validation at exact head 3ce4c27 passed with Lean 4.35.0, the pinned Mathlib revision, the unchanged proof-length plugin from #712, the normal project options and warningAsError.

The 40-module dependency closure includes all seven modified modules: 38 project modules compiled quietly, with two unchanged modules reused from verified prior passes; 15 missing Mathlib dependency modules were also compiled. The intended semantic proof-length checker emitted no warning. The separate 200/201 boundary controls and original over-limit baseline were preserved, not rerun.

This covers the modified files and their dependency closure. Full-project build/lint/style/quality, required contexts and native integration checks remain separate; this is not a compile-cost comparison or a closure of #723.

@Vilin97
Vilin97 added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 6814773 Nov 5, 2026
24 of 26 checks passed
Vilin97 added a commit to loefflerd/lean-pool that referenced this pull request Nov 5, 2026
Brings in the long-proof splits from LeanPool#756 and LeanPool#757 so the new linter passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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