Skip to content

Commit cdc8123

Browse files
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
1 parent 6952f77 commit cdc8123

10 files changed

Lines changed: 119 additions & 306 deletions

File tree

OpenGALib/GeometricMeasureTheory/Isoperimetric/ReducedBoundary.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ infrastructure.
145145
theorem tangentHyperplane_at_reducedBoundary_orthogonal
146146
(Ω : FinitePerimeter M) (x : M)
147147
(_hx : x ∈ FinitePerimeter.reducedBoundary Ω) (v : TangentSpace I x) :
148-
Riemannian.metricInner x v (Varifold.bvGradientDirection I Ω x) = 0
148+
Riemannian.HasMetric.metric.metricInner x v (Varifold.bvGradientDirection I Ω x) = 0
149149
v ∈ (Submodule.span ℝ {Varifold.bvGradientDirection I Ω x})ᗮ := by
150150
sorry
151151

OpenGALib/Riemannian/Curvature/RicciTensorBundle.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ fixed real constant $c$ (the *Einstein constant*).
574574
Reference: do Carmo §4 Ex. 6; Petersen Ch. 3 §6. -/
575575
def IsEinstein : Prop :=
576576
∃ c : ℝ, ∀ (x : M) (V W : TangentSpace I x),
577-
ricciTensor HasMetric.metric x V W = c * metricInner x V W
577+
ricciTensor HasMetric.metric x V W = c * HasMetric.metric.metricInner x V W
578578

579579
end Riemannian
580580

OpenGALib/Riemannian/Curvature/RiemannCurvature.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ $K_g(X, Y)(x) = K_g(Y, X)(x)$.
10711071
Numerator: $g(R(X,Y)Y, X) = g(R(Y,X)X, Y)$ via `riemannCurvature_pair_symm`
10721072
on $(X, Y, Y, X) \leftrightarrow (Y, X, X, Y)$, then a sign cancellation
10731073
using `riemannCurvature_antisymm` once in each slot.
1074-
Denominator: symmetric in $X, Y$ via `metricInner_comm`. -/
1074+
Denominator: symmetric in $X, Y$ via `HasMetric.metric.metricInner_comm`. -/
10751075
theorem sectionalCurvature_symmetric
10761076
[IsManifold I 2 M]
10771077
(g : RiemannianMetric I M)

OpenGALib/Riemannian/Instances/EuclideanSpace.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ over itself with the standard inner product as a constant metric tensor.
1212
1313
* `euclideanRiemannianMetric` — the flat metric as data
1414
(`RiemannianMetric (𝓘(ℝ, E)) E`).
15-
* `metricInner_euclidean` — `g.metricInner x v w = ⟪v, w⟫_ℝ` on the
15+
* `HasMetric.metric.metricInner_euclidean` — `g.metricInner x v w = ⟪v, w⟫_ℝ` on the
1616
flat metric.
1717
1818
Reference: do Carmo, *Riemannian Geometry*, §1.1 Example 1.4.

OpenGALib/Riemannian/Manifold/SmoothManifold.lean

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -119,191 +119,4 @@ instance instHasMetricOfRiemannianManifold :
119119

120120
end RiemannianManifoldBridges
121121

