Skip to content

refactor: rename Pi.map to Function.piMap - #39233

Draft
wrenna-robson wants to merge 17 commits into
leanprover-community:masterfrom
wrenna-robson:function_map
Draft

wrenna-robson wants to merge 17 commits into
leanprover-community:masterfrom
wrenna-robson:function_map

Conversation

@wrenna-robson

@wrenna-robson wrenna-robson commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR renames Pi.map to Function.piMap and makes the changes necessary to support this. In particular this means that Mathlib.Logic.Function.Defs now only contains the Function namespace.

The name Function.piMap (rather than Function.map) keeps it consistent with the existing *.piMap names: the bundled versions MulHom.piMap, MonoidHom.piMap, LinearMap.piMap, ContinuousLinearMap.piMap, and the predicate lemmas Function.Injective.piMap, Continuous.piMap, IsFixedPt.piMap etc.

Renames (all with deprecated aliases):

  • Pi.map → Function.piMap
  • Pi.map_apply → Function.piMap_apply
  • Pi.map_id → Function.piMap_id
  • Pi.map_id' → Function.piMap_id'
  • Pi.map_comp_map → Function.piMap_comp_piMap
  • Pi.map_injective → Function.piMap_injective
  • Pi.map_update → Function.piMap_update
  • Pi.map_iterate → Function.piMap_iterate

New: Function.piMap_def, Function.piMap_const.

Zulip thread: #PR reviews > #39233 - rename Pi.map to Function.map @ 💬


General discussion regarding the Pi namespace: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/The.20Pi.20namespace/near/594782721


Open in Gitpod

@wrenna-robson wrenna-robson added the WIP Work in progress label May 12, 2026
@github-actions

github-actions Bot commented May 12, 2026 •

Copy link
Copy Markdown

PR summary ccd186c86f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ Pi.map
+ Pi.map_apply
+ Pi.map_comp_map
+ Pi.map_id
+ Pi.map_id'
+ Pi.map_injective
+ Pi.map_iterate
+ Pi.map_update
+ piMap
+ piMap_apply
+ piMap_comp_piMap
+ piMap_const
+ piMap_def
+ piMap_id
+ piMap_id'
+ piMap_injective
+ piMap_iterate
+ piMap_update
- _root_.Pi.map_injective
- _root_.Pi.map_update
- map
- map_apply
- map_comp_map
- map_id
- map_id'
- map_iterate

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 -- stale, waiting for the new build)

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

  • +10 new declarations
  • −0 removed declarations
+Function.map
+Function.map_apply
+Function.map_comp_map
+Function.map_const
+Function.map_def
+Function.map_id
+Function.map_id'
+Function.map_injective
+Function.map_iterate
+Function.map_update

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

Current commit ccd186c86f
Reference commit 83e85adc6e

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

@wrenna-robson wrenna-robson removed the WIP Work in progress label May 12, 2026
@wrenna-robson wrenna-robson changed the title feat: Function.map partial changes feat: Pi.map rename to Function.map May 12, 2026
@eric-wieser eric-wieser added the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label May 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 May 21, 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 May 29, 2026
@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

I do not know how to meaningfully progress this because nobody is participating in the linked Zulip thread.

@themathqueen

Copy link
Copy Markdown
Member

A future PR may update the names of *.piMap in line with this.

I don't understand this. What do you mean? Changing .piMap to .functionMap? Or?

@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

A future PR may update the names of *.piMap in line with this.

I don't understand this. What do you mean? Changing .piMap to .functionMap? Or?

Yes - I mean if I am honest I would happily leave it as it is but this was suggested to me. Equally instead of Function.map we could choose Function.piMap which would have the nice side effect of making it consistent at present.

@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 Aug 8, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@joneugster joneugster added the t-data Data (lists, quotients, numbers, etc) label Sep 20, 2026
wrenna-robson and others added 2 commits October 14, 2026 11:45
# Conflicts:
#	Mathlib/Algebra/Notation/Pi/Defs.lean
#	Mathlib/Algebra/Regular/Pi.lean
#	Mathlib/Logic/Function/Defs.lean
@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 14, 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 11, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

# Conflicts:
#	Mathlib/Algebra/Group/Pi/Lemmas.lean
#	Mathlib/Data/Finset/Powerset.lean
#	Mathlib/Topology/Constructions.lean
Keeps it consistent with the existing `*.piMap` names (`LinearMap.piMap`,
`MonoidHom.piMap`, `Injective.piMap`, ...). Lemmas follow: `piMap_apply`,
`piMap_def`, `piMap_const`, `piMap_update`, `piMap_injective`, `piMap_id`,
`piMap_id'`, `piMap_comp_piMap`, `piMap_iterate`.
@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 18, 2026
@wrenna-robson wrenna-robson changed the title feat: Pi.map rename to Function.map refactor: rename Pi.map to Function.piMap Nov 18, 2026
@wrenna-robson
wrenna-robson marked this pull request as draft November 18, 2026 20:04
@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 19, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

This branch has not been deployed

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

Labels

awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants