Skip to content

Commit 32df576

Browse files
committed
chore(RingTheory): Module.Flat is invariant under ULift (#37998)
From Proetale.
1 parent a3fde50 commit 32df576

4 files changed

Lines changed: 127 additions & 2 deletions

File tree

Mathlib/LinearAlgebra/TensorProduct/Tower.lean

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,30 @@ theorem tensorTensorTensorComm_eq :
589589

590590
end tensorTensorTensorComm
591591

592+
section
593+
594+
universe u₁ u₂ u₃ u₄
595+
596+
attribute [local instance] ULift.algebra' in
597+
/-- `ULift` commutes with tensor products. -/
598+
def uliftEquiv : ULift.{u₁} (M ⊗[R] N) ≃ₗ[A] ULift.{u₂} M ⊗[ULift.{u₃} R] ULift.{u₄} N :=
599+
ULift.moduleEquiv ≪≫ₗ
600+
AlgebraTensorModule.congr ULift.moduleEquiv.symm ULift.moduleEquiv.symm ≪≫ₗ
601+
(equivOfCompatibleSMul _ _ _ _ _)
602+
603+
variable {M N}
604+
605+
@[simp]
606+
lemma down_uliftEquiv_symm_tmul (m : ULift M) (n : ULift N) :
607+
((uliftEquiv R A M N).symm (m ⊗ₜ n)).down = m.down ⊗ₜ n.down :=
608+
rfl
609+
610+
@[simp]
611+
lemma uliftEquiv_tmul (m : M) (n : N) : uliftEquiv R A M N ⟨m ⊗ₜ n⟩ = ⟨m⟩ ⊗ₜ ⟨n⟩ :=
612+
rfl
613+
614+
end
615+
592616
end CommSemiring
593617

594618
end AlgebraTensorModule

Mathlib/RingTheory/Flat/Stability.lean

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ We show that flatness is stable under composition and base change.
2929

3030
public section
3131

32-
universe u v w t
32+
universe u v w t t'
3333

3434
open Function (Injective Surjective)
3535

@@ -68,6 +68,19 @@ theorem trans [Flat R S] [Flat S M] : Flat R M := by
6868
iterate 2 apply Flat.lTensor_preserves_injective_linearMap
6969
exact Subtype.val_injective
7070

71+
variable {R M} in
72+
@[simp]
73+
lemma ulift_left_iff : Flat (ULift.{t} R) M ↔ Flat R M := by
74+
refine ⟨fun h ↦ .trans _ (ULift R) _, fun h ↦ ?_⟩
75+
have : Module.Flat (ULift.{t} R) R := .of_ulift
76+
let _ := ULift.algebra'
77+
exact .trans _ R _
78+
79+
variable {R M} in
80+
@[simp]
81+
lemma ulift_right_iff : Flat R (ULift.{t} M) ↔ Flat R M :=
82+
Flat.equiv_iff ULift.moduleEquiv
83+
7184
end Composition
7285

7386
section BaseChange

Mathlib/RingTheory/RingHom/Flat.lean

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In this file we define flat ring homomorphisms and show their meta properties.
1818

1919
@[expose] public section
2020

21-
universe u v
21+
universe u₁ u₂ u v
2222

2323
open TensorProduct
2424

@@ -170,6 +170,30 @@ lemma tensorProductMap {f : A →ₐ[S] C} {g : B →ₐ[R] D} (hf : f.Flat) (hg
170170

171171
end
172172

173+
lemma comp_iff_of_bijective_left {f : R →+* S} {g : S →+* T} (hg : Function.Bijective g) :
174+
(g.comp f).Flat ↔ f.Flat := by
175+
refine ⟨fun hf ↦ ?_, fun hf ↦ .comp hf (.of_bijective hg)⟩
176+
let e := RingEquiv.ofBijective g hg
177+
have : f = e.symm.toRingHom.comp (e.toRingHom.comp f) := by ext; simp
178+
rw [this]
179+
exact .comp hf (.of_bijective e.symm.bijective)
180+
181+
lemma comp_iff_of_bijective_right {f : R →+* S} {g : T →+* R} (hg : Function.Bijective g) :
182+
(f.comp g).Flat ↔ f.Flat := by
183+
refine ⟨fun hf ↦ ?_, fun hf ↦ .comp (.of_bijective hg) hf⟩
184+
let e := RingEquiv.ofBijective g hg
185+
have : f = (f.comp e.toRingHom).comp e.symm.toRingHom := by ext; simp
186+
rw [this]
187+
exact .comp (.of_bijective e.symm.bijective) hf
188+
189+
@[simp]
190+
lemma ulift_iff {f : R →+* S} : (ulift.{u₁, u₂} f).Flat ↔ f.Flat := by
191+
refine ⟨fun hf ↦ ?_, fun hf ↦ ?_⟩
192+
· rwa [← comp_ulift_eq.{u₁, u₂} f, comp_iff_of_bijective_left (Equiv.bijective _),
193+
comp_iff_of_bijective_right (Equiv.bijective _)]
194+
· exact .comp (.comp (.of_bijective <| Equiv.bijective _) hf)
195+
(.of_bijective <| Equiv.bijective _)
196+
173197
end RingHom.Flat
174198

175199
section
@@ -195,3 +219,24 @@ lemma CommRingCat.inl_injective_of_flat
195219
|>.injective.comp (Algebra.TensorProduct.includeLeft_injective (S := R) (A := S) hg)
196220

197221
end
222+
223+
open CategoryTheory
224+
225+
namespace CommRingCat
226+
227+
/-- The morphism property of flat ring maps. -/
228+
def flat : MorphismProperty CommRingCat.{u} :=
229+
RingHom.toMorphismProperty fun f ↦ f.Flat
230+
231+
@[simp]
232+
lemma flat_iff {R S : CommRingCat.{u}} (f : R ⟶ S) :
233+
flat f ↔ f.hom.Flat := .rfl
234+
235+
lemma flat_ofHom_iff {R S : Type u} [CommRing R] [CommRing S] (f : R →+* S) :
236+
flat (ofHom f) ↔ f.Flat := .rfl
237+
238+
instance : flat.IsStableUnderCobaseChange := by
239+
rw [flat, RingHom.isStableUnderCobaseChange_toMorphismProperty_iff]
240+
exact RingHom.Flat.isStableUnderBaseChange
241+
242+
end CommRingCat

Mathlib/RingTheory/TensorProduct/Maps.lean

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,3 +851,46 @@ variable {C : Subalgebra R A}
851851

852852
lemma Subalgebra.tmul_mem_baseChange {x : A} (hx : x ∈ C) (b : B) : b ⊗ₜ[R] x ∈ C.baseChange B :=
853853
⟨(b ⊗ₜ[R] ⟨x, hx⟩), rfl⟩
854+
855+
section
856+
857+
universe u₁ u₂ u₃ u₄ u₅
858+
859+
variable (R S A B : Type*) [CommSemiring R] [CommSemiring S] [Algebra R S]
860+
[Semiring A] [Algebra R A] [Algebra S A] [IsScalarTower R S A] [Semiring B] [Algebra R B]
861+
862+
attribute [local instance] ULift.algebra' in
863+
/-- `ULift` commutes with tensor products of algebras. -/
864+
def Algebra.TensorProduct.uliftEquiv :
865+
ULift.{u₁} (A ⊗[R] B) ≃ₐ[S] ULift.{u₂} A ⊗[ULift.{u₃} R] ULift.{u₄} B :=
866+
AlgEquiv.trans ULift.algEquiv
867+
(.trans (congr ULift.algEquiv.symm ULift.algEquiv.symm) <|
868+
Algebra.TensorProduct.equivOfCompatibleSMul _ _ _ _ _)
869+
870+
variable {A B}
871+
872+
@[simp]
873+
lemma Algebra.TensorProduct.uliftEquiv_tmul (a : A) (b : B) :
874+
uliftEquiv R S A B ⟨a ⊗ₜ b⟩ = ⟨a⟩ ⊗ₜ ⟨b⟩ :=
875+
rfl
876+
877+
attribute [local instance] ULift.algebra' in
878+
@[simp]
879+
lemma Algebra.TensorProduct.down_uliftEquiv_symm_tmul (a : ULift A) (b : ULift B) :
880+
((uliftEquiv R S A B).symm (a ⊗ₜ b)).down = a.down ⊗ₜ b.down :=
881+
rfl
882+
883+
attribute [local instance] ULift.algebra' in
884+
lemma Algebra.TensorProduct.uliftEquiv_symm_tmul (a : ULift A) (b : ULift B) :
885+
(uliftEquiv R S A B).symm (a ⊗ₜ b) = ⟨a.down ⊗ₜ b.down⟩ :=
886+
rfl
887+
888+
set_option backward.isDefEq.respectTransparency false in
889+
attribute [local instance] ULift.algebra' in
890+
lemma Algebra.TensorProduct.lmul'_ulift :
891+
TensorProduct.lmul' (S := ULift.{u₂} S) (ULift.{u₁} R) =
892+
(TensorProduct.lmul' (S := S) R).ulift.comp
893+
(uliftEquiv _ _ _ _).symm.toAlgHom := by
894+
ext <;> simp
895+
896+
end

0 commit comments

Comments
 (0)