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

Commit f784cc6

Browse files
committed
feat(linear_algebra/tensor_product/matrix): connect with matrix.kronecker (#18616)
This shows that `to_matrix _ _ (tensor_product.map f g) = to_matrix _ _ f ⊗ₖ to_matrix _ _ g` , and the equivalent statement for `to_lin`.
1 parent 485b24e commit f784cc6

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/-
2+
Copyright (c) 2023 Eric Wieser. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Eric Wieser
5+
-/
6+
7+
import data.matrix.kronecker
8+
import linear_algebra.matrix.to_lin
9+
import linear_algebra.tensor_product_basis
10+
11+
/-!
12+
# Connections between `tensor_product` and `matrix`
13+
14+
This file contains results about the matrices corresponding to maps between tensor product types,
15+
where the correspondance is induced by `basis.tensor_product`
16+
17+
Notably, `tensor_product.to_matrix_map` shows that taking the tensor product of linear maps is
18+
equivalent to taking the kronecker product of their matrix representations.
19+
-/
20+
21+
variables {R : Type*} {M N P M' N' : Type*} {ι κ τ ι' κ' : Type*}
22+
variables [decidable_eq ι] [decidable_eq κ] [decidable_eq τ]
23+
variables [fintype ι] [fintype κ] [fintype τ] [fintype ι'] [fintype κ']
24+
variables [comm_ring R]
25+
variables [add_comm_group M] [add_comm_group N] [add_comm_group P]
26+
variables [add_comm_group M'] [add_comm_group N']
27+
variables [module R M] [module R N] [module R P] [module R M'] [module R N']
28+
variables (bM : basis ι R M) (bN : basis κ R N) (bP : basis τ R P)
29+
variables (bM' : basis ι' R M') (bN' : basis κ' R N')
30+
31+
open_locale kronecker
32+
open matrix linear_map
33+
34+
/-- The linear map built from `tensor_product.map` corresponds to the matrix built from
35+
`matrix.kronecker`. -/
36+
lemma tensor_product.to_matrix_map (f : M →ₗ[R] M') (g : N →ₗ[R] N') :
37+
to_matrix (bM.tensor_product bN) (bM'.tensor_product bN') (tensor_product.map f g)
38+
= to_matrix bM bM' f ⊗ₖ to_matrix bN bN' g :=
39+
begin
40+
ext ⟨i, j⟩ ⟨i', j'⟩,
41+
simp_rw [matrix.kronecker_map_apply, to_matrix_apply, basis.tensor_product_apply,
42+
tensor_product.map_tmul, basis.tensor_product_repr_tmul_apply],
43+
end
44+
45+
/-- The matrix built from `matrix.kronecker` corresponds to the linear map built from
46+
`tensor_product.map`. -/
47+
lemma matrix.to_lin_kronecker (A : matrix ι' ι R) (B : matrix κ' κ R) :
48+
to_lin (bM.tensor_product bN) (bM'.tensor_product bN') (A ⊗ₖ B) =
49+
tensor_product.map (to_lin bM bM' A) (to_lin bN bN' B) :=
50+
by rw [←linear_equiv.eq_symm_apply, to_lin_symm, tensor_product.to_matrix_map,
51+
to_matrix_to_lin, to_matrix_to_lin]
52+
53+
/-- `tensor_product.comm` corresponds to a permutation of the identity matrix. -/
54+
lemma tensor_product.to_matrix_comm :
55+
to_matrix (bM.tensor_product bN) (bN.tensor_product bM) (tensor_product.comm R M N)
56+
= (1 : matrix (ι × κ) (ι × κ) R).submatrix prod.swap id :=
57+
begin
58+
ext ⟨i, j⟩ ⟨i', j'⟩,
59+
simp_rw [to_matrix_apply, basis.tensor_product_apply, linear_equiv.coe_coe,
60+
tensor_product.comm_tmul, basis.tensor_product_repr_tmul_apply, matrix.submatrix_apply,
61+
prod.swap_prod_mk, id.def, basis.repr_self_apply, matrix.one_apply, prod.ext_iff, ite_and,
62+
@eq_comm _ i', @eq_comm _ j'],
63+
split_ifs; simp,
64+
end
65+
66+
/-- `tensor_product.assoc` corresponds to a permutation of the identity matrix. -/
67+
lemma tensor_product.to_matrix_assoc :
68+
to_matrix ((bM.tensor_product bN).tensor_product bP) (bM.tensor_product (bN.tensor_product bP))
69+
(tensor_product.assoc R M N P)
70+
= (1 : matrix (ι × κ × τ) (ι × κ × τ) R).submatrix id (equiv.prod_assoc _ _ _) :=
71+
begin
72+
ext ⟨i, j, k⟩ ⟨⟨i', j'⟩, k'⟩,
73+
simp_rw [to_matrix_apply, basis.tensor_product_apply, linear_equiv.coe_coe,
74+
tensor_product.assoc_tmul, basis.tensor_product_repr_tmul_apply, matrix.submatrix_apply,
75+
equiv.prod_assoc_apply, id.def, basis.repr_self_apply, matrix.one_apply, prod.ext_iff, ite_and,
76+
@eq_comm _ i', @eq_comm _ j', @eq_comm _ k'],
77+
split_ifs; simp,
78+
end

src/linear_algebra/tensor_product_basis.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ lemma basis.tensor_product_apply' (b : basis ι R M) (c : basis κ R N) (i : ι
4040
basis.tensor_product b c i = b i.1 ⊗ₜ c i.2 :=
4141
by simp [basis.tensor_product]
4242

43+
@[simp]
44+
lemma basis.tensor_product_repr_tmul_apply (b : basis ι R M) (c : basis κ R N)
45+
(m : M) (n : N) (i : ι) (j : κ) :
46+
(basis.tensor_product b c).repr (m ⊗ₜ n) (i, j) = b.repr m i * c.repr n j :=
47+
by simp [basis.tensor_product]
48+
4349
end comm_ring

0 commit comments

Comments
 (0)