Skip to content

[Merged by Bors] - feat: MulActionHom in the semilinear style - #6057

Closed
AntoineChambert-Loir wants to merge 260 commits into
masterfrom
SMulSemiHom
Closed

AntoineChambert-Loir wants to merge 260 commits into
masterfrom
SMulSemiHom

Conversation

@AntoineChambert-Loir

@AntoineChambert-Loir AntoineChambert-Loir commented Jul 22, 2023 •

Copy link
Copy Markdown
Collaborator

Generalize MulActionHom so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let M, N, X, Y be types, with SMul M X and SMul N Y, and let φ : M → N be a map.

  • MulActionHom φ X Y, the type of equivariant functions from X to Y, consists of functions f : X → Y such that f (m • x) = (φ m) • (f x) for all m : M and x : X.

Assume that we have Monoid M, Monoid N and that φ : M →* N. For A, B by types with AddMonoid A and AddMonoid B, endowed with DistribMulAction M A and DistribMulAction M B:

  • DistribMulActionHom φ A B is the type of equivariant additive monoid homomorphisms from A to B.

Similarly, when R and S are types with Semiring R, Semiring S, MulSemiringAction M R and MulSemiringAction N S

  • SMulSemiringHom φ R S is the type of equivariant ring homomorphisms
    from R to S.

The above types have corresponding classes:

  • MulActionHomClass F φ X Y states that F is a type of bundled X → Y homs which are φ-equivariant
  • DistribMulActionHomClass F φ A B states that F is a type of bundled A → B homs preserving the additive monoid structure and φ-equivariant
  • SMulSemiringHomClass F φ R S states that F is a type of bundled R → S homs preserving the ring structure and φ-equivariant

Notation

We introduce the following notation to code equivariant maps
(the subscript index ₑ is for equivariant) :

  • X →ₑ[φ] Y is MulActionHom φ X Y.
  • A →ₑ+[φ] B is DistribMulActionHom φ A B.
  • R →ₑ+*[φ] S is MulSemiringActionHom φ R S.

When M = N and φ = MonoidHom.id M, we provide the backward compatible notation :

  • X →[M] Y is MulActionHom (@id M) X Y
  • A →+[M] B is DistribMulActionHom (MonoidHom.id M) A B
  • R →+*[M] S is MulSemiringActionHom (MonoidHom.id M) R S

