# mathlibdocumentation

linear_algebra.dimension

# Dimension of modules and vector spaces #

## Main definitions #

• The rank of a module is defined as module.rank : cardinal. This is defined as the supremum of the cardinalities of linearly independent subsets.

Although this definition works for any module over a (semi)ring, for now we quickly specialize to division rings and then to fields. There's lots of generalization still to be done.

## Main statements #

• mk_eq_mk_of_basis: the dimension theorem, any two bases of the same vector space have the same cardinality.
• dim_quotient_add_dim: if V₁ is a submodule of V, then module.rank (V/V₁) + module.rank V₁ = module.rank V.
• dim_range_add_dim_ker: the rank-nullity theorem.

## Implementation notes #

Many theorems in this file are not universe-generic when they relate dimensions in different universes. They should be as general as they can be without inserting lifts. The types V, V', ... all live in different universes, and V₁, V₂, ... all live in the same universe.

def module.rank (K : Type u) (V : Type v) [semiring K] [ V] :

The rank of a module, defined as a term of type cardinal.

We define this as the supremum of the cardinalities of linearly independent subsets.

In a vector space, this is the same as the dimension of the space (i.e. the cardinality of any basis).

The definition is marked as protected to avoid conflicts with _root_.rank, the rank of a linear map.

Equations
theorem basis.le_span {K : Type u} {V : Type v} {ι : Type w} [ V] {J : set V} (v : K V) (hJ : = ) :
theorem mk_eq_mk_of_basis {K : Type u} {V : Type v} {ι : Type w} {ι' : Type w'} [ V] (v : K V) (v' : basis ι' K V) :
(# ι).lift = (# ι').lift

The dimension theorem: if v and v' are two bases, their index types have the same cardinalities.

theorem mk_eq_mk_of_basis' {K : Type u} {V : Type v} {ι : Type w} [ V] {ι' : Type w} (v : K V) (v' : basis ι' K V) :
# ι = # ι'
theorem basis.mk_eq_dim'' {K : Type u} {V : Type v} [ V] {ι : Type v} (v : K V) :
# ι = V
theorem basis.mk_range_eq_dim {K : Type u} {V : Type v} {ι : Type w} [ V] (v : K V) :
theorem basis.mk_eq_dim {K : Type u} {V : Type v} {ι : Type w} [ V] (v : K V) :
(# ι).lift = V).lift
theorem basis.mk_eq_dim' {K : Type u} {V : Type v} {ι : Type w} [ V] (v : K V) :
(# ι).lift = V).lift
theorem dim_le {K : Type u} {V : Type v} [ V] {n : } (H : ∀ (s : finset V), (λ (i : s), i)s.card n) :
V n
theorem basis.nonempty_fintype_index_of_dim_lt_omega {K : Type u} {V : Type v} [ V] {ι : Type u_1} (b : K V) (h : V < cardinal.omega) :

If a vector space has a finite dimension, all bases are indexed by a finite type.

def basis.fintype_index_of_dim_lt_omega {K : Type u} {V : Type v} [ V] {ι : Type u_1} (b : K V) (h : V < cardinal.omega) :

If a vector space has a finite dimension, all bases are indexed by a finite type.

Equations
theorem basis.finite_index_of_dim_lt_omega {K : Type u} {V : Type v} [ V] {ι : Type u_1} {s : set ι} (b : K V) (h : V < cardinal.omega) :

If a vector space has a finite dimension, all bases are indexed by a finite set.

theorem basis.finite_of_vector_space_index_of_dim_lt_omega {K : Type u} {V : Type v} [ V] (h : V < cardinal.omega) :

If a vector space has a finite dimension, the index set of basis.of_vector_space is finite.

theorem linear_equiv.lift_dim_eq {K : Type u} {V : Type v} {V' : Type v'} [ V] [add_comm_group V'] [ V'] (f : V ≃ₗ[K] V') :
V).lift = V').lift

Two linearly equivalent vector spaces have the same dimension, a version with different universes.

theorem linear_equiv.dim_eq {K : Type u} {V V₁ : Type v} [ V] [add_comm_group V₁] [ V₁] (f : V ≃ₗ[K] V₁) :
V = V₁

Two linearly equivalent vector spaces have the same dimension.

theorem nonempty_linear_equiv_of_lift_dim_eq {K : Type u} {V : Type v} {V' : Type v'} [ V] [add_comm_group V'] [ V'] (cond : V).lift = V').lift) :

Two vector spaces are isomorphic if they have the same dimension.

theorem nonempty_linear_equiv_of_dim_eq {K : Type u} {V V₁ : Type v} [ V] [add_comm_group V₁] [ V₁] (cond : V = V₁) :
nonempty (V ≃ₗ[K] V₁)

Two vector spaces are isomorphic if they have the same dimension.

def linear_equiv.of_lift_dim_eq {K : Type u} (V : Type v) (V' : Type v') [ V] [add_comm_group V'] [ V'] (cond : V).lift = V').lift) :
V ≃ₗ[K] V'

Two vector spaces are isomorphic if they have the same dimension.

Equations
• cond =
def linear_equiv.of_dim_eq {K : Type u} (V V₁ : Type v) [ V] [add_comm_group V₁] [ V₁] (cond : V = V₁) :
V ≃ₗ[K] V₁

Two vector spaces are isomorphic if they have the same dimension.

Equations
• cond =
theorem linear_equiv.nonempty_equiv_iff_lift_dim_eq {K : Type u} {V : Type v} {V' : Type v'} [ V] [add_comm_group V'] [ V'] :
nonempty (V ≃ₗ[K] V') V).lift = V').lift

Two vector spaces are isomorphic if and only if they have the same dimension.

theorem linear_equiv.nonempty_equiv_iff_dim_eq {K : Type u} {V V₁ : Type v} [ V] [add_comm_group V₁] [ V₁] :
nonempty (V ≃ₗ[K] V₁) V = V₁

Two vector spaces are isomorphic if and only if they have the same dimension.

@[simp]
theorem dim_bot {K : Type u} {V : Type v} [ V] :
= 0
@[simp]
theorem dim_top {K : Type u} {V : Type v} [ V] :
= V
theorem dim_of_field (K : Type u_1) [field K] :
K = 1
theorem dim_span {K : Type u} {V : Type v} {ι : Type w} [ V] {v : ι → V} (hv : v) :
theorem dim_span_set {K : Type u} {V : Type v} [ V] {s : set V} (hs : (λ (x : s), x)) :
s) = # s
theorem cardinal_lift_le_dim_of_linear_independent {K : Type u} {V : Type v} [ V] {ι : Type w} {v : ι → V} (hv : v) :
(# ι).lift V).lift
theorem cardinal_le_dim_of_linear_independent {K : Type u} {V : Type v} [ V] {ι : Type v} {v : ι → V} (hv : v) :
# ι V
theorem cardinal_le_dim_of_linear_independent' {K : Type u} {V : Type v} [ V] {s : set V} (hs : (λ (x : s), x)) :
# s V
theorem dim_span_le {K : Type u} {V : Type v} [ V] (s : set V) :
s) # s
theorem dim_span_of_finset {K : Type u} {V : Type v} [ V] (s : finset V) :
theorem dim_prod {K : Type u} {V V₁ : Type v} [ V] [add_comm_group V₁] [ V₁] :
(V × V₁) = V + V₁
theorem dim_quotient_add_dim {K : Type u} {V : Type v} [field K] [ V] (p : V) :
+ p = V
theorem dim_quotient_le {K : Type u} {V : Type v} [field K] [ V] (p : V) :
V
theorem dim_range_add_dim_ker {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) :
(f.range) + (f.ker) = V

rank-nullity theorem

theorem dim_range_le {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) :
(f.range) V
theorem dim_map_le {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) (p : V) :
p) p
theorem dim_range_of_surjective {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] (f : V →ₗ[K] V') (h : function.surjective f) :
(f.range) = V'
theorem dim_eq_of_surjective {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) (h : function.surjective f) :
V = V₁ + (f.ker)
theorem dim_le_of_surjective {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) (h : function.surjective f) :
V₁ V
theorem dim_eq_of_injective {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) (h : function.injective f) :
V = (f.range)
theorem dim_submodule_le {K : Type u} {V : Type v} [field K] [ V] (s : V) :
s V
theorem dim_le_of_injective {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) (h : function.injective f) :
V V₁
theorem dim_le_of_submodule {K : Type u} {V : Type v} [field K] [ V] (s t : V) (h : s t) :
theorem linear_independent_le_dim {K : Type u} {V : Type v} {ι : Type w} [field K] [ V] {v : ι → V} (hv : v) :
(# ι).lift V).lift
theorem linear_independent_le_dim' {K : Type u} {V : Type v} {ι : Type w} [field K] [ V] {v : ι → V} (hs : v) :
(# ι).lift V).lift
theorem dim_add_dim_split {K : Type u} {V V₁ V₂ V₃ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] [add_comm_group V₂] [ V₂] [add_comm_group V₃] [ V₃] (db : V₂ →ₗ[K] V) (eb : V₃ →ₗ[K] V) (cd : V₁ →ₗ[K] V₂) (ce : V₁ →ₗ[K] V₃) (hde : db.range eb.range) (hgd : cd.ker = ) (eq : db.comp cd = eb.comp ce) (eq₂ : ∀ (d : V₂) (e : V₃), db d = eb e(∃ (c : V₁), cd c = d ce c = e)) :
V + V₁ = V₂ + V₃

This is mostly an auxiliary lemma for dim_sup_add_dim_inf_eq.

theorem dim_sup_add_dim_inf_eq {K : Type u} {V : Type v} [field K] [ V] (s t : V) :
(s t) + (s t) = s + t
theorem dim_add_le_dim_add_dim {K : Type u} {V : Type v} [field K] [ V] (s t : V) :
(s t) s + t
theorem dim_pi {K : Type u} {η : Type u₁'} {φ : η → Type u_1} [field K] [fintype η] [Π (i : η), add_comm_group (φ i)] [Π (i : η), (φ i)] :
(Π (i : η), φ i) = cardinal.sum (λ (i : η), (φ i))
theorem dim_fun {K : Type u} [field K] {V η : Type u} [fintype η] [ V] :
(η → V) = ((fintype.card η)) * V
theorem dim_fun_eq_lift_mul {K : Type u} {V : Type v} {η : Type u₁'} [field K] [ V] [fintype η] :
(η → V) = ((fintype.card η)) * V).lift
theorem dim_fun' {K : Type u} {η : Type u₁'} [field K] [fintype η] :
(η → K) = (fintype.card η)
theorem dim_fin_fun {K : Type u} [field K] (n : ) :
(fin n → K) = n
theorem exists_mem_ne_zero_of_ne_bot {K : Type u} {V : Type v} [field K] [ V] {s : V} (h : s ) :
∃ (b : V), b s b 0
theorem exists_mem_ne_zero_of_dim_pos {K : Type u} {V : Type v} [field K] [ V] {s : V} (h : 0 < s) :
∃ (b : V), b s b 0
def rank {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] (f : V →ₗ[K] V') :

rank f is the rank of a linear_map f, defined as the dimension of f.range.

Equations
theorem rank_le_domain {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) :
rank f V
theorem rank_le_range {K : Type u} {V V₁ : Type v} [field K] [ V] [add_comm_group V₁] [ V₁] (f : V →ₗ[K] V₁) :
rank f V₁
theorem rank_add_le {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] (f g : V →ₗ[K] V') :
rank (f + g) rank f + rank g
@[simp]
theorem rank_zero {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] :
rank 0 = 0
theorem rank_finset_sum_le {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] {η : Type u_1} (s : finset η) (f : η → (V →ₗ[K] V')) :
rank (∑ (d : η) in s, f d) ∑ (d : η) in s, rank (f d)
theorem rank_comp_le1 {K : Type u} {V : Type v} {V' : Type v'} {V'' : Type v''} [field K] [ V] [add_comm_group V'] [ V'] [add_comm_group V''] [ V''] (g : V →ₗ[K] V') (f : V' →ₗ[K] V'') :
rank (f.comp g) rank f
theorem rank_comp_le2 {K : Type u} {V : Type v} {V' V'₁ : Type v'} [field K] [ V] [add_comm_group V'] [ V'] [add_comm_group V'₁] [ V'₁] (g : V →ₗ[K] V') (f : V' →ₗ[K] V'₁) :
rank (f.comp g) rank g
theorem dim_zero_iff_forall_zero {K : Type u} {V : Type v} [field K] [ V] :
V = 0 ∀ (x : V), x = 0
theorem dim_zero_iff {K : Type u} {V : Type v} [field K] [ V] :
V = 0
def basis.of_dim_eq_zero {K : Type u} {V : Type v} [field K] [ V] {ι : Type u_1} [is_empty ι] (hV : V = 0) :
K V

The ι indexed basis on V, where ι is an empty type and V is zero-dimensional.

See also finite_dimensional.fin_basis.

Equations
@[simp]
theorem basis.of_dim_eq_zero_apply {K : Type u} {V : Type v} [field K] [ V] {ι : Type u_1} [is_empty ι] (hV : V = 0) (i : ι) :
i = 0
theorem dim_pos_iff_exists_ne_zero {K : Type u} {V : Type v} [field K] [ V] :
0 < V ∃ (x : V), x 0
theorem dim_pos_iff_nontrivial {K : Type u} {V : Type v} [field K] [ V] :
0 < V
theorem dim_pos {K : Type u} {V : Type v} [field K] [ V] [h : nontrivial V] :
0 < V
theorem le_dim_iff_exists_linear_independent {K : Type u} {V : Type v} [field K] [ V] {c : cardinal} :
c V ∃ (s : set V), # s = c
theorem le_dim_iff_exists_linear_independent_finset {K : Type u} {V : Type v} [field K] [ V] {n : } :
n V ∃ (s : finset V), s.card = n
theorem le_rank_iff_exists_linear_independent {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] {c : cardinal} {f : V →ₗ[K] V'} :
c rank f ∃ (s : set V), (# s).lift = c.lift (λ (x : s), f x)
theorem le_rank_iff_exists_linear_independent_finset {K : Type u} {V : Type v} {V' : Type v'} [field K] [ V] [add_comm_group V'] [ V'] {n : } {f : V →ₗ[K] V'} :
n rank f ∃ (s : finset V), s.card = n (λ (x : s), f x)
theorem dim_le_one_iff {K : Type u} {V : Type v} [field K] [ V] :
V 1 ∃ (v₀ : V), ∀ (v : V), ∃ (r : K), r v₀ = v

A vector space has dimension at most 1 if and only if there is a single vector of which all vectors are multiples.

theorem dim_submodule_le_one_iff {K : Type u} {V : Type v} [field K] [ V] (s : V) :
s 1 ∃ (v₀ : V) (H : v₀ s), s {v₀}

A submodule has dimension at most 1 if and only if there is a single vector in the submodule such that the submodule is contained in its span.

theorem dim_submodule_le_one_iff' {K : Type u} {V : Type v} [field K] [ V] (s : V) :
s 1 ∃ (v₀ : V), s {v₀}

A submodule has dimension at most 1 if and only if there is a single vector, not necessarily in the submodule, such that the submodule is contained in its span.

theorem linear_equiv.dim_eq_lift {K : Type u} {V : Type v} {E : Type v'} [ V] [ E] (f : V ≃ₗ[K] E) :
V).lift = E).lift

Version of linear_equiv.dim_eq without universe constraints.