Skip to content

chore: rename notation3 to notation +delab - #45028

Open
YaelDillies wants to merge 10 commits into
leanprover-community:masterfrom
YaelDillies:notation_delab
Open

YaelDillies wants to merge 10 commits into
leanprover-community:masterfrom
YaelDillies:notation_delab

Conversation

@YaelDillies

@YaelDillies YaelDillies commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This makes it extremely clear what notation3 does on top of notation.

For notations with precedence, the precedence comes before the +delab, e.g. notation:25 +delab ....

This rename isn't completely true to the purpose of the elaborator, which is instead to provide Lean 3's notation features. Indeed, notation3 currently has a (prettyPrint := false) flag when a delaborator cannot/shouldn't be generated. I am removing this flag because notation +delab (prettyPrint := false) would read very weird: "Please generate a delaborator, but don't pretty-print!". Only one notation in mathlib uses this flag, namely cycle notation c[...]. It cannot have a delaborator generated due to the use of by decide in the expansion. Although notation +delab could be fixed to generate a delaborator in this case even (see #45042), I think it is reasonable to say that this rare use-case is unsupported.

I am performing a few auxiliary changes too:

  • Update the docstring of notation +delab to clarify that it is not deprecated anymore.
  • Add a missing space in the notation +delab notation, so that polishPP needn't add it after the fact.
  • Rename the file from Util.Notation3 to Util.NotationDelab.
  • Rename the trace option from trace.notation3 to trace.notationDelab.

Zulip discussion

Generated by Claude Sonnet/Opus in ~10 prompts, then reviewed line-by-line by myself and hand-edited a bit further.

Assisted-by: Claude Sonnet 5.5, Claude Opus 5.5


This makes it extremely clear what `notation3` does on top of `notation`.

For notations with precedence, the precedence comes before the `+delab`, e.g. `notation:25 +delab ...`.

This rename isn't completely true to the purpose of the elaborator, which is instead to provide Lean 3's `notation` features. Indeed, `notation3` currently has a `(prettyPrint := false)` flag when a delaborator cannot/shouldn't be generated. I am removing this flag because `notation +delab (prettyPrint := false)` would read very weird: "Please generate a delaborator, but don't pretty-print!".
Only three notations in mathlib used this flag, namely average notation `⨍⁻ x in s, f`, lexicographic pi type notation `Πₗ (i : ℕ), β i`, and cycle notation `c[...]`. The first two couldn't have a delaborator generated due to errors in the provided expansion. I have fixed them and removed the flag. The last one cannot have a a delaborator generated due to the use of `by decide` in the expansion. Although `notation +delab` could be fixed to generate a delaborator in this case even, I think it is reasonable to say that this rare use-case is unsupported. I have switched the notation to use `macro` directly instead.

I am performing a few auxiliary changes too:
* Update the docstring of `notation +delab` to clarify that it is not deprecated anymore.
* Add a missing space in the `notation +delab` notation, so that `polishPP` needn't add it after the fact.
* Rename the file from `Util.Notation3` to `Util.NotationDelab`.
* Rename the trace option from `trace.otation3` to `trace.notationDelab`.

