|
| 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 |
0 commit comments