@@ -242,6 +242,24 @@ noncomputable def basisUnique (ι : Type*) [Unique ι]
242242 Module.finite_of_finrank_pos (_root_.zero_lt_one.trans_le h.symm.le)
243243 (finBasisOfFinrankEq R M h).reindex (Equiv.ofUnique _ _)
244244
245+ /-- If a finite module of `finrank 1` has a basis, then this basis has a unique element. -/
246+ theorem Basis.nonempty_unique_index_of_finrank_eq_one
247+ {ι : Type *} (b : Module.Basis ι R M) (d1 : Module.finrank R M = 1 ) :
248+ Nonempty (Unique ι) := by
249+ -- why isn't this an instance?
250+ have : Nontrivial R := nontrivial_of_invariantBasisNumber R
251+ haveI : Module.Finite R M :=
252+ Module.finite_of_finrank_pos (Nat.lt_of_sub_eq_succ d1)
253+ have : Finite ι := Module.Finite.finite_basis b
254+ have : Fintype ι := Fintype.ofFinite ι
255+ rwa [Module.finrank_eq_card_basis b, Fintype.card_eq_one_iff_nonempty_unique] at d1
256+
257+ theorem nonempty_linearEquiv_of_finrank_eq_one (d1 : Module.finrank R M = 1 ) :
258+ Nonempty (R ≃ₗ[R] M) := by
259+ let ⟨ι, b⟩ := (Module.Free.exists_basis R M).some
260+ have : Unique ι := (b.nonempty_unique_index_of_finrank_eq_one d1).some
261+ exact ⟨((b.equivFun).trans (LinearEquiv.funUnique ι R R)).symm⟩
262+
245263@[simp]
246264theorem basisUnique_repr_eq_zero_iff {ι : Type *} [Unique ι]
247265 {h : finrank R M = 1 } {v : M} {i : ι} :
@@ -250,6 +268,38 @@ theorem basisUnique_repr_eq_zero_iff {ι : Type*} [Unique ι]
250268 (basisUnique ι h).repr.map_eq_zero_iff.mp (Finsupp.ext fun j => Subsingleton.elim i j ▸ hv),
251269 fun hv => by rw [hv, LinearEquiv.map_zero, Finsupp.zero_apply]⟩
252270
271+ variable {R : Type *} [CommSemiring R] [StrongRankCondition R]
272+ {M : Type *} [AddCommMonoid M] [Module R M] [Module.Free R M]
273+
274+ theorem _root_.LinearMap.existsUnique_eq_smul_id_of_finrank_eq_one
275+ (d1 : Module.finrank R M = 1 ) (u : M →ₗ[R] M) :
276+ ∃! c : R, u = c • LinearMap.id := by
277+ let e := (nonempty_linearEquiv_of_finrank_eq_one d1).some
278+ set c := e.symm (u (e 1 )) with hc
279+ suffices u = c • LinearMap.id by
280+ use c
281+ simp only [this, true_and]
282+ intro d hcd
283+ rw [LinearMap.ext_iff] at hcd
284+ simpa using (LinearEquiv.congr_arg (e := e.symm) (hcd (e 1 ))).symm
285+ ext x
286+ have (x : M) : x = (e.symm x) • (e 1 ) := by simp [← LinearEquiv.map_smul]
287+ rw [this x]
288+ simp only [hc, map_smul, LinearMap.smul_apply, LinearMap.id_coe, id_eq]
289+ rw [← this]
290+
291+ /-- Endomorphisms of a free module of rank one are homotheties. -/
292+ @[simps apply]
293+ noncomputable def _root_.LinearEquiv.smul_id_of_finrank_eq_one (d1 : Module.finrank R M = 1 ) :
294+ R ≃ₗ[R] (M →ₗ[R] M) where
295+ toFun := fun c ↦ c • LinearMap.id
296+ map_add' c d := by ext; simp [add_smul]
297+ map_smul' c d := by ext; simp [mul_smul]
298+ invFun u := (u.existsUnique_eq_smul_id_of_finrank_eq_one d1).choose
299+ left_inv c := by
300+ simp [← (LinearMap.existsUnique_eq_smul_id_of_finrank_eq_one d1 _).choose_spec.2 c]
301+ right_inv u := ((u.existsUnique_eq_smul_id_of_finrank_eq_one d1).choose_spec.1 ).symm
302+
253303end Module
254304
255305namespace Algebra
0 commit comments