This more general definition is propagated all over mathlib, in particular to LinearMap.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes CompTriple and MonoidHom.CompTriple of “composable triples`, and various instances for them.


TODO (?) :

  • The CompTriple mechanism may have to be unified
  • There are no semilinear maps of affine spaces.

Open in Gitpod

@AntoineChambert-Loir
AntoineChambert-Loir marked this pull request as draft July 22, 2023 21:23
@AntoineChambert-Loir AntoineChambert-Loir added the WIP Work in progress label Jul 22, 2023
@AntoineChambert-Loir
AntoineChambert-Loir marked this pull request as ready for review July 22, 2023 21:23
@AntoineChambert-Loir

Copy link
Copy Markdown
Collaborator Author

I need some advice here :

  • MulActionHom uses map_smul', with _root_.map_smul
  • LinearMap was using map_smul_sl for (truly) semilinear map, and map_smul when the morphism is identity. I have defined abbreviations, possibly not in the correct way.
  • The outcome is that Lean hesitates between various map_smul functions, so that I have to specify SemilinearMapClass.map_smul, which is awkward.

@AntoineChambert-Loir
AntoineChambert-Loir requested review from Vierkantor and removed request for Vierkantor July 29, 2023 14:16
Comment thread Mathlib/Algebra/Hom/GroupAction.lean Resolved
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 6, 2023
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 15, 2023
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Aug 19, 2023
map_smulₛₗ _ _ _
#align non_unital_alg_hom.map_smul NonUnitalAlgHom.map_smul

-- @[simp] -- Porting note (#10618): simp can prove this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please restore all the (#10618)'s in these comments?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (I don't even remember having deleted it…)


variable {φ' : S →* R} {ψ : S →* T} {χ : R →* T}

set_option linter.unusedVariables false in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this now needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of kappa, I believe, which is used implicitly in comp.

@jcommelin

Copy link
Copy Markdown
Member

!bench

@leanprover-bot

Copy link
Copy Markdown

Here are the benchmark results for commit 41c8327.
There were significant changes against commit b7ca925:

  Benchmark                                            Metric         Change
  ==========================================================================
- ~Mathlib.Algebra.Algebra.NonUnitalHom                instructions    60.4%
- ~Mathlib.Analysis.NormedSpace.HahnBanach.Extension   instructions    20.6%
- ~Mathlib.GroupTheory.GroupAction.Hom                 instructions    43.8%

mathlib-bors Bot pushed a commit that referenced this pull request Apr 3, 2024
…ilinearMap (#10758)

This PR adds a coercion from any instance of `SemilinearMapClass` to `SemilinearMap`. This is the standard practice for other parts of the library, such as ring homs (see also the recent change #10368). I also expect this change will help with some rough edges in #6057. Previously, a coercion from `f : AlgHom` to `LinearMap` would look like `f.toNonUnitalAlgHom.toDistribMulActionHom.toLinearMap`, now it should look like `SemilinearMapClass.semilinearMap f`.

The new coercion instances are `CoeHead` since the left hand side is a free variable `F`. I redefined the existing `DistribMulActionHom → LinearMap` coercion in terms of the `SemilinearMapClass` coercion to ensure we don't get any diamonds.
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 3, 2024
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 3, 2024
@AntoineChambert-Loir

Copy link
Copy Markdown
Collaborator Author

!bench

@leanprover-bot

Copy link
Copy Markdown

Here are the benchmark results for commit 8644410.
There were significant changes against commit 6a3812f:

  Benchmark                                                         Metric         Change
  =======================================================================================
- ~Mathlib.Algebra.Algebra.NonUnitalHom                             instructions    60.4%
- ~Mathlib.Algebra.Module.PID                                       instructions     6.3%
- ~Mathlib.Analysis.NormedSpace.HahnBanach.Extension                instructions    22.9%
+ ~Mathlib.Analysis.NormedSpace.PiTensorProduct.InjectiveSeminorm   instructions    -6.2%
- ~Mathlib.GroupTheory.GroupAction.Hom                              instructions    43.8%
+ ~Mathlib.RepresentationTheory.GroupCohomology.Resolution          instructions    -3.9%

@j-loreaux

Copy link
Copy Markdown
Contributor

Thanks again for all your work on this @AntoineChambert-Loir !

bors merge

@github-actions github-actions Bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Apr 5, 2024
mathlib-bors Bot pushed a commit that referenced this pull request Apr 5, 2024
Generalize `MulActionHom` so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let `M`, `N`, `X`, `Y` be types, with `SMul M X` and `SMul N Y`, and let `φ : M → N` be a map. 
* `MulActionHom φ X Y`, the type of equivariant functions from `X` to `Y`, consists of functions `f : X → Y` such that `f (m • x) = (φ m) • (f x)` for all `m : M` and `x : X`.

Assume that we have `Monoid M`, `Monoid N` and that `φ : M →* N`. For `A`, `B` by types with `AddMonoid A` and `AddMonoid B`, endowed with `DistribMulAction M A` and `DistribMulAction M B`:
* `DistribMulActionHom φ A B` is  the type of equivariant additive monoid homomorphisms from `A` to `B`.

Similarly, when `R` and `S` are types with `Semiring R`, `Semiring S`, `MulSemiringAction M R` and `MulSemiringAction N S` 
* `SMulSemiringHom φ R S` is the type of equivariant ring homomorphisms
  from `R` to `S`.

The above types have corresponding classes:
* `MulActionHomClass F φ X Y` states that `F` is a type of bundled `X → Y` homs  which are `φ`-equivariant
* `DistribMulActionHomClass F φ A B` states that `F` is a type of bundled `A → B` homs  preserving the additive monoid structure and `φ`-equivariant
* `SMulSemiringHomClass F φ R S` states that `F` is a type of bundled `R → S` homs  preserving the ring structure and `φ`-equivariant

## Notation

We introduce the following notation to code equivariant maps
(the subscript index `ₑ` is for *equivariant*) :
* `X →ₑ[φ] Y` is `MulActionHom φ X Y`.
* `A →ₑ+[φ] B` is `DistribMulActionHom φ A B`.
* `R →ₑ+*[φ] S` is `MulSemiringActionHom φ R S`.

When `M = N` and `φ = MonoidHom.id M`, we provide the backward compatible notation :
* `X →[M] Y` is `MulActionHom (@id M) X Y`
* `A →+[M] B` is `DistribMulActionHom (MonoidHom.id M) A B`
* `R →+*[M] S` is `MulSemiringActionHom (MonoidHom.id M) R S`

This more general definition is propagated all over mathlib, in particular to `LinearMap`.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes `CompTriple` and `MonoidHom.CompTriple` of “composable triples`, and various instances for them.
@mathlib-bors

