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

Commit 500ccb1

Browse files
committed
chore(linear_algebra/dimension): remove a nontriviality assumption (#18715)
`dim_pos` does not need `nontrivial R`. Also adds a new lemma that demonstrates why the assumption is still needed on some later results.
1 parent 5f6e827 commit 500ccb1

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

src/linear_algebra/dimension.lean

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,23 +463,53 @@ end
463463
section rank_zero
464464

465465
variables {R : Type u} {M : Type v}
466-
variables [ring R] [nontrivial R] [add_comm_group M] [module R M] [no_zero_smul_divisors R M]
466+
variables [ring R] [add_comm_group M] [module R M]
467+
468+
@[simp] lemma dim_subsingleton [subsingleton R] : module.rank R M = 1 :=
469+
begin
470+
haveI := module.subsingleton R M,
471+
haveI : nonempty {s : set M // linear_independent R (coe : s → M)},
472+
{ exact ⟨⟨∅, linear_independent_empty _ _⟩⟩ },
473+
rw [module.rank, csupr_eq_of_forall_le_of_forall_lt_exists_gt],
474+
{ rintros ⟨s, hs⟩,
475+
rw cardinal.mk_le_one_iff_set_subsingleton,
476+
apply subsingleton_of_subsingleton },
477+
intros w hw,
478+
refine ⟨⟨{0}, _⟩, _⟩,
479+
{ rw linear_independent_iff',
480+
intros,
481+
exact subsingleton.elim _ _ },
482+
{ exact hw.trans_eq (cardinal.mk_singleton _).symm },
483+
end
484+
485+
variables [no_zero_smul_divisors R M]
486+
487+
lemma dim_pos [nontrivial M] : 0 < module.rank R M :=
488+
begin
489+
obtain ⟨x, hx⟩ := exists_ne (0 : M),
490+
suffices : 1 ≤ module.rank R M,
491+
{ exact zero_lt_one.trans_le this },
492+
letI := module.nontrivial R M,
493+
suffices : linear_independent R (λ (y : ({x} : set M)), ↑y),
494+
{ simpa using (cardinal_le_dim_of_linear_independent this), },
495+
exact linear_independent_singleton hx
496+
end
497+
498+
variables [nontrivial R]
467499

468500
lemma dim_zero_iff_forall_zero : module.rank R M = 0 ↔ ∀ x : M, x = 0 :=
469501
begin
470502
refine ⟨λ h, _, λ h, _⟩,
471503
{ contrapose! h,
472504
obtain ⟨x, hx⟩ := h,
473-
suffices : 1 ≤ module.rank R M,
474-
{ intro h, exact this.not_lt (h.symm ▸ zero_lt_one) },
475-
suffices : linear_independent R (λ (y : ({x} : set M)), ↑y),
476-
{ simpa using (cardinal_le_dim_of_linear_independent this), },
477-
exact linear_independent_singleton hx },
505+
letI : nontrivial M := nontrivial_of_ne _ _ hx,
506+
exact dim_pos.ne' },
478507
{ have : (⊤ : submodule R M) = ⊥,
479508
{ ext x, simp [h x] },
480509
rw [←dim_top, this, dim_bot] }
481510
end
482511

512+
/-- See `dim_subsingleton` for the reason that `nontrivial R` is needed. -/
483513
lemma dim_zero_iff : module.rank R M = 0 ↔ subsingleton M :=
484514
dim_zero_iff_forall_zero.trans (subsingleton_iff_forall_eq 0).symm
485515

@@ -492,9 +522,6 @@ end
492522
lemma dim_pos_iff_nontrivial : 0 < module.rank R M ↔ nontrivial M :=
493523
dim_pos_iff_exists_ne_zero.trans (nontrivial_iff_exists_ne 0).symm
494524

495-
lemma dim_pos [h : nontrivial M] : 0 < module.rank R M :=
496-
dim_pos_iff_nontrivial.2 h
497-
498525
end rank_zero
499526

500527
section invariant_basis_number

0 commit comments

Comments
 (0)