Skip to content

Commit 2c14f90

Browse files
Add riem_simp attribute + riem_normalize tactic; polish riemannCurvature_antisymm
Engineering layer (Util/) gains its first real Riemann-tensor infrastructure. The polish target on riemannCurvature_antisymm shrinks 12 lines → 3 lines while preserving the same mathematical content, demonstrating the API design pattern for downstream curvature work. Util/ additions: - Util/Attributes.lean: register_simp_attr riem_simp (paralleling metric_simp). Declaration only — populated by lemmas in math files. - Util/Tactic.lean: macro "riem_normalize" : tactic => simp only [riem_simp]. Real executable tactic in Util, not just docstrings. Math layer (Connection/Bianchi.lean) additions: - riemannCurvature_unfold (@[riem_simp]): definitional expansion of R(X,Y)Z to ∇∇ - ∇∇ - ∇_{[·,·]} form, rfl proof. - covDeriv_lambda_mlieBracket_swap: pulls Lie-bracket antisymmetry through covDeriv's direction argument. Kept OUT of riem_simp to avoid X ↔ Y rewrite loop; used as explicit rw step. Polished proof of riemannCurvature_antisymm: 3 lines (simp / rw / abel), each a single math step. Build verified (3514 jobs).
1 parent d600fed commit 2c14f90

3 files changed

Lines changed: 76 additions & 15 deletions

File tree

OpenGALib/Riemannian/Connection/Bianchi.lean

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import OpenGALib.Riemannian.Connection.LeviCivita
2+
import OpenGALib.Riemannian.Util.Attributes
23

34
/-!
45
# Riemannian.Connection.Bianchi
@@ -162,28 +163,56 @@ noncomputable def riemannCurvature
162163
let bracketXY : Π x : M, TangentSpace I x := fun x => mlieBracket I X Y x
163164
covDeriv X nablaYZ x - covDeriv Y nablaXZ x - covDeriv bracketXY Z x
164165

166+
/-! ### `riem_simp` lemmas
167+
168+
Two rewrites that drive the `riem_simp` simp set, populated for the
169+
Riemann curvature operator built from the framework's `covDeriv`. Together
170+
with `abel` they discharge the algebraic identities of `riemannCurvature`
171+
without exposing the underlying connection plumbing. -/
172+
173+
/-- **Definitional unfold** of `riemannCurvature` to the
174+
$\nabla \nabla - \nabla \nabla - \nabla_{[\cdot,\cdot]}$ form.
175+
Pure rewrite — no smoothness hypotheses. -/
176+
@[riem_simp]
177+
theorem riemannCurvature_unfold
178+
(X Y Z : Π x : M, TangentSpace I x) (x : M) :
179+
riemannCurvature X Y Z x
180+
= covDeriv X (fun y => covDeriv Y Z y) x
181+
- covDeriv Y (fun y => covDeriv X Z y) x
182+
- covDeriv (fun y => mlieBracket I X Y y) Z x := rfl
183+
184+
/-- **Lie-bracket antisymmetry pulled through the connection's direction
185+
argument**: $\nabla_{[Y,X]} Z = -\nabla_{[X,Y]} Z$ pointwise. Combines
186+
`VectorField.mlieBracket_swap_apply` with the ℝ-linearity of
187+
`leviCivitaConnection.toFun Z x` (a CLM, so it commutes with negation).
188+
Pure rewrite — no smoothness hypotheses.
189+
190+
Used as an explicit `rw` step (not in `riem_simp`): the rewrite is
191+
symmetric in `X ↔ Y`, so adding it to a simp set causes loop. -/
192+
theorem covDeriv_lambda_mlieBracket_swap
193+
(X Y Z : Π x : M, TangentSpace I x) (x : M) :
194+
covDeriv (fun y => mlieBracket I Y X y) Z x
195+
= -covDeriv (fun y => mlieBracket I X Y y) Z x := by
196+
unfold covDeriv
197+
rw [show (fun y => mlieBracket I Y X y) x = -mlieBracket I X Y x from
198+
VectorField.mlieBracket_swap_apply,
199+
(leviCivitaConnection.toFun Z x).map_neg]
200+
165201
/-- **Riemann tensor antisymmetry in the first two arguments**:
166202
$R(X, Y) Z = -R(Y, X) Z$ pointwise.
167203
168-
Direct from antisymmetry of the Lie bracket
169-
(`VectorField.mlieBracket_swap_apply`) plus ℝ-linearity of
170-
`leviCivitaConnection.toFun Z z` (it is a CLM).
204+
Math: Lie bracket is antisymmetric and the connection is linear in its
205+
direction argument. `simp only [riem_simp]` unfolds `R` to its
206+
$\nabla \nabla - \nabla \nabla - \nabla_{[\cdot,\cdot]}$ form;
207+
`covDeriv_lambda_mlieBracket_swap` pulls the bracket-swap negation
208+
through `covDeriv`; `abel` finishes.
171209
172210
**Ground truth**: do Carmo 1992 §4 Proposition 2.5 (i). -/
173211
theorem riemannCurvature_antisymm
174212
(X Y Z : Π x : M, TangentSpace I x) (x : M) :
175213
riemannCurvature X Y Z x = -riemannCurvature Y X Z x := by
176-
show covDeriv X (fun y => covDeriv Y Z y) x
177-
- covDeriv Y (fun y => covDeriv X Z y) x
178-
- covDeriv (fun y => mlieBracket I X Y y) Z x
179-
= -(covDeriv Y (fun y => covDeriv X Z y) x
180-
- covDeriv X (fun y => covDeriv Y Z y) x
181-
- covDeriv (fun y => mlieBracket I Y X y) Z x)
182-
have h_swap : mlieBracket I Y X x = -mlieBracket I X Y x :=
183-
VectorField.mlieBracket_swap_apply
184-
unfold covDeriv
185-
rw [show (fun y => mlieBracket I Y X y) x = -mlieBracket I X Y x from h_swap,
186-
(leviCivitaConnection.toFun Z x).map_neg]
214+
simp only [riem_simp]
215+
rw [covDeriv_lambda_mlieBracket_swap]
187216
abel
188217

189218
/-! ## Algebraic Bianchi I

OpenGALib/Riemannian/Util/Attributes.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ rules, zero / neg / sub / self_nonneg. Tagged on the lemmas in
1919
`Metric/Basic.lean`; downstream proofs can invoke
2020
`simp only [metric_simp]` for routine inner-product calculations. -/
2121
register_simp_attr metric_simp
22+
23+
/-- Simp set for `riemannCurvature` algebra normalisation: definitional
24+
unfold ($R(X,Y)Z = \nabla_X \nabla_Y Z - \nabla_Y \nabla_X Z - \nabla_{[X,Y]} Z$),
25+
Lie-bracket antisymmetry under `covDeriv`, and connection-direction
26+
linearity rewrites. Tagged on lemmas in `Connection/Bianchi.lean`;
27+
downstream proofs invoke `simp only [riem_simp]` to normalise curvature
28+
expressions before `abel` / `ring` / further reasoning. -/
29+
register_simp_attr riem_simp

OpenGALib/Riemannian/Util/Tactic.lean

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,42 @@ metric algebra lemmas tagged with them.
2020
`metricInner_sub_left/right`, `metricInner_add_left/right`,
2121
`metricInner_smul_left/right`, `metricInner_self_nonneg`.
2222
23+
* `riem_simp` — `riemannCurvature` algebra normalisation. Currently
24+
populated by `riemannCurvature_unfold` (definitional expansion to
25+
`∇∇ - ∇∇ - ∇_{[·,·]}` form, no smoothness hypotheses). Use with
26+
explicit `rw` of the bracket-swap helper
27+
`covDeriv_lambda_mlieBracket_swap` (kept out of the simp set to
28+
avoid `X ↔ Y` rewrite loops) and `abel` to close Riemann-tensor
29+
algebraic identities.
30+
31+
## Tactics
32+
33+
* `riem_normalize` — shorthand for `simp only [riem_simp]`. Use as a
34+
first step on goals involving `riemannCurvature`; pair with explicit
35+
`rw` of named bracket / linearity lemmas as needed.
36+
2337
## Usage
2438
2539
```
2640
example {g : RiemannianMetric I M} (x : M) (V : TangentSpace I x) :
2741
metricInner x (V - 0) (-V + V) = -metricInner x V V + metricInner x V V := by
2842
simp only [metric_simp]
43+
44+
example (X Y Z : Π x : M, TangentSpace I x) (x : M) :
45+
riemannCurvature X Y Z x = -riemannCurvature Y X Z x := by
46+
riem_normalize
47+
rw [covDeriv_lambda_mlieBracket_swap]
48+
abel
2949
```
3050
3151
## Future extensions (deferred)
3252
3353
* `koszul_simp` — Koszul algebraic identities.
34-
* `riem_simp` — Riemann tensor algebra.
3554
* `metric_calc` — bespoke tactic combining `metric_simp` with `ring`
3655
for closed-form algebraic goals.
3756
-/
57+
58+
/-- **`riem_normalize` tactic** — applies the `riem_simp` simp set to
59+
normalise `riemannCurvature` expressions to their underlying
60+
`∇∇ - ∇∇ - ∇_{[·,·]}` form. Equivalent to `simp only [riem_simp]`. -/
61+
macro "riem_normalize" : tactic => `(tactic| simp only [riem_simp])

0 commit comments

Comments
 (0)