Skip to content
Open
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
47b8ec5
Update Basic.lean
BryceT233 Apr 9, 2026
c642855
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 9, 2026
bb5e058
Create ULift.lean
BryceT233 Apr 9, 2026
61e6971
Update Mathlib.lean
BryceT233 Apr 9, 2026
adec84c
Create README.md
BryceT233 Apr 9, 2026
dfcfb78
Delete Mathlib/Algebra/Category/LocAlgCat/README.md
BryceT233 Apr 9, 2026
123df16
Create Defs.lean
BryceT233 Apr 9, 2026
2f7ff4e
Update Defs.lean
BryceT233 Apr 9, 2026
e9126ff
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 11, 2026
73ada75
Update Defs.lean
BryceT233 Apr 11, 2026
98f8a2d
Update Mathlib.lean
BryceT233 Apr 11, 2026
bae1d90
Update Defs.lean
BryceT233 Apr 11, 2026
4ae9f40
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 11, 2026
52d9e14
Add files via upload
BryceT233 Apr 11, 2026
feab79a
Add files via upload
BryceT233 Apr 11, 2026
6045824
Update Mathlib.lean
BryceT233 Apr 11, 2026
140d133
Update Basic.lean
BryceT233 Apr 11, 2026
ec34740
Update KrullDimension.lean
BryceT233 Apr 11, 2026
456db0b
Update Length.lean
BryceT233 Apr 11, 2026
0bb827a
Update BaseCat.lean
BryceT233 Apr 11, 2026
22f3a8b
Update Cotangent.lean
BryceT233 Apr 11, 2026
6f03216
Update Defs.lean
BryceT233 Apr 11, 2026
605501d
Update Basic.lean
BryceT233 Apr 11, 2026
95974fa
Update Basic.lean
BryceT233 Apr 11, 2026
477aff4
Update Basic.lean
BryceT233 Apr 12, 2026
a56d501
Update Cotangent.lean
BryceT233 Apr 12, 2026
4f399a4
Update BaseCat.lean
BryceT233 Apr 12, 2026
371f629
Update Maps.lean
BryceT233 Apr 12, 2026
28f335d
fix simp
BryceT233 Apr 12, 2026
326caad
refine docstrings
BryceT233 Apr 12, 2026
c7602e5
refine docstrings
BryceT233 Apr 12, 2026
6abcee0
refine docstrings
BryceT233 Apr 12, 2026
cf46f38
Update Basic.lean
BryceT233 Apr 12, 2026
e85bdbd
refine docstrings
BryceT233 Apr 12, 2026
c53938e
Update Defs.lean
BryceT233 Apr 12, 2026
86905ec
refine a proof
BryceT233 Apr 12, 2026
5dbd77e
Update Defs.lean
BryceT233 Apr 13, 2026
c1e83bf
improve doc
BryceT233 Apr 14, 2026
41a86fc
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 14, 2026
3201937
fix
BryceT233 Apr 14, 2026
e988c63
add a `simp` lemma for `baseCotangentMap`
BryceT233 Apr 14, 2026
697c6b7
Merge branch 'master' into LocAlgCat
BryceT233 Apr 15, 2026
733747e
fix
BryceT233 Apr 15, 2026
5419818
use `NeZero` instance for `infinitesimalNeighbothood`
BryceT233 Apr 15, 2026
998398f
cleanup
BryceT233 Apr 15, 2026
a3b6a77
cleanup
BryceT233 Apr 15, 2026
afd2c80
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 16, 2026
7a57baa
add `ofQuotKerIsoOfSurjective` and make `Cotangent` more functorial
BryceT233 Apr 16, 2026
b9f3c3c
add more results
BryceT233 Apr 16, 2026
af4ce68
add a `nontrivial` instance
BryceT233 Apr 17, 2026
849ae98
add `ofPullback` in `Basic.lean` and add bijective results in `Cotang…
BryceT233 Apr 17, 2026
79b36d7
fix
BryceT233 Apr 17, 2026
59046d2
add more on `ofPullback`
BryceT233 Apr 18, 2026
e6ce6bf
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 18, 2026
59b0ffb
cleanup
BryceT233 Apr 18, 2026
5060721
Merge branch 'LocAlgCat' of https://github.com/BryceT233/mathlib4 int…
BryceT233 Apr 18, 2026
45b1c9e
add results about `ofPullback` in artinian ring case
BryceT233 Apr 19, 2026
f9f9da1
add `ofPullback` in `BaseCat`
BryceT233 Apr 19, 2026
7baea03
replace `IsLocalHom` instances by `Algebra.IsIntegral`
BryceT233 Apr 19, 2026
d72ff8f
Merge branch 'leanprover-community:master' into LocAlgCat
BryceT233 Apr 19, 2026
7fc3a68
add `IsEssSurj` to `BaseCat.lean`
BryceT233 Apr 20, 2026
9418034
Update Cotangent.lean
BryceT233 Apr 21, 2026
4049a2f
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Apr 21, 2026
bc0193b
fix
BryceT233 Apr 21, 2026
fde30a4
Merge branch 'master' into LocAlgCat
kbuzzard Apr 21, 2026
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
5 changes: 5 additions & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public import Mathlib.Algebra.Category.Grp.Zero
public import Mathlib.Algebra.Category.GrpWithZero
public import Mathlib.Algebra.Category.HopfAlgCat.Basic
public import Mathlib.Algebra.Category.HopfAlgCat.Monoidal
public import Mathlib.Algebra.Category.LocAlgCat.BaseCat
public import Mathlib.Algebra.Category.LocAlgCat.Basic
public import Mathlib.Algebra.Category.LocAlgCat.Cotangent
public import Mathlib.Algebra.Category.LocAlgCat.Defs
public import Mathlib.Algebra.Category.ModuleCat.AB
public import Mathlib.Algebra.Category.ModuleCat.Abelian
public import Mathlib.Algebra.Category.ModuleCat.Adjunctions
Expand Down Expand Up @@ -489,6 +493,7 @@ public import Mathlib.Algebra.Group.Units.Defs
public import Mathlib.Algebra.Group.Units.Equiv
public import Mathlib.Algebra.Group.Units.Hom
public import Mathlib.Algebra.Group.Units.Opposite
public import Mathlib.Algebra.Group.Units.ULift
public import Mathlib.Algebra.Group.WithOne.Basic
public import Mathlib.Algebra.Group.WithOne.Defs
public import Mathlib.Algebra.Group.WithOne.Map
Expand Down
48 changes: 48 additions & 0 deletions Mathlib/Algebra/Algebra/Subalgebra/Prod.lean
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,51 @@ theorem prod_inf_prod {S T : Subalgebra R A} {S₁ T₁ : Subalgebra R B} :
SetLike.coe_injective Set.prod_inter_prod

end Subalgebra

namespace AlgHom

variable {R A B C : Type*} [CommSemiring R]

section Semiring

variable [Semiring A] [Algebra R A] [Semiring B] [Algebra R B] [Semiring C] [Algebra R C]

/-- The subalgebra of pairs `(a, b) : A × B` such that `f a = g b`, i.e.,
the pullback of f and g as a subalgebra of A × B. -/
abbrev pullback (f : A →ₐ[R] C) (g : B →ₐ[R] C) : Subalgebra R (A × B) := equalizer
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These do not belong in this file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate of AlgHom.equalizer

(f.comp (fst R A B)) (g.comp (snd R A B))

/-- The first projection from the pullback of `f` and `g` to `A`. -/
abbrev pullbackFst (f : A →ₐ[R] C) (g : B →ₐ[R] C) : pullback f g →ₐ[R] A :=
(fst R A B).comp (pullback f g).val

/-- The second projection from the pullback of `f` and `g` to `B`. -/
abbrev pullbackSnd (f : A →ₐ[R] C) (g : B →ₐ[R] C) : pullback f g →ₐ[R] B :=
(snd R A B).comp (pullback f g).val

theorem pullback_comm_sq (f : A →ₐ[R] C) (g : B →ₐ[R] C) :
f.comp (pullbackFst f g) = g.comp (pullbackSnd f g) :=
AlgHom.ext fun x ↦ x.prop

end Semiring

section Ring

variable [Ring A] [Algebra R A] [Ring B] [Algebra R B] [Semiring C] [Algebra R C]

theorem isUnit_pullback_mk_iff (f : A →ₐ[R] C) (g : B →ₐ[R] C) {a : A × B}
(a_in : a ∈ f.pullback g) : IsUnit (⟨a, a_in⟩ : f.pullback g) ↔
IsUnit a.1 ∧ IsUnit a.2 :=
RingHom.isUnit_pullback_mk_iff (f : A →+* C) (g : B →+* C) a_in

theorem surjective_pullbackFst_of_surjective (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(h : Function.Surjective g) : Function.Surjective (pullbackFst f g) :=
RingHom.surjective_pullbackFst_of_surjective (f : A →+* C) (g : B →+* C) h

theorem surjective_pullbackSnd_of_surjective (f : A →ₐ[R] C) (g : B →ₐ[R] C)
(h : Function.Surjective f) : Function.Surjective (pullbackSnd f g) :=
RingHom.surjective_pullbackSnd_of_surjective (f : A →+* C) (g : B →+* C) h

end Ring

end AlgHom
373 changes: 373 additions & 0 deletions Mathlib/Algebra/Category/LocAlgCat/BaseCat.lean

Large diffs are not rendered by default.

426 changes: 426 additions & 0 deletions Mathlib/Algebra/Category/LocAlgCat/Basic.lean

Large diffs are not rendered by default.

324 changes: 324 additions & 0 deletions Mathlib/Algebra/Category/LocAlgCat/Cotangent.lean

Large diffs are not rendered by default.

257 changes: 257 additions & 0 deletions Mathlib/Algebra/Category/LocAlgCat/Defs.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
/-
Copyright (c) 2026 Bingyu Xia. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Bingyu Xia
-/

module

public import Mathlib.Algebra.EuclideanDomain.Field
public import Mathlib.Algebra.Group.Units.ULift
public import Mathlib.Combinatorics.Quiver.ReflQuiver
public import Mathlib.RingTheory.LocalRing.ResidueField.Basic

/-!
# The Category of Local Algebras with a Fixed Residue Field

This file defines the category of local algebras over a base commutative ring `Λ`
with a fixed residue field `k`. This category serves as the ambient environment
for formal deformation theory.

## Main Definitions

* `LocAlgCat Λ k` : The type of objects in the category of local `Λ`-algebras with
residue field `k`. An object consists of a local `Λ`-algebra `A` equipped with
a surjective residue map to `k`.

* `LocAlgCat.Hom` : The type of morphisms between objects in `LocAlgCat Λ k`.
A morphism `f : A ⟶ B` is a local `Λ`-algebra homomorphism compatible with the
residue maps.

* `LocAlgCat.isoMk`, `LocAlgCat.ofIso` : Canonical translations between algebra
equivalences and categorical isomorphisms.

* `LocAlgCat.uliftFunctor` : The universe lift functor for `LocAlgCat`.

-/

universe w w' v u

@[expose] public section

open IsLocalRing CategoryTheory Function

variable {Λ : Type u} [CommRing Λ]
variable {k : Type v} [Field k] [Algebra Λ k]

/-- The category of local `Λ`-algebras with residue field `k` and their morphisms. An object of
`LocAlgCat` consists of a local `Λ`-algebra `A` equipped with a surjective map to `k`. -/
structure LocAlgCat (Λ : Type u) (k : Type v) [CommRing Λ] [Field k] [Algebra Λ k] : Type _ where
private mk ::
/-- The underlying type of the local `Λ`-algebras. -/
carrier : Type w
[commRing : CommRing carrier]
[localRing : IsLocalRing carrier]
[baseAlgebra : Algebra Λ carrier]
[residueAlgebra : Algebra carrier k]
[scalarTower : IsScalarTower Λ carrier k]
surj : Surjective (algebraMap carrier k)

namespace LocAlgCat

variable {A B C : LocAlgCat.{w} Λ k} {X Y Z : Type w}
variable [CommRing X] [IsLocalRing X] [Algebra Λ X] [Algebra X k] [IsScalarTower Λ X k]
variable [CommRing Y] [IsLocalRing Y] [Algebra Λ Y] [Algebra Y k] [IsScalarTower Λ Y k]
variable [CommRing Z] [IsLocalRing Z] [Algebra Λ Z] [Algebra Z k] [IsScalarTower Λ Z k]
variable {hX : Surjective (algebraMap X k)} {hY : Surjective (algebraMap Y k)}
{hZ : Surjective (algebraMap Z k)}

attribute [instance] localRing commRing baseAlgebra scalarTower residueAlgebra

initialize_simps_projections LocAlgCat (-localRing, -commRing, -baseAlgebra, -residueAlgebra,
-scalarTower)

instance : CoeSort (LocAlgCat Λ k) (Type w) := ⟨carrier⟩

attribute [coe] carrier

/-- The canonical residue map from an object `A` to `k`.
This is a prefered way to apply residue maps in `LocAlgCat`. -/
def residue (A : LocAlgCat Λ k) : A →ₐ[Λ] k :=
IsScalarTower.toAlgHom Λ A k

lemma residue_toRingHom : A.residue = algebraMap A k := rfl

lemma residue_apply {a : A} : A.residue a = algebraMap A k a := rfl

lemma ker_residue : RingHom.ker (residue A) = maximalIdeal A :=
eq_maximalIdeal (RingHom.ker_isMaximal_of_surjective _ A.surj)

lemma residue_surjective : Surjective (residue A) := A.surj

lemma residue_eq_zero_iff {x : A} : residue A x = 0 ↔ x ∈ maximalIdeal A := by
rw [← RingHom.mem_ker, ker_residue]

variable (Λ k) in
set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
Comment on lines +96 to +97
Copy link
Copy Markdown
Contributor

@Deicyde Deicyde Apr 21, 2026

Choose a reason for hiding this comment

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

Can you explain why these are here?

If you read the documentation of this command, you will see that it explains "This is a backwards compatibility option, intended to help migrating to new Lean releases... Please report an issue if you rely on this option."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review and comments, I will look into them in detail! For the set_option here, I thought this was because mk is made private in the definition of LocAlgCat, I found this pattern in files under the same Category folder like CommAlgCat.lean. I am not sure why mk is made private though.

Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies Apr 21, 2026

Choose a reason for hiding this comment

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

The reason is to reimplement the constructor with the correct binder types, but this can be done with the new field (binder1) [binder2] : ReturnType syntax instead

Copy link
Copy Markdown
Contributor Author

@BryceT233 BryceT233 Apr 21, 2026

Choose a reason for hiding this comment

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

Thanks, I will try this and hopefully remove the set_option here

/-- The object in the category of local `Λ`-algebras associated to a type equipped with
the appropriate typeclasses. This is a preferred way to construct a term of `LocAlgCat`. -/
abbrev of (X : Type w) [CommRing X] [IsLocalRing X] [Algebra Λ X] [Algebra X k]
[IsScalarTower Λ X k] (h : Surjective (algebraMap X k)) : LocAlgCat Λ k :=
⟨X, h⟩

variable (X) in
lemma coe_of : (of Λ k X hX : Type w) = X := rfl

@[simp]
lemma residue_of_apply {x : (of Λ k X hX)} : (of Λ k X hX).residue x = algebraMap X k x := rfl

/-- The canonical equivalence between the residue field of an object and `k`. -/
noncomputable def residueEquiv (A : LocAlgCat Λ k) : ResidueField A ≃ₐ[Λ] k where
__ := (Ideal.quotEquivOfEq (ker_residue (A := A)).symm).trans
(RingHom.quotientKerEquivOfSurjective A.residue_surjective)
commutes' r := (IsScalarTower.algebraMap_apply Λ A k r).symm

@[simp]
lemma residueEquiv_residue_apply {x : A} :
A.residueEquiv (IsLocalRing.residue A x) = A.residue x := rfl

/-- The type of morphisms in `LocAlgCat`. A morphism consists of a local algebra map
compatible with the residue maps. -/
@[ext]
structure Hom (A B : LocAlgCat.{w} Λ k) : Type w where
/-- The underlying algebra map. -/
toAlgHom : A →ₐ[Λ] B
-- We do not use `IsLocalHom` in order to avoid introducing `IsLocalHom` instances for `AlgHom`.
comap_maximalIdeal_eq : (maximalIdeal B).comap toAlgHom = maximalIdeal A
residue_comp : B.residue.comp toAlgHom = A.residue

instance : Category (LocAlgCat.{w} Λ k) where
Hom A B := Hom A B
id A := ⟨AlgHom.id Λ A, by simp, by simp⟩
comp {A B C} f g := ⟨g.toAlgHom.comp f.toAlgHom, by
rw [← Ideal.comap_comapₐ, g.comap_maximalIdeal_eq, f.comap_maximalIdeal_eq], by
rw [← AlgHom.comp_assoc, g.residue_comp, f.residue_comp]⟩

lemma Hom.isLocalHom_toAlgHom (f : A ⟶ B) : IsLocalHom f.toAlgHom := by
have := (((local_hom_TFAE (f.toAlgHom : A →+* B)).out 0 4).mpr (by
rw [Ideal.comap_coe, f.comap_maximalIdeal_eq]))
exact ⟨this.map_nonunit⟩

lemma Hom.map_maximalIdeal_le (f : A ⟶ B) :
(maximalIdeal A).map f.toAlgHom ≤ maximalIdeal B := by
have := (local_hom_TFAE f.toAlgHom.toRingHom).out 4 2
rw [AlgHom.toRingHom_eq_coe, Ideal.comap_coe, Ideal.map_coe] at this
rw [← this]; exact f.comap_maximalIdeal_eq

/-- Typecheck an `AlgHom` compatible with residue maps as a morphism in `LocAlgCat`. -/
abbrev ofHom (f : X →ₐ[Λ] Y) (h : (maximalIdeal Y).comap f = maximalIdeal X)
(h' : (of Λ k Y hY).residue.comp f = (of Λ k X hX).residue) : of Λ k X hX ⟶ of Λ k Y hY :=
⟨f, h, h'⟩

@[simp]
lemma ofhom_toAlgHom (f : A ⟶ B) : ofHom f.toAlgHom f.comap_maximalIdeal_eq f.residue_comp = f :=
rfl

@[simp]
lemma toAlgHom_id : (𝟙 A : A ⟶ A).toAlgHom = AlgHom.id Λ A := rfl

@[simp]
lemma toAlgHom_comp (f : A ⟶ B) (g : B ⟶ C) : (f ≫ g).toAlgHom = g.toAlgHom.comp f.toAlgHom :=
rfl

@[simp]
lemma ofHom_id : ofHom (.id Λ X) (by simp) (by simp) = 𝟙 (of Λ k X hX) := rfl

@[simp]
lemma ofHom_comp (f : X →ₐ[Λ] Y) (hf : (maximalIdeal Y).comap f = maximalIdeal X)
(hf' : (of Λ k Y hY).residue.comp f = (of Λ k X hX).residue) (g : Y →ₐ[Λ] Z)
(hg : (maximalIdeal Z).comap g = maximalIdeal Y)
(hg' : (of Λ k Z hZ).residue.comp g = (of Λ k Y hY).residue) : ofHom (g.comp f)
(by rw [← Ideal.comap_comapₐ, hg, hf] ) (by rw [← AlgHom.comp_assoc, hg', hf']) =
ofHom f hf hf' ≫ ofHom g hg hg' := rfl

lemma ofHom_toAlgHom_apply (f : X →ₐ[Λ] Y) (h : (maximalIdeal Y).comap f = maximalIdeal X)
(h' : (of Λ k Y hY).residue.comp f = (of Λ k X hX).residue) (x : X) :
(ofHom f h h').toAlgHom x = f x := rfl

@[simp]
lemma inv_hom_apply (e : A ≅ B) (x : A) : e.inv.toAlgHom (e.hom.toAlgHom x) = x := by
simp [← AlgHom.comp_apply, ← toAlgHom_comp]

@[simp]
lemma hom_inv_apply (e : A ≅ B) (x : B) : e.hom.toAlgHom (e.inv.toAlgHom x) = x := by
simp [← AlgHom.comp_apply, ← toAlgHom_comp]

/-- Build an isomorphism in the category `LocAlgCat` from an `AlgEquiv` between `Λ`-algebras. -/
@[simps]
def isoMk {X Y : Type w} {_ : CommRing X} {_ : IsLocalRing X} {_ : Algebra Λ X} {_ : CommRing Y}
{_ : IsLocalRing Y} {_ : Algebra Λ Y} {_ : Algebra X k} {_ : Algebra Y k}
{_ : IsScalarTower Λ X k} {_ : IsScalarTower Λ Y k} {hX : Surjective (algebraMap X k)}
{hY : Surjective (algebraMap Y k)} (e : X ≃ₐ[Λ] Y) (he : (of Λ k Y hY).residue.comp e =
(of Λ k X hX).residue) : of Λ k X hX ≅ of Λ k Y hY where
hom := ofHom (e : X →ₐ[Λ] Y) (by ext; simp) (by rw [← he])
inv := ofHom (e.symm : Y →ₐ[Λ] X) (by ext; simp) (by ext; simp [← he])
inv_hom_id := by simp [← ofHom_comp]
hom_inv_id := by simp [← ofHom_comp]

/-- Build an `AlgEquiv` from an isomorphism in the category `LocAlgCat Λ k`. -/
@[simps]
def ofIso (i : A ≅ B) : A ≃ₐ[Λ] B where
__ := i.hom.toAlgHom
toFun := i.hom.toAlgHom
invFun := i.inv.toAlgHom
left_inv x := by simp
right_inv x := by simp

@[simp]
lemma residue_comp_coe_ofIso (i : A ≅ B) : B.residue.comp (ofIso i) = A.residue := by
ext
simpa using DFunLike.congr_fun i.hom.residue_comp _

/-- Algebra equivalences compatible with residue maps are the same as
isomorphisms in `LocAlgCat`. -/
@[simps]
def isoEquivSubtypeAlgEquiv : (of Λ k X hX ≅ of Λ k Y hY) ≃
{ e : X ≃ₐ[Λ] Y // (of Λ k Y hY).residue.comp e = (of Λ k X hX).residue } where
toFun i := ⟨ofIso i, residue_comp_coe_ofIso i⟩
invFun f := isoMk f.val f.prop

variable (Λ k) in
/-- Universe lift functor for `LocAlgCat`. -/
def uliftFunctor : LocAlgCat.{w} Λ k ⥤ LocAlgCat.{max w w'} Λ k where
obj A :=
letI : Algebra (ULift.{w'} A) k := ULift.algebra' ..
haveI : IsScalarTower Λ (ULift.{w'} A) k := ULift.isScalarTower' ..
of Λ k (ULift.{w'} A) (fun r ↦ by simpa using A.surj r)
map {A B} f :=
letI : Algebra (ULift.{w'} A) k := ULift.algebra' ..
haveI : IsScalarTower Λ (ULift.{w'} A) k := ULift.isScalarTower' ..
letI : Algebra (ULift.{w'} B) k := ULift.algebra' ..
haveI : IsScalarTower Λ (ULift.{w'} B) k := ULift.isScalarTower' ..
ofHom (ULift.algEquiv.symm.toAlgHom.comp <| f.toAlgHom.comp ULift.algEquiv.toAlgHom) (by
have := f.isLocalHom_toAlgHom
ext; simp) (by ext x; simpa using DFunLike.congr_fun f.residue_comp x.down)

variable (Λ k) in
/-- The universe lift functor for `LocAlgCat` is fully faithful. -/
def fullyFaithfulUliftFunctor : (uliftFunctor Λ k).FullyFaithful where
preimage {A B} f :=
letI : Algebra (ULift.{w'} A) k := ULift.algebra' ..
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is usually a bad sign when you have to thread a bunch of letI, haveI throughout your file. Something is messing up your instance resolution.

haveI : IsScalarTower Λ (ULift.{w'} A) k := ULift.isScalarTower' ..
letI : Algebra (ULift.{w'} B) k := ULift.algebra' ..
haveI : IsScalarTower Λ (ULift.{w'} B) k := ULift.isScalarTower' ..
letI F : ULift A →ₐ[Λ] ULift B := f.toAlgHom
ofHom (ULift.algEquiv.toAlgHom.comp <| F.comp ULift.algEquiv.symm.toAlgHom) (by
have : IsLocalHom F := f.isLocalHom_toAlgHom
ext; simp) (AlgHom.ext fun x ↦ by
have := DFunLike.congr_fun f.residue_comp
simp only [uliftFunctor, AlgEquiv.toAlgHom_eq_coe, coe_of, ULift.forall] at this
exact this x)

instance : (uliftFunctor Λ k).Full := (fullyFaithfulUliftFunctor Λ k).full

instance : (uliftFunctor Λ k).Faithful := (fullyFaithfulUliftFunctor Λ k).faithful

end LocAlgCat
31 changes: 31 additions & 0 deletions Mathlib/Algebra/Group/Units/ULift.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/-
Copyright (c) 2026 Bingyu Xia. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Bingyu Xia
-/
module

public import Mathlib.Algebra.Group.ULift
public import Mathlib.Algebra.Group.Units.Hom

/-!
# Results about `Units` and `ULift`
-/

public section

universe u v

variable {M : Type u} [Monoid M]

namespace ULift

@[to_additive (attr := simp)]
theorem isUnit_up {a : M} : IsUnit (ULift.up.{v} a) ↔ IsUnit a :=
⟨IsUnit.map MulEquiv.ulift, IsUnit.map MulEquiv.ulift.symm⟩

@[to_additive (attr := simp)]
theorem isUnit_down {a : ULift.{v} M} : IsUnit a.down ↔ IsUnit a :=
ULift.isUnit_up.symm

end ULift
Loading
Loading