Skip to content

chore(Algebra/Category/Grp/Adjunctions): make AddCommGrpCat.free implicit_reducible - #46754

Open
roy7 wants to merge 1 commit into
leanprover-community:masterfrom
roy7:chore/addcommgrpcat-free-implicit-reducible
Open

roy7 wants to merge 1 commit into
leanprover-community:masterfrom
roy7:chore/addcommgrpcat-free-implicit-reducible

Conversation

@roy7

@roy7 roy7 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Mark the free functor AddCommGrpCat.free as @[implicit_reducible] and remove the two options set_option backward.defeqAttrib.useBackward true in and set_option backward.isDefEq.respectTransparency false in from AddCommGrpCat.adj.

The two options work around two separate stricter checks, and both stumble on free being an ordinary def. Since leanprover/lean4#12179 (Lean v4.29), isDefEq compares implicit arguments at a transparency that does not unfold ordinary definitions; backward.isDefEq.respectTransparency false restores the old behaviour. Separately, dsimp only uses an rfl lemma that holds at .implicit transparency (@[defeq]); lemmas that are rfl only at default transparency are tagged @[backward_defeq] and are used only under backward.defeqAttrib.useBackward. Because free.obj α is of (FreeAddCommGroup α) only after unfolding free, the simps lemmas free_obj and free_map are @[backward_defeq] but not @[defeq]. In the proof of homEquiv_naturality_left_symm in adj, rw [← FreeAddCommGroup.lift_comp] (after dsimp [ConcreteCategory.homEquiv]) then finds no instance of its pattern if either option is removed. The .implicit transparency unfolds implicit_reducible definitions, so with the attribute free_obj and free_map become @[defeq], the implicit arguments match, and adj needs neither option. This is the same kind of change as #42161 and #44272.


The attribute does not make any of the other backward.* options in the files that import this one removable (the respectTransparency and useBackward options in Mathlib/CategoryTheory/Sites/MayerVietorisSquare.lean and the respectTransparency options in Mathlib/CategoryTheory/Sites/SheafCohomology/MayerVietoris.lean), including the two on instance : Mono S.shortComplex.f, whose failing instance goal involves AddCommGrpCat.free (through the definition of shortComplex).

I found this while looking at a respectTransparency workaround in the Riemann Hypothesis formalization (https://github.com/leanprover-community/riemann-hypothesis), where AddCommGrpCat.free is one of the definitions involved.

AI use: I used Claude Code (Anthropic's coding agent) to find the definition while investigating that workaround, make the change, build and test Mathlib with it, compare the declarations and heartbeat counts before and after, and draft this description, and a second AI model (Grok) to review it adversarially.

🤖 Generated with Claude Code

@roy7

roy7 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

LLM-generated

@github-actions github-actions Bot added LLM-generated PRs with substantial input from LLMs - review accordingly new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to Zulip and join the Lean community.
Thank you again for joining our community.

@github-actions github-actions Bot added the tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip label Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

PR summary ad26728b5e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

No declarations were harmed in the making of this PR! 🐙

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

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


Decrease in strong tech debt: (relative, absolute) = (1.00, 0.00)
Current number Change Type (strong)
1678 -1 backward.defeqAttrib.useBackward
3464 -1 backward.isDefEq.respectTransparency
No changes to weak technical debt.

Current commit ad26728b5e
Reference commit 98f3735536

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

@github-actions github-actions Bot added the t-algebra Algebra (groups, rings, fields, etc) label Nov 30, 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

LLM-generated PRs with substantial input from LLMs - review accordingly new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc) 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.

1 participant