Skip to content

chore: remove backward.privateInPublic in algebra, combinatorics and number theory - #44024

Open
kim-em wants to merge 1 commit into
leanprover-community:masterfrom
kim-em:pip-unprivate-algebra
Open

kim-em wants to merge 1 commit into
leanprover-community:masterfrom
kim-em:pip-unprivate-algebra

Conversation

@kim-em

@kim-em kim-em commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

This PR removes the backward.privateInPublic option in 9 files across algebra, combinatorics, number theory, order theory and set theory. In each case a private definition appeared in the statement of a public declaration, so it was already part of the public interface in all but name. The fix is to drop private from those definitions, adding docstrings where they were missing. In Algebra/EuclideanDomain/Basic the opposite direction is cleaner: the only consumer xgcdAux_P becomes private as well, matching the existing setup in Data/Int/GCD. In Combinatorics/SetFamily/FourFunctions the definition becomes Finset.collapse rather than a root-level name. In Combinatorics/SetFamily/KruskalKatona the predicate is marked @[expose], since the file's public section is not exposed and the DecidableRel instance needs to unfold it.

Files where a private lemma appeared in a public statement are handled by wrapping the use site instead, in #44032. Names are kept as they were (for example Pell.d); suggestions for better names are welcome but are not needed for this PR.

🤖 Prepared with Claude Code

@github-actions github-actions Bot added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown

PR summary 2411ae2c1d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ Finset.collapse
- collapse

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

  • +14 new declarations
  • −1 removed declarations
-EuclideanDomain.xgcdAux_P
+Finset.UV.UsefulCompression
+Finset.UV.UsefulCompression.instDecidableRel
+Finset.collapse
+Finset.collapse.congr_simp
+FreeAlgebra.liftAux
+HomogeneousLocalization.awayMapAux
+HomogeneousLocalization.awayMapAux.congr_simp
+IsFreeGroupoid.SpanningTree.root'
+IsFreeGroupoid.symgen
+ONote.toStringAux
+Pell.d
+Pell.d.congr_simp
+SzemerediRegularity.distinctPairs
+SzemerediRegularity.distinctPairs.congr_simp

Decrease in strong tech debt: (relative, absolute) = (45.65, 0.36)
Current number Change Type (strong)
backward.privateInPublic 477 -53
backward.privateInPublic.warn 172 -43
No changes to weak technical debt.

Current commit 2411ae2c1d
Reference commit 0a6c8e0355

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

@grunweg grunweg added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Sep 21, 2026
@grunweg

grunweg commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Can you take a look at the test failure, please?

…number theory by un-privating definitions used in public statements
@kim-em
kim-em force-pushed the pip-unprivate-algebra branch from c1154b2 to 2411ae2 Compare September 21, 2026 09:05
@github-actions github-actions Bot removed the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Sep 21, 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

tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants