File: Mathlib/LinearAlgebra/Dimension/RankNullity.lean

full_name: HasRankNullity.exists_set_linearIndependent
code: /--
`HasRankNullity.{u}` is a class of rings satisfying
1. Every `R`-module `M : Type u` has a linear independent subset of cardinality `Module.rank R M`.
2. `rank (M ⧸ N) + rank N = rank M` for every `R`-module `M : Type u` and every `N : Submodule R M`.

Usually such a ring satisfies `HasRankNullity.{w}` for all universes `w`, and the universe
argument is there because of technical limitations to universe polymorphism.

See `DivisionRing.hasRankNullity` and `IsDomain.hasRankNullity`.
-/
@[pp_with_univ]
class HasRankNullity (R : Type v) [inst : Ring R] : Prop where
  exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M],
    ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val
  rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M),
    Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M
goal: ∃ s, #↑s = Module.rank R M ∧ LinearIndependent (ι := ↑s) R Subtype.val

full_name: HasRankNullity.rank_quotient_add_rank
code: /--
`HasRankNullity.{u}` is a class of rings satisfying
1. Every `R`-module `M : Type u` has a linear independent subset of cardinality `Module.rank R M`.
2. `rank (M ⧸ N) + rank N = rank M` for every `R`-module `M : Type u` and every `N : Submodule R M`.

Usually such a ring satisfies `HasRankNullity.{w}` for all universes `w`, and the universe
argument is there because of technical limitations to universe polymorphism.

See `DivisionRing.hasRankNullity` and `IsDomain.hasRankNullity`.
-/
@[pp_with_univ]
class HasRankNullity (R : Type v) [inst : Ring R] : Prop where
  exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M],
    ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val
  rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M),
    Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M
goal: Module.rank R (M ⧸ N) + Module.rank R ↥N = Module.rank R M

full_name: HasRankNullity
code: /--
`HasRankNullity.{u}` is a class of rings satisfying
1. Every `R`-module `M : Type u` has a linear independent subset of cardinality `Module.rank R M`.
2. `rank (M ⧸ N) + rank N = rank M` for every `R`-module `M : Type u` and every `N : Submodule R M`.

Usually such a ring satisfies `HasRankNullity.{w}` for all universes `w`, and the universe
argument is there because of technical limitations to universe polymorphism.

See `DivisionRing.hasRankNullity` and `IsDomain.hasRankNullity`.
-/
@[pp_with_univ]
class HasRankNullity (R : Type v) [inst : Ring R] : Prop where
  exists_set_linearIndependent : ∀ (M : Type u) [AddCommGroup M] [Module R M],
    ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val
  rank_quotient_add_rank : ∀ {M : Type u} [AddCommGroup M] [Module R M] (N : Submodule R M),
    Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M
goal: Prop

full_name: rank_quotient_add_rank
code: lemma rank_quotient_add_rank (N : Submodule R M) :
    Module.rank R (M ⧸ N) + Module.rank R N = Module.rank R M 
goal: Module.rank R (M ⧸ N) + Module.rank R ↥N = Module.rank R M

full_name: exists_set_linearIndependent
code: lemma exists_set_linearIndependent :
    ∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val 
goal: ∃ s, #↑s = Module.rank R M ∧ LinearIndependent (ι := ↑s) R Subtype.val

full_name: nontrivial_of_hasRankNullity
code: theorem nontrivial_of_hasRankNullity : Nontrivial R 
goal: Nontrivial R

full_name: lift_rank_range_add_rank_ker
code: theorem lift_rank_range_add_rank_ker (f : M →ₗ[R] M') :
    lift.{u} (Module.rank R (LinearMap.range f)) + lift.{v} (Module.rank R (LinearMap.ker f)) =
      lift.{v} (Module.rank R M) 
goal: Cardinal.lift.{u, v} (Module.rank R ↥(LinearMap.range f)) + Cardinal.lift.{v, u} (Module.rank R ↥(LinearMap.ker f)) =
  Cardinal.lift.{v, u} (Module.rank R M)

full_name: rank_range_add_rank_ker
code: /-- The **rank-nullity theorem** -/
theorem rank_range_add_rank_ker (f : M →ₗ[R] M₁) :
    Module.rank R (LinearMap.range f) + Module.rank R (LinearMap.ker f) = Module.rank R M 
goal: Module.rank R ↥(LinearMap.range f) + Module.rank R ↥(LinearMap.ker f) = Module.rank R M

full_name: lift_rank_eq_of_surjective
code: theorem lift_rank_eq_of_surjective {f : M →ₗ[R] M'} (h : Surjective f) :
    lift.{v} (Module.rank R M) =
      lift.{u} (Module.rank R M') + lift.{v} (Module.rank R (LinearMap.ker f)) 
goal: Cardinal.lift.{v, u} (Module.rank R M) =
  Cardinal.lift.{u, v} (Module.rank R M') + Cardinal.lift.{v, u} (Module.rank R ↥(LinearMap.ker f))

full_name: rank_eq_of_surjective
code: theorem rank_eq_of_surjective {f : M →ₗ[R] M₁} (h : Surjective f) :
    Module.rank R M = Module.rank R M₁ + Module.rank R (LinearMap.ker f) 
goal: Module.rank R M = Module.rank R M₁ + Module.rank R ↥(LinearMap.ker f)

full_name: exists_linearIndependent_of_lt_rank
code: theorem exists_linearIndependent_of_lt_rank [StrongRankCondition R]
    {s : Set M} (hs : LinearIndependent (ι := s) R Subtype.val) :
    ∃ t, s ⊆ t ∧ #t = Module.rank R M ∧ LinearIndependent (ι := t) R Subtype.val 
goal: ∃ t, s ⊆ t ∧ #↑t = Module.rank R M ∧ LinearIndependent (ι := ↑t) R Subtype.val

full_name: exists_linearIndependent_cons_of_lt_rank
code: /-- Given a family of `n` linearly independent vectors in a space of dimension `> n`, one may extend
the family by another vector while retaining linear independence. -/
theorem exists_linearIndependent_cons_of_lt_rank [StrongRankCondition R] {n : ℕ} {v : Fin n → M}
    (hv : LinearIndependent R v) (h : n < Module.rank R M) :
    ∃ (x : M), LinearIndependent R (Fin.cons x v) 
goal: ∃ x, LinearIndependent R (Fin.cons x v)

full_name: exists_linearIndependent_snoc_of_lt_rank
code: /-- Given a family of `n` linearly independent vectors in a space of dimension `> n`, one may extend
the family by another vector while retaining linear independence. -/
theorem exists_linearIndependent_snoc_of_lt_rank [StrongRankCondition R] {n : ℕ} {v : Fin n → M}
    (hv : LinearIndependent R v) (h : n < Module.rank R M) :
    ∃ (x : M), LinearIndependent R (Fin.snoc v x) 
goal: ∃ x, LinearIndependent R (Fin.snoc v x)

full_name: exists_linearIndependent_pair_of_one_lt_rank
code: /-- Given a nonzero vector in a space of dimension `> 1`, one may find another vector linearly
independent of the first one. -/
theorem exists_linearIndependent_pair_of_one_lt_rank [StrongRankCondition R]
    [NoZeroSMulDivisors R M] (h : 1 < Module.rank R M) {x : M} (hx : x ≠ 0) :
    ∃ y, LinearIndependent R ![x, y] 
goal: ∃ y, LinearIndependent R ![x, y]

full_name: exists_smul_not_mem_of_rank_lt
code: theorem exists_smul_not_mem_of_rank_lt {N : Submodule R M} (h : Module.rank R N < Module.rank R M) :
    ∃ m : M, ∀ r : R, r ≠ 0 → r • m ∉ N 
goal: ∃ m, ∀ (r : R), r ≠ 0 → r • m ∉ N

full_name: Submodule.rank_sup_add_rank_inf_eq
code: theorem Submodule.rank_sup_add_rank_inf_eq (s t : Submodule R M) :
    Module.rank R (s ⊔ t : Submodule R M) + Module.rank R (s ⊓ t : Submodule R M) =
    Module.rank R s + Module.rank R t 
goal: Module.rank R ↥(s ⊔ t) + Module.rank R ↥(s ⊓ t) = Module.rank R ↥s + Module.rank R ↥t

full_name: Submodule.rank_add_le_rank_add_rank
code: theorem Submodule.rank_add_le_rank_add_rank (s t : Submodule R M) :
    Module.rank R (s ⊔ t : Submodule R M) ≤ Module.rank R s + Module.rank R t 
goal: Module.rank R ↥(s ⊔ t) ≤ Module.rank R ↥s + Module.rank R ↥t

full_name: exists_linearIndependent_snoc_of_lt_finrank
code: /-- Given a family of `n` linearly independent vectors in a finite-dimensional space of
dimension `> n`, one may extend the family by another vector while retaining linear independence. -/
theorem exists_linearIndependent_snoc_of_lt_finrank {n : ℕ} {v : Fin n → M}
    (hv : LinearIndependent R v) (h : n < finrank R M) :
    ∃ (x : M), LinearIndependent R (Fin.snoc v x) 
goal: ∃ x, LinearIndependent R (Fin.snoc v x)

full_name: exists_linearIndependent_cons_of_lt_finrank
code: /-- Given a family of `n` linearly independent vectors in a finite-dimensional space of
dimension `> n`, one may extend the family by another vector while retaining linear independence. -/
theorem exists_linearIndependent_cons_of_lt_finrank {n : ℕ} {v : Fin n → M}
    (hv : LinearIndependent R v) (h : n < finrank R M) :
    ∃ (x : M), LinearIndependent R (Fin.cons x v) 
goal: ∃ x, LinearIndependent R (Fin.cons x v)

full_name: exists_linearIndependent_pair_of_one_lt_finrank
code: /-- Given a nonzero vector in a finite-dimensional space of dimension `> 1`, one may find another
vector linearly independent of the first one. -/
theorem exists_linearIndependent_pair_of_one_lt_finrank [NoZeroSMulDivisors R M]
    (h : 1 < finrank R M) {x : M} (hx : x ≠ 0) :
    ∃ y, LinearIndependent R ![x, y] 
goal: ∃ y, LinearIndependent R ![x, y]