Skip to content

[Merged by Bors] - chore: replace numeric projections with named projections throughout mathlib - #45389

Closed
thorimur wants to merge 43 commits into
leanprover-community:masterfrom
thorimur:num-proj-lint-skimmer
Closed

thorimur wants to merge 43 commits into
leanprover-community:masterfrom
thorimur:num-proj-lint-skimmer

Conversation

@thorimur

@thorimur thorimur commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

This PR replaces numeric projections such as .2 with the named version of that projection, with the exception of certain types. This was generated using scripts/runSkimmer.sh in the output of #45341, plus some manual fixes and an LLM whitespace-only fix for handling (hundreds of) long lines.


@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

PR summary 572f60fc12

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ instance (I : N.associatedPrimes) : I.1.IsPrime := I.2.toIsPrime
+ instance (X : CofibrantObject C) : IsCofibrant (CofibrantObject.ι.obj X) := X.property
+ instance (X : CofibrantObject C) : IsCofibrant X.obj := X.property
+ instance (X : CompHausLike P) : HasProp P X := ⟨X.prop⟩
+ instance (X : FibrantObject C) : IsFibrant (FibrantObject.ι.obj X) := X.property
+ instance (X : FibrantObject C) : IsFibrant X.obj := X.property
+ instance (X : InjectiveObject C) : Injective ((ι C).obj X) := X.property
+ instance (X : InjectiveObject C) : Injective X.obj := X.property
+ instance : Algebra R ((Spec.topMap f _* (structureSheaf S).obj).stalk p)
+ instance : Groupoid (Discrete C) := { inv := fun h ↦ ⟨h.eq.symm⟩ }
+ instance : Hashable Char := ⟨fun c => hash c.val⟩
+ instance : Inv (GroupLike R A) where inv a := ⟨antipode R a, a.isGroupLikeElem_val.antipode⟩
+ instance : IsMarkovKernel κ.hom.hom := κ.property
+ instance : Max (OpenNhdsOf x) := ⟨fun U V => ⟨U.toOpens ⊔ V.toOpens, Or.inl U.mem'⟩⟩
+ instance : Min (GroupTopology α)
+ instance : Min (OpenNhdsOf x) := ⟨fun U V => ⟨U.toOpens ⊓ V.toOpens, U.mem', V.mem'⟩⟩
+ instance : Mul (GroupLike R A)
+ instance : Pow (GroupLike R A) ℕ where pow a n := ⟨a ^ n, a.isGroupLikeElem_val.pow⟩
+ instance {S : Scheme.{u}} (𝒰 : S.Cover (precoverage P)) [QuasiCompactCover 𝒰.toPreZeroHypercover] :
- instance (I : N.associatedPrimes) : I.1.IsPrime := I.2.1
- instance (X : CofibrantObject C) : IsCofibrant (CofibrantObject.ι.obj X) := X.2
- instance (X : CofibrantObject C) : IsCofibrant X.1 := X.2
- instance (X : CompHausLike P) : HasProp P X := ⟨X.4⟩
- instance (X : FibrantObject C) : IsFibrant (FibrantObject.ι.obj X) := X.2
- instance (X : FibrantObject C) : IsFibrant X.1 := X.2
- instance (X : InjectiveObject C) : Injective ((ι C).obj X) := X.2
- instance (X : InjectiveObject C) : Injective X.obj := X.2
- instance : Algebra R ((Spec.topMap f _* (structureSheaf S).1).stalk p)
- instance : Groupoid (Discrete C) := { inv := fun h ↦ ⟨h.1.symm⟩ }
- instance : Hashable Char := ⟨fun c => hash c.1⟩
- instance : Inv (GroupLike R A) where inv a := ⟨antipode R a, a.2.antipode⟩
- instance : IsMarkovKernel κ.hom.hom := κ.2
- instance : Max (OpenNhdsOf x) := ⟨fun U V => ⟨U.1 ⊔ V.1, Or.inl U.2⟩⟩
- instance : Min (GroupTopology α) where min x y := ⟨x.1 ⊓ y.1, isTopologicalGroup_inf x.2 y.2⟩
- instance : Min (OpenNhdsOf x) := ⟨fun U V => ⟨U.1 ⊓ V.1, U.2, V.2⟩⟩
- instance : Mul (GroupLike R A) where mul a b := ⟨a * b, a.2.mul b.2⟩
- instance : Pow (GroupLike R A) ℕ where pow a n := ⟨a ^ n, a.2.pow⟩
- instance {S : Scheme.{u}} (𝒰 : S.Cover (precoverage P)) [QuasiCompactCover 𝒰.1] :
-+-+ comp
-+-+ continuous
-+-+ epi_of_epi
-+-+ id_f
-+-+ isoMk
-+-+ iso_of_iso
-+-+ localTrivAt_apply
-+-+ mono_of_mono
-+-+ mul_def
-+-+ strInv
-+-+ toFinset_val
--++ comp_f

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 572f60f).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


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

Current commit 572f60fc12
Reference commit 57870a3ef0

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

@github-actions github-actions Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 28, 2026
@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 28, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 28, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@thorimur
thorimur marked this pull request as ready for review October 29, 2026 20:59
@mathlib-bors

mathlib-bors Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

#45341 is now stacked on #45389: both are in a linked bundle and merge in the same batch, or not at all. The batch applies #45389's changes first. Each pull request still needs its own bors r+; bors unlink removes the link.

Review: #45341's own changes: the diff of #45341 without #45389's changes.

View this bundle in bors (sign in with GitHub to view).

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 29, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 29, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 29, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 31, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

Takes num-proj-lint-skimmer-algebra (leanprover-community#45722) from upstream/master, where it has landed.
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 11, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 12, 2026
@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 14, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 14, 2026
@[trans, simps! source target iso]
noncomputable def trans (f : X.PartialIso Y) (g : Y.PartialIso Z) : X.PartialIso Z :=
have := f.dense_target.inter_of_isOpen_right g.dense_source g.source.2
have := f.dense_target.inter_of_isOpen_right g.dense_source g.source.is_open'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't all the is_open's be isOpen, without the prime?

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 sounds reasonable, though I'd suggest we address it in a follow-up PR instead of auditing our projections here. Moreover, there seem to be various named projections that we are allowed to use but shouldn't; ideally we should either make them private or lint against them.

I'm not sure if making this particular one private is feasible, since a couple of spots outside of the file use the field to construct the structure with { carrier := ..., is_open' := ... }. But we can at least replace them all, and hypothetically we could lint against using them as a projection separately.

I've replaced them all in the follow-up PR #46133. :)

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 17, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions Bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 17, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

This pull request is no longer linked; it will merge on its own.

@jcommelin

Copy link
Copy Markdown
Member

Thanks 🎉

bors merge

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Nov 18, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Nov 18, 2026
…mathlib (#45389)

This PR replaces numeric projections such as `.2` with the named version of that projection, with the exception of certain types. This was generated using `scripts/runSkimmer.sh` in the output of #45341, plus some manual fixes and an LLM whitespace-only fix for handling (hundreds of) long lines.

Co-authored-by: Jireh Loreaux <[email protected]>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Nov 18, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore: replace numeric projections with named projections throughout mathlib [Merged by Bors] - chore: replace numeric projections with named projections throughout mathlib Nov 18, 2026
@mathlib-bors mathlib-bors Bot closed this Nov 18, 2026
thorimur added a commit to thorimur/mathlib4 that referenced this pull request Nov 18, 2026
Takes num-proj-lint-skimmer (leanprover-community#45389) from upstream/master, where it has landed.
thorimur added a commit to thorimur/mathlib4 that referenced this pull request Nov 18, 2026
Takes num-proj-lint-skimmer (leanprover-community#45389) from upstream/master, where it has landed.
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. ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants