Skip to content

Commit 59cb29b

Browse files
committed
chore(IsFractionRing): make argument explicit (#36655)
Makes the base ring an explicit argument in `IsFractionRing.div_surjective`. This argument cannot be inferred by typeclass inference, because the base ring is not an `outParam` or `semiOutParam` in the type of `IsFractionRing`. It is also rarely determined by the expected type, since this is typically used as the discriminant for an `obtain` or `rcases`. Also update every usage of `IsFractionRing.div_surjective` to take advantage of this explicit argument.
1 parent bf010ad commit 59cb29b

File tree

11 files changed

+25
-24
lines changed

11 files changed

+25
-24
lines changed

Mathlib/Algebra/Algebra/Epi.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ end Semiring
6262
instance (R A : Type*) [CommRing R] [IsDomain R] [Field A] [Algebra R A] [IsFractionRing R A] :
6363
Algebra.IsEpi R A := by
6464
refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun x ↦ ?_
65-
obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective (A := R) x
65+
obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective R x
6666
set f := algebraMap R A with hf
6767
replace hb : f b ≠ 0 := by aesop
6868
calc 1 ⊗ₜ[R] (f a / f b)

Mathlib/FieldTheory/Galois/IsGaloisGroup.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ theorem IsGaloisGroup.to_isFractionRing [Finite G] [hGAB : IsGaloisGroup G A B]
124124
refine ⟨⟨fun h ↦ ?_⟩, ⟨fun g x y ↦ ?_⟩, ⟨fun x h ↦ ?_⟩⟩
125125
· have := hGAB.faithful
126126
exact eq_of_smul_eq_smul fun y ↦ by simpa [← algebraMap.coe_smul'] using h (algebraMap B L y)
127-
· obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective (A := A) x
128-
obtain ⟨c, d, hd, rfl⟩ := IsFractionRing.div_surjective (A := B) y
127+
· obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective A x
128+
obtain ⟨c, d, hd, rfl⟩ := IsFractionRing.div_surjective B y
129129
simp [Algebra.smul_def, smul_mul', smul_div₀', hc, ← algebraMap.coe_smul']
130130
· have := hGAB.isInvariant.isIntegral
131131
have : Nontrivial A := (IsFractionRing.nontrivial_iff_nontrivial A K).mpr inferInstance
132132
have : Nontrivial B := (IsFractionRing.nontrivial_iff_nontrivial B L).mpr inferInstance
133-
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective (A := B) x
133+
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective B x
134134
have hy' : algebraMap B L y ≠ 0 := by simpa using nonZeroDivisors.ne_zero hy
135135
obtain ⟨b, a, ha, hb⟩ := (Algebra.IsAlgebraic.isAlgebraic (R := A) y).exists_smul_eq_mul x hy
136136
rw [mul_comm, Algebra.smul_def, mul_comm] at hb
@@ -152,7 +152,7 @@ theorem IsGaloisGroup.of_isFractionRing [hGKL : IsGaloisGroup G K L]
152152
refine ⟨⟨fun h ↦ ?_⟩, ⟨fun g x y ↦ IsFractionRing.injective B L ?_⟩, ⟨fun x h ↦ ?_⟩⟩
153153
· have := hGKL.faithful
154154
refine eq_of_smul_eq_smul fun (y : L) ↦ ?_
155-
obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective (A := B) y
155+
obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective B y
156156
simp only [smul_div₀', ← algebraMap.coe_smul', h]
157157
· simp [Algebra.smul_def, algebraMap.coe_smul', ← hc]
158158
· obtain ⟨b, hb⟩ := hGKL.isInvariant.isInvariant (algebraMap B L x)

Mathlib/NumberTheory/NumberField/Completion/FinitePlace.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ theorem hasFiniteMulSupport_int {x : 𝓞 K} (h_x_nezero : x ≠ 0) :
326326
@[fun_prop]
327327
theorem hasFiniteMulSupport {x : K} (h_x_nezero : x ≠ 0) :
328328
(fun w : FinitePlace K ↦ w x).HasFiniteMulSupport := by
329-
rcases IsFractionRing.div_surjective (A := 𝓞 K) x with ⟨a, b, hb, rfl⟩
329+
rcases IsFractionRing.div_surjective (𝓞 K) x with ⟨a, b, hb, rfl⟩
330330
simp_all only [ne_eq, div_eq_zero_iff, FaithfulSMul.algebraMap_eq_zero_iff, not_or, map_div₀]
331331
obtain ⟨ha, hb⟩ := h_x_nezero
332332
simp_rw [← RingOfIntegers.coe_eq_algebraMap]

Mathlib/NumberTheory/NumberField/ProductFormula.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ equal to the inverse of the absolute value of `Algebra.norm ℚ x`. -/
7878
theorem FinitePlace.prod_eq_inv_abs_norm {x : K} (h_x_nezero : x ≠ 0) :
7979
∏ᶠ w : FinitePlace K, w x = |(Algebra.norm ℚ) x|⁻¹ := by
8080
--reduce to 𝓞 K
81-
rcases IsFractionRing.div_surjective (A := 𝓞 K) x with ⟨a, b, hb, rfl⟩
81+
rcases IsFractionRing.div_surjective (𝓞 K) x with ⟨a, b, hb, rfl⟩
8282
apply nonZeroDivisors.ne_zero at hb
8383
have ha : a ≠ 0 := by
8484
rintro rfl

Mathlib/NumberTheory/RamificationInertia/HilbertTheory.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ theorem IsDecompositionField.of_isGaloisGroup [h : IsGaloisGroup (stabilizer G P
8282
· refine (stabilizerEquiv _ (IsGaloisGroup.mulEquivAlgEquiv G K L) fun _ _ ↦ ?_).symm
8383
apply FaithfulSMul.algebraMap_injective B L
8484
simp [algebraMap.smul']
85-
· obtain ⟨y, z, _, rfl⟩ := IsFractionRing.div_surjective (A := B) x
85+
· obtain ⟨y, z, _, rfl⟩ := IsFractionRing.div_surjective B x
8686
simp_rw [smul_div₀', subgroup_smul_def, ← algebraMap.smul', ← subgroup_smul_def,
8787
stabilizerEquiv_symm_apply_smul]
8888

@@ -92,7 +92,7 @@ theorem IsInertiaField.of_isGaloisGroup [h : IsGaloisGroup (inertia G P) D L] :
9292
· refine (inertiaEquiv _ (IsGaloisGroup.mulEquivAlgEquiv G K L) fun _ _ ↦ ?_).symm
9393
apply FaithfulSMul.algebraMap_injective B L
9494
simp [algebraMap.smul']
95-
· obtain ⟨y, z, _, rfl⟩ := IsFractionRing.div_surjective (A := B) x
95+
· obtain ⟨y, z, _, rfl⟩ := IsFractionRing.div_surjective B x
9696
simp_rw [smul_div₀', subgroup_smul_def, ← algebraMap.smul', ← subgroup_smul_def,
9797
inertiaEquiv_symm_apply_smul]
9898

Mathlib/RingTheory/Invariant/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private theorem fixed_of_fixed2 (f : Gal(L/K)) (x : L)
360360
obtain ⟨_⟩ := nonempty_fintype G
361361
have : P.IsPrime := Ideal.over_def Q P ▸ Ideal.IsPrime.under A Q
362362
have : Algebra.IsIntegral A B := Algebra.IsInvariant.isIntegral A B G
363-
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective (A := B ⧸ Q) x
363+
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective (B ⧸ Q) x
364364
obtain ⟨b, a, ha, h⟩ := (Algebra.IsAlgebraic.isAlgebraic (R := A ⧸ P) y).exists_smul_eq_mul x hy
365365
replace ha : algebraMap (A ⧸ P) L a ≠ 0 := by
366366
rwa [Ne, algebraMap_apply (A ⧸ P) K L, algebraMap_eq_zero_iff, algebraMap_eq_zero_iff]

Mathlib/RingTheory/Localization/AsSubring.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ instance isLocalization_ofField : IsLocalization S (ofField K S hS) := by
140140

141141
instance (S : Subalgebra A K) : IsFractionRing S K := by
142142
refine IsFractionRing.of_field S K fun z ↦ ?_
143-
rcases IsFractionRing.div_surjective (A := A) z with ⟨x, y, _, eq⟩
143+
rcases IsFractionRing.div_surjective A z with ⟨x, y, _, eq⟩
144144
exact ⟨algebraMap A S x, algebraMap A S y, eq.symm⟩
145145

146146
instance isFractionRing_ofField : IsFractionRing (ofField K S hS) K :=

Mathlib/RingTheory/Localization/FractionRing.lean

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ theorem mk'_mk_eq_div {r s} (hs : s ∈ nonZeroDivisors A) :
250250
theorem mk'_eq_div {r} (s : nonZeroDivisors A) : mk' K r s = algebraMap A K r / algebraMap A K s :=
251251
mk'_mk_eq_div s.2
252252

253+
variable (A) in
253254
theorem div_surjective (z : K) :
254255
∃ x y : A, y ∈ nonZeroDivisors A ∧ algebraMap _ _ x / algebraMap _ _ y = z :=
255256
let ⟨x, ⟨y, hy⟩, h⟩ := exists_mk'_eq (nonZeroDivisors A) z
@@ -286,7 +287,7 @@ omit [IsDomain B]
286287

287288
theorem algHom_commutes (e : K₁ →ₐ[A] K₂) (f : L₁ →ₐ[B] L₂) (x : K₁) :
288289
algebraMap K₂ L₂ (e x) = f (algebraMap K₁ L₁ x) := by
289-
obtain ⟨r, s, hs, rfl⟩ := IsFractionRing.div_surjective (A := A) x
290+
obtain ⟨r, s, hs, rfl⟩ := IsFractionRing.div_surjective A x
290291
simp_rw [map_div₀, AlgHom.commutes, ← IsScalarTower.algebraMap_apply,
291292
IsScalarTower.algebraMap_apply A B L₁, AlgHom.commutes, ← IsScalarTower.algebraMap_apply]
292293

@@ -303,7 +304,7 @@ variable (A K) in
303304
the image of `algebraMap A K` is equal to the whole field `K`. -/
304305
theorem closure_range_algebraMap : Subfield.closure (Set.range (algebraMap A K)) = ⊤ :=
305306
top_unique fun z _ ↦ by
306-
obtain ⟨_, _, -, rfl⟩ := div_surjective (A := A) z
307+
obtain ⟨_, _, -, rfl⟩ := div_surjective A z
307308
apply div_mem <;> exact Subfield.subset_closure ⟨_, rfl⟩
308309

309310
variable {L : Type*} [Field L] {g : A →+* L} {f : K →+* L}
@@ -343,7 +344,7 @@ theorem lift_unique (hg : Function.Injective g) {f : K →+* L}
343344
theorem ringHom_ext {f1 f2 : K →+* L}
344345
(hf : ∀ x : A, f1 (algebraMap A K x) = f2 (algebraMap A K x)) : f1 = f2 := by
345346
ext z
346-
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective (A := A) z
347+
obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective A z
347348
rw [map_div₀, map_div₀, hf, hf]
348349

349350
theorem injective_comp_algebraMap :
@@ -474,7 +475,7 @@ variable {A B C D : Type*}
474475
noncomputable def fieldEquivOfAlgEquiv (f : B ≃ₐ[A] C) : FB ≃ₐ[FA] FC where
475476
__ := IsFractionRing.ringEquivOfRingEquiv f.toRingEquiv
476477
commutes' x := by
477-
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective (A := A) x
478+
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective A x
478479
simp_rw [map_div₀, ← IsScalarTower.algebraMap_apply, IsScalarTower.algebraMap_apply A B FB]
479480
simp [← IsScalarTower.algebraMap_apply A C FC]
480481

@@ -494,14 +495,14 @@ variable (A B) in
494495
lemma fieldEquivOfAlgEquiv_refl :
495496
fieldEquivOfAlgEquiv FA FB FB (AlgEquiv.refl : B ≃ₐ[A] B) = AlgEquiv.refl := by
496497
ext x
497-
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective (A := B) x
498+
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective B x
498499
simp
499500

500501
lemma fieldEquivOfAlgEquiv_trans (f : B ≃ₐ[A] C) (g : C ≃ₐ[A] D) :
501502
fieldEquivOfAlgEquiv FA FB FD (f.trans g) =
502503
(fieldEquivOfAlgEquiv FA FB FC f).trans (fieldEquivOfAlgEquiv FA FC FD g) := by
503504
ext x
504-
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective (A := B) x
505+
obtain ⟨x, y, -, rfl⟩ := IsFractionRing.div_surjective B x
505506
simp
506507

507508
end fieldEquivOfAlgEquiv

Mathlib/RingTheory/Localization/Integral.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ theorem isAlgebraic_iff' [Field K] [IsDomain R] [Algebra R K] [Algebra S K]
491491
letI := FractionRing.liftAlgebra R K
492492
have := FractionRing.isScalarTower_liftAlgebra R K
493493
rw [IsFractionRing.isAlgebraic_iff R (FractionRing R) K, isAlgebraic_iff_isIntegral]
494-
obtain ⟨a : S, b, ha, rfl⟩ := div_surjective (A := S) x
494+
obtain ⟨a : S, b, ha, rfl⟩ := div_surjective S x
495495
obtain ⟨f, hf₁, hf₂⟩ := h b
496496
rw [div_eq_mul_inv]
497497
refine .mul ?_ (.inv ?_) <;> exact isAlgebraic_iff_isIntegral.mp <|

Mathlib/RingTheory/Valuation/Discrete/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ open scoped WithZero
466466
theorem exists_lift_of_le_one {x : K} (H : ((maximalIdeal A).valuation K) x ≤ (1 : ℤᵐ⁰)) :
467467
∃ a : A, algebraMap A K a = x := by
468468
obtain ⟨π, hπ⟩ := exists_irreducible A
469-
obtain ⟨a, b, hb, h_frac⟩ := IsFractionRing.div_surjective (A := A) x
469+
obtain ⟨a, b, hb, h_frac⟩ := IsFractionRing.div_surjective A x
470470
by_cases ha : a = 0
471471
· rw [← h_frac]
472472
use 0

0 commit comments

Comments
 (0)