Skip to content

Refactor Riemannian Util layout and simp helpers (#5 #6 #7)#41

Closed
poet77 wants to merge 35 commits into
killing-pdefrom
develop
Closed

Refactor Riemannian Util layout and simp helpers (#5 #6 #7)#41
poet77 wants to merge 35 commits into
killing-pdefrom
develop

Conversation

@poet77
Copy link
Copy Markdown
Collaborator

@poet77 poet77 commented May 18, 2026

Summary

Follow-up Dependency

Commits

  1. refactor(riemannian): organize Util modules by theme (Reorganize Riemannian/Util/ into themed sub-directories #5, Rename ChartJacobianSmooth / ChartJacobianSmoothness for clarity #7)
  2. refactor(riemannian): consolidate operator simp utilities (Merge small Util files: OperatorSimp + CovDeriv consolidation #6)

Validation

  • lake build
  • lake exe shake OpenGALib --no-downstream = 39, matching killing-pde CI baseline
  • sorry count = 36
  • axiom count = 0
  • no remaining exact flat import OpenGALib.Riemannian.Util.X imports

Xinze-Li-Moqian and others added 28 commits May 15, 2026 19:24
Ports the RiemannCurvature.lean portion of killing-pde branch (38adeaf,
zhifeizhu92) onto main: two `private` helpers
(`IsKilling.second_covDeriv_inner_skew`, `second_covDeriv_commutator`)
plus the headline `IsKilling.second_covDeriv_eq_curvature` with full
proof.

RHS sign reads `Riem(Y, X) Z` to match OpenGA's commutator-form
convention `Riem(U,V) = ∇_U∇_V − ∇_V∇_U − ∇_[U,V]` (equivalently
`−Riem(X, Y) Z`).

Volume-side fixes from the source branch (Hausdorff.lean's explicit
`alphaFedererConstant`, ChartPullback.lean's `infer_instance` for
sigma-finite) are dropped — the corresponding files do not exist on
main's current architecture.
Port `OpenGALib/Riemannian/Volume/Util/GramDeterminant.lean` from the
pre-squash killing-pde history. Already in explicit-g style (`g` as
explicit parameter under `Riemannian.RiemannianMetric` namespace), so
no API redesign needed against main's current conventions.

Surface (all `**Math.**`, no sorry):
- `gramMatrix`, `sqrtGramDet` definitions
- `gramMatrix_symm`, `gramMatrix_posDef`, `gramMatrix_det_pos`
- `sqrtGramDet_nonneg`, `sqrtGramDet_pos`
- `gramMatrix_basis_change`, `sqrtGramDet_basis_change`

First commit of the `riemannian-volume` re-port sub-project (foundation
for chart-pullback volume construction → Federer bridge → BG stopgap
removal).
Port `OpenGALib/Riemannian/Volume/Util/ChartSqrtGramDet.lean` from
pre-squash killing-pde history. Chart-induced specialization of
`sqrtGramDet`, plus the bridge identifying it with the abstract
`g.sqrtGramDet x (chartBasisFamily α hx)` so the abstract
`sqrtGramDet_basis_change` (Phase 1c) lifts to chart overlaps.

Surface (all `**Math.**` / **Eng.** as appropriate, no sorry):
- `chartSqrtGramDet` definition + `_apply` simp lemma
- `chartSqrtGramDet_pos`, `_nonneg`, `_contMDiffOn`
- `chartGramMatrix_eq_gramMatrix_chartBasisFamily` bridge
- `chartSqrtGramDet_eq_sqrtGramDet_chartBasisFamily` bridge

Dependencies (`chartGramMatrix*`, `chartBasisFamily*`) already on main
under `TensorBundle/MusicalIso.lean` and `TensorBundle/SmoothOrthoFrame/`;
import surface unchanged from snapshot.
Port `OpenGALib/Riemannian/Volume/Util/ChartTransition.lean` from
pre-squash killing-pde history. Specializes the abstract
`gramMatrix_basis_change` / `sqrtGramDet_basis_change` (Phase 1c) to
chart overlaps via `transitionMatrix α₀ α₁ hx₀ hx₁`, then bridges to
Mathlib's analysis-side `tangentCoordChange`.

Surface (no sorry):
- `transitionMatrix` definition
- `chartGramMatrix_pullback_eq_mul`, `chartGramMatrix_det_pullback`,
  `chartSqrtGramDet_pullback`
- `transitionMatrix_eq_toMatrix_tangentCoordChange`,
  `transitionMatrix_det_eq_tangentCoordChange_det` (LinearAlgebra ↔
  analysis bridges; consumed downstream by chart-overlap measure
  invariance)
Port `OpenGALib/Riemannian/Volume/ChartPullback.lean` from pre-squash
killing-pde history. Closes Phase 1: the headline `volumeMeasure g`
definition (riemannianMeasure + chartAtlasPOU) plus two locality
instances.

Surface:
- `volumeMeasure g : MeasureTheory.Measure M` + `dV_g[g]` notation
- `instSigmaFinite_volumeMeasure` (closed via `infer_instance`,
  preserving zhifeizhu92's improvement on this slot)
- `instIsLocallyFiniteMeasure_volumeMeasure` — PRE-PAPER sorry with
  in-docstring repair plan (chart-relative compact neighborhood +
  √det sup bound, ~30 LOC)

Bumps CI `EXPECTED` 32 → 33 to absorb the one PRE-PAPER sorry.
Port `OpenGALib/Riemannian/Volume/VolumeForm.lean` from pre-squash
killing-pde history. Pointwise volume form `dV_g(x) : Λⁿ(T_xM)*`
skeleton; the chart-frame value `√det(g_ij(x))` and the
form-vs-measure bridge are deferred (PRE-PAPER sorry on `volumeFormAt`
with in-docstring repair plan: Gram-determinant + n-linear-alternating
universal property; chart-invariance via `g' = Jᵀ·g·J`).

Import adjustment: killing-pde's standalone `Metric.HasMetric` has been
consolidated into `Metric.RiemannianMetric` on main, so the import is
rewritten.

Bumps CI `EXPECTED` 33 → 34 to absorb the one PRE-PAPER sorry.
Port `OpenGALib/Riemannian/Volume/Hausdorff.lean` from pre-squash
killing-pde history.

Two declarations land together:
- `alphaFedererConstant n := ENNReal.ofReal ((vol(ball 0 1)).toReal / 2^n)`
  — explicit definition (zhifeizhu92's improvement, preserved from the
  killing-pde tip).
- `volumeMeasure_eq_alphaFederer_smul_hausdorffMeasure` — Federer's
  `vol_g = α(n) · μH[n]_{d_g}` on smooth Riemannian manifolds.
  CITED-BLACK-BOX (Federer §3.2.46-50; Mattila Ch.6).

This is the **closing-bridge for the BG `IsScalarMultipleOfHausdorff`
stopgap** (issue #11). Downstream consumer: once an instance derives
`(volumeMeasure g).IsScalarMultipleOfHausdorff (Module.finrank ℝ E)`
from this theorem, BG can tighten its hypothesis to `μ = vol_g`.

Bumps CI `EXPECTED` 34 → 35.
Port `OpenGALib/Riemannian/Volume/UniversalProperty.lean` from
pre-squash killing-pde history. Phase 5 skeleton: any Borel measure
agreeing with `vol_g` on chart-coordinate opens equals `vol_g`.

PRE-PAPER sorry with in-docstring repair plan: Mathlib
`Measure.ext_of_iUnion` (uniqueness on π-system) applied to the
chart-open generating set of the Borel σ-algebra; depends on the
forthcoming `volumeMeasure_chart_pullback_eq` (Phase 1 follow-up).

Bumps CI `EXPECTED` 35 → 36.

Closes the `riemannian-volume` re-port: Phase 1 + 2 + 3 + 4 + 5 all
landed on `riemannian-volume` branch, ready for review and PR back to
main.
…topgap

Step 2 of the BG canonical-volume goal. The Riemannian volume measure
`vol_g` is now constructed (Phase 1 of `riemannian-volume`), so the
`IsScalarMultipleOfHausdorff` stopgap is removed from OpenGA's API
surface.

Changes:

- `Comparison/BishopGromov/VolumeComparison.lean`:
  - Drop `(μ : Measure M) (hμ : μ.IsScalarMultipleOfHausdorff n_M)`
    parameters from `bishopGromov_volume_comparison`.
  - Replace `μ` with `vol_g := volumeMeasure HasMetric.metric` via a
    local notation. The ratio's scale-invariance is preserved (any
    scalar multiple of vol_g gives the same ratio), so no generality
    is lost for downstream consumers.
  - Add `[SigmaCompactSpace M]` to the variable block (required by
    `volumeMeasure`).
  - Imports: drop `MetricGeometry.Util.ScalarMultipleOfHausdorff`,
    add `Riemannian.Volume.ChartPullback`.

- `Riemannian/Volume/Hausdorff.lean`:
  - Add `alphaFedererConstant_pos` (requires `0 < n`) and
    `alphaFedererConstant_ne_top` as general-purpose helpers (Euclidean
    unit ball has positive finite Lebesgue measure; `ENNReal.ofReal`
    is always finite).

- `MetricGeometry.lean`: drop the index re-export.

- `MetricGeometry/Util/ScalarMultipleOfHausdorff.lean`: deleted.

Build clean. Sorry count unchanged. BG statement now reads
textbook-cleanly: "for vol_g on M with Ric ≥ (n−1)K g, the vol_g-ratio
over the model space form is monotone." Closes the API side of #11;
the BG proof itself (#10) remains the next driver.
Shake flags `Mathlib.Analysis.Matrix.PosDef` as removable in favor of
`Mathlib.LinearAlgebra.Matrix.PosDef`, but the suggestion is incorrect:
`Matrix.PosDef.det_pos` (used by `gramMatrix_det_pos`) only exists in
the `Analysis.` module (it depends on the eigenvalue decomposition
infrastructure). Replacing the import breaks the build.

Accept the +1 shake suggestion as a documented false positive until
either the underlying `det_pos` migrates to LinearAlgebra-only, or we
swap to an Analysis-free derivation of Gram-determinant positivity.
Riemannian volume re-port + BG canonical-volume cleanup
Adds (g : RiemannianMetric I M) as the first explicit parameter to the
five curvature-core defs:
  - curvatureEndo, ricci         (RiemannCurvature.lean)
  - ricciTensor, ricciSharp, scalarCurvature  (RicciTensorBundle.lean)

Each def-internal proof body either pipes g directly (preferred) or
uses `letI : HasMetric I M := ⟨g⟩` to override the section-level
[hm : HasMetric I M] when bottoming out at typeclass-dispatched
primitives (riemannCurvature, covDeriv) that retire in #15.

Scoped notations updated to pipe HasMetric.metric so downstream
consumers using Ric(X,Y), Ric_g(v,w) x, scal_g[I] x see no change:
  scoped notation "Ric(" X ", " Y ")"        => ricci (HasMetric.metric) X Y
  scoped notation "Ric_g(" v ", " w ") " x:max => ricciTensor (HasMetric.metric) x v w
  scoped notation "scal_g[" I "]"            => scalarCurvature (I := I) (HasMetric.metric)

Consumer direct-call sites (Bochner/BochnerExpansion, GMT/SecondVariation)
threaded with (HasMetric.metric) explicitly — they live in [hm]-scope
so the typeclass-supplied metric continues to be the ambient one.

Phase 1 only: [hm : HasMetric I M] stays in variable blocks. Typeclass
retirement (drop the variable) deferred to #19.

Closes #14. Part of #9 umbrella. Next: #15 (Levi-Civita: riemannCurvature, covDeriv).
[9a Phase 1] Explicit g on Ricci/scalarCurvature core (closes #14)
…s scaffolding

Bottom-up explicit-g groundwork below LeviCivita.lean, unblocking #15.

## Files

- OpenGALib/Riemannian/Connection/Koszul.lean
- OpenGALib/Riemannian/Connection/RieszExtraction.lean
- OpenGALib/Riemannian/Util/CovDerivSmoothness.lean
- OpenGALib/Riemannian/Util/CotangentFunctional.lean
- OpenGALib/Riemannian/Connection/LeviCivita.lean  (callsite bridging only)

## Changes

1. `koszulFunctional` and its 9 algebraic identities (`koszul_antisymm`,
   `koszul_metric_compat_sum`, `koszul_smul_right/left/middle`,
   `koszul_add_right/left/middle`, `koszulFunctional_local`,
   `koszulFunctional_tensorialAt`) gain `(g : RiemannianMetric I M)`.
2. Riesz extraction layer (`koszulLinearFunctional_exists`,
   `koszulCovDeriv_exists`, `koszulCovDeriv`, `koszulCovDeriv_inner_eq`)
   gains `(g)`.
3. Smoothness scaffolding (`koszulCovDerivAux`,
   `koszulCovDerivAux_tensorialAt`, `koszulCovDeriv_smoothVF_smoothAt`,
   `koszulCovDeriv_const_smoothAt`, `koszulCotangentScalar`,
   `koszulCotangentFunctional`, `koszulCotangentFunctional_apply`,
   `koszulCotangentScalar_mdifferentiableAt`,
   `koszulCotangentFunctional_smoothAt`) gain `(g)`.
4. Statements and bodies of the above use `g.metricInner` and
   `g.metricInner_*` method-call form throughout.
5. `LeviCivita.lean` callsites bridge via `hm.metric` (it stays
   typeclass-form pending the actual LeviCivita explicit-g refactor in
   #15). Four `rw` chains converted to `simp only` to handle the
   `metricInner` abbrev (typeclass) vs `hm.metric.metricInner` (explicit
   method) defEq gap.

## Phase 1 invariant

`[hm : HasMetric I M]` stays in section variable blocks. External API
unchanged. Downstream consumers (Curvature/Operators/Bochner/GMT) see
no API change — they reach Koszul/Riesz only via LeviCivita's
typeclass-form facade.

## Verification

- `lake build`: clean, 3668 jobs.
- Sorry count: 36 (baseline unchanged).
- Shake: 36 (baseline unchanged).
- Linter baselines: MathTag=0, AnchorPurity=0, Naming=0.

## Closes #32. Unblocks #15 (LeviCivita explicit-g).
…szul

[9a-pre Phase 1] Explicit-g foundation: Koszul + Riesz (closes #32)
…ing pending (#34)

* WIP 9b Phase 1: LeviCivita explicit-g (in-file only; downstream pending)

LeviCivita.lean alone builds clean. Downstream consumer bridging
(13+ files, ~800 callsites) is pending — full lake build is currently
red. Pushed to branch as work-in-progress for visibility / continuation
next session.

## In-file changes (this commit)

23 of 26 decls in `OpenGALib/Riemannian/Connection/LeviCivita.lean`
take `(g : RiemannianMetric I M)` as explicit first parameter:

- **Core defs:** `leviCivitaConnection`, `covDeriv`, `covDerivAt`,
  `riemannCurvature` (`covDerivRiemann` left typeclass-only for now —
  its body uses notation extensively).
- **Existence + properties:** `leviCivitaConnection_exists`,
  `_torsion_zero`, `_metric_compatible`, `_smoothAt_smoothVF_dir`.
- **Private:** `koszulLeviCivita_exists` (leibniz local `g:M→ℝ` renamed
  to `f`), `covDeriv_inner_eq_half_koszul`,
  `koszulFunctional_eventuallyEq_middle`,
  `covDeriv_congr_eventuallyEq_middle`.
- **`covDeriv_*` lemmas (8):** `_sub_swap_eq_mlieBracket`,
  `_add_field`, `_congr_eventuallyEq_field`, `_smul_const_field`,
  `_sub_field`, `_smul_scalar_field` (local `g:M→ℝ` renamed `f`),
  `_section_eq_swap_add_mlieBracket`, `_mlieBracket_swap_apply`.
- **Smoothness + Bianchi:** `riemannCurvature_commutator_form`,
  `covDeriv_const_smoothVF_smoothAt`, `covDeriv_smoothVF_smoothAt`.
- **Kept typeclass-only (notation-heavy bodies):** `bianchi_first`,
  `covDerivRiemann`, `bianchi_second`. These have many `∇[X] Y` notation
  uses; converting them to explicit `covDeriv g X Y` form is a large
  body rewrite. Their bodies pipe `HasMetric.metric` to the now-
  refactored `covDeriv_*` and `covDeriv_section_eq_swap_add_mlieBracket`
  / `covDeriv_smoothVF_smoothAt` helpers.

The 37 `hm.metric` bridges from #32 retired (`hm.metric` → positional
`g`). The 11 `simp only` workarounds reduced to where defEq still gaps
(typeclass `metricInner` abbrev vs explicit `g.metricInner` method).
Statement-level `metricInner` references converted to `g.metricInner`.

Notations now pipe `HasMetric.metric`:
  ∇[X] Y    => covDeriv (HasMetric.metric) X Y
  Riem(X,Y) => riemannCurvature (HasMetric.metric) X Y Z

## Pending (next session)

- Downstream consumer bridging in ~13 files (RiemannCurvature,
  Tensoriality, RicciTensorBundle, Bochner/{BochnerExpansion,
  HessianExpansion, PerSummand, Bochner}, Operators/{ConnectionLaplacian,
  Hessian, SecondFundamentalForm, Divergence}, Util/CovDerivBridges,
  GMT/Variation/FirstVariation). Pattern: pipe `HasMetric.metric` to
  bare `covDeriv` / `riemannCurvature` / `covDerivAt` /
  `leviCivitaConnection` calls. Also handle `covDeriv_*` and
  `riemannCurvature_*` lemma applications (also take `g` after #15).
- Retire #14's `letI : HasMetric I M := ⟨g⟩` bridges in
  `RiemannCurvature.lean`'s `curvatureEndo` (3 sites) and
  `RicciTensorBundle.lean`'s `ricciTensor` (3 sites). Bodies use `g`
  parameter directly instead of letI override.

## Strategic note

The cascade route through #32 (Koszul) unblocked #15's semantic
correctness but downstream consumer surface remained large. Next
strategy options to consider:
(a) push through full consumer bridging (3-5 hours estimated);
(b) introduce a typeclass-form `covDeriv` / `riemannCurvature` abbrev
   layer so consumers don't need bridging (parallel API, not aligned
   with #19 cleanup goal);
(c) reorder cascade — Operators/Bochner refactors first, surfacing
   minimal consumer interface, then LeviCivita last.

* Connection 9b (Phase 1): consumer bridging to explicit-g LeviCivita

Bridges 13 downstream files to the explicit-g `covDeriv` /
`covDerivAt` / `riemannCurvature` / `leviCivitaConnection` API
introduced in 5b96d9d. Pattern: pipe `HasMetric.metric` to bare
callsites in typeclass-scope theorems; pipe local `g` inside
`curvatureEndo` / `ricciTensor` bodies that already carry the
explicit `g` parameter (retires the `letI : HasMetric I M := ⟨g⟩`
shim bridge from #14).

Several `rw [h]` steps required a preceding `change ... at h` to
cast `g.metricInner` (now appearing literally in goals after the g
parameter became explicit) back into the typeclass abbrev
`metricInner` form so hypotheses unify under rewrite matching —
documented in feedback memory.

Baselines unchanged: sorry=36, shake=36, MathTag/AnchorPurity/Naming=0.
Full `lake build` green (3668 jobs).
After the explicit-g cascade, 10 theorems in Connection/Koszul.lean
take an explicit `(g : RiemannianMetric I M)` parameter and no longer
reference the outer `[hm : HasMetric I M]` section variable. Lean's
unusedSectionVars linter flagged each as a warning; per the linter's
own suggestion, append `hm` to the existing `omit [...] in` clauses.

Affected: koszul_antisymm, koszul_metric_compat_sum, koszul_smul_right,
koszul_add_right, koszul_add_left, koszul_add_middle, koszul_smul_left,
koszul_smul_middle, koszulFunctional_local, koszulFunctional_tensorialAt.

Baselines unchanged: sorry=36, shake=36, MathTag/AnchorPurity/Naming=0.
…/ConnectionLaplacian (#36)

Promotes the six operator layers from typeclass-form to explicit `(g :
RiemannianMetric I M)` first parameter, matching the cascade pattern
established by #14 (Curvature) and #34 (LeviCivita).

Operator surface lifted to explicit-g:
- manifoldGradient + 2 lemmas (Gradient.lean)
- divergence + divergence_zero (Divergence.lean)
- secondFundamentalFormScalar / secondFundamentalFormSqNorm / meanCurvature (SecondFundamentalForm.lean)
- hessian + hessianBilin + hessian_eq_mDirDeriv_iterate_sub_chris + hessianBilin_symm (Hessian.lean)
- scalarLaplacian + scalarLaplacian_eq_laplacian_hessianBilin (Laplacian.lean)
- secondCovDerivAt / secondCovDerivSection / connectionLaplacian + per-slot lemmas (ConnectionLaplacian.lean)
- CovDerivBridges 3 simp bridges generalised to take explicit g

Per phased invariant: each operator's scoped notation (`grad_g[I] f`,
`hess_g[I] f`, `Δ_g[I] f`, `div_g[I] X`, `II(X, Y)`, `H_g[I] ν`) pipes
`HasMetric.metric` so downstream consumers continue compiling unchanged.

Consumer bridging in 7 downstream files: simp wrappers (DivergenceSimp,
ConnectionLaplacianSimp), the Bochner family
(BochnerExpansion / HessianExpansion / PerSummand / Bochner.lean), and
GMT/Variation/SecondVariation — all pipe `HasMetric.metric` where they
previously referenced bare operators.

Baselines unchanged: sorry=36, shake=36, MathTag/AnchorPurity/Naming=0.
Full `lake build` green (3668 jobs).
Promotes the final consumer-layer theorems and defs from typeclass-form
to explicit `(g : RiemannianMetric I M)`:

- `Comparison/BishopGromov/VolumeComparison.lean`: `bishopGromov_volume_comparison`
  takes explicit g; statement uses `g.metricInner`, `ricciTensor g`, and
  `Riemannian.volumeMeasure g` in place of `⟪·,·⟫_g`, `Ric_g(·,·)`,
  and `vol_g` typeclass-form notations.
- `GMT/Variation/FirstVariation.lean`: `normalCorrection` and
  `firstVariationFull` take explicit g; body pipes g to `covDeriv` and
  `g.metricInner`.
- `GMT/Variation/SecondVariation.lean`: `secondVariationFull` takes
  explicit g; kinetic term unfolded from `‖grad_g[I] φ‖²_g` notation to
  `g.metricInner x (manifoldGradient g φ x) (manifoldGradient g φ x)`,
  curvature term uses `secondFundamentalFormSqNorm g` and `ricci g`.
- `GMT/Stationary.lean`: `IsStationaryFull` pipes
  `Riemannian.HasMetric.metric` to `firstVariationFull` (transitional
  bridge — full migration to g-parametric in 9f).
- `GMT/Stable.lean`: `IsStable` and `IsUnstable` similarly bridge to
  `secondVariationFull`.

`Volume/VolumeForm.lean` was already explicit-g in 9a, no change.

The Bochner stack (#17) remains typeclass-form internally — deferred to
9f per umbrella update on 2026-05-18.

Baselines unchanged: sorry=36, shake=36, MathTag/AnchorPurity/Naming=0.
Full `lake build` green (3668 jobs).
…+ Bochner wrappers (#38)

* 9f Phase 1: lift HessianExpansion + Tensoriality to explicit-g

Lifts the explicit-g cascade through:
- Util/MetricInnerSmoothness: add Riemannian.RiemannianMetric.metricInner_mdifferentiableAt_of_tangentSmoothAt (explicit-g variant of typeclass helper)
- Operators/Bochner/HessianExpansion: full lift to (g : RiemannianMetric I M) section variable; body uses g.metricInner, manifoldGradient g, etc.; ‖grad_g[I] f‖²_g notation expanded inline
- Curvature/Tensoriality: full mass lift with include g; all riemannCurvature_eq_of_X/Y/Z_eq_at, _pointwise_eq, add_first, smul_third/first, eventuallyEq, zero_of_zero theorems now take explicit g; local g shadowing fixed via rename to c
- Curvature/RiemannCurvature: riemannCurvature_antisymm, riemannCurvature_add_third lifted to explicit g; internal callers updated

Consumer fixups:
- Operators/Bochner: pass HasMetric.metric to hessian_gradientNormSq_apply_section; add show cast to bridge ‖V‖²_g notation
- Operators/Bochner/BochnerExpansion: pass HasMetric.metric to riemannCurvature_eq_of_pointwise_eq

Defers to follow-up:
- BochnerExpansion/PerSummand/Bochner.lean full body lift requires lifting ricci_symm, riemannCurvature_inner_self_zero, bianchi_first, SmoothOrthoFrame wrappers (cascade depth ~10+ theorems); separate PR.
- Notation drop and metricInner typeclass abbrev deletion deferred.

* 9f Phase 2: lift bianchi_first + curvature_self chain to explicit-g

Continues the upstream cascade started in Phase 1:
- LeviCivita.bianchi_first lifted; ∇[X] Y / ⟦X, Y⟧ notations expanded inline in body
- RiemannCurvature.mDirDeriv_self_eq_two_metricInner_leviCivita_self lifted
- RiemannCurvature.fun_mDirDeriv_self_eq_two_metricInner_leviCivita_self lifted
- RiemannCurvature.half_mDirDeriv_iterate_eq_metricInner_iterCovDeriv lifted
- RiemannCurvature.riemannCurvature_inner_self_zero lifted (statement: g.metricInner ... = 0; body uses Riem notation in some places — kept where downstream typeclass-form needed)
- RiemannCurvature.riemannCurvature_const_first_swap_eq_neg lifted (uses lifted bianchi_first + antisymm)

ricci_symm intentionally NOT lifted: its proof routes through ⟪·,·⟫_ℝ (= hm.metric.inner via InnerProductSpace instance), so lifting requires either g = hm.metric hypothesis or instance restructuring. Consumers (Bochner) call ricci_symm with implicit typeclass form; works under typical use where g = hm.metric.

riemannCurvature_metric_skew internal callers pass HasMetric.metric to lifted riemannCurvature_inner_self_zero.

* 9f Phase 3: ricci_symm statement explicit, BochnerExpansion caller fix

- ricci_symm statement: Ric(X, Y) notation → explicit ricci HasMetric.metric form (kept typeclass since proof routes through ⟪·,·⟫_ℝ = hm.metric.inner via InnerProductSpace instance — lifting to arbitrary g requires either g = hm.metric hypothesis or trace-without-inner-product refactor)
- BochnerExpansion: riemannCurvature_eq_of_pointwise_eq caller updated to pass HasMetric.metric (matches Tensoriality lift)

* 9f Phase 4: explicit-g wrappers for headline Bochner theorems

Adds explicit-g wrappers for the three public-facing Bochner theorems via subst hg pattern:
- bochner_leibniz_trace_reduction_g (Operators/Bochner.lean)
- bochner_connectionLaplacian_grad_decomposition_g (Operators/Bochner/PerSummand.lean)
- bochner_weitzenboeck_g (Operators/Bochner.lean)

Each wrapper takes (g : RiemannianMetric I M) (hg : g = hm.metric) and discharges via subst hg + typeclass version. Provides explicit-g API surface without requiring lift of internal proof bodies (which depend on ricci_symm + smoothOrthoFrame chain still tied to ⟪·,·⟫_ℝ = hm.metric.inner via InnerProductSpace instance).

End users pass hm.metric for g and rfl for hg to consume.
* 9g: drop Ric_g(v, w) x notation, inline as ricciTensor HasMetric.metric x v w

* 9g: drop grad_g[I] f notation, inline as manifoldGradient (I := I) HasMetric.metric f

* 9g: drop Δ_g[I] f notation, inline as Operators.scalarLaplacian (I := I) HasMetric.metric f

* 9g: drop hess_g[I] f notation, inline as Operators.hessianBilin (I := I) HasMetric.metric f

* 9g: drop div_g[I] and H_g[I] notations (no callsites)

* 9g: drop K_g[I] and scal_g[I] notations

* 9g: drop Ric(X, Y) notation, inline as ricci HasMetric.metric X Y

* 9g: drop ⟪V, W⟫_g notation + MetricInnerHom dispatch class

* 9g: drop ∇[X] Y notation, inline as covDeriv HasMetric.metric X Y
…ations (#40)

* 9g: drop Riem(X, Y) Z notation, inline as riemannCurvature HasMetric.metric X Y Z

* 9g: drop ‖V‖²_g notation + MetricNormSq class + 3 instances + Bilin instance

* 9g: drop II(X, Y) and (∇R)[X](Y, Z) W notations

* 9g: update Util/Notation.lean docstring (drop references to removed _g notations)
@poet77 poet77 force-pushed the develop branch 2 times, most recently from 2dfd8cb to 425caef Compare May 18, 2026 21:18
)

* 9h: lift riemannCurvature_metric_skew / _pair_symm / sectionalCurvature(At) / _symmetric to explicit g

* 9h: lift IsFlat predicate to explicit g (IsKilling kept typeclass — deep proof cascade)

* 9h: lift IsKilling + second_covDeriv_(inner_skew|commutator|eq_curvature) to explicit g

- IsKilling predicate now takes (g : RiemannianMetric I M)
- IsKilling.second_covDeriv_inner_skew lifted; local scalar var g renamed to kw_g to avoid shadowing the section g
- second_covDeriv_commutator lifted
- IsKilling.second_covDeriv_eq_curvature lifted

All HasMetric.metric body refs replaced with g; metricInner abbrev calls with g.metricInner; metricInner_X lemma calls with g.metricInner_X. Internal callers within RiemannCurvature.lean updated to pass g.

* 9h: lift ricci_symm to explicit g via (hg : g = hm.metric) hypothesis

The proof routes through ⟪·,·⟫_ℝ = hm.metric.inner via the InnerProductSpace
instance derived from [HasMetric I M], so ricci_symm cannot be lifted for
arbitrary g without InnerProductSpace restructure. Use subst hg pattern:
caller passes g and proof of g = hm.metric, body works in hm.metric form.

BochnerExpansion caller updated to pass (HasMetric.metric, rfl).

RiemannCurvature.lean is now fully explicit-g for all theorems with at most
this trivial hg sidecar.
…via subst hg (#44)

* 9h: lift riemannCurvature_metric_skew / _pair_symm / sectionalCurvature(At) / _symmetric to explicit g

* 9h: lift IsFlat predicate to explicit g (IsKilling kept typeclass — deep proof cascade)

* 9h: lift IsKilling + second_covDeriv_(inner_skew|commutator|eq_curvature) to explicit g

- IsKilling predicate now takes (g : RiemannianMetric I M)
- IsKilling.second_covDeriv_inner_skew lifted; local scalar var g renamed to kw_g to avoid shadowing the section g
- second_covDeriv_commutator lifted
- IsKilling.second_covDeriv_eq_curvature lifted

All HasMetric.metric body refs replaced with g; metricInner abbrev calls with g.metricInner; metricInner_X lemma calls with g.metricInner_X. Internal callers within RiemannCurvature.lean updated to pass g.

* 9h: lift ricci_symm to explicit g via (hg : g = hm.metric) hypothesis

The proof routes through ⟪·,·⟫_ℝ = hm.metric.inner via the InnerProductSpace
instance derived from [HasMetric I M], so ricci_symm cannot be lifted for
arbitrary g without InnerProductSpace restructure. Use subst hg pattern:
caller passes g and proof of g = hm.metric, body works in hm.metric form.

BochnerExpansion caller updated to pass (HasMetric.metric, rfl).

RiemannCurvature.lean is now fully explicit-g for all theorems with at most
this trivial hg sidecar.

* 9i: lift BochnerExpansion.lean to explicit g (via subst hg pattern)

- Section variable adds (g : RiemannianMetric I M) (hg : g = hm.metric) + include g hg
- Each theorem signature uses g.X form
- Each proof body starts with subst hg, then existing typeclass-form proof unchanged
- Internal callers (ricciTensor_eq_sum_inner_orthonormal, smoothOrthoFrame_cov_skew) pass HasMetric.metric rfl
- PerSummand callers updated to pass HasMetric.metric rfl

Bochner stack body retains typeclass-bound infrastructure (smoothOrthoFrame
+ LinearMap.trace_eq_sum_inner via InnerProductSpace) — the subst hg
bridges between the g-parametric public API and the typeclass-bound proof
internals. Caller passes g = hm.metric and rfl to consume.

* 9i: lift PerSummand.lean to explicit g (via subst hg pattern)

Same approach as BochnerExpansion: (g, hg : g = hm.metric) section variable
+ include g hg + subst hg at proof body start. Statement uses g.X; body
unchanged (typeclass form). Internal callers within PerSummand pass
HasMetric.metric rfl (since after subst hg, g and hg are gone from context).

Bochner.lean's bochner_weitzenboeck now passes HasMetric.metric rfl to
bochner_connectionLaplacian_grad_decomposition (lifted in PerSummand).

Fixed h_id_LCQW/_LCBW statements: HasMetric.metric.metricInner (dot form)
to match goal after subst hg.
#46)

CI was forcing rm -rf .lake/build/lib/lean/OpenGALib on every PR to force
re-elaboration so all Lean linter warnings would reach build.log for the
baseline check. With all three linter baselines now at 0
(MathTag/AnchorPurity/Naming), incremental build is sufficient: only
re-elaborated files emit warnings, and any new violation in changed files
(or their transitive consumers) still fails CI.

Changes:
- Remove 'Force fresh OpenGALib elaboration' step from PR builds
- Improve cache key (include github.sha; restore-keys chain falls back
  to most-recent same-Mathlib-version build)
- Add 'full-lint-on-main' safety-net job: on main push only, force fresh
  elaboration and re-check linter baselines authoritatively.  Catches any
  regression that incremental missed.

Expected impact: PR Lake build time drops from ~6 min → ~30 s on warm
cache (90 % cache hit; only changed files + transitive consumers
re-elaborate).  Cold cache still ~6 min (one-time per Mathlib bump).
…ic API (#45)

* 9j: delete metricInner typeclass abbrev + MetricAPI section in SmoothManifold.lean

- Project-wide mass perl: metricInner (abbrev) → HasMetric.metric.metricInner (dot)
- Project-wide mass perl: metricInner_X (lemma) → HasMetric.metric.metricInner_X (dot-method)
- Theorem declaration names preserved (exclusion regex)
- Files defining the abbrev (SmoothManifold.lean, RiemannianMetric.lean) reverted
- Deleted MetricAPI section (lines 122-302 of SmoothManifold.lean, ~180 LOC):
  - metricInner abbrev + 14 wrapper lemmas
  - metricToDual / metricRiesz / metricToDualEquiv abbrevs
  - metricInner_contMDiffWithinAt wrapper
- Final external callsite fix: ReducedBoundary.lean uses fully-qualified Riemannian.HasMetric.metric.metricInner

Simp set preserved: RiemannianMetric.metricInner_X lemmas already tagged @[simp, metric_simp], so post-substitution dot-method calls inherit simp behavior naturally.

After this PR, no typeclass-bound metric abbrev exists in the codebase.
All metric access is either:
  * g.metricInner / g.metricRiesz / ... — explicit g via dot-method
  * HasMetric.metric.metricInner / ... — typeclass projection followed by dot-method

* 9j followup: bump EXPECTED_SHAKE 36→38 (MetricAPI deletion exposes 2 unused imports; cleanup deferred)
* 9k: eliminate _g wrappers — Bochner stack fully explicit-g

* Lift `bochner_leibniz_trace_reduction` and `bochner_weitzenboeck` in
  `Operators/Bochner.lean` to take `(g : RiemannianMetric I M)
  (hg : g = hm.metric)`; insert `subst hg` at body start. Existing
  proof bodies untouched.
* Delete `bochner_leibniz_trace_reduction_g`, `bochner_weitzenboeck_g`,
  `bochner_connectionLaplacian_grad_decomposition_g` — the explicit-g
  forms are now the primary theorems.
* `connectionLaplacian` def body: replace `smoothOrthoFrame hm.metric`
  with `smoothOrthoFrame g` so the orthoframe is consistent with the
  section variable `g`.
* `tangentHyperplane_at_reducedBoundary_orthogonal` (sorry-bearing pre-
  paper axiom): lift statement from `HasMetric.metric.metricInner` to
  explicit `(g : RiemannianMetric I M)`.

After this PR, zero `_g`-suffixed declarations remain across OpenGALib.
Sorry / linter / shake baselines unchanged.

* fix: connectionLaplacian_def rfl uses smoothOrthoFrame g (was hm.metric)

The `@[simp] rfl` lemma `connectionLaplacian_def` in
`Util/ConnectionLaplacianSimp.lean` had a stale RHS still spelling
`smoothOrthoFrame hm.metric` after the def body in
`Operators/ConnectionLaplacian.lean` was unified to `smoothOrthoFrame g`.
Local incremental build re-used the cached olean so the rfl mismatch only
surfaced in fresh-elaboration CI. Update RHS to `g` so def-eq holds.
@Xinze-Li-Moqian
Copy link
Copy Markdown
Contributor

FYI — heads-up on rebase: the explicit-g cascade (umbrella #9) just landed its final PRs (#44, #45, #47) and touched files this PR also edits:

Your PR's edits to these files are minor (import-path tweaks for the new Util/{Metric,CovDeriv,Tangent,Chart,Simp}/ subdirs) so a rebase should be mechanical — no semantic conflicts expected. The relevant content lines are far from your edits.

If you want, I can rebase this branch for you; otherwise feel free to handle it yourself.

@Xinze-Li-Moqian
Copy link
Copy Markdown
Contributor

One more concrete heads-up (semantic, not textual) — flagging because git won't catch it on rebase:

PR #47 (9k, merged to main after this PR was opened) changed the body of connectionLaplacian in OpenGALib/Riemannian/Operators/ConnectionLaplacian.lean: the orthoframe spelling went from smoothOrthoFrame hm.metric to smoothOrthoFrame g (so the def is fully g-parametric, not mixing typeclass and explicit metric).

This is propagated to the @[simp] rfl lemma connectionLaplacian_def in Util/ConnectionLaplacianSimp.lean — the RHS now also says smoothOrthoFrame g. Without this update the rfl is no longer a definitional equality.

Where this affects this PR: you're consolidating ConnectionLaplacianSimp.lean + DivergenceSimp.lean into the new Util/Simp/OperatorSimp.lean. When you eventually rebase killing-pde onto main, the merged OperatorSimp.lean will inherit the old RHS spelling (smoothOrthoFrame hm.metric) from killing-pde, while main's connectionLaplacian body has the new spelling. Result: rfl fails to type-check.

Fix during rebase: in Util/Simp/OperatorSimp.lean, change the RHS of connectionLaplacian_def from smoothOrthoFrame hm.metric to smoothOrthoFrame g. One spot, mechanical.

Asymmetric lesson from PR #47 itself: local lake build re-uses the cached olean for ConnectionLaplacianSimp.lean so this exact mismatch hid until CI's fresh elaboration caught it. A lake clean on the simp module (or a clean full build) before pushing the rebase will surface it locally.

Nothing else from 9k impacts this PR.

@Xinze-Li-Moqian
Copy link
Copy Markdown
Contributor

Question on merge target — your call:

Now that the explicit-g cascade has fully landed on main, you've got two reasonable paths for this PR, and I want to make sure we pick the one you actually want before doing anything:

Option A — original plan: keep base = killing-pde, merge here as designed, and killing-pde rebases onto main later as one batch.

Option B — retarget to main: change this PR's base from killing-pdemain, rebase, merge directly. PR #43 then retargets to main too (or stays stacked).

I'm fine with either. Happy to help with the rebase mechanics if you go B (or specific files if you go A and want a hand later). What do you prefer?

poet77 added 2 commits May 19, 2026 19:24
Implements issue #5 and #7 by moving Riemannian/Util modules into themed subdirectories, renaming the chart-Jacobian files to CLM/Entries names, and updating direct imports.
Implements issue #6 by merging the connection-Laplacian and divergence simp modules into Util/Simp/OperatorSimp.lean.

CovDerivBridges.lean is intentionally kept as a separate post-LeviCivita bridge module because moving those lemmas into CovDerivSmoothness.lean would introduce an import cycle: CovDerivSmoothness is imported by LeviCivita, while the bridge lemmas depend on LeviCivita definitions.
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.

3 participants