mathlib-bors Bot commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat: MulActionHom in the semilinear style [Merged by Bors] - feat: MulActionHom in the semilinear style Apr 5, 2024
@mathlib-bors mathlib-bors Bot closed this Apr 5, 2024
@mathlib-bors
mathlib-bors Bot deleted the SMulSemiHom branch April 5, 2024 02:04
xgenereux pushed a commit that referenced this pull request Apr 15, 2024
…ilinearMap (#10758)

This PR adds a coercion from any instance of `SemilinearMapClass` to `SemilinearMap`. This is the standard practice for other parts of the library, such as ring homs (see also the recent change #10368). I also expect this change will help with some rough edges in #6057. Previously, a coercion from `f : AlgHom` to `LinearMap` would look like `f.toNonUnitalAlgHom.toDistribMulActionHom.toLinearMap`, now it should look like `SemilinearMapClass.semilinearMap f`.

The new coercion instances are `CoeHead` since the left hand side is a free variable `F`. I redefined the existing `DistribMulActionHom → LinearMap` coercion in terms of the `SemilinearMapClass` coercion to ensure we don't get any diamonds.
xgenereux pushed a commit that referenced this pull request Apr 15, 2024
Generalize `MulActionHom` so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let `M`, `N`, `X`, `Y` be types, with `SMul M X` and `SMul N Y`, and let `φ : M → N` be a map. 
* `MulActionHom φ X Y`, the type of equivariant functions from `X` to `Y`, consists of functions `f : X → Y` such that `f (m • x) = (φ m) • (f x)` for all `m : M` and `x : X`.

Assume that we have `Monoid M`, `Monoid N` and that `φ : M →* N`. For `A`, `B` by types with `AddMonoid A` and `AddMonoid B`, endowed with `DistribMulAction M A` and `DistribMulAction M B`:
* `DistribMulActionHom φ A B` is  the type of equivariant additive monoid homomorphisms from `A` to `B`.

Similarly, when `R` and `S` are types with `Semiring R`, `Semiring S`, `MulSemiringAction M R` and `MulSemiringAction N S` 
* `SMulSemiringHom φ R S` is the type of equivariant ring homomorphisms
  from `R` to `S`.

The above types have corresponding classes:
* `MulActionHomClass F φ X Y` states that `F` is a type of bundled `X → Y` homs  which are `φ`-equivariant
* `DistribMulActionHomClass F φ A B` states that `F` is a type of bundled `A → B` homs  preserving the additive monoid structure and `φ`-equivariant
* `SMulSemiringHomClass F φ R S` states that `F` is a type of bundled `R → S` homs  preserving the ring structure and `φ`-equivariant

## Notation

We introduce the following notation to code equivariant maps
(the subscript index `ₑ` is for *equivariant*) :
* `X →ₑ[φ] Y` is `MulActionHom φ X Y`.
* `A →ₑ+[φ] B` is `DistribMulActionHom φ A B`.
* `R →ₑ+*[φ] S` is `MulSemiringActionHom φ R S`.

When `M = N` and `φ = MonoidHom.id M`, we provide the backward compatible notation :
* `X →[M] Y` is `MulActionHom (@id M) X Y`
* `A →+[M] B` is `DistribMulActionHom (MonoidHom.id M) A B`
* `R →+*[M] S` is `MulSemiringActionHom (MonoidHom.id M) R S`

This more general definition is propagated all over mathlib, in particular to `LinearMap`.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes `CompTriple` and `MonoidHom.CompTriple` of “composable triples`, and various instances for them.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
…ilinearMap (#10758)

This PR adds a coercion from any instance of `SemilinearMapClass` to `SemilinearMap`. This is the standard practice for other parts of the library, such as ring homs (see also the recent change #10368). I also expect this change will help with some rough edges in #6057. Previously, a coercion from `f : AlgHom` to `LinearMap` would look like `f.toNonUnitalAlgHom.toDistribMulActionHom.toLinearMap`, now it should look like `SemilinearMapClass.semilinearMap f`.

The new coercion instances are `CoeHead` since the left hand side is a free variable `F`. I redefined the existing `DistribMulActionHom → LinearMap` coercion in terms of the `SemilinearMapClass` coercion to ensure we don't get any diamonds.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
Generalize `MulActionHom` so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let `M`, `N`, `X`, `Y` be types, with `SMul M X` and `SMul N Y`, and let `φ : M → N` be a map. 
* `MulActionHom φ X Y`, the type of equivariant functions from `X` to `Y`, consists of functions `f : X → Y` such that `f (m • x) = (φ m) • (f x)` for all `m : M` and `x : X`.

Assume that we have `Monoid M`, `Monoid N` and that `φ : M →* N`. For `A`, `B` by types with `AddMonoid A` and `AddMonoid B`, endowed with `DistribMulAction M A` and `DistribMulAction M B`:
* `DistribMulActionHom φ A B` is  the type of equivariant additive monoid homomorphisms from `A` to `B`.

Similarly, when `R` and `S` are types with `Semiring R`, `Semiring S`, `MulSemiringAction M R` and `MulSemiringAction N S` 
* `SMulSemiringHom φ R S` is the type of equivariant ring homomorphisms
  from `R` to `S`.

The above types have corresponding classes:
* `MulActionHomClass F φ X Y` states that `F` is a type of bundled `X → Y` homs  which are `φ`-equivariant
* `DistribMulActionHomClass F φ A B` states that `F` is a type of bundled `A → B` homs  preserving the additive monoid structure and `φ`-equivariant
* `SMulSemiringHomClass F φ R S` states that `F` is a type of bundled `R → S` homs  preserving the ring structure and `φ`-equivariant

## Notation

We introduce the following notation to code equivariant maps
(the subscript index `ₑ` is for *equivariant*) :
* `X →ₑ[φ] Y` is `MulActionHom φ X Y`.
* `A →ₑ+[φ] B` is `DistribMulActionHom φ A B`.
* `R →ₑ+*[φ] S` is `MulSemiringActionHom φ R S`.

When `M = N` and `φ = MonoidHom.id M`, we provide the backward compatible notation :
* `X →[M] Y` is `MulActionHom (@id M) X Y`
* `A →+[M] B` is `DistribMulActionHom (MonoidHom.id M) A B`
* `R →+*[M] S` is `MulSemiringActionHom (MonoidHom.id M) R S`

This more general definition is propagated all over mathlib, in particular to `LinearMap`.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes `CompTriple` and `MonoidHom.CompTriple` of “composable triples`, and various instances for them.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
…ilinearMap (#10758)

This PR adds a coercion from any instance of `SemilinearMapClass` to `SemilinearMap`. This is the standard practice for other parts of the library, such as ring homs (see also the recent change #10368). I also expect this change will help with some rough edges in #6057. Previously, a coercion from `f : AlgHom` to `LinearMap` would look like `f.toNonUnitalAlgHom.toDistribMulActionHom.toLinearMap`, now it should look like `SemilinearMapClass.semilinearMap f`.

The new coercion instances are `CoeHead` since the left hand side is a free variable `F`. I redefined the existing `DistribMulActionHom → LinearMap` coercion in terms of the `SemilinearMapClass` coercion to ensure we don't get any diamonds.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
Generalize `MulActionHom` so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let `M`, `N`, `X`, `Y` be types, with `SMul M X` and `SMul N Y`, and let `φ : M → N` be a map. 
* `MulActionHom φ X Y`, the type of equivariant functions from `X` to `Y`, consists of functions `f : X → Y` such that `f (m • x) = (φ m) • (f x)` for all `m : M` and `x : X`.

Assume that we have `Monoid M`, `Monoid N` and that `φ : M →* N`. For `A`, `B` by types with `AddMonoid A` and `AddMonoid B`, endowed with `DistribMulAction M A` and `DistribMulAction M B`:
* `DistribMulActionHom φ A B` is  the type of equivariant additive monoid homomorphisms from `A` to `B`.

Similarly, when `R` and `S` are types with `Semiring R`, `Semiring S`, `MulSemiringAction M R` and `MulSemiringAction N S` 
* `SMulSemiringHom φ R S` is the type of equivariant ring homomorphisms
  from `R` to `S`.

The above types have corresponding classes:
* `MulActionHomClass F φ X Y` states that `F` is a type of bundled `X → Y` homs  which are `φ`-equivariant
* `DistribMulActionHomClass F φ A B` states that `F` is a type of bundled `A → B` homs  preserving the additive monoid structure and `φ`-equivariant
* `SMulSemiringHomClass F φ R S` states that `F` is a type of bundled `R → S` homs  preserving the ring structure and `φ`-equivariant

## Notation

We introduce the following notation to code equivariant maps
(the subscript index `ₑ` is for *equivariant*) :
* `X →ₑ[φ] Y` is `MulActionHom φ X Y`.
* `A →ₑ+[φ] B` is `DistribMulActionHom φ A B`.
* `R →ₑ+*[φ] S` is `MulSemiringActionHom φ R S`.

When `M = N` and `φ = MonoidHom.id M`, we provide the backward compatible notation :
* `X →[M] Y` is `MulActionHom (@id M) X Y`
* `A →+[M] B` is `DistribMulActionHom (MonoidHom.id M) A B`
* `R →+*[M] S` is `MulSemiringActionHom (MonoidHom.id M) R S`

This more general definition is propagated all over mathlib, in particular to `LinearMap`.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes `CompTriple` and `MonoidHom.CompTriple` of “composable triples`, and various instances for them.
callesonne pushed a commit that referenced this pull request Apr 22, 2024
…ilinearMap (#10758)

This PR adds a coercion from any instance of `SemilinearMapClass` to `SemilinearMap`. This is the standard practice for other parts of the library, such as ring homs (see also the recent change #10368). I also expect this change will help with some rough edges in #6057. Previously, a coercion from `f : AlgHom` to `LinearMap` would look like `f.toNonUnitalAlgHom.toDistribMulActionHom.toLinearMap`, now it should look like `SemilinearMapClass.semilinearMap f`.

The new coercion instances are `CoeHead` since the left hand side is a free variable `F`. I redefined the existing `DistribMulActionHom → LinearMap` coercion in terms of the `SemilinearMapClass` coercion to ensure we don't get any diamonds.
callesonne pushed a commit that referenced this pull request Apr 22, 2024
Generalize `MulActionHom` so that it allows two different monoids acting, related by a morphism. This is inspired by the treatment of (semi)linear maps in mathlib, and allows to refactor them.

Let `M`, `N`, `X`, `Y` be types, with `SMul M X` and `SMul N Y`, and let `φ : M → N` be a map. 
* `MulActionHom φ X Y`, the type of equivariant functions from `X` to `Y`, consists of functions `f : X → Y` such that `f (m • x) = (φ m) • (f x)` for all `m : M` and `x : X`.

Assume that we have `Monoid M`, `Monoid N` and that `φ : M →* N`. For `A`, `B` by types with `AddMonoid A` and `AddMonoid B`, endowed with `DistribMulAction M A` and `DistribMulAction M B`:
* `DistribMulActionHom φ A B` is  the type of equivariant additive monoid homomorphisms from `A` to `B`.

Similarly, when `R` and `S` are types with `Semiring R`, `Semiring S`, `MulSemiringAction M R` and `MulSemiringAction N S` 
* `SMulSemiringHom φ R S` is the type of equivariant ring homomorphisms
  from `R` to `S`.

The above types have corresponding classes:
* `MulActionHomClass F φ X Y` states that `F` is a type of bundled `X → Y` homs  which are `φ`-equivariant
* `DistribMulActionHomClass F φ A B` states that `F` is a type of bundled `A → B` homs  preserving the additive monoid structure and `φ`-equivariant
* `SMulSemiringHomClass F φ R S` states that `F` is a type of bundled `R → S` homs  preserving the ring structure and `φ`-equivariant

## Notation

We introduce the following notation to code equivariant maps
(the subscript index `ₑ` is for *equivariant*) :
* `X →ₑ[φ] Y` is `MulActionHom φ X Y`.
* `A →ₑ+[φ] B` is `DistribMulActionHom φ A B`.
* `R →ₑ+*[φ] S` is `MulSemiringActionHom φ R S`.

When `M = N` and `φ = MonoidHom.id M`, we provide the backward compatible notation :
* `X →[M] Y` is `MulActionHom (@id M) X Y`
* `A →+[M] B` is `DistribMulActionHom (MonoidHom.id M) A B`
* `R →+*[M] S` is `MulSemiringActionHom (MonoidHom.id M) R S`

This more general definition is propagated all over mathlib, in particular to `LinearMap`.

The treatment of composition of equivariant maps is inspired by that of semilinear maps. We provide classes `CompTriple` and `MonoidHom.CompTriple` of “composable triples`, and various instances for them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

9 participants