Skip to content

Commit 4973f73

Browse files
committed
chore: reduce defeq abuse
Cherry-picked from #35182, adjusted
1 parent 738faa5 commit 4973f73

File tree

9 files changed

+35
-21
lines changed

9 files changed

+35
-21
lines changed

Mathlib/Algebra/Module/Projective.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ theorem Projective.iff_split_of_projective [Module.Projective R M] (s : M →ₗ
185185
Module.Projective R P ↔ ∃ i, s ∘ₗ i = LinearMap.id :=
186186
fun _ ↦ projective_lifting_property _ _ hs, fun ⟨i, H⟩ ↦ Projective.of_split i s H⟩
187187

188-
attribute [local instance] RingHomInvPair.of_ringEquiv in
188+
attribute [local instance] RingHomInvPair.of_ringEquiv RingHomInvPair.of_ringEquiv_symm in
189189
theorem Projective.of_ringEquiv {R S} [Semiring R] [Semiring S] {M N}
190190
[AddCommMonoid M] [AddCommMonoid N] [Module R M] [Module S N]
191191
(e₁ : R ≃+* S) (e₂ : M ≃ₛₗ[RingHomClass.toRingHom e₁] N)

Mathlib/Algebra/Module/SnakeLemma.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ such that `f₂` is surjective with a (set-theoretic) section `σ`, `g₁` is in
4848
(set-theoretic) retraction `ρ`, and that `ι₃` is injective and `π₁` is surjective.
4949
-/
5050

51-
variable {R} [CommRing R] {M₁ M₂ M₃ N₁ N₂ N₃}
51+
variable {R : Type*} [CommRing R] {M₁ M₂ M₃ N₁ N₂ N₃ : Type*}
5252
[AddCommGroup M₁] [Module R M₁] [AddCommGroup M₂] [Module R M₂] [AddCommGroup M₃] [Module R M₃]
5353
[AddCommGroup N₁] [Module R N₁] [AddCommGroup N₂] [Module R N₂] [AddCommGroup N₃] [Module R N₃]
5454
(i₁ : M₁ →ₗ[R] N₁) (i₂ : M₂ →ₗ[R] N₂) (i₃ : M₃ →ₗ[R] N₃)
5555
(f₁ : M₁ →ₗ[R] M₂) (f₂ : M₂ →ₗ[R] M₃) (hf : Exact f₁ f₂)
5656
(g₁ : N₁ →ₗ[R] N₂) (g₂ : N₂ →ₗ[R] N₃) (hg : Exact g₁ g₂)
5757
(h₁ : g₁.comp i₁ = i₂.comp f₁) (h₂ : g₂.comp i₂ = i₃.comp f₂)
5858
(σ : M₃ → M₂) (hσ : f₂ ∘ σ = id) (ρ : N₂ → N₁) (hρ : ρ ∘ g₁ = id)
59-
{K₂ K₃ C₁ C₂} [AddCommGroup K₂] [Module R K₂] [AddCommGroup K₃] [Module R K₃]
59+
{K₂ K₃ C₁ C₂ : Type*} [AddCommGroup K₂] [Module R K₂] [AddCommGroup K₃] [Module R K₃]
6060
[AddCommGroup C₁] [Module R C₁] [AddCommGroup C₂] [Module R C₂]
6161
(ι₂ : K₂ →ₗ[R] M₂) (hι₂ : Exact ι₂ i₂) (ι₃ : K₃ →ₗ[R] M₃) (hι₃ : Exact ι₃ i₃)
6262
(π₁ : N₁ →ₗ[R] C₁) (hπ₁ : Exact i₁ π₁) (π₂ : N₂ →ₗ[R] C₂) (hπ₂ : Exact i₂ π₂)

Mathlib/Algebra/MonoidAlgebra/Grading.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ theorem grade_eq_lsingle_range (m : M) :
8080
Submodule.ext (mem_grade_iff' R m)
8181

8282
theorem single_mem_gradeBy {R} [CommSemiring R] (f : M → ι) (m : M) (r : R) :
83-
Finsupp.single m r ∈ gradeBy R f (f m) := by
83+
single m r ∈ gradeBy R f (f m) := by
8484
intro x hx
8585
rw [Finset.mem_singleton.mp (Finsupp.support_single_subset hx)]
8686

87-
theorem single_mem_grade {R} [CommSemiring R] (i : M) (r : R) : Finsupp.single i r ∈ grade R i :=
87+
theorem single_mem_grade {R} [CommSemiring R] (i : M) (r : R) :
88+
single i r ∈ grade R i :=
8889
single_mem_gradeBy _ _ _
8990

9091
end

Mathlib/Algebra/Ring/CompTypeclasses.lean

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,19 @@ instance triples₂ {σ₂₁ : R₂ →+* R₁} [RingHomInvPair σ₁₂ σ₂
114114
/-- Construct a `RingHomInvPair` from both directions of a ring equiv.
115115
116116
This is not an instance, as for equivalences that are involutions, a better instance
117-
would be `RingHomInvPair e e`. Indeed, this declaration is not currently used in mathlib.
117+
would be `RingHomInvPair e e`.
118118
-/
119119
theorem of_ringEquiv (e : R₁ ≃+* R₂) : RingHomInvPair (↑e : R₁ →+* R₂) ↑e.symm :=
120120
⟨e.symm_toRingHom_comp_toRingHom, e.symm.symm_toRingHom_comp_toRingHom⟩
121121

122+
/-- Construct a `RingHomInvPair` from both directions of a ring equiv.
123+
124+
This is not an instance, as for equivalences that are involutions, a better instance
125+
would be `RingHomInvPair e e`.
126+
-/
127+
theorem of_ringEquiv_symm (e : R₁ ≃+* R₂) : RingHomInvPair (↑e.symm : R₂ →+* R₁) ↑e :=
128+
of_ringEquiv e.symm
129+
122130
/--
123131
Swap the direction of a `RingHomInvPair`. This is not an instance as it would loop, and better
124132
instances are often available and may often be preferable to using this one. Indeed, this

Mathlib/LinearAlgebra/FreeModule/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ theorem of_equiv' {P : Type v} [AddCommMonoid P] [Module R P] (_ : Module.Free R
132132
instance Module.free_shrink [Module.Free R M] [Small.{w} M] : Module.Free R (Shrink.{w} M) :=
133133
Module.Free.of_equiv (Shrink.linearEquiv R M).symm
134134

135-
attribute [local instance] RingHomInvPair.of_ringEquiv in
136-
lemma of_ringEquiv {R R' M M'} [Semiring R] [AddCommMonoid M] [Module R M]
135+
attribute [local instance] RingHomInvPair.of_ringEquiv RingHomInvPair.of_ringEquiv_symm in
136+
lemma of_ringEquiv {R R' M M' : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
137137
[Semiring R'] [AddCommMonoid M'] [Module R' M']
138-
(e₁ : R ≃+* R') (e₂ : M ≃ₛₗ[RingHomClass.toRingHom e₁] M') [Module.Free R M] :
138+
(e₁ : R ≃+* R') (e₂ : M ≃ₛₗ[(e₁ : R →+* R')] M') [Module.Free R M] :
139139
Module.Free R' M' := by
140140
let I := Module.Free.ChooseBasisIndex R M
141141
obtain ⟨e₃ : M ≃ₗ[R] I →₀ R⟩ := Module.Free.chooseBasis R M
@@ -146,7 +146,7 @@ lemma of_ringEquiv {R R' M M'} [Semiring R] [AddCommMonoid M] [Module R M]
146146
{ __ := e, map_smul' := fun m x ↦ Finsupp.ext fun i ↦ by simp [he, map_smulₛₗ] }
147147
exact of_basis (.ofRepr e')
148148

149-
attribute [local instance] RingHomInvPair.of_ringEquiv in
149+
attribute [local instance] RingHomInvPair.of_ringEquiv RingHomInvPair.of_ringEquiv_symm in
150150
lemma iff_of_ringEquiv {R R' M M'} [Semiring R] [AddCommMonoid M] [Module R M]
151151
[Semiring R'] [AddCommMonoid M'] [Module R' M']
152152
(e₁ : R ≃+* R') (e₂ : M ≃ₛₗ[RingHomClass.toRingHom e₁] M') :

Mathlib/RingTheory/AdjoinRoot.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ variable [CommRing R] (I : Ideal R) (f : R[X])
875875
See `adjoin_root.quot_map_of_equiv` for the isomorphism with `(R/I)[X] / (f mod I)`. -/
876876
def quotMapOfEquivQuotMapCMapSpanMk :
877877
AdjoinRoot f ⧸ I.map (of f) ≃+*
878-
AdjoinRoot f ⧸ (I.map (C : R →+* R[X])).map (Ideal.Quotient.mk (span {f})) :=
878+
AdjoinRoot f ⧸ (I.map (C : R →+* R[X])).map (AdjoinRoot.mk f) :=
879879
Ideal.quotEquivOfEq (by rw [of, AdjoinRoot.mk, Ideal.map_map])
880880

881881
@[simp]
@@ -894,7 +894,7 @@ theorem quotMapOfEquivQuotMapCMapSpanMk_symm_mk (x : AdjoinRoot f) :
894894
/-- The natural isomorphism `R[α]/((I[x] ⊔ (f)) / (f)) ≅ (R[x]/I[x])/((f) ⊔ I[x] / I[x])`
895895
for `α` a root of `f : R[X]` and `I : Ideal R` -/
896896
def quotMapCMapSpanMkEquivQuotMapCQuotMapSpanMk :
897-
AdjoinRoot f ⧸ (I.map (C : R →+* R[X])).map (Ideal.Quotient.mk (span ({f} : Set R[X]))) ≃+*
897+
AdjoinRoot f ⧸ (I.map (C : R →+* R[X])).map (AdjoinRoot.mk f) ≃+*
898898
(R[X] ⧸ I.map (C : R →+* R[X])) ⧸
899899
(span ({f} : Set R[X])).map (Ideal.Quotient.mk (I.map (C : R →+* R[X]))) :=
900900
quotQuotEquivComm (Ideal.span ({f} : Set R[X])) (I.map (C : R →+* R[X]))

Mathlib/RingTheory/Kaehler/Basic.lean

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ instance KaehlerDifferential.isScalarTower' : IsScalarTower R (S ⊗[R] S) Ω[S
175175
def KaehlerDifferential.fromIdeal : KaehlerDifferential.ideal R S →ₗ[S ⊗[R] S] Ω[S⁄R] :=
176176
(KaehlerDifferential.ideal R S).toCotangent
177177

178+
theorem KaehlerDifferential.fromIdeal_surjective : Function.Surjective (fromIdeal R S) :=
179+
Ideal.toCotangent_surjective _
180+
178181
/-- (Implementation) The underlying linear map of the derivation into `Ω[S⁄R]`. -/
179182
def KaehlerDifferential.DLinearMap : S →ₗ[R] Ω[S⁄R] :=
180183
((KaehlerDifferential.fromIdeal R S).restrictScalars R).comp
@@ -218,13 +221,14 @@ theorem KaehlerDifferential.span_range_derivation :
218221
Submodule.span S (Set.range <| KaehlerDifferential.D R S) = ⊤ := by
219222
rw [_root_.eq_top_iff]
220223
rintro x -
221-
obtain ⟨⟨x, hx⟩, rfl⟩ := Ideal.toCotangent_surjective _ x
222-
have : x ∈ (KaehlerDifferential.ideal R S).restrictScalars S := hx
223-
rw [← KaehlerDifferential.submodule_span_range_eq_ideal] at this
224-
suffices ∃ hx, (KaehlerDifferential.ideal R S).toCotangent ⟨x, hx⟩ ∈
225-
Submodule.span S (Set.range <| KaehlerDifferential.D R S) by
226-
exact this.choose_spec
227-
refine Submodule.span_induction ?_ ?_ ?_ ?_ this
224+
obtain ⟨⟨x, hx⟩, rfl⟩ := fromIdeal_surjective R S x
225+
rw [← Submodule.restrictScalars_mem S, ← KaehlerDifferential.submodule_span_range_eq_ideal] at hx
226+
suffices ∃ hx,
227+
fromIdeal R S ⟨x, hx⟩ ∈ Submodule.span S (Set.range <| KaehlerDifferential.D R S) from
228+
this.snd
229+
-- TODO: this proof looks like we're reinventinv `Submodule.span_le`.
230+
-- I'm not sure what's the RHS here though.
231+
refine Submodule.span_induction ?_ ?_ ?_ ?_ hx
228232
· rintro _ ⟨x, rfl⟩
229233
refine ⟨KaehlerDifferential.one_smul_sub_smul_one_mem_ideal R x, ?_⟩
230234
apply Submodule.subset_span

Mathlib/RingTheory/KrullDimension/Polynomial.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private lemma height_eq_height_add_one_of_isMaximal (p : Ideal R) [p.IsMaximal]
5656
let _ : Field (R ⧸ p) := Quotient.field p
5757
suffices h : (P.map (Ideal.Quotient.mk (Ideal.map (algebraMap R R[X]) p))).height = 1 by
5858
rw [height_eq_height_add_of_liesOver_of_hasGoingDown p, h]
59-
let e : (R[X] ⧸ (p.map C)) ≃+* (R ⧸ p)[X] := (polynomialQuotientEquivQuotientPolynomial p).symm
59+
let e : (R[X] ⧸ (p.map (algebraMap R R[X]))) ≃+* (R ⧸ p)[X] :=
60+
(polynomialQuotientEquivQuotientPolynomial p).symm
6061
let P' : Ideal (R ⧸ p)[X] := Ideal.map e <| P.map (Ideal.Quotient.mk <| p.map (algebraMap R R[X]))
6162
have : (P.map (Ideal.Quotient.mk <| p.map (algebraMap R R[X]))).IsMaximal := by
6263
refine .map_of_surjective_of_ker_le Quotient.mk_surjective ?_

Mathlib/RingTheory/LocalProperties/Projective.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ variable
151151
(f : ∀ (P : Ideal R) [P.IsMaximal], M →ₗ[R] Mₚ P)
152152
[inst : ∀ (P : Ideal R) [P.IsMaximal], IsLocalizedModule P.primeCompl (f P)]
153153

154-
attribute [local instance] RingHomInvPair.of_ringEquiv in
154+
attribute [local instance] RingHomInvPair.of_ringEquiv RingHomInvPair.of_ringEquiv_symm in
155155
include f in
156156
/--
157157
A variant of `Module.projective_of_localization_maximal` that accepts `IsLocalizedModule`.

0 commit comments

Comments
 (0)