leanprover-community / leanprover-community/mathlib4
Add `Trans` instances for morphisms
Open
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 4.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
As an example:
import Mathlib.Algebra.Module.Equiv
variables (R A B C D : Type _) [Semiring R] [AddCommMonoid A] [AddCommMonoid B] [AddCommMonoid C] [AddCommMonoid D]
[Module R A] [Module R B] [Module R C] [Module R D]
-- TODO: semilinearize
instance : Trans
-- all but the last two arguments of `LinearEquiv`
(@LinearEquiv R R _ _ (RingHom.id _) (RingHom.id _) _ _ A B _ _)
(@LinearEquiv R R _ _ (RingHom.id _) (RingHom.id _) _ _ B C _ _)
(@LinearEquiv R R _ _ (RingHom.id _) (RingHom.id _) _ _ A C _ _) where trans := LinearEquiv.trans
example (R A B C D : Type _) [Semiring R] [AddCommMonoid A] [AddCommMonoid B] [AddCommMonoid C] [AddCommMonoid D]
[Module R A] [Module R B] [Module R C] [Module R D] (f : A ≃ₗ[R] B) (g : B ≃ₗ[R] C) (h : C ≃ₗ[R] D) : A ≃ₗ[R] D := by
calc
A ≃ₗ[R] B := f
B ≃ₗ[R] C := g
C ≃ₗ[R] D := h
We already have this for Equiv
We should have it for at least:
-
(Add)MonoidHom -
RingHom -
LinearMap -
AlgHom -
AddEquiv/MulEquiv -
RingEquiv -
LinearEquiv -
AlgEquiv
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing Trans instance for Equiv and the example importing Mathlib.Algebra.Module.Equiv. Review the listed morphism types—(Add)MonoidHom, RingHom, LinearMap, AlgHom, AddEquiv, MulEquiv, RingEquiv, LinearEquiv, and AlgEquiv—and add the corresponding instances so the chained calc example works for each applicable type.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100