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

Commit 12bb9ae

Browse files
chore(linear_algebra/*): split lines and doc direct_sum/tensor_product (#6360)
This PR provides a short module doc to `direct_sum/tensor_product` (the file contains only one result). Furthermore, it splits lines in the `linear_algebra` folder. Co-authored-by: Julian-Kuelshammer <68201724+Julian-Kuelshammer@users.noreply.github.com>
1 parent a10c19d commit 12bb9ae

File tree

7 files changed

+34
-18
lines changed

7 files changed

+34
-18
lines changed

src/linear_algebra/basis.lean

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ lemma is_basis.injective [nontrivial R] (hv : is_basis R v) : injective v :=
9191
λ x y h, linear_independent.injective hv.1 h
9292

9393
lemma is_basis.range (hv : is_basis R v) : is_basis R (λ x, x : range v → M) :=
94-
⟨hv.1.to_subtype_range, by { convert hv.2, ext i, exact ⟨λ ⟨p, hp⟩, hp ▸ p.2, λ hi, ⟨⟨i, hi⟩, rfl⟩⟩ }⟩
94+
⟨hv.1.to_subtype_range,
95+
by { convert hv.2, ext i, exact ⟨λ ⟨p, hp⟩, hp ▸ p.2, λ hi, ⟨⟨i, hi⟩, rfl⟩⟩ }⟩
9596

9697
/-- Given a basis, any vector can be written as a linear combination of the basis vectors. They are
9798
given by this linear map. This is one direction of `module_equiv_finsupp`. -/
@@ -289,11 +290,13 @@ begin
289290
end
290291

291292
lemma linear_equiv_of_is_basis_trans_symm (e : ι ≃ ι') {v' : ι' → M'} (hv' : is_basis R v') :
292-
(linear_equiv_of_is_basis hv hv' e).trans (linear_equiv_of_is_basis hv' hv e.symm) = linear_equiv.refl R M :=
293+
(linear_equiv_of_is_basis hv hv' e).trans (linear_equiv_of_is_basis hv' hv e.symm) =
294+
linear_equiv.refl R M :=
293295
by simp
294296

295297
lemma linear_equiv_of_is_basis_symm_trans (e : ι ≃ ι') {v' : ι' → M'} (hv' : is_basis R v') :
296-
(linear_equiv_of_is_basis hv' hv e.symm).trans (linear_equiv_of_is_basis hv hv' e) = linear_equiv.refl R M' :=
298+
(linear_equiv_of_is_basis hv' hv e.symm).trans (linear_equiv_of_is_basis hv hv' e) =
299+
linear_equiv.refl R M' :=
297300
by simp
298301

299302
lemma is_basis_inl_union_inr {v : ι → M} {v' : ι' → M'}

src/linear_algebra/char_poly/coeff.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ We give methods for computing coefficients of the characteristic polynomial.
2121
2222
- `char_poly_degree_eq_dim` proves that the degree of the characteristic polynomial
2323
over a nonzero ring is the dimension of the matrix
24-
- `det_eq_sign_char_poly_coeff` proves that the determinant is the constant term of the characteristic
25-
polynomial, up to sign.
26-
- `trace_eq_neg_char_poly_coeff` proves that the trace is the negative of the (d-1)th coefficient of the
27-
characteristic polynomial, where d is the dimension of the matrix.
24+
- `det_eq_sign_char_poly_coeff` proves that the determinant is the constant term of the
25+
characteristic polynomial, up to sign.
26+
- `trace_eq_neg_char_poly_coeff` proves that the trace is the negative of the (d-1)th coefficient of
27+
the characteristic polynomial, where d is the dimension of the matrix.
2828
For a nonzero ring, this is the second-highest coefficient.
2929
3030
-/
@@ -187,8 +187,8 @@ end
187187
char_poly (M ^ p) = char_poly M :=
188188
by { have h := finite_field.char_poly_pow_card M, rwa zmod.card at h, }
189189

190-
lemma finite_field.trace_pow_card {K : Type*} [field K] [fintype K] [nonempty n] (M : matrix n n K) :
191-
trace n K K (M ^ (fintype.card K)) = (trace n K K M) ^ (fintype.card K) :=
190+
lemma finite_field.trace_pow_card {K : Type*} [field K] [fintype K] [nonempty n]
191+
(M : matrix n n K) : trace n K K (M ^ (fintype.card K)) = (trace n K K M) ^ (fintype.card K) :=
192192
by rw [trace_eq_neg_char_poly_coeff, trace_eq_neg_char_poly_coeff,
193193
finite_field.char_poly_pow_card, finite_field.pow_card]
194194

src/linear_algebra/determinant.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ lemma det_update_column_smul (M : matrix n n R) (j : n) (s : R) (u : n → R) :
254254
det (update_column M j $ s • u) = s * det (update_column M j u) :=
255255
begin
256256
simp only [det],
257-
have : ∀ σ : perm n, ∏ i, M.update_column j (s • u) (σ i) i = s * ∏ i, M.update_column j u (σ i) i,
257+
have : ∀ σ : perm n, ∏ i, M.update_column j (s • u) (σ i) i =
258+
s * ∏ i, M.update_column j u (σ i) i,
258259
{ intros σ,
259260
simp only [update_column_apply, prod_ite, filter_eq', finset.prod_singleton, finset.mem_univ,
260261
if_true, algebra.id.smul_eq_mul, pi.smul_apply],

src/linear_algebra/direct_sum/finsupp.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ noncomputable theory
2121
open_locale classical direct_sum
2222

2323
open set linear_map submodule
24-
variables {R : Type u} {M : Type v} {N : Type w} [ring R] [add_comm_group M] [module R M] [add_comm_group N] [module R N]
24+
variables {R : Type u} {M : Type v} {N : Type w} [ring R] [add_comm_group M] [module R M]
25+
[add_comm_group N] [module R N]
2526

2627
section finsupp_lequiv_direct_sum
2728

src/linear_algebra/direct_sum/tensor_product.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ Copyright (c) 2018 Kenny Lau. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau, Mario Carneiro
55
-/
6+
67
import linear_algebra.tensor_product
78
import linear_algebra.direct_sum_module
89

10+
/-!
11+
# Tensor products of direct sums
12+
13+
This file shows that taking `tensor_product`s commutes with taking `direct_sum`s in both arguments.
14+
-/
15+
916
section ring
1017

1118
namespace tensor_product

src/linear_algebra/matrix.lean

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ lemma is_basis.iff_det {v : ι → M} : is_basis R v ↔ is_unit (he.det v) :=
473473
begin
474474
split,
475475
{ intro hv,
476-
suffices : is_unit (linear_map.to_matrix he he (linear_equiv_of_is_basis he hv $ equiv.refl ι)).det,
476+
suffices :
477+
is_unit (linear_map.to_matrix he he (linear_equiv_of_is_basis he hv $ equiv.refl ι)).det,
477478
{ rw [is_basis.det_apply, is_basis.to_matrix_eq_to_matrix_constr],
478479
exact this },
479480
apply linear_equiv.is_unit_det },
@@ -748,7 +749,8 @@ reindex_refl_refl A
748749

749750
lemma reindex_mul [semiring R]
750751
(eₘ : m ≃ m') (eₙ : n ≃ n') (eₗ : l ≃ l') (M : matrix m n R) (N : matrix n l R) :
751-
(reindex_linear_equiv eₘ eₙ M) ⬝ (reindex_linear_equiv eₙ eₗ N) = reindex_linear_equiv eₘ eₗ (M ⬝ N) :=
752+
(reindex_linear_equiv eₘ eₙ M) ⬝ (reindex_linear_equiv eₙ eₗ N) =
753+
reindex_linear_equiv eₘ eₗ (M ⬝ N) :=
752754
begin
753755
ext i j,
754756
dsimp only [matrix.mul, matrix.dot_product],
@@ -761,7 +763,8 @@ types is an equivalence of algebras. -/
761763
def reindex_alg_equiv [comm_semiring R] [decidable_eq m] [decidable_eq n]
762764
(e : m ≃ n) : matrix m m R ≃ₐ[R] matrix n n R :=
763765
{ map_mul' := λ M N, by simp only [reindex_mul, linear_equiv.to_fun_apply, mul_eq_mul],
764-
commutes' := λ r, by { ext, simp [algebra_map, algebra.to_ring_hom], by_cases h : i = j; simp [h], },
766+
commutes' := λ r,
767+
by { ext, simp [algebra_map, algebra.to_ring_hom], by_cases h : i = j; simp [h], },
765768
..(reindex_linear_equiv e e) }
766769

767770
@[simp] lemma coe_reindex_alg_equiv [comm_semiring R] [decidable_eq m] [decidable_eq n]
@@ -916,9 +919,9 @@ if H : ∃ s : finset M, is_basis R (λ x, x : (↑s : set M) → M)
916919
then trace_aux R (classical.some_spec H)
917920
else 0
918921

919-
theorem trace_eq_matrix_trace (R : Type u) [comm_ring R] {M : Type v} [add_comm_group M] [module R M]
920-
{ι : Type w} [fintype ι] [decidable_eq ι] {b : ι → M} (hb : is_basis R b) (f : M →ₗ[R] M) :
921-
trace R M f = matrix.trace ι R R (linear_map.to_matrix hb hb f) :=
922+
theorem trace_eq_matrix_trace (R : Type u) [comm_ring R] {M : Type v} [add_comm_group M]
923+
[module R M] {ι : Type w} [fintype ι] [decidable_eq ι] {b : ι → M} (hb : is_basis R b)
924+
(f : M →ₗ[R] M) : trace R M f = matrix.trace ι R R (linear_map.to_matrix hb hb f) :=
922925
have ∃ s : finset M, is_basis R (λ x, x : (↑s : set M) → M),
923926
from ⟨finset.univ.image b,
924927
by { rw [finset.coe_image, finset.coe_univ, set.image_univ], exact hb.range }⟩,

src/linear_algebra/special_linear_group.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ section
5050

5151
variables (n : Type u) [decidable_eq n] [fintype n] (R : Type v) [comm_ring R]
5252

53-
/-- `special_linear_group n R` is the group of `n` by `n` `R`-matrices with determinant equal to 1. -/
53+
/-- `special_linear_group n R` is the group of `n` by `n` `R`-matrices with determinant equal to 1.
54+
-/
5455
def special_linear_group := { A : matrix n n R // A.det = 1 }
5556

5657
end

0 commit comments

Comments
 (0)