Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Algebra/CategoryTheory): Add CommAlgebraCat #19299

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Mathlib/Algebra/Algebra/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class Algebra (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] extends SM
commutes' : ∀ r x, toRingHom r * x = x * toRingHom r
smul_def' : ∀ r x, r • x = toRingHom r * x

class CommAlgebra (R : Type u) (A : Type v) [CommSemiring R] [CommSemiring A] extends Algebra R A

end Prio

/-- Embedding `R →+* A` given by `Algebra` structure. -/
Expand Down
25 changes: 24 additions & 1 deletion Mathlib/Algebra/Category/AlgebraCat/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Since the universe the ring lives in can be inferred, we put that last. -/
abbrev AlgebraCatMax.{v₁, v₂, u₁} (R : Type u₁) [CommRing R] := AlgebraCat.{max v₁ v₂} R

attribute [instance] AlgebraCat.isRing AlgebraCat.isAlgebra

initialize_simps_projections AlgebraCat (-isRing, -isAlgebra)

namespace AlgebraCat
Expand Down Expand Up @@ -238,3 +237,27 @@ instance AlgebraCat.forget_reflects_isos : (forget (AlgebraCat.{u} R)).ReflectsI
{R} [CommRing R] {G : Type u} [Ring G] [Algebra R G] {H : AlgebraCat.{u} R} (f : G →ₐ[R] H) :
AlgHom.comp (𝟙 H) f = f :=
Category.comp_id (AlgebraCat.ofHom f)

def isComm {R : Type u} [CommRing R] (A : AlgebraCat R) : Prop := ∀ x y : A, x * y = y * x
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest you inline this


variable (R : Type u) [CommRing R]

def CommAlgebraCat := FullSubcategory (fun (A : AlgebraCat R) => isComm A)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def CommAlgebraCat := FullSubcategory (fun (A : AlgebraCat R) => isComm A)
def CommAlgebraCat := FullSubcategory fun A : AlgebraCat R ↦ ∀ a b : A, a * b = b * a


namespace CommAlgebraCat

instance : CoeSort (CommAlgebraCat R) (Type v) where coe A := A.obj.carrier

instance : Category (CommAlgebraCat R) := by unfold

/-- The object in the category of comm-R-algebras associated to a type equipped with the appropriate
typeclasses. -/
def of (X : Type u) [CommRing X] [CommAlgebra R X] : CommAlgebraCat R :=
⟨⟨X⟩, mul_comm⟩

@[simp]
theorem coe_of (X : Type u) [CommRing X] [CommAlgebra R X] : (of R X : Type u) = X :=
rfl


end CommAlgebraCat
Loading