Repository navigation
Conversation
PR summary ca31f024eeImport changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 You can run this locally as follows## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for No changes to technical debt.This script lives in the
|
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match our commit style conventions. |
…/"public section"/g
Contributor
|
bors merge |
Contributor
|
Pull request successfully merged into master. Build succeeded:
|
jcommelin
pushed a commit
to leanprover-community/mathlib-ci
that referenced
this pull request
Apr 27, 2026
…rface errors in PR comment (#26) * fix: replay auto commits in isolated worktrees and surface errors in PR comment The commit verification script had several bugs that combined to produce unhelpful PR comments and cascading false-positive failures: - Per-commit replay shared the main checkout, so any untracked file an earlier auto commit's command produced (e.g., from a `> hits.txt` redirect) blocked the next commit's `git checkout --detach $parent` with "untracked working tree files would be overwritten". The "fix" to earlier commit N+1 then reported a confusing checkout error instead of its real failure. - JSON output was hand-rolled with `echo "{ \"...\": \"$subject\" }"` and only escaped quotes. Subjects containing literal newlines (created by some commit-message generators) produced unparseable JSON, which then caused the comment-rendering step to fail silently with `jq: parse error: Invalid escape`. - The comment surfaced no actual error output. Authors saw "❌ Failed" and had to dig through CI logs to learn what went wrong. This rewrite: - Replays each auto commit in a fresh `git worktree add --detach $parent` under a single mktemp'd parent. Worktrees are removed after each iteration, on EXIT (trap), and `git worktree prune` runs at startup so any stale state from interrupted runs is cleared. The same isolation applies to the transient-commit cherry-pick replay. - Captures combined stdout+stderr via `tee` so live CI logs still show the command's output while we also save it for the JSON report. - Builds JSON via `jq -nc --arg ...` so commit subjects with arbitrary bytes (newlines, backslashes, control chars) round-trip safely. - Records a `failure_kind` (`command_failed`, `timed_out`, or `tree_mismatch`) plus the last 4KB / 40 lines of output, and for tree mismatches a truncated `git diff-tree --stat`. The summary script dispatches on `failure_kind` (no keyword matching on error text — the underlying tool's message is the diagnosis) and renders each failed commit as a `<details>` block containing the actual output. - Caps total comment size at 50KB, falling back to "see CI logs" links for late-truncated content. - Replaces the literal `✅`/`❌` escape strings (which only rendered correctly inside `jq` output) with real UTF-8 ✅/❌. - Drops the bash-4 `mapfile` and associative-array dependencies; both scripts now run on bash 3.2+, easing local testing. - Recovers from unparseable JSON: if `verify_commits.sh` crashes before writing the JSON file, the summary script emits a fallback comment pointing to the CI logs rather than producing empty output. Smoke-tested against the failing run for leanprover-community/mathlib4#38480. The new comment shows the actual bash parse error / xargs / sed / git rm output for each commit independently, with no cascading "checkout would overwrite" noise. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix: allow TIMEOUT_SECONDS to be overridden via environment variable Hard-coded 600s makes the timeout-handling path effectively unreachable from test harnesses that build a synthetic git history and need a quick artificial timeout. Use the same `${VAR:-default}` pattern already used for TRANSIENT_PREFIX et al., so a test scenario can set TIMEOUT_SECONDS=1 and exercise the timed_out failure_kind path in seconds. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
jessealama
pushed a commit
to jessealama/mathlib4
that referenced
this pull request
May 2, 2026
xroblot
pushed a commit
to xroblot/mathlib4
that referenced
this pull request
May 2, 2026
gaetanserre
pushed a commit
to gaetanserre/mathlib4
that referenced
this pull request
May 5, 2026
gasparattila
pushed a commit
to gasparattila/mathlib4
that referenced
this pull request
May 9, 2026
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Strip `@[expose]` from `public section` headers in modules where the section body contains no `def` or `inductive` declarations. These are the cheapest possible cache-cut wins: the file's defaults flip from "bodies exposed" to "bodies hidden" with no risk to downstream code, because only `def` and `inductive` bodies are semantically relevant downstream (rfl/simp/unfold/pattern-matching). Other decl kinds in these files (theorem/lemma/abbrev/structure/class/instance) don't require body exposure: theorem proofs are irrelevant, abbrevs are already reducible, structure/class projections use auto-generated lemmas, and instance bodies are found by typeclass search by type. This is a catch-up sweep on top of leanprover-community#38480 (grunweg, merged April 26) which mass-stripped 1,101 files using the same heuristic. The 35 files here are the @[expose] section headers that have appeared in the 3 weeks since leanprover-community#38480 merged. Pipeline: per-section isolation + 4-importer cone check + global build + cascade revert, followed by adding back 11 known-good strips that were collateral-reverted in cascade due to a temporal-ordering bug. Final `lake build`: passes (8,433 jobs). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
…r-validated) Strip `@[expose]` from `public section` headers in modules where no declaration benefits from body exposure downstream — validated by the `superfluousExpose` linter (see companion PR with the linter itself). A declaration 'benefits from exposure' iff it's a public, non-internal, non-instance `def` or non-structure `inductive` whose body matters for downstream typechecking (`rfl` / `simp` / `unfold` / pattern matching). Excludes `@[reducible]` (abbrev), `@[irreducible] def` (still `rw`-targetable), `@[match_pattern]` defs, and `to_additive`-derived defs from the safe set — all of which the linter correctly blocks. Final tally: - target universe (files with `@[expose] section`): 4,725 - linter-validated subset (relaxed def-free filter): 89 - `lake build` final status: passes (8,433 jobs) This is a catch-up sweep on top of leanprover-community#38480 (grunweg, merged April 26) which mass-stripped 1,101 such files using the same heuristic. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
…inter-validated) Strip `@[expose]` from `public section` headers in modules where no declaration benefits from body exposure downstream — validated by the `superfluousExpose` linter (companion PR adds the linter itself). A declaration 'benefits from exposure' iff it's a public, non-internal `def` or non-structure `inductive` whose body matters for downstream typechecking. The linter skips declarations that: - are private/reserved/internal-detail-named; - are auto-generated by the inductive elaborator (recursors, projections, matchers, no-confusion lemmas, `.ctorIdx` functions) — detected via `Lean.isAuxRecursor`, `env.getProjectionFnInfo?`, `isMatcherCore`, `Lean.isNoConfusion`, `isCtorIdxCore?`; - have notation/syntax-generated names (`«term_…»`, `«binder_…»`, …); - are instances (incl. `local instance`, `scoped instance` — fallback via the `inst[A-Z]` auto-naming convention when `isInstanceCore` misses them); - are `unsafe def` / `partial def` (kernel treats body as opaque); - are `abbrev` (bodies auto-exposed in modules per the reference); - are structures or classes (special projection handling via `isStructure`). Validates with build verification (8,433 jobs pass). Final tally: - target universe (files with `@[expose] public section`): 4,725 - linter-validated subset: 101 - `lake build` final status: passes This is a catch-up sweep on top of leanprover-community#38480 (grunweg, merged April 2026) which mass-stripped 1,101 such files using a similar heuristic. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
marcelolynch
pushed a commit
to marcelolynch/mathlib4
that referenced
this pull request
May 14, 2026
Inverse of `privateModule` linter: detects modules where `@[expose] public section` is superfluous because no decl in the file would benefit from exposure downstream. Suggested by PR leanprover-community#38477 as the long-term mechanism to prevent regressions of the kind that leanprover-community#38480 and related PRs cleaned up manually. A decl 'benefits from exposure' iff it's a public, non-internal `def` or `inductive` that is: - not private / reserved / internal-detail-named, - not an auxiliary recursor / projection / matcher, - not a notation/syntax-generated name, - not a meta-namespace declaration, - not an instance (incl. local/scoped/auto-named), - not an abbrev / @[irreducible] / @[implicit_reducible]... wait, implicit_reducible DOES benefit, - not a structure/class (those go through `inductInfo` but have special projection handling). Includes 11 test files covering positive (theorem-only, class-only, abbrev-only, irreducible-def-only, local-instance, scoped-instance, notation, recursors) and negative (plain def, to_additive-derived, inductive) cases. Known limitations the linter currently misses (would block in error): - Tactic macros from `scoped macro (name := X) ...` - `simproc_decl` (creates def whose body is a simprocedure) - `alias`es with non-trivial bodies (technically real defs) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
kim-em
pushed a commit
to kim-em/mathlib-ci
that referenced
this pull request
May 22, 2026
…rface errors in PR comment (leanprover-community#26) * fix: replay auto commits in isolated worktrees and surface errors in PR comment The commit verification script had several bugs that combined to produce unhelpful PR comments and cascading false-positive failures: - Per-commit replay shared the main checkout, so any untracked file an earlier auto commit's command produced (e.g., from a `> hits.txt` redirect) blocked the next commit's `git checkout --detach $parent` with "untracked working tree files would be overwritten". The "fix" to earlier commit N+1 then reported a confusing checkout error instead of its real failure. - JSON output was hand-rolled with `echo "{ \"...\": \"$subject\" }"` and only escaped quotes. Subjects containing literal newlines (created by some commit-message generators) produced unparseable JSON, which then caused the comment-rendering step to fail silently with `jq: parse error: Invalid escape`. - The comment surfaced no actual error output. Authors saw "❌ Failed" and had to dig through CI logs to learn what went wrong. This rewrite: - Replays each auto commit in a fresh `git worktree add --detach $parent` under a single mktemp'd parent. Worktrees are removed after each iteration, on EXIT (trap), and `git worktree prune` runs at startup so any stale state from interrupted runs is cleared. The same isolation applies to the transient-commit cherry-pick replay. - Captures combined stdout+stderr via `tee` so live CI logs still show the command's output while we also save it for the JSON report. - Builds JSON via `jq -nc --arg ...` so commit subjects with arbitrary bytes (newlines, backslashes, control chars) round-trip safely. - Records a `failure_kind` (`command_failed`, `timed_out`, or `tree_mismatch`) plus the last 4KB / 40 lines of output, and for tree mismatches a truncated `git diff-tree --stat`. The summary script dispatches on `failure_kind` (no keyword matching on error text — the underlying tool's message is the diagnosis) and renders each failed commit as a `<details>` block containing the actual output. - Caps total comment size at 50KB, falling back to "see CI logs" links for late-truncated content. - Replaces the literal `✅`/`❌` escape strings (which only rendered correctly inside `jq` output) with real UTF-8 ✅/❌. - Drops the bash-4 `mapfile` and associative-array dependencies; both scripts now run on bash 3.2+, easing local testing. - Recovers from unparseable JSON: if `verify_commits.sh` crashes before writing the JSON file, the summary script emits a fallback comment pointing to the CI logs rather than producing empty output. Smoke-tested against the failing run for leanprover-community/mathlib4#38480. The new comment shows the actual bash parse error / xargs / sed / git rm output for each commit independently, with no cascading "checkout would overwrite" noise. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix: allow TIMEOUT_SECONDS to be overridden via environment variable Hard-coded 600s makes the timeout-handling path effectively unreachable from test harnesses that build a synthetic git history and need a quick artificial timeout. Use the same `${VAR:-default}` pattern already used for TRANSIENT_PREFIX et al., so a test scenario can set TIMEOUT_SECONDS=1 and exercise the timed_out failure_kind path in seconds. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
mathlib-bors Bot
pushed a commit
that referenced
this pull request
Aug 12, 2026
Strip `@[expose]` from `public section` headers in 136 modules where no declaration needs its body visible downstream. A new sweep in the style of #38480 Found using the linter-in-progress: #39387 Relevant Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Removing.20unnecessary.20.60.40.5Bexpose.5D.60/with/595180230
attilavjda
pushed a commit
to attilavjda/mathlib4
that referenced
this pull request
Sep 5, 2026
…munity#39388) Strip `@[expose]` from `public section` headers in 136 modules where no declaration needs its body visible downstream. A new sweep in the style of leanprover-community#38480 Found using the linter-in-progress: leanprover-community#39387 Relevant Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Removing.20unnecessary.20.60.40.5Bexpose.5D.60/with/595180230
eohjelle
pushed a commit
to eohjelle/TauCeti
that referenced
this pull request
Oct 19, 2026
…ality (TauCetiProject#16535) This PR exposes the bodies of `TauCeti.conjRepFunctor`, `TauCeti.conjRep`, `TauCeti.conjFDRepFunctor` and `TauCeti.conjFDRep`, and restates the lemmas about the conjugate action as plain equalities instead of heterogeneous equalities and casts. These four definitions were sealed, so in every importing module the carrier `(conjRep s A).V` is not definitionally `A.V`. As a result the statement a consumer actually wants, `(conjRep s A).ρ x = A.ρ (conjSubgroupEquiv s H x)`, does not elaborate outside `Conjugate.lean`. It fails with `Type mismatch … The following definitions were not unfolded because their definition is not exposed: TauCeti.conjRep`. Even `(conjRep s A).V = A.V := by rfl` fails there. The same restriction applies to public statements inside the defining file, so the API was forced into workarounds: - `conjRep_ρ`, `conjRep_ρ_mk`, `conjFDRep_ρ`, `conjRepFunctor_map_hom_toLinearMap` and the two `conjRepSubrepresentationOrderIso_…_toSubmodule` lemmas were `HEq` statements; - `conjRep_ρ_apply` and `conjFDRep_ρ_cast` were stated through `cast` along `conjRep_V` and `conjFDRep_V`. An `HEq` lemma cannot be used by `rw` or `simp`, so the two `@[simp]` ones never fired as rewrites. With the bodies exposed, all of these lemmas are equalities, and most are `rfl`. For example, `conjFDRep_ρ` drops from an eight-line proof (a `change`, three rewrites through `FDRep.hom_hom_action_ρ` and `Action.res_obj_ρ`, then `congrArg`) to `rfl`. `conjRep_V` and `conjFDRep_V` drop their `change` steps and are proved by `(rfl)`, so they are not added to `dsimp`'s defeq set. The file shrinks by 22 lines. No caller outside the file uses the changed statements: the Mackey files go through `res_obj_eq_conjRep` and `res_obj_eq_conjFDRep`, which are unchanged. This matches Mathlib's restriction functor, which `conjRep` specialises. [`Rep.resFunctor`](https://github.com/leanprover-community/mathlib4/blob/3b531c35df33d6bbe64b4e87dec056211d3a5676/Mathlib/RepresentationTheory/Rep/Res.lean#L37) and [`Rep.res`](https://github.com/leanprover-community/mathlib4/blob/3b531c35df33d6bbe64b4e87dec056211d3a5676/Mathlib/RepresentationTheory/Rep/Res.lean#L42) are `abbrev`s. Because of that, [`Rep.coe_res_obj_ρ'`](https://github.com/leanprover-community/mathlib4/blob/3b531c35df33d6bbe64b4e87dec056211d3a5676/Mathlib/RepresentationTheory/Rep/Res.lean#L50) and [`Rep.res_obj_V`](https://github.com/leanprover-community/mathlib4/blob/3b531c35df33d6bbe64b4e87dec056211d3a5676/Mathlib/RepresentationTheory/Rep/Res.lean#L52) are equalities proved by `rfl`. They were introduced in that form by leanprover-community/mathlib4#36127 and kept when leanprover-community/mathlib4#38480 removed superfluous file-level `@[expose]`. [`Action.res`](https://github.com/leanprover-community/mathlib4/blob/3b531c35df33d6bbe64b4e87dec056211d3a5676/Mathlib/CategoryTheory/Action/Basic.lean#L328), which `conjFDRepFunctor` wraps, sits in an `@[expose] public section` with `@[simps]`. Within this file, the normal-subgroup sibling `conjNormalRepFunctor`/`conjNormalRep` was already `@[expose]` (TauCetiProject#1513) for exactly this reason, which makes `conjNormalRep_ρ` `rfl`. Its docstrings, which contrasted it with the heterogeneous `conjRep_ρ`, are updated. A sealed body lets the encoding change without touching importers, and stops downstream proofs from depending on it definitionally. Here there is no rival encoding to protect: `res_obj_eq_conjRep` and `res_obj_eq_conjFDRep` already record, by `rfl`, that the conjugate *is* Mathlib's restriction along `conjSubgroupEquiv s H`. Exposure does not change reducibility, so `rw` and `simp` still do not unfold these definitions. Removed public declarations: - `TauCeti.conjFDRep_ρ_cast`: replaced by `TauCeti.conjFDRep_ρ`, which is now the equality `(conjFDRep s A).ρ x = A.ρ (conjSubgroupEquiv s H x)`. Restated under the same names, as equalities: `TauCeti.conjRep_ρ`, `TauCeti.conjRep_ρ_apply` (no casts), `TauCeti.conjRep_ρ_mk`, `TauCeti.conjFDRep_ρ`, `TauCeti.conjRepFunctor_map_hom_toLinearMap`, `TauCeti.conjRepSubrepresentationOrderIso_apply_toSubmodule` and `TauCeti.conjRepSubrepresentationOrderIso_symm_apply_toSubmodule`. Each old `HEq` form is recovered by `heq_of_eq`. Roadmap: RepresentationTheory <!--tauceti-target:v1 {"focus":"RepresentationTheory","id":"conjrep"}--> 🤖 Prepared with Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All these files contain no single definition or instance: similar to #33581 and friends.
During mathlib's migration to the module system,
@[expose] public sectionwas added at the beginningof each file. In the medium-term, we would like to be more conscious about mathlib's use of the module
system. This PR helps by clarifying how many definitions' status need to actually be checked.
Zulip thread
A future PR may make the
privateModulelinter also lint about files with@[expose] sectionand no definitions; this would avoid regressions.Version of #38477 with hopefully easier to verify history.