@@ -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
2323open TensorProduct
2424
@@ -170,6 +170,30 @@ lemma tensorProductMap {f : A →ₐ[S] C} {g : B →ₐ[R] D} (hf : f.Flat) (hg
170170
171171end
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+
173197end RingHom.Flat
174198
175199section
@@ -195,3 +219,24 @@ lemma CommRingCat.inl_injective_of_flat
195219 |>.injective.comp (Algebra.TensorProduct.includeLeft_injective (S := R) (A := S) hg)
196220
197221end
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
0 commit comments