122-
/-! ## Math-first metric API
123-
124-
Downstream operator code reads as textbook math when the metric is
125-
carried implicitly by `[HasMetric I M]`:
126-
127-
* `metricInner x v w` (inner product on `T_xM`, not `g.metricInner`)
128-
* `metricRiesz x φ` (Riesz dual vector)
129-
* `metricInner_add_left ...` (algebra lemmas, bare names)
130-
131-
Each wrapper takes `[HasMetric I M]` as instance argument and delegates
132-
to the underlying `RiemannianMetric.X` method on `HasMetric.metric`.
133-
Wrappers are `abbrev` / direct delegations so `g.X`-style proofs still
134-
work via abbrev unfolding, and so the `@[simp]` / `@[metric_simp]` simp
135-
sets unify naturally with the underlying method-form lemmas. -/
136-
137-
section MetricAPI
138-
139-
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
140-
{H : Type*} [TopologicalSpace H] {I : ModelWithCorners ℝ E H}
141-
{M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I ∞ M]
142-
[hm : HasMetric I M]
143-
144-
/-- **Math.** The **metric inner product** $\langle V, W\rangle_g$ as a
145-
top-level function, sourcing $g$ from `[HasMetric I M]`. -/
146-
noncomputable abbrev metricInner (x : M)
147-
(v w : TangentSpace I x) : ℝ :=
148-
hm.metric.metricInner x v w
149-
150-
@[simp]
151-
theorem metricInner_apply (x : M) (v w : TangentSpace I x) :
152-
metricInner x v w = hm.metric.inner x v w := rfl
153-
154-
/-- **Math.** Symmetry: $\langle V, W\rangle_g = \langle W, V\rangle_g$. -/
155-
theorem metricInner_comm (x : M) (v w : TangentSpace I x) :
156-
metricInner x v w = metricInner x w v :=
157-
hm.metric.metricInner_comm x v w
158-
159-
/-- **Math.** Positive-definiteness: $V \ne 0 \Rightarrow \langle V, V\rangle_g > 0$. -/
160-
theorem metricInner_self_pos (x : M) (v : TangentSpace I x)
161-
(hv : v ≠ 0) : 0 < metricInner x v v :=
162-
hm.metric.metricInner_self_pos x v hv
163-
164-
@[metric_simp]
165-
theorem metricInner_add_left (x : M) (v₁ v₂ w : TangentSpace I x) :
166-
metricInner x (v₁ + v₂) w = metricInner x v₁ w + metricInner x v₂ w :=
167-
hm.metric.metricInner_add_left x v₁ v₂ w
168-
169-
@[metric_simp]
170-
theorem metricInner_add_right (x : M) (v w₁ w₂ : TangentSpace I x) :
171-
metricInner x v (w₁ + w₂) = metricInner x v w₁ + metricInner x v w₂ :=
172-
hm.metric.metricInner_add_right x v w₁ w₂
173-
174-
@[metric_simp]
175-
theorem metricInner_smul_left (x : M) (c : ℝ)
176-
(v w : TangentSpace I x) :
177-
metricInner x (c • v) w = c * metricInner x v w :=
178-
hm.metric.metricInner_smul_left x c v w
179-
180-
@[metric_simp]
181-
theorem metricInner_smul_right (x : M) (c : ℝ)
182-
(v w : TangentSpace I x) :
183-
metricInner x v (c • w) = c * metricInner x v w :=
184-
hm.metric.metricInner_smul_right x c v w
185-
186-
@[simp, metric_simp]
187-
theorem metricInner_zero_left (x : M) (w : TangentSpace I x) :
188-
metricInner x 0 w = 0 :=
189-
hm.metric.metricInner_zero_left x w
190-
191-
@[simp, metric_simp]
192-
theorem metricInner_zero_right (x : M) (v : TangentSpace I x) :
193-
metricInner x v 0 = 0 :=
194-
hm.metric.metricInner_zero_right x v
195-
196-
@[simp, metric_simp]
197-
theorem metricInner_neg_left (x : M) (v w : TangentSpace I x) :
198-
metricInner x (-v) w = -metricInner x v w :=
199-
hm.metric.metricInner_neg_left x v w
200-
201-
@[simp, metric_simp]
202-
theorem metricInner_neg_right (x : M) (v w : TangentSpace I x) :
203-
metricInner x v (-w) = -metricInner x v w :=
204-
hm.metric.metricInner_neg_right x v w
205-
206-
@[simp, metric_simp]
207-
theorem metricInner_sub_left (x : M) (v₁ v₂ w : TangentSpace I x) :
208-
metricInner x (v₁ - v₂) w = metricInner x v₁ w - metricInner x v₂ w :=
209-
hm.metric.metricInner_sub_left x v₁ v₂ w
210-
211-
@[simp, metric_simp]
212-
theorem metricInner_sub_right (x : M) (v w₁ w₂ : TangentSpace I x) :
213-
metricInner x v (w₁ - w₂) = metricInner x v w₁ - metricInner x v w₂ :=
214-
hm.metric.metricInner_sub_right x v w₁ w₂
215-
216-
@[simp, metric_simp]
217-
theorem metricInner_self_nonneg (x : M) (v : TangentSpace I x) :
218-
0 ≤ metricInner x v v :=
219-
hm.metric.metricInner_self_nonneg x v
220-
221-
/-- **Math.** Non-degeneracy: vectors with equal inner-products against every test
222-
vector are equal. -/
223-
theorem metricInner_eq_iff_eq (x : M) (v w : TangentSpace I x) :
224-
(∀ z : TangentSpace I x, metricInner x v z = metricInner x w z) ↔
225-
v = w :=
226-
hm.metric.metricInner_eq_iff_eq x v w
227-
228-
section RieszSection
229-
230-
variable [FiniteDimensional ℝ E]
231-
232-
/-- **Math.** The **metric-to-dual** continuous linear map $V \mapsto g_x(V, \cdot)$. -/
233-
noncomputable abbrev metricToDual (x : M) :
234-
TangentSpace I x →L[ℝ] (TangentSpace I x →L[ℝ] ℝ) :=
235-
hm.metric.metricToDual x
236-
237-
omit [FiniteDimensional ℝ E] in
238-
@[simp]
239-
theorem metricToDual_apply (x : M) (v w : TangentSpace I x) :
240-
metricToDual x v w = metricInner x v w := rfl
241-
242-
omit [FiniteDimensional ℝ E] in
243-
theorem metricToDual_injective (x : M) :
244-
Function.Injective (metricToDual (I := I) (M := M) x) :=
245-
hm.metric.metricToDual_injective x
246-
247-
theorem metricToDual_bijective (x : M) :
248-
Function.Bijective (metricToDual (I := I) (M := M) x) :=
249-
hm.metric.metricToDual_bijective x
250-
251-
/-- **Math.** Inverse Riesz: $\varphi \mapsto V_\varphi$ such that
252-
$g_x(V_\varphi, W) = \varphi(W)$. -/
253-
noncomputable abbrev metricRiesz (x : M)
254-
(φ : TangentSpace I x →L[ℝ] ℝ) : TangentSpace I x :=
255-
hm.metric.metricRiesz x φ
256-
257-
@[simp]
258-
theorem metricRiesz_inner (x : M)
259-
(φ : TangentSpace I x →L[ℝ] ℝ) (v : TangentSpace I x) :
260-
metricInner x (metricRiesz x φ) v = φ v :=
261-
hm.metric.metricRiesz_inner x φ v
262-
263-
theorem metricRiesz_unique (x : M) (v : TangentSpace I x)
264-
(φ : TangentSpace I x →L[ℝ] ℝ)
265-
(h : ∀ w, metricInner x v w = φ w) :
266-
v = metricRiesz x φ :=
267-
hm.metric.metricRiesz_unique x v φ h
268-
269-
/-- **Math.** The Riesz isomorphism `T_xM ≃ₗ[ℝ] (T_xM →L[ℝ] ℝ)`. -/
270-
noncomputable abbrev metricToDualEquiv (x : M) :
271-
TangentSpace I x ≃ₗ[ℝ] (TangentSpace I x →L[ℝ] ℝ) :=
272-
hm.metric.metricToDualEquiv x
273-
274-
end RieszSection
275-
276-
/-! ## Smoothness of the metric inner product — Math headline
277-
278-
`metricInner y (v y) (w y)` is `ContMDiffWithinAt` whenever the
279-
tangent-bundle sections `v, w` are. The pointwise / set / global parity
280-
variants, the first-order `MDifferentiable*` analog family, and the
281-
`TangentSmoothAt`-form convenience wrapper all live in
282-
`Riemannian/Util/MetricInnerSmoothness.lean`. -/
283-
284-
section Smoothness
285-
286-
variable {v w : ∀ x : M, TangentSpace I x} {s : Set M} {x : M}
287-
288-
variable {n : ℕ∞ω} [hLE : ENat.LEInfty n]
289-
290-
/-- **Math.** $\langle v(\cdot), w(\cdot)\rangle_g$ is `ContMDiffWithinAt`. -/
291-
theorem metricInner_contMDiffWithinAt
292-
(hv : ContMDiffWithinAt I (I.prod 𝓘(ℝ, E)) n
293-
(fun y => (⟨y, v y⟩ : TangentBundle I M)) s x)
294-
(hw : ContMDiffWithinAt I (I.prod 𝓘(ℝ, E)) n
295-
(fun y => (⟨y, w y⟩ : TangentBundle I M)) s x) :
296-
ContMDiffWithinAt I 𝓘(ℝ, ℝ) n
297-
(fun y => metricInner y (v y) (w y)) s x :=
298-
hm.metric.metricInner_contMDiffWithinAt hv hw
299-
300-
end Smoothness
301-
302-
end MetricAPI
303-
304-
-- Polymorphic notation `⟪·, ·⟫_g` and `‖·‖²_g` (and the dispatch classes
305-
-- `MetricInnerHom`, `MetricNormSq`) live in
306-
-- `OpenGALib/Riemannian/Util/MetricNotation.lean`; the import below
307-
-- pulls them into scope for every consumer of `SmoothManifold`.
308-
309122
end Riemannian

OpenGALib/Riemannian/Operators/Bochner.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ theorem bochner_leibniz_trace_reduction
6464
classical
6565
have h_grad := manifoldGradient_smooth_of_smooth HasMetric.metric f hf
6666
show (1 / 2 : ℝ) * Operators.scalarLaplacian (I := I) (M := M) HasMetric.metric ((fun y => HasMetric.metric.metricInner y (manifoldGradient (I := I) HasMetric.metric f y) (manifoldGradient (I := I) HasMetric.metric f y))) x
67-
= metricInner x
67+
= HasMetric.metric.metricInner x
6868
(connectionLaplacian (I := I) (M := M) HasMetric.metric (manifoldGradient (I := I) HasMetric.metric f) x)
6969
(manifoldGradient (I := I) HasMetric.metric f x)
7070
+ frobeniusSq (I := I) (M := M) (hessianBilin (I := I) HasMetric.metric f) x
@@ -93,11 +93,11 @@ theorem bochner_leibniz_trace_reduction
9393
have h_summand : ∀ i,
9494
(1 / 2 : ℝ) * hessian (I := I) (M := M) HasMetric.metric ((fun y => HasMetric.metric.metricInner y (manifoldGradient (I := I) HasMetric.metric f y) (manifoldGradient (I := I) HasMetric.metric f y)))
9595
(Bi i).toFun (Bi i).toFun x
96-
= metricInner x
96+
= HasMetric.metric.metricInner x
9797
(secondCovDerivSection (I := I) (M := M) HasMetric.metric
9898
(manifoldGradient (I := I) HasMetric.metric f) (Bi i).toFun (Bi i).toFun x)
9999
(manifoldGradient (I := I) HasMetric.metric f x)
100-
+ metricInner x
100+
+ HasMetric.metric.metricInner x
101101
(covDeriv HasMetric.metric (Bi i).toFun (manifoldGradient (I := I) HasMetric.metric f) x)
102102
(covDeriv HasMetric.metric (Bi i).toFun (manifoldGradient (I := I) HasMetric.metric f) x) := by
103103
intro i
@@ -113,11 +113,11 @@ theorem bochner_leibniz_trace_reduction
113113
congr 1
114114
· -- First sum: ∑_i ⟨secondCovDerivSection ∇f (Bi · x) (Bi · x) x, ∇f x⟩
115115
-- = ⟨connectionLaplacian ∇f x, ∇f x⟩ via `sum_inner` + `connectionLaplacian_def`.
116-
show ∑ i, metricInner x
116+
show ∑ i, HasMetric.metric.metricInner x
117117
(secondCovDerivSection (I := I) (M := M) HasMetric.metric
118118
(manifoldGradient (I := I) HasMetric.metric f) (Bi i).toFun (Bi i).toFun x)
119119
(manifoldGradient (I := I) HasMetric.metric f x)
120-
= metricInner x
120+
= HasMetric.metric.metricInner x
121121
(connectionLaplacian (I := I) (M := M) HasMetric.metric (manifoldGradient (I := I) HasMetric.metric f) x)
122122
(manifoldGradient (I := I) HasMetric.metric f x)
123123
unfold connectionLaplacian
@@ -130,7 +130,7 @@ theorem bochner_leibniz_trace_reduction
130130
-- `B(v, w) := ⟪covDerivAt HasMetric.metric ∇f x v, covDerivAt HasMetric.metric ∇f x w⟫_ℝ` (a `LinearMap.mk₂`),
131131
-- converts smoothOrthoFrame trace to std-basis trace; then the existing
132132
-- orthonormal-basis Frobenius identity closes.
133-
show ∑ i, metricInner x
133+
show ∑ i, HasMetric.metric.metricInner x
134134
(covDeriv HasMetric.metric (Bi i).toFun (manifoldGradient (I := I) HasMetric.metric f) x)
135135
(covDeriv HasMetric.metric (Bi i).toFun (manifoldGradient (I := I) HasMetric.metric f) x)
136136
= frobeniusSq (I := I) (M := M) (hessianBilin (I := I) HasMetric.metric f) x
@@ -185,7 +185,7 @@ theorem bochner_leibniz_trace_reduction
185185
Riemannian.Tensor.sum_diagonal_smoothOrthoFrame_eq_std (I := I) x B'
186186
rw [hB'_def] at h_stage7
187187
simp only [LinearMap.mk₂_apply] at h_stage7
188-
-- LHS: rewrite `metricInner x (covDeriv HasMetric.metric (Bi · x) ∇f x) (covDeriv HasMetric.metric (Bi · x) ∇f x)`
188+
-- LHS: rewrite `HasMetric.metric.metricInner x (covDeriv HasMetric.metric (Bi · x) ∇f x) (covDeriv HasMetric.metric (Bi · x) ∇f x)`
189189
-- as `⟪covDerivAt HasMetric.metric ∇f x (Bi · x x), covDerivAt HasMetric.metric ∇f x (Bi · x x)⟫_ℝ` (def-eq), match h_stage7's LHS.
190190
show ∑ i, @inner ℝ (TangentSpace I x) _
191191
(covDerivAt HasMetric.metric (manifoldGradient (I := I) HasMetric.metric f) x
@@ -203,13 +203,13 @@ theorem bochner_leibniz_trace_reduction
203203
set v : TangentSpace I x :=
204204
covDerivAt HasMetric.metric (manifoldGradient (I := I) HasMetric.metric f) x (b i)
205205
have h_hess_unfold : ∀ j, ((hessianBilin (I := I) HasMetric.metric f x) (b i)) (b j)
206-
= metricInner x v (b j) := fun _ => rfl
206+
= HasMetric.metric.metricInner x v (b j) := fun _ => rfl
207207
simp only [h_hess_unfold]
208208
calc @inner ℝ (TangentSpace I x) _ v v
209209
= ⟪v, v⟫_ℝ := rfl
210210
_ = ‖v‖ ^ 2 := real_inner_self_eq_norm_sq v
211211
_ = ∑ j, ⟪v, b j⟫_ℝ ^ 2 := (b.sum_sq_inner_left v).symm
212-
_ = ∑ j, (metricInner x v (b j)) ^ 2 := rfl
212+
_ = ∑ j, (HasMetric.metric.metricInner x v (b j)) ^ 2 := rfl
213213

214214
/-- **Math.** **Explicit-`g` form of the Leibniz trace reduction**. -/
215215
theorem bochner_leibniz_trace_reduction_g

0 commit comments

Comments
 (0)