Skip to content

refactor(Geometry/Manifold/Instances/Sphere): use mvfderiv when appropriate - #42374

Open
grunweg wants to merge 1 commit into
leanprover-community:masterfrom
grunweg:sphere-use-mvfderiv
Open

refactor(Geometry/Manifold/Instances/Sphere): use mvfderiv when appropriate#42374
grunweg wants to merge 1 commit into
leanprover-community:masterfrom
grunweg:sphere-use-mvfderiv

Conversation

@grunweg

@grunweg grunweg commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Fixes a TODO in the file, and some pre-existing defeq abuse.
While at it, rename the affected lemmas to follow the naming convention.
There is some remaining defeq abuse in the proofs, which we comment on and localise more.

While at it, we also remove three defeq abuse options which are simply superfluous now.


Open in Gitpod

@grunweg grunweg changed the title chore(Geometry/Manifold/Instances/Sphere): use mvfderiv more refactor(Geometry/Manifold/Instances/Sphere): use mvfderiv when appropriate Aug 2, 2026
@grunweg
grunweg requested a review from sgouezel August 2, 2026 16:59
@github-actions github-actions Bot added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

PR summary 870d68f581

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Geometry.Manifold.Instances.Sphere 2356 2358 +2 (+0.08%)
Import changes for all files
Files Import difference
3 files Mathlib.Geometry.Manifold.Instances.Sphere Mathlib.Geometry.Manifold.PoincareConjecture Mathlib.Topology.Compactification.OnePoint.Sphere
2

Declarations diff (regex)

+ MDifferentiableAt.mvfderiv
+ MDifferentiableWithinAt.mvfderivWithin
+ injective_mvfderiv_subtypeVal_sphere
+ range_mvfderiv_subtypeVal

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 870d68f).

  • +4 new declarations
  • −0 removed declarations
+MDifferentiableAt.mvfderiv
+MDifferentiableWithinAt.mvfderivWithin
+injective_mvfderiv_subtypeVal_sphere
+range_mvfderiv_subtypeVal

Decrease in strong tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type (strong)
7094 -2 backward.isDefEq.respectTransparency
No changes to weak technical debt.

Current commit 870d68f581
Reference commit 5eec30bc56

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-differential-geometry Manifolds etc label Aug 2, 2026

-- TODO: rephrase this using `mvfderiv`, avoiding the defeq abuse
-- Without this option, the lemmas `EmbeddingLike.map_eq_zero_iff` and `Submodule.range_subtype`
-- are not applied by simp.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-- are not applied by simp.
-- are not applied by simp below.

HasFDerivAt (stereoInvFunAux (-v : E) ∘ (Subtype.val : (ℝ ∙ (↑(-v) : E))ᗮ → E))
(ℝ ∙ (↑(-v) : E))ᗮ.subtypeL (U.symm 0) := by
convert! hasFDerivAt_stereoInvFunAux_comp_coe (-v : E)
simp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first location needing backcompat options (for reasons independent of this PR).

convert!
(U.symm : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] (ℝ ∙ (↑(-v) : E))ᗮ).range_comp
(ℝ ∙ (↑(-v) : E))ᗮ.subtype using 1
simp only [Submodule.range_subtype, coe_neg_sphere]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the second one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-differential-geometry Manifolds etc tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant