Skip to content

Commit

Permalink
chore: tidy various files (#6838)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben-VandeVelde committed Sep 1, 2023
1 parent b5fcdfd commit cda5caa
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 143 deletions.
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean
Expand Up @@ -451,7 +451,7 @@ theorem injective_codRestrict (f : F) (S : NonUnitalSubalgebra R B) (hf : ∀ x
Function.Injective (NonUnitalAlgHom.codRestrict f S hf) ↔ Function.Injective f :=
fun H _x _y hxy => H <| Subtype.eq hxy, fun H _x _y hxy => H (congr_arg Subtype.val hxy : _)⟩

/-- Restrict the codomain of an alg_hom `f` to `f.range`.
/-- Restrict the codomain of an `NonUnitalAlgHom` `f` to `f.range`.
This is the bundled version of `Set.rangeFactorization`. -/
@[reducible]
Expand Down
13 changes: 7 additions & 6 deletions Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean
Expand Up @@ -14,17 +14,18 @@ import Mathlib.RingTheory.TensorProduct
## Main definitions
* `CategoryTheory.ModuleCat.restrictScalars`: given rings `R, S` and a ring homomorphism `R ⟶ S`,
then `restrictScalars : Module S ⥤ Module R` is defined by `M ↦ M` where `M : S-module` is seen
as `R-module` by `r • m := f r • m` and `S`-linear map `l : M ⟶ M'` is `R`-linear as well.
then `restrictScalars : ModuleCat S ⥤ ModuleCat R` is defined by `M ↦ M` where an `S`-module `M`
is seen as an `R`-module by `r • m := f r • m` and `S`-linear map `l : M ⟶ M'` is `R`-linear as
well.
* `CategoryTheory.ModuleCat.extendScalars`: given **commutative** rings `R, S` and ring homomorphism
`f : R ⟶ S`, then `extendScalars : Module R ⥤ Module S` is defined by `M ↦ S ⨂ M` where the
`f : R ⟶ S`, then `extendScalars : ModuleCat R ⥤ ModuleCat S` is defined by `M ↦ S ⨂ M` where the
module structure is defined by `s • (s' ⊗ m) := (s * s') ⊗ m` and `R`-linear map `l : M ⟶ M'`
is sent to `S`-linear map `s ⊗ m ↦ s ⊗ l m : S ⨂ M ⟶ S ⨂ M'`.
* `CategoryTheory.ModuleCat.coextendScalars`: given rings `R, S` and a ring homomorphism `R ⟶ S`
then `coextendScalars : Module R ⥤ Module S` is defined by `M ↦ (S →ₗ[R] M)` where `S` is seen as
`R-module` by restriction of scalars and `l ↦ l ∘ _`.
then `coextendScalars : ModuleCat R ⥤ ModuleCat S` is defined by `M ↦ (S →ₗ[R] M)` where `S` is
seen as an `R`-module by restriction of scalars and `l ↦ l ∘ _`.
## Main results
Expand Down Expand Up @@ -530,7 +531,7 @@ def HomEquiv.evalAt {X : ModuleCat R} {Y : ModuleCat S} (s : S)
LinearMap.map_smul, smul_comm r s (g x : Y)] )

/--
Given `R`-module X and `S`-module Y and a map `X ⟶ (restrict_scalars f).obj Y`, i.e `R`-linear map
Given `R`-module X and `S`-module Y and a map `X ⟶ (restrictScalars f).obj Y`, i.e `R`-linear map
`X ⟶ Y`, there is a map `(extend_scalars f).obj X ⟶ Y`, i.e `S`-linear map `S ⨂ X → Y` by
`s ⊗ x ↦ s • g x`.
-/
Expand Down
12 changes: 5 additions & 7 deletions Mathlib/Algebra/RingQuot.lean
Expand Up @@ -276,13 +276,11 @@ theorem smul_quot [Algebra S R] {n : S} {a : R} :
rfl
#align ring_quot.smul_quot RingQuot.smul_quot

