Skip to content

Commit

Permalink
chore: unify monotonicity of rank lemmas (#17292)
Browse files Browse the repository at this point in the history
The names were all over the place. Rename:
* `rank_le_of_submodule` -> `Submodule.rank_mono`
* `Submodule.finrank_le_finrank_of_le` -> `Submodule.finrank_mono` (existing, up to unfolding `Monotone`)
* `rank_submodule_le` -> `Submodule.rank_le`

From LeanCamCombi
  • Loading branch information
YaelDillies committed Oct 3, 2024
1 parent f7338d0 commit 491935d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Archive/Sensitivity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ theorem exists_eigenvalue (H : Set (Q m.succ)) (hH : Card H ≥ 2 ^ m + 1) :
suffices 0 < dim (W ⊓ img) by
exact mod_cast exists_mem_ne_zero_of_rank_pos this
have dim_le : dim (W ⊔ img) ≤ 2 ^ (m + 1 : Cardinal) := by
convert ← rank_submodule_le (W ⊔ img)
convert ← Submodule.rank_le (W ⊔ img)
rw [← Nat.cast_succ]
apply dim_V
have dim_add : dim (W ⊔ img) + dim (W ⊓ img) = dim W + 2 ^ m := by
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/LinearAlgebra/AffineSpace/FiniteDimensional.lean
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ lemma AffineIndependent.card_le_card_of_subset_affineSpan {s t : Finset V}
have direction_le := AffineSubspace.direction_le (affineSpan_mono k hst)
rw [AffineSubspace.affineSpan_coe, direction_affineSpan, direction_affineSpan,
← @Subtype.range_coe _ (s : Set V), ← @Subtype.range_coe _ (t : Set V)] at direction_le
have finrank_le := add_le_add_right (Submodule.finrank_le_finrank_of_le direction_le) 1
have finrank_le := add_le_add_right (Submodule.finrank_mono direction_le) 1
-- We use `erw` to elide the difference between `↥s` and `↥(s : Set V)}`
erw [hs.finrank_vectorSpan_add_one] at finrank_le
simpa using finrank_le.trans <| finrank_vectorSpan_range_add_one_le _ _
Expand Down Expand Up @@ -371,7 +371,7 @@ alias ⟨Collinear.finrank_le_one, _⟩ := collinear_iff_finrank_le_one

/-- A subset of a collinear set is collinear. -/
theorem Collinear.subset {s₁ s₂ : Set P} (hs : s₁ ⊆ s₂) (h : Collinear k s₂) : Collinear k s₁ :=
(rank_le_of_submodule (vectorSpan k s₁) (vectorSpan k s₂) (vectorSpan_mono k hs)).trans h
(Submodule.rank_mono (vectorSpan_mono k hs)).trans h

/-- The `vectorSpan` of collinear points is finite-dimensional. -/
theorem Collinear.finiteDimensional_vectorSpan {s : Set P} (h : Collinear k s) :
Expand Down Expand Up @@ -634,7 +634,7 @@ alias ⟨Coplanar.finrank_le_two, _⟩ := coplanar_iff_finrank_le_two

/-- A subset of a coplanar set is coplanar. -/
theorem Coplanar.subset {s₁ s₂ : Set P} (hs : s₁ ⊆ s₂) (h : Coplanar k s₂) : Coplanar k s₁ :=
(rank_le_of_submodule (vectorSpan k s₁) (vectorSpan k s₂) (vectorSpan_mono k hs)).trans h
(Submodule.rank_mono (vectorSpan_mono k hs)).trans h

/-- Collinear points are coplanar. -/
theorem Collinear.coplanar {s : Set P} (h : Collinear k s) : Coplanar k s :=
Expand Down
11 changes: 7 additions & 4 deletions Mathlib/LinearAlgebra/Dimension/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,12 @@ theorem lift_rank_map_le (f : M →ₗ[R] M') (p : Submodule R M) :
theorem rank_map_le (f : M →ₗ[R] M₁) (p : Submodule R M) :
Module.rank R (p.map f) ≤ Module.rank R p := by simpa using lift_rank_map_le f p

theorem rank_le_of_submodule (s t : Submodule R M) (h : s ≤ t) :
Module.rank R s ≤ Module.rank R t :=
lemma Submodule.rank_mono {s t : Submodule R M} (h : s ≤ t) : Module.rank R s ≤ Module.rank R t :=
(Submodule.inclusion h).rank_le_of_injective fun ⟨x, _⟩ ⟨y, _⟩ eq =>
Subtype.eq <| show x = y from Subtype.ext_iff_val.1 eq

@[deprecated (since := "2024-09-30")] alias rank_le_of_submodule := Submodule.rank_mono

/-- Two linearly equivalent vector spaces have the same dimension, a version with different
universes. -/
theorem LinearEquiv.lift_rank_eq (f : M ≃ₗ[R] M') :
Expand Down Expand Up @@ -331,9 +332,11 @@ theorem rank_range_of_surjective (f : M →ₗ[R] M') (h : Surjective f) :
Module.rank R (LinearMap.range f) = Module.rank R M' := by
rw [LinearMap.range_eq_top.2 h, rank_top]

theorem rank_submodule_le (s : Submodule R M) : Module.rank R s ≤ Module.rank R M := by
theorem Submodule.rank_le (s : Submodule R M) : Module.rank R s ≤ Module.rank R M := by
rw [← rank_top R M]
exact rank_le_of_submodule _ _ le_top
exact rank_mono le_top

@[deprecated (since := "2024-10-02")] alias rank_submodule_le := Submodule.rank_le

theorem LinearMap.lift_rank_le_of_surjective (f : M →ₗ[R] M') (h : Surjective f) :
lift.{v} (Module.rank R M') ≤ lift.{v'} (Module.rank R M) := by
Expand Down
12 changes: 6 additions & 6 deletions Mathlib/LinearAlgebra/Dimension/Constructions.lean
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ variable [StrongRankCondition R]
/-- The dimension of a submodule is bounded by the dimension of the ambient space. -/
theorem Submodule.finrank_le [Module.Finite R M] (s : Submodule R M) :
finrank R s ≤ finrank R M :=
toNat_le_toNat (rank_submodule_le s) (rank_lt_aleph0 _ _)
toNat_le_toNat (Submodule.rank_le s) (rank_lt_aleph0 _ _)

/-- The dimension of a quotient is bounded by the dimension of the ambient space. -/
theorem Submodule.finrank_quotient_le [Module.Finite R M] (s : Submodule R M) :
Expand All @@ -386,12 +386,12 @@ theorem Submodule.finrank_map_le
finrank R (p.map f) ≤ finrank R p :=
finrank_le_finrank_of_rank_le_rank (lift_rank_map_le _ _) (rank_lt_aleph0 _ _)

theorem Submodule.finrank_le_finrank_of_le {s t : Submodule R M} [Module.Finite R t] (hst : s ≤ t) :
theorem Submodule.finrank_mono {s t : Submodule R M} [Module.Finite R t] (hst : s ≤ t) :
finrank R s ≤ finrank R t :=
calc
finrank R s = finrank R (s.comap t.subtype) :=
(Submodule.comapSubtypeEquivOfLe hst).finrank_eq.symm
_ ≤ finrank R t := Submodule.finrank_le _
Cardinal.toNat_le_toNat (Submodule.rank_mono hst) (rank_lt_aleph0 R ↥t)

@[deprecated (since := "2024-09-30")]
alias Submodule.finrank_le_finrank_of_le := Submodule.finrank_mono

end

Expand Down
6 changes: 3 additions & 3 deletions Mathlib/LinearAlgebra/Dimension/LinearMap.lean
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abbrev rank (f : V →ₗ[K] V') : Cardinal :=
Module.rank K (LinearMap.range f)

theorem rank_le_range (f : V →ₗ[K] V') : rank f ≤ Module.rank K V' :=
rank_submodule_le _
Submodule.rank_le _

theorem rank_le_domain (f : V →ₗ[K] V₁) : rank f ≤ Module.rank K V :=
rank_range_le _
Expand All @@ -46,7 +46,7 @@ theorem rank_zero [Nontrivial K] : rank (0 : V →ₗ[K] V') = 0 := by
variable [AddCommGroup V''] [Module K V'']

theorem rank_comp_le_left (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') : rank (f.comp g) ≤ rank f := by
refine rank_le_of_submodule _ _ ?_
refine Submodule.rank_mono ?_
rw [LinearMap.range_comp]
exact LinearMap.map_le_range

Expand Down Expand Up @@ -82,7 +82,7 @@ variable [AddCommGroup V'] [Module K V']
theorem rank_add_le (f g : V →ₗ[K] V') : rank (f + g) ≤ rank f + rank g :=
calc
rank (f + g) ≤ Module.rank K (LinearMap.range f ⊔ LinearMap.range g : Submodule K V') := by
refine rank_le_of_submodule _ _ ?_
refine Submodule.rank_mono ?_
exact LinearMap.range_le_iff_comap.2 <| eq_top_iff'.2 fun x =>
show f x + g x ∈ (LinearMap.range f ⊔ LinearMap.range g : Submodule K V') from
mem_sup.2 ⟨_, ⟨x, rfl⟩, _, ⟨x, rfl⟩, rfl⟩
Expand Down
20 changes: 2 additions & 18 deletions Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ instance finiteDimensional_submodule [FiniteDimensional K V] (S : Submodule K V)
· exact
iff_fg.1
(IsNoetherian.iff_rank_lt_aleph0.2
(lt_of_le_of_lt (rank_submodule_le _) (_root_.rank_lt_aleph0 K V)))
((Submodule.rank_le _).trans_lt (_root_.rank_lt_aleph0 K V)))
· infer_instance

/-- A quotient of a finite-dimensional space is also finite-dimensional. -/
Expand Down Expand Up @@ -374,8 +374,7 @@ theorem finiteDimensional_of_le {S₁ S₂ : Submodule K V} [FiniteDimensional K
FiniteDimensional K S₁ :=
haveI : IsNoetherian K S₂ := iff_fg.2 inferInstance
iff_fg.1
(IsNoetherian.iff_rank_lt_aleph0.2
(lt_of_le_of_lt (rank_le_of_submodule _ _ h) (rank_lt_aleph0 K S₂)))
(IsNoetherian.iff_rank_lt_aleph0.2 ((Submodule.rank_mono h).trans_lt (rank_lt_aleph0 K S₂)))

/-- The inf of two submodules, the first finite-dimensional, is
finite-dimensional. -/
Expand Down Expand Up @@ -694,21 +693,6 @@ noncomputable def fieldOfFiniteDimensional (F K : Type*) [Field F] [h : CommRing
{ divisionRingOfFiniteDimensional F K with
toCommRing := h }
end

namespace Submodule

section DivisionRing

variable [DivisionRing K] [AddCommGroup V] [Module K V] {V₂ : Type v'} [AddCommGroup V₂]
[Module K V₂]

theorem finrank_mono [FiniteDimensional K V] : Monotone fun s : Submodule K V => finrank K s :=
fun _ _ => finrank_le_finrank_of_le

end DivisionRing

end Submodule

section DivisionRing

variable [DivisionRing K] [AddCommGroup V] [Module K V]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/LinearDisjoint.lean
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ if any two elements of `↥(M ⊓ N)` are commutative, then the rank of `↥(M
theorem rank_inf_le_one_of_commute_of_flat (hf : Module.Flat R M ∨ Module.Flat R N)
(hc : ∀ (m n : ↥(M ⊓ N)), Commute m.1 n.1) : Module.rank R ↥(M ⊓ N) ≤ 1 := by
nontriviality R
refine rank_le fun s h ↦ ?_
refine _root_.rank_le fun s h ↦ ?_
by_contra hs
rw [not_le, ← Fintype.card_coe, Fintype.one_lt_card_iff_nontrivial] at hs
obtain ⟨a, b, hab⟩ := hs.exists_pair_ne
Expand Down

0 comments on commit 491935d

Please sign in to comment.