Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit d1accf4

Browse files
committed
chore(ring_theory/ideal/local_ring): use derive for more consistent instances (#17468)
Many definitions are now computable due to the shortcut `ring` and `comm_ring` instances. The new `algebra` instance now avoids diamonds in `smul` caused by `to_algebra`.
1 parent c6c8f20 commit d1accf4

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/ring_theory/henselian.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ begin
138138
{ intros H, constructor, intros f hf a₀ h₁ h₂,
139139
specialize H f hf (residue R a₀),
140140
have aux := flip mem_nonunits_iff.mp h₂,
141-
simp only [aeval_def, ring_hom.algebra_map_to_algebra, eval₂_at_apply,
141+
simp only [aeval_def, residue_field.algebra_map_eq, eval₂_at_apply,
142142
← ideal.quotient.eq_zero_iff_mem, ← local_ring.mem_maximal_ideal] at H h₁ aux,
143143
obtain ⟨a, ha₁, ha₂⟩ := H h₁ aux,
144144
refine ⟨a, ha₁, _⟩,

src/ring_theory/ideal/local_ring.lean

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,27 +309,27 @@ section
309309
variables (R) [comm_ring R] [local_ring R] [comm_ring S] [local_ring S] [comm_ring T] [local_ring T]
310310

311311
/-- The residue field of a local ring is the quotient of the ring by its maximal ideal. -/
312+
@[derive [ring, comm_ring, inhabited]]
312313
def residue_field := R ⧸ maximal_ideal R
313314

314315
noncomputable instance residue_field.field : field (residue_field R) :=
315316
ideal.quotient.field (maximal_ideal R)
316317

317-
noncomputable instance : inhabited (residue_field R) := ⟨37
318-
319318
/-- The quotient map from a local ring to its residue field. -/
320319
def residue : R →+* (residue_field R) :=
321320
ideal.quotient.mk _
322321

323-
noncomputable
324-
instance residue_field.algebra : algebra R (residue_field R) := (residue R).to_algebra
322+
instance residue_field.algebra : algebra R (residue_field R) :=
323+
ideal.quotient.algebra _
324+
325+
lemma residue_field.algebra_map_eq : algebra_map R (residue_field R) = residue R := rfl
325326

326327
variables {R}
327328

328329
namespace residue_field
329330

330331
/-- The map on residue fields induced by a local homomorphism between local rings -/
331-
noncomputable def map (f : R →+* S) [is_local_ring_hom f] :
332-
residue_field R →+* residue_field S :=
332+
def map (f : R →+* S) [is_local_ring_hom f] : residue_field R →+* residue_field S :=
333333
ideal.quotient.lift (maximal_ideal R) ((ideal.quotient.mk _).comp f) $
334334
λ a ha,
335335
begin
@@ -359,8 +359,7 @@ fun_like.congr_fun (map_comp f g).symm x
359359

360360
/-- A ring isomorphism defines an isomorphism of residue fields. -/
361361
@[simps apply]
362-
noncomputable def map_equiv (f : R ≃+* S) :
363-
local_ring.residue_field R ≃+* local_ring.residue_field S :=
362+
def map_equiv (f : R ≃+* S) : local_ring.residue_field R ≃+* local_ring.residue_field S :=
364363
{ to_fun := map (f : R →+* S),
365364
inv_fun := map (f.symm : S →+* R),
366365
left_inv := λ x, by simp only [map_map, ring_equiv.symm_comp, map_id, ring_hom.id_apply],
@@ -379,7 +378,7 @@ ring_equiv.to_ring_hom_injective map_id
379378

380379
/-- The group homomorphism from `ring_aut R` to `ring_aut k` where `k`
381380
is the residue field of `R`. -/
382-
@[simps] noncomputable def map_aut : ring_aut R →* ring_aut (local_ring.residue_field R) :=
381+
@[simps] def map_aut : ring_aut R →* ring_aut (local_ring.residue_field R) :=
383382
{ to_fun := map_equiv,
384383
map_mul' := λ e₁ e₂, map_equiv_trans e₂ e₁,
385384
map_one' := map_equiv_refl }

0 commit comments

Comments
 (0)