instance instIsScalarTowerRingQuot [CommSemiring T] [SMul S T] [Algebra S R] [Algebra T R]
[IsScalarTower S T R] :
IsScalarTower S T (RingQuot r) :=
instance instIsScalarTower [CommSemiring T] [SMul S T] [Algebra S R] [Algebra T R]
[IsScalarTower S T R] : IsScalarTower S T (RingQuot r) :=
fun s t ⟨a⟩ => Quot.inductionOn a <| fun a' => by simp only [RingQuot.smul_quot, smul_assoc]⟩

instance instSMulCommClassRingQuot [CommSemiring T] [Algebra S R] [Algebra T R]
[SMulCommClass S T R] :
instance instSMulCommClass [CommSemiring T] [Algebra S R] [Algebra T R] [SMulCommClass S T R] :
SMulCommClass S T (RingQuot r) :=
fun s t ⟨a⟩ => Quot.inductionOn a <| fun a' => by simp only [RingQuot.smul_quot, smul_comm]⟩

Expand Down Expand Up @@ -396,10 +394,10 @@ instance instCommSemiring {R : Type uR} [CommSemiring R] (r : R → R → Prop)
instance {R : Type uR} [CommRing R] (r : R → R → Prop) : CommRing (RingQuot r) :=
{ RingQuot.instCommSemiring r, RingQuot.instRing r with }

instance instInhabitedRingQuot (r : R → R → Prop) : Inhabited (RingQuot r) :=
instance instInhabited (r : R → R → Prop) : Inhabited (RingQuot r) :=
0

instance instAlgebraRingQuot [Algebra S R] (r : R → R → Prop) : Algebra S (RingQuot r) where
instance instAlgebra [Algebra S R] (r : R → R → Prop) : Algebra S (RingQuot r) where
smul := (· • ·)
toFun r := ⟨Quot.mk _ (algebraMap S R r)⟩
map_one' := by simp [← one_quot]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Set/Finite.lean
Expand Up @@ -1595,7 +1595,7 @@ theorem Finite.exists_maximal_wrt [PartialOrder β] (f : α → β) (s : Set α)
is finite rather than `s` itself. -/
theorem Finite.exists_maximal_wrt' [PartialOrder β] (f : α → β) (s : Set α) (h : (f '' s).Finite)
(hs : s.Nonempty) : (∃ a ∈ s, ∀ (a' : α), a' ∈ s → f a ≤ f a' → f a = f a') := by
obtain ⟨_, ⟨a, ha,rfl⟩, hmax⟩ := Finite.exists_maximal_wrt id (f '' s) h (hs.image f)
obtain ⟨_, ⟨a, ha, rfl⟩, hmax⟩ := Finite.exists_maximal_wrt id (f '' s) h (hs.image f)
exact ⟨a, ha, fun a' ha' hf ↦ hmax _ (mem_image_of_mem f ha') hf⟩

theorem Finite.exists_minimal_wrt [PartialOrder β] (f : α → β) (s : Set α) (h : s.Finite)
Expand Down
6 changes: 2 additions & 4 deletions Mathlib/Data/Set/Image.lean
Expand Up @@ -1651,11 +1651,9 @@ section Sigma
variable {α : Type*} {β : α → Type*} {i j : α} {s : Set (β i)}

lemma sigma_mk_preimage_image' (h : i ≠ j) : Sigma.mk j ⁻¹' (Sigma.mk i '' s) = ∅ := by
change Sigma.mk j ⁻¹' {⟨i, u⟩ | u ∈ s} = ∅
simp [h]
simp [image, h]

lemma sigma_mk_preimage_image_eq_self : Sigma.mk i ⁻¹' (Sigma.mk i '' s) = s := by
change Sigma.mk i ⁻¹' {⟨i, u⟩ | u ∈ s} = s
simp
simp [image]

end Sigma

0 comments on commit cda5caa

Please sign in to comment.