Skip to content

[Merged by Bors] - chore(RepresentationTheory): Refactor Rep - #36127

Closed
Whysoserioushah wants to merge 235 commits into
leanprover-community:masterfrom
Whysoserioushah:edison/refactor_rep
Closed

Whysoserioushah wants to merge 235 commits into
leanprover-community:masterfrom
Whysoserioushah:edison/refactor_rep

Conversation

@Whysoserioushah

@Whysoserioushah Whysoserioushah commented Mar 4, 2026 •

Copy link
Copy Markdown
Collaborator

In this PR I've added three more files in a folder "Rep" to replace the old RepresentationTheory.Rep as it's quite a long file.
Rep.Basic: Defines Rep in terms of bundled Representations instead of using Action.
Rep.Iso: Proves the category equivalence between Rep k G and ModuleCat k k[G].
Rep.Res: Introduces restriction on a representation induced by a group homomorphism, this is upstreamed from ClassFieldTheory project to avoid the use of Action.


I believe I tried to make the minimal change to the rest of the files just enough to make it build without any erws :-/

Future plans :

  1. Upstream more results from ClassFieldTheory about Rep and groupCohomology
  2. Fix the defEq abuse in Action (very hard) or refactor Rep even more to make it completely independent of Action.

Open in Gitpod

@riccardobrasca

Copy link
Copy Markdown
Member

!radar

@leanprover-radar

leanprover-radar commented Mar 24, 2026 •

Copy link
Copy Markdown

Benchmark results for 9c18916 against 817fb21 are in. Significant changes detected! @riccardobrasca

  • ✅ build//instructions: -17.9G (-0.01%)

Large changes (2✅)

  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.FiniteCyclic//instructions: -12.1G (-28.53%)
  • ✅ build/module/Mathlib.RepresentationTheory.Induced//instructions: -121.4G (-52.06%)

Medium changes (5✅, 1🟥)

  • ✅ build/module/Mathlib.RepresentationTheory.Coinvariants//instructions: -11.3G (-11.15%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.FiniteCyclic//instructions: -3.4G (-12.18%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Functoriality//instructions: +9.6G (+11.65%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.Basic//instructions: -4.3G (-11.01%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.Functoriality//instructions: -22.3G (-11.51%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree//instructions: -12.6G (-8.04%)

Small changes (5✅, 7🟥)

  • ✅ build/module/Mathlib.Analysis.Analytic.Uniqueness//instructions: -652.3M (-2.55%)
  • ✅ build/module/Mathlib.RepresentationTheory.Action//instructions: -3.4G (-7.39%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Coinduced//instructions: +14.6G (+39.41%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.FiniteIndex//instructions: +9.5G (+20.38%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.FiniteCyclic//instructions: +3.6G (+13.37%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic//instructions: -5.0G (-12.79%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Hilbert90//instructions: -1.4G (-6.10%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.LongExactSequence//instructions: -757.1M (-2.90%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.Resolution//instructions: +15.8G (+35.82%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.Intertwining//instructions: +7.5G (+11.04%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Invariants//instructions: +3.3G (+7.66%)
  • 🟥 build/module/Mathlib.Util.PrintSorries//instructions: +134.0M (+3.15%) (reduced significance based on absolute threshold)

@riccardobrasca

Copy link
Copy Markdown
Member

!radar

@leanprover-radar

leanprover-radar commented Mar 24, 2026 •

Copy link
Copy Markdown

Benchmark results for 3af8f13 against 817fb21 are in. Significant changes detected! @riccardobrasca

  • ✅ build//instructions: -520.1M (-0.00%)

Large changes (2✅)

  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.FiniteCyclic//instructions: -12.0G (-28.36%)
  • ✅ build/module/Mathlib.RepresentationTheory.Induced//instructions: -121.3G (-51.99%)

Medium changes (5✅, 1🟥)

  • ✅ build/module/Mathlib.RepresentationTheory.Coinvariants//instructions: -11.3G (-11.13%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.FiniteCyclic//instructions: -3.4G (-12.26%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Functoriality//instructions: +9.4G (+11.40%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.Basic//instructions: -4.3G (-10.99%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.Functoriality//instructions: -22.2G (-11.46%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree//instructions: -12.9G (-8.23%)

Small changes (4✅, 7🟥)

  • 🟥 build/module/Mathlib.Lean.Elab.InfoTree//instructions: +124.0M (+4.94%)
  • ✅ build/module/Mathlib.RepresentationTheory.Action//instructions: -3.5G (-7.60%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Coinduced//instructions: +14.5G (+39.08%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.FiniteIndex//instructions: +9.5G (+20.39%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.FiniteCyclic//instructions: +3.7G (+13.53%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic//instructions: -4.9G (-12.74%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupCohomology.Hilbert90//instructions: -1.4G (-6.06%)
  • ✅ build/module/Mathlib.RepresentationTheory.Homological.GroupHomology.LongExactSequence//instructions: -768.1M (-2.94%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Homological.Resolution//instructions: +15.9G (+36.02%) (reduced significance based on *//lines)
  • 🟥 build/module/Mathlib.RepresentationTheory.Intertwining//instructions: +7.5G (+11.04%)
  • 🟥 build/module/Mathlib.RepresentationTheory.Invariants//instructions: +3.2G (+7.59%)

@riccardobrasca

Copy link
Copy Markdown
Member

Thanks!

bors merge

@mathlib-triage mathlib-triage Bot added the ready-to-merge This PR has been sent to bors. label Mar 24, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Mar 24, 2026
In this PR I've added three more files in a folder "Rep" to replace the old `RepresentationTheory.Rep` as it's quite a long file.
`Rep.Basic`: Defines `Rep` in terms of bundled `Representation`s instead of using `Action`.
`Rep.Iso`: Proves the category equivalence between `Rep k G` and `ModuleCat k k[G]`.
`Rep.Res`: Introduces restriction on a representation induced by a group homomorphism, this is upstreamed from ClassFieldTheory project to avoid the use of `Action`.

Co-authored-by: Kevin Buzzard <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title chore(RepresentationTheory): Refactor Rep [Merged by Bors] - chore(RepresentationTheory): Refactor Rep Mar 24, 2026
@mathlib-bors mathlib-bors Bot closed this Mar 24, 2026
justus-springer pushed a commit to justus-springer/mathlib4 that referenced this pull request Mar 28, 2026
In this PR I've added three more files in a folder "Rep" to replace the old `RepresentationTheory.Rep` as it's quite a long file.
`Rep.Basic`: Defines `Rep` in terms of bundled `Representation`s instead of using `Action`.
`Rep.Iso`: Proves the category equivalence between `Rep k G` and `ModuleCat k k[G]`.
`Rep.Res`: Introduces restriction on a representation induced by a group homomorphism, this is upstreamed from ClassFieldTheory project to avoid the use of `Action`.

Co-authored-by: Kevin Buzzard <[email protected]>
YaelDillies added a commit to YaelDillies/mathlib4 that referenced this pull request Apr 1, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Apr 1, 2026
…`Monoid` (#37483)

This was accidentally ungeneralised in #36127.

From ClassFieldTheory
aditya-ramabadran pushed a commit to aditya-ramabadran/mathlib4 that referenced this pull request Apr 1, 2026
xroblot pushed a commit to xroblot/mathlib4 that referenced this pull request Apr 3, 2026
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
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 ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants