Skip to content

feat: implement DLMF attribute - #42899

Open
luigi-massacci wants to merge 9 commits into
leanprover-community:masterfrom
luigi-massacci:LM_link_dlmf
Open

feat: implement DLMF attribute#42899
luigi-massacci wants to merge 9 commits into
leanprover-community:masterfrom
luigi-massacci:LM_link_dlmf

Conversation

@luigi-massacci

@luigi-massacci luigi-massacci commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Implement DLMF attribute. This allows users to link Mathlib declarations to DLMF entries.

The implementation here copies the LMFDB implementation (so in particular only checks that the character set in the ID is valid).

The DLMF (NIST Digital Library of Mathematical Functions) is a mathematical database for special functions and their applications by the National Institute of Standards and Technology (see wikipedia, and the DLMF itself).

It is also already linked to by the zbmath API for example.


Open in Gitpod

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

PR summary 44b96e2cc4

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ Lean.TSyntax.getDlmfId
+ dlmfIdAntiquot.parenthesizer
+ dlmfIdFn
+ dlmfIdKind
+ dlmfIdNoAntiquot
+ dlmfIdNoAntiquot.formatter
+ dlmfIdParser
+ test

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

  • +14 new declarations
  • −0 removed declarations
+Lean.PrettyPrinter.Formatter.dlmfIdNoAntiquot.formatter
+Lean.PrettyPrinter.Parenthesizer.dlmfIdAntiquot.parenthesizer
+Lean.TSyntax.getDlmfId
+Mathlib.CrossRef.Database.dlmf
+Mathlib.CrossRef.Database.dlmf.elim
+Mathlib.CrossRef.Database.dlmf.sizeOf_spec
+Mathlib.CrossRef.dlmfIdFn
+Mathlib.CrossRef.dlmfIdKind
+Mathlib.CrossRef.dlmfIdNoAntiquot
+Mathlib.CrossRef.dlmfIdParser
+Mathlib.CrossRef.dlmfIdParser.formatter
+Mathlib.CrossRef.dlmfIdParser.parenthesizer
+Mathlib.CrossRef.dlmfTag
+Mathlib.CrossRef.dlmfTags

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 44b96e2cc4
Reference commit f682431588

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

@grunweg grunweg added the t-meta Tactics, attributes or user commands label Aug 18, 2026
@grunweg

grunweg commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Hi, thanks for your PR. What's DLMF, can you add a brief explanation?

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 18, 2026
@luigi-massacci luigi-massacci removed the awaiting-author A reviewer has asked the author a question or requested changes. label Aug 18, 2026
@luigi-massacci

Copy link
Copy Markdown
Collaborator Author

Hello, I extended the PR description. I guess you have never been to FoCM ; )

@grunweg

grunweg commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Thanks! Indeed, I haven't :-)

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

Labels

t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants