Skip to content

Commit

Permalink
feat(linear_algebra): some easy linear map/equiv lemmas (#3890)
Browse files Browse the repository at this point in the history
From the sphere eversion project.
  • Loading branch information
PatrickMassot committed Aug 20, 2020
1 parent c9704ff commit 36386fc
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/linear_algebra/basic.lean
Expand Up @@ -1629,6 +1629,7 @@ rfl

lemma to_equiv_injective : function.injective (to_equiv : (M ≃ₗ[R] M₂) → M ≃ M₂) :=
λ ⟨_, _, _, _, _, _⟩ ⟨_, _, _, _, _, _⟩ h, linear_equiv.mk.inj_eq.mpr (equiv.mk.inj h)

end

section
Expand All @@ -1645,6 +1646,16 @@ section
variables {e e'}
@[ext] lemma ext (h : ∀ x, e x = e' x) : e = e' :=
to_equiv_injective (equiv.ext h)

variables [semimodule R M] [semimodule R M₂]

lemma eq_of_linear_map_eq {f f' : M ≃ₗ[R] M₂} (h : (f : M →ₗ[R] M₂) = f') : f = f' :=
begin
ext x,
change (f : M →ₗ[R] M₂) x = (f' : M →ₗ[R] M₂) x,
rw h
end

end

section
Expand Down Expand Up @@ -1691,6 +1702,23 @@ lemma symm_apply_eq {x y} : e.symm x = y ↔ x = e y := e.to_equiv.symm_apply_eq

lemma eq_symm_apply {x y} : y = e.symm x ↔ e y = x := e.to_equiv.eq_symm_apply

@[simp] lemma trans_symm [semimodule R M] [semimodule R M₂] (f : M ≃ₗ[R] M₂) :
f.trans f.symm = linear_equiv.refl R M :=
by { ext x, simp }

@[simp] lemma symm_trans [semimodule R M] [semimodule R M₂] (f : M ≃ₗ[R] M₂) :
f.symm.trans f = linear_equiv.refl R M₂ :=
by { ext x, simp }

@[simp, norm_cast] lemma refl_to_linear_map [semimodule R M] :
(linear_equiv.refl R M : M →ₗ[R] M) = linear_map.id :=
rfl

@[simp, norm_cast]
lemma comp_coe [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : M ≃ₗ[R] M₂)
(f' : M₂ ≃ₗ[R] M₃) : (f' : M₂ →ₗ[R] M₃).comp (f : M →ₗ[R] M₂) = (f.trans f' : M →ₗ[R] M₃) :=
rfl

@[simp] theorem map_add (a b : M) : e (a + b) = e a + e b := e.map_add' a b
@[simp] theorem map_zero : e 0 = 0 := e.to_linear_map.map_zero
@[simp] theorem map_smul (c : R) (x : M) : e (c • x) = c • e x := e.map_smul' c x
Expand Down
35 changes: 32 additions & 3 deletions src/linear_algebra/basis.lean
Expand Up @@ -69,12 +69,12 @@ open_locale classical big_operators
universe u

variables {ι : Type*} {ι' : Type*} {R : Type*} {K : Type*}
{M : Type*} {M' : Type*} {V : Type u} {V' : Type*}
{M : Type*} {M' M'' : Type*} {V : Type u} {V' : Type*}

section module
variables {v : ι → M}
variables [ring R] [add_comm_group M] [add_comm_group M']
variables [module R M] [module R M']
variables [ring R] [add_comm_group M] [add_comm_group M'] [add_comm_group M'']
variables [module R M] [module R M'] [module R M'']
variables {a b : R} {x y : M}

variables (R) (v)
Expand Down Expand Up @@ -869,6 +869,35 @@ def equiv_of_is_basis' {v : ι → M} {v' : ι' → M'} (f : M → M') (g : M'
λ y, congr_arg (λ h:M' →ₗ[R] M', h y) this,
..hv.constr (f ∘ v) }

@[simp] lemma equiv_of_is_basis_comp {ι'' : Type*} {v : ι → M} {v' : ι' → M'} {v'' : ι'' → M''}
(hv : is_basis R v) (hv' : is_basis R v') (hv'' : is_basis R v'')
(e : ι ≃ ι') (f : ι' ≃ ι'' ) :
(equiv_of_is_basis hv hv' e).trans (equiv_of_is_basis hv' hv'' f) =
equiv_of_is_basis hv hv'' (e.trans f) :=
begin
apply linear_equiv.eq_of_linear_map_eq,
apply hv.ext,
intros i,
simp [equiv_of_is_basis]
end

@[simp] lemma equiv_of_is_basis_refl :
equiv_of_is_basis hv hv (equiv.refl ι) = linear_equiv.refl R M :=
begin
apply linear_equiv.eq_of_linear_map_eq,
apply hv.ext,
intros i,
simp [equiv_of_is_basis]
end

lemma equiv_of_is_basis_trans_symm (e : ι ≃ ι') {v' : ι' → M'} (hv' : is_basis R v') :
(equiv_of_is_basis hv hv' e).trans (equiv_of_is_basis hv' hv e.symm) = linear_equiv.refl R M :=
by simp

lemma equiv_of_is_basis_symm_trans (e : ι ≃ ι') {v' : ι' → M'} (hv' : is_basis R v') :
(equiv_of_is_basis hv' hv e.symm).trans (equiv_of_is_basis hv hv' e) = linear_equiv.refl R M' :=
by simp

lemma is_basis_inl_union_inr {v : ι → M} {v' : ι' → M'}
(hv : is_basis R v) (hv' : is_basis R v') :
is_basis R (sum.elim (inl R M M' ∘ v) (inr R M M' ∘ v')) :=
Expand Down

0 comments on commit 36386fc

Please sign in to comment.