Skip to content

Commit 14697d4

Browse files
committed
fix: tidy def of fieldOfFiniteDimensional (#5288)
As suggested by Sebastian Gouezel [here](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/!4.235256.20RingTheory.2ETrace/near/367812247). Makes the term `fieldOfFiniteDimensional` a bit tidier (it removes ` let src_1 := inst_1;`).
1 parent 75ce646 commit 14697d4

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Mathlib/LinearAlgebra/FiniteDimensional.lean

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,27 +1079,32 @@ end LinearMap
10791079

10801080
section
10811081

1082+
lemma FiniteDimensional.exists_mul_eq_one (F : Type _) {K : Type _} [Field F] [Ring K] [IsDomain K]
1083+
[Algebra F K] [FiniteDimensional F K] {x : K} (H : x ≠ 0) : ∃ y, x * y = 1 := by
1084+
have : Function.Surjective (LinearMap.mulLeft F x) :=
1085+
LinearMap.injective_iff_surjective.1 fun y z => ((mul_right_inj' H).1 : x * y = x * z → y = z)
1086+
exact this 1
1087+
10821088
/-- A domain that is module-finite as an algebra over a field is a division ring. -/
1083-
noncomputable def divisionRingOfFiniteDimensional (F K : Type _) [Field F] [Ring K] [IsDomain K]
1089+
noncomputable def divisionRingOfFiniteDimensional (F K : Type _) [Field F] [h : Ring K] [IsDomain K]
10841090
[Algebra F K] [FiniteDimensional F K] : DivisionRing K :=
1085-
-- porting note: extracted from the fields below to a `haveI`
1086-
haveI : ∀ x : K, x ≠ 0 → Function.Surjective (LinearMap.mulLeft F x) := fun x H =>
1087-
LinearMap.injective_iff_surjective.1 fun y z => ((mul_right_inj' H).1 : x * y = x * z → y = z)
1088-
{ ‹IsDomain K›, ‹Ring K› with
1089-
inv := fun x => if H : x = 0 then 0 else Classical.choose <| (this _ H) 1
1091+
{ ‹IsDomain K› with
1092+
toRing := h
1093+
inv := fun x => if H : x = 0 then 0 else Classical.choose <|
1094+
FiniteDimensional.exists_mul_eq_one F H
10901095
mul_inv_cancel := fun x hx =>
10911096
show x * dite _ _ _ = _ by
10921097
rw [dif_neg hx]
1093-
exact (Classical.choose_spec (this _ hx 1) :)
1098+
exact (Classical.choose_spec (FiniteDimensional.exists_mul_eq_one F hx) :)
10941099
inv_zero := dif_pos rfl }
10951100
#align division_ring_of_finite_dimensional divisionRingOfFiniteDimensional
10961101

10971102
/-- An integral domain that is module-finite as an algebra over a field is a field. -/
1098-
noncomputable def fieldOfFiniteDimensional (F K : Type _) [Field F] [CommRing K] [IsDomain K]
1103+
noncomputable def fieldOfFiniteDimensional (F K : Type _) [Field F] [h : CommRing K] [IsDomain K]
10991104
[Algebra F K] [FiniteDimensional F K] : Field K :=
1100-
{ divisionRingOfFiniteDimensional F K, ‹CommRing K› with }
1105+
{ divisionRingOfFiniteDimensional F K with
1106+
toCommRing := h }
11011107
#align field_of_finite_dimensional fieldOfFiniteDimensional
1102-
11031108
end
11041109

11051110
namespace Submodule

0 commit comments

Comments
 (0)