[Zulip](https://leanprover.zulipchat.com/#narrow/channel/345428-mathlib-reviewers/topic/status.20of.20.60notation3.60)

Generated by Claude Sonnet/Opus in ~10 prompts, then reviewed line-by-line by myself.

Assisted-by: Claude Sonnet 5.5, Claude Opus 5.5
@github-actions github-actions Bot added the increases-technical-debt Automatically added label for PRs which increase "strong" technical debts label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

PR summary 1eb6145069

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Util.Notation3 -111
Mathlib.Util.NotationDelab 111

Declarations diff (regex)

+ elabNotationDelab

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

  • +98 new declarations
  • −96 removed declarations
+Equiv.Perm.«termC[_,,]»
-Equiv.Perm.«termC[_,]»
-Mathlib.Notation3.BoundValueType
-Mathlib.Notation3.BoundValueType.casesOn
-Mathlib.Notation3.BoundValueType.ctorElim
-Mathlib.Notation3.BoundValueType.ctorElimType
-Mathlib.Notation3.BoundValueType.ctorIdx
-Mathlib.Notation3.BoundValueType.foldl
-Mathlib.Notation3.BoundValueType.foldl.elim
-Mathlib.Notation3.BoundValueType.foldl.sizeOf_spec
-Mathlib.Notation3.BoundValueType.foldr
-Mathlib.Notation3.BoundValueType.foldr.elim
-Mathlib.Notation3.BoundValueType.foldr.sizeOf_spec
-Mathlib.Notation3.BoundValueType.noConfusion
-Mathlib.Notation3.BoundValueType.noConfusionType
-Mathlib.Notation3.BoundValueType.normal
-Mathlib.Notation3.BoundValueType.normal.elim
-Mathlib.Notation3.BoundValueType.normal.sizeOf_spec
-Mathlib.Notation3.BoundValueType.rec
-Mathlib.Notation3.BoundValueType.recOn
-Mathlib.Notation3.DelabKey
-Mathlib.Notation3.DelabKey.app
-Mathlib.Notation3.DelabKey.app.elim
-Mathlib.Notation3.DelabKey.app.inj
-Mathlib.Notation3.DelabKey.app.injEq
-Mathlib.Notation3.DelabKey.app.noConfusion
-Mathlib.Notation3.DelabKey.app.sizeOf_spec
-Mathlib.Notation3.DelabKey.casesOn
-Mathlib.Notation3.DelabKey.ctorElim
-Mathlib.Notation3.DelabKey.ctorElimType
-Mathlib.Notation3.DelabKey.ctorIdx
-Mathlib.Notation3.DelabKey.key
-Mathlib.Notation3.DelabKey.noConfusion
-Mathlib.Notation3.DelabKey.noConfusionType
-Mathlib.Notation3.DelabKey.other
-Mathlib.Notation3.DelabKey.other.elim
-Mathlib.Notation3.DelabKey.other.inj
-Mathlib.Notation3.DelabKey.other.injEq
-Mathlib.Notation3.DelabKey.other.noConfusion
-Mathlib.Notation3.DelabKey.other.sizeOf_spec
-Mathlib.Notation3.DelabKey.rec
-Mathlib.Notation3.DelabKey.recOn
-Mathlib.Notation3.MatchState
-Mathlib.Notation3.MatchState.captureSubexpr
-Mathlib.Notation3.MatchState.casesOn
-Mathlib.Notation3.MatchState.ctorIdx
-Mathlib.Notation3.MatchState.delabVar
-Mathlib.Notation3.MatchState.empty
-Mathlib.Notation3.MatchState.foldState
-Mathlib.Notation3.MatchState.getBinders
-Mathlib.Notation3.MatchState.getFoldArray
-Mathlib.Notation3.MatchState.mk
-Mathlib.Notation3.MatchState.mk.inj
-Mathlib.Notation3.MatchState.mk.injEq
-Mathlib.Notation3.MatchState.mk.noConfusion
-Mathlib.Notation3.MatchState.mk.sizeOf_spec
-Mathlib.Notation3.MatchState.noConfusion
-Mathlib.Notation3.MatchState.noConfusionType
-Mathlib.Notation3.MatchState.pushFold
-Mathlib.Notation3.MatchState.rec
-Mathlib.Notation3.MatchState.recOn
-Mathlib.Notation3.MatchState.scopeState
-Mathlib.Notation3.MatchState.vars
-Mathlib.Notation3.MatchState.withVar
-Mathlib.Notation3.Matcher
-Mathlib.Notation3.bindersItem
-Mathlib.Notation3.expandFoldl
-Mathlib.Notation3.expandFoldr
-Mathlib.Notation3.exprToMatcher
-Mathlib.Notation3.foldAction
-Mathlib.Notation3.foldKind
-Mathlib.Notation3.getPrettyPrintOpt
-Mathlib.Notation3.identOptScoped
-Mathlib.Notation3.instInhabitedMatcher
-Mathlib.Notation3.instReprDelabKey
-Mathlib.Notation3.instReprDelabKey.repr
-Mathlib.Notation3.isType'
-Mathlib.Notation3.matchApp
-Mathlib.Notation3.matchExpr
-Mathlib.Notation3.matchFVar
-Mathlib.Notation3.matchFoldl
-Mathlib.Notation3.matchForall
-Mathlib.Notation3.matchLambda
-Mathlib.Notation3.matchScoped
-Mathlib.Notation3.matchTypeOf
-Mathlib.Notation3.matchVar
-Mathlib.Notation3.mkExprMatcher
-Mathlib.Notation3.mkFoldlMatcher
-Mathlib.Notation3.mkFoldrMatcher
-Mathlib.Notation3.mkScopedMatcher
-Mathlib.Notation3.natLitMatcher
-Mathlib.Notation3.notation3
-Mathlib.Notation3.notation3Item
-Mathlib.Notation3.prettyPrintOpt
-Mathlib.Notation3.setupLCtx
-Mathlib.Notation3.withHeadRefIfTagAppFns
-Mathlib.Notation3.«termExpand_binders%(_=>_)_,_»
+Mathlib.NotationDelab.BoundValueType
+Mathlib.NotationDelab.BoundValueType.casesOn
+Mathlib.NotationDelab.BoundValueType.ctorElim
+Mathlib.NotationDelab.BoundValueType.ctorElimType
+Mathlib.NotationDelab.BoundValueType.ctorIdx
+Mathlib.NotationDelab.BoundValueType.foldl
+Mathlib.NotationDelab.BoundValueType.foldl.elim
+Mathlib.NotationDelab.BoundValueType.foldl.sizeOf_spec
+Mathlib.NotationDelab.BoundValueType.foldr
+Mathlib.NotationDelab.BoundValueType.foldr.elim
+Mathlib.NotationDelab.BoundValueType.foldr.sizeOf_spec
+Mathlib.NotationDelab.BoundValueType.noConfusion
+Mathlib.NotationDelab.BoundValueType.noConfusionType
+Mathlib.NotationDelab.BoundValueType.normal
+Mathlib.NotationDelab.BoundValueType.normal.elim
+Mathlib.NotationDelab.BoundValueType.normal.sizeOf_spec
+Mathlib.NotationDelab.BoundValueType.rec
+Mathlib.NotationDelab.BoundValueType.recOn
+Mathlib.NotationDelab.DelabKey
+Mathlib.NotationDelab.DelabKey.app
+Mathlib.NotationDelab.DelabKey.app.elim
+Mathlib.NotationDelab.DelabKey.app.inj
+Mathlib.NotationDelab.DelabKey.app.injEq
+Mathlib.NotationDelab.DelabKey.app.noConfusion
+Mathlib.NotationDelab.DelabKey.app.sizeOf_spec
+Mathlib.NotationDelab.DelabKey.casesOn
+Mathlib.NotationDelab.DelabKey.ctorElim
+Mathlib.NotationDelab.DelabKey.ctorElimType
+Mathlib.NotationDelab.DelabKey.ctorIdx
+Mathlib.NotationDelab.DelabKey.key
+Mathlib.NotationDelab.DelabKey.noConfusion
+Mathlib.NotationDelab.DelabKey.noConfusionType
+Mathlib.NotationDelab.DelabKey.other
+Mathlib.NotationDelab.DelabKey.other.elim
+Mathlib.NotationDelab.DelabKey.other.inj
+Mathlib.NotationDelab.DelabKey.other.injEq
+Mathlib.NotationDelab.DelabKey.other.noConfusion
+Mathlib.NotationDelab.DelabKey.other.sizeOf_spec
+Mathlib.NotationDelab.DelabKey.rec
+Mathlib.NotationDelab.DelabKey.recOn
+Mathlib.NotationDelab.MatchState
+Mathlib.NotationDelab.MatchState.captureSubexpr
+Mathlib.NotationDelab.MatchState.casesOn
+Mathlib.NotationDelab.MatchState.ctorIdx
+Mathlib.NotationDelab.MatchState.delabVar
+Mathlib.NotationDelab.MatchState.empty
+Mathlib.NotationDelab.MatchState.foldState
+Mathlib.NotationDelab.MatchState.getBinders
+Mathlib.NotationDelab.MatchState.getFoldArray
+Mathlib.NotationDelab.MatchState.mk
+Mathlib.NotationDelab.MatchState.mk.inj
+Mathlib.NotationDelab.MatchState.mk.injEq
+Mathlib.NotationDelab.MatchState.mk.noConfusion
+Mathlib.NotationDelab.MatchState.mk.sizeOf_spec
+Mathlib.NotationDelab.MatchState.noConfusion
+Mathlib.NotationDelab.MatchState.noConfusionType
+Mathlib.NotationDelab.MatchState.pushFold
+Mathlib.NotationDelab.MatchState.rec
+Mathlib.NotationDelab.MatchState.recOn
+Mathlib.NotationDelab.MatchState.scopeState
+Mathlib.NotationDelab.MatchState.vars
+Mathlib.NotationDelab.MatchState.withVar
+Mathlib.NotationDelab.Matcher
+Mathlib.NotationDelab.bindersItem
+Mathlib.NotationDelab.elabNotationDelab
+Mathlib.NotationDelab.expandFoldl
+Mathlib.NotationDelab.expandFoldr
+Mathlib.NotationDelab.exprToMatcher
+Mathlib.NotationDelab.foldAction
+Mathlib.NotationDelab.foldKind
+Mathlib.NotationDelab.getPrettyPrintOpt
+Mathlib.NotationDelab.identOptScoped
+Mathlib.NotationDelab.instInhabitedMatcher
+Mathlib.NotationDelab.instReprDelabKey
+Mathlib.NotationDelab.instReprDelabKey.repr
+Mathlib.NotationDelab.isType'
+Mathlib.NotationDelab.matchApp
+Mathlib.NotationDelab.matchExpr
+Mathlib.NotationDelab.matchFVar
+Mathlib.NotationDelab.matchFoldl
+Mathlib.NotationDelab.matchForall
+Mathlib.NotationDelab.matchLambda
+Mathlib.NotationDelab.matchScoped
+Mathlib.NotationDelab.matchTypeOf
+Mathlib.NotationDelab.matchVar
+Mathlib.NotationDelab.mkExprMatcher
+Mathlib.NotationDelab.mkFoldlMatcher
+Mathlib.NotationDelab.mkFoldrMatcher
+Mathlib.NotationDelab.mkScopedMatcher
+Mathlib.NotationDelab.natLitMatcher
+Mathlib.NotationDelab.notation3
+Mathlib.NotationDelab.notationDelab
+Mathlib.NotationDelab.notationDelabItem
+Mathlib.NotationDelab.prettyPrintOpt
+Mathlib.NotationDelab.setupLCtx
+Mathlib.NotationDelab.withHeadRefIfTagAppFns
+Mathlib.NotationDelab.«termExpand_binders%(_=>_)_,_»

Decrease in strong tech debt: (relative, absolute) = (3.00, 0.02)
Current number Change Type (strong)
197 -3 documentation nolints entries
No changes to weak technical debt.

Current commit 1eb6145069
Reference commit 1ebec2bd36

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

note: file MathlibTest/Linter/PrivateModule/Notation3.lean was removed.
Please create a follow-up pull request adding a module deprecation. Thanks!

note: file MathlibTest/Util/Notation3.lean` was renamed to `MathlibTest/Util/NotationDelab.lean without a module deprecation
Please create a follow-up pull request adding one. Thanks!

note: file Mathlib/Util/Notation3.lean` was renamed to `Mathlib/Util/NotationDelab.lean without a module deprecation
Please create a follow-up pull request adding one. Thanks!

@github-actions github-actions Bot added the file-removed A Lean module was (re)moved without a `deprecated_module` annotation label Oct 19, 2026
@YaelDillies YaelDillies added the LLM-generated PRs with substantial input from LLMs - review accordingly label Oct 19, 2026
Comment thread Mathlib/Util/NotationDelab.lean Resolved
@github-actions github-actions Bot added tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip and removed increases-technical-debt Automatically added label for PRs which increase "strong" technical debts labels Oct 19, 2026
Comment thread Mathlib/Order/PiLex.lean Resolved
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 19, 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 Oct 19, 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 20, 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 20, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Oct 20, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@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 20, 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 21, 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 23, 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 24, 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 2, 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 5, 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 18, 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 18, 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 19, 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 20, 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 30, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

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

@YaelDillies YaelDillies removed the awaiting-zulip There is a Zulip discussion; the author should await and report/implement the decision reached there label Dec 1, 2026
@YaelDillies

Copy link
Copy Markdown
Contributor Author

Eric's confusion was clarified in the reviewer stream: notation does not create a delaborator but merely an app-unexpander.

@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 Dec 1, 2026
@kbuzzard kbuzzard assigned JovanGerb and unassigned JovanGerb Dec 1, 2026
@joneugster joneugster added the t-meta Tactics, attributes or user commands label Dec 1, 2026

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

file-removed A Lean module was (re)moved without a `deprecated_module` annotation LLM-generated PRs with substantial input from LLMs - review accordingly t-meta Tactics, attributes or user commands tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants