Skip to content

[Merged by Bors] - chore: rename declarations whose names do not match their statements - #44051

Closed
Multramate wants to merge 3 commits into
leanprover-community:masterfrom
Multramate:split/typo-name-statement
Closed

Multramate wants to merge 3 commits into
leanprover-community:masterfrom
Multramate:split/typo-name-statement

Conversation

@Multramate

@Multramate Multramate commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

The lemmas about IsLocalDiffeomorphAt.localInverse simply were in the wrong order: they should say continuous_localInverse etc. instead of localInverse_continuous. In some cases, both variants already existed (so we deprecated the wrongly named one).

Split out of #43889.

Written with the assistance of Claude (Claude Code).


Unlike the other parts of the split, these old names are well-formed and pronounceable — there is no misspelling to spot. They simply say the wrong thing, so each one needs its statement read.

  • coeff_isPWOsupportisPWO_support_coeff — the conclusion really is IsPWO (support (coeff ..))
  • preserveFiniteLimits_plusFunctorpreservesFiniteLimits_plusFunctor — the verb tracks the head symbol PreservesFiniteLimits
  • tendsto_of_uncrossing_lt_toptendsto_of_upcrossings_lt_top — wrong word and wrong number, checked against the hypothesis upcrossings a b f w
  • substr_num_den'sub_num_den'
  • nneg_mul_add_sq_of_abs_le_onenonneg_mul_add_sq_of_abs_le_one

lemmas

contmdiffOn_localInversecontMDiffOn_localInverse, and for consistency the two lemmas below it take the same order: localInverse_contMDiffAtcontMDiffAt_localInverse and localInverse_mdifferentiableAtmdifferentiableAt_localInverse. All three old names are deprecated and their use sites updated.

localInverse_contMDiffOn already existed further down the file with a byte-identical statement and proof. The duplicate is dropped and the lemma moved above its first use, so that name is deprecated to contMDiffOn_localInverse too.

The review suggested mdifferentiableAt_contMDiffAt for the third of these. Its statement is MDiffAt hf.localInverse (f x) — about the local inverse, not about contMDiffAt — so mdifferentiableAt_localInverse is used instead, matching the other two. Happy to change it if the original was meant literally.

Notes on the review

preserveFiniteLimits_plusFunctor gets no deprecated alias: it is an instance, so it is found by typeclass resolution rather than by name, and nothing in Mathlib refers to it by name.

sub_num_den' is left as proposed. The statement is (q - r).num * q.den * r.den = (q.num * r.den - r.num * q.den) * (q - r).den, which is genuinely subtraction; it sits directly below add_num_den' and mul_num_den' and its proof goes via add_num_den' and sub_eq_add_neg; and no sub_num_den or sub_num_den' exists anywhere else in Mathlib or the toolchain, so there is no collision.


(see #44049, #44050 and #44052 for the other parts).

These old names are well-formed and pronounceable - there is no misspelling
to spot - they simply say the wrong thing, so each one needs the statement
read. That is fine for six and intolerable interleaved with fifty others,
which is why they are split out of leanprover-community#43889.

- `coeff_isPWOsupport` -> `isPWO_support_coeff`: the conclusion really is
  `IsPWO (support (coeff ..))`.
- `contmdiffOn_localInverse` -> `localInverse_contMDiffOn`.
- `preserveFiniteLimits_plusFunctor` -> `preservesFiniteLimits_plusFunctor`:
  the verb tracks the head symbol `PreservesFiniteLimits`.
- `tendsto_of_uncrossing_lt_top` -> `tendsto_of_upcrossings_lt_top`: wrong
  word and wrong number, checked against the hypothesis `upcrossings a b f w`.
- `substr_num_den'` -> `sub_num_den'`: the statement is subtraction, and the
  new name matches the neighbouring `add_num_den'`.
- `nneg_mul_add_sq_of_abs_le_one` -> `nonneg_mul_add_sq_of_abs_le_one`.

`localInverse_contMDiffOn` already existed further down
`Mathlib/Geometry/Manifold/LocalDiffeomorph.lean` with a byte-identical
statement and proof; this moves the lemma above its first use and drops the
duplicate, so the rename can take the name.
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

PR summary 8083eb1ba6

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ contMDiffAt_localInverse
+ contMDiffOn_localInverse
+ isPWO_support_coeff
+ mdifferentiableAt_localInverse
+ nonneg_mul_add_sq_of_abs_le_one
+ preservesFiniteLimits_plusFunctor
+ sub_num_den'
+ tendsto_of_upcrossings_lt_top
- preserveFiniteLimits_plusFunctor

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 -- unavailable)

⚠️ No declarations diff yet: there is no built master snapshot at this PR's merge-base (typically a bors-batch intermediate that CI never built). Merge master into this PR and push to refresh.


No changes to strong technical debt.
No changes to weak technical debt.

Current commit 8083eb1ba6
Reference commit 4abb71fee8

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.py 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).

@Multramate Multramate added easy < 20s of review time. See the lifecycle page for guidelines. LLM-generated PRs with substantial input from LLMs - review accordingly labels Sep 21, 2026

@grunweg grunweg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! A few minor comments. Please also update the PR description accordingly.

Comment thread Mathlib/CategoryTheory/Sites/LeftExact.lean Outdated
rw [← divInt_eq_div]

theorem substr_num_den' (q r : ℚ) :
theorem sub_num_den' (q r : ℚ) :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let me flag this for a second pair of eyes.

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.

I think this is fine? It's literally subtraction (apparently spelt substraction here for whatever reason), and there are already add_num_den and mul_num_den, etc.

Comment thread Mathlib/Geometry/Manifold/LocalDiffeomorph.lean
Comment thread Mathlib/Geometry/Manifold/LocalDiffeomorph.lean Outdated
@grunweg grunweg added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 21, 2026
- Drop the deprecated alias for `preserveFiniteLimits_plusFunctor`. It is an
  instance, so it is found by typeclass resolution rather than by name, and
  nothing in Mathlib refers to it by name.

- Use `contMDiffOn_localInverse` rather than `localInverse_contMDiffOn`, as
  requested. `localInverse_contMDiffOn` exists on master, so it is deprecated
  to the new name alongside the misspelled `contmdiffOn_localInverse`.

- Follow the same order for the two neighbouring lemmas:
  `localInverse_contMDiffAt` -> `contMDiffAt_localInverse` and
  `localInverse_mdifferentiableAt` -> `mdifferentiableAt_localInverse`,
  both deprecated, with their use sites updated.

The review suggested `mdifferentiableAt_contMDiffAt` for the last of these,
but the statement is `MDiffAt hf.localInverse (f x)` - about the local
inverse, not about `contMDiffAt` - so `mdifferentiableAt_localInverse` is
used instead, matching the other two.

`sub_num_den'` is left as is: the statement is subtraction, it sits directly
below `add_num_den'` and `mul_num_den'`, its proof goes via `add_num_den'`,
and no `sub_num_den`/`sub_num_den'` exists anywhere else.
@Multramate Multramate removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 21, 2026
The previous run failed in `Test and lint` because the prebuilt artifact
download returned 403, so `lake lint` rebuilt Mathlib from source and hit the
10-minute timeout twice. No linter finding was reported. Empty commit to get
a clean run.
@grunweg grunweg removed the easy < 20s of review time. See the lifecycle page for guidelines. label Sep 21, 2026
@grunweg

grunweg commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Thanks! I have drastically shortened the PR description. (Can you take that into account for the next PRs, please?) With that fixed, I think this PR is good to go.
bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Sep 21, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
…44051)

The lemmas about `IsLocalDiffeomorphAt.localInverse` simply were in the wrong order: they should say `continuous_localInverse` etc. instead of `localInverse_continuous`. In some cases, both variants already existed (so we deprecated the wrongly named one).

Split out of #43889.

Written with the assistance of Claude (Claude Code).
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Sep 21, 2026
@mathlib-bors

mathlib-bors Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore: rename declarations whose names do not match their statements [Merged by Bors] - chore: rename declarations whose names do not match their statements Sep 21, 2026
@mathlib-bors mathlib-bors Bot closed this Sep 21, 2026
grunweg pushed a commit to grunweg/mathlib4 that referenced this pull request Sep 22, 2026
…eanprover-community#44051)

The lemmas about `IsLocalDiffeomorphAt.localInverse` simply were in the wrong order: they should say `continuous_localInverse` etc. instead of `localInverse_continuous`. In some cases, both variants already existed (so we deprecated the wrongly named one).

Split out of leanprover-community#43889.

Written with the assistance of Claude (Claude Code).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. LLM-generated PRs with substantial input from LLMs - review accordingly ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants