Skip to content

Commit fe59037

Browse files
committed
feat(LinearAlgebra/TensorProduct/Basic): add LinearEquiv.(l|r)Tensor (#11731)
- add `LinearMap.(l|r)Tensor` and their properties - add `congr_symm`, `congr_refl_refl`, `congr_trans`, `congr_mul`, `congr_pow` and `congr_zpow`
1 parent b856377 commit fe59037

File tree

3 files changed

+139
-3
lines changed

3 files changed

+139
-3
lines changed

Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid
138138
[AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] :
139139
(((assoc R X Y Z).toLinearMap.lTensor W).comp
140140
(assoc R W (X ⊗[R] Y) Z).toLinearMap).comp
141-
((assoc R W X Y).rTensor Z) =
141+
((assoc R W X Y).toLinearMap.rTensor Z) =
142142
(assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by
143143
apply TensorProduct.ext_fourfold
144144
intro w x y z

Mathlib/LinearAlgebra/TensorProduct/Basic.lean

Lines changed: 137 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,30 @@ theorem congr_symm_tmul (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) (p : P) (q : Q)
10321032
rfl
10331033
#align tensor_product.congr_symm_tmul TensorProduct.congr_symm_tmul
10341034

1035+
theorem congr_symm (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) : (congr f g).symm = congr f.symm g.symm := rfl
1036+
1037+
@[simp] theorem congr_refl_refl : congr (.refl R M) (.refl R N) = .refl R _ :=
1038+
LinearEquiv.toLinearMap_injective <| ext' fun _ _ ↦ rfl
1039+
1040+
theorem congr_trans (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) (f' : P ≃ₗ[R] S) (g' : Q ≃ₗ[R] T) :
1041+
congr (f ≪≫ₗ f') (g ≪≫ₗ g') = congr f g ≪≫ₗ congr f' g' :=
1042+
LinearEquiv.toLinearMap_injective <| map_comp _ _ _ _
1043+
1044+
theorem congr_mul (f : M ≃ₗ[R] M) (g : N ≃ₗ[R] N) (f' : M ≃ₗ[R] M) (g' : N ≃ₗ[R] N) :
1045+
congr (f * f') (g * g') = congr f g * congr f' g' := congr_trans _ _ _ _
1046+
1047+
@[simp] theorem congr_pow (f : M ≃ₗ[R] M) (g : N ≃ₗ[R] N) (n : ℕ) :
1048+
congr f g ^ n = congr (f ^ n) (g ^ n) := by
1049+
induction n with
1050+
| zero => exact congr_refl_refl.symm
1051+
| succ n ih => simp_rw [pow_succ, ih, congr_mul]
1052+
1053+
@[simp] theorem congr_zpow (f : M ≃ₗ[R] M) (g : N ≃ₗ[R] N) (n : ℤ) :
1054+
congr f g ^ n = congr (f ^ n) (g ^ n) := by
1055+
induction n with
1056+
| ofNat n => exact congr_pow _ _ _
1057+
| negSucc n => simp_rw [zpow_negSucc, congr_pow]; exact congr_symm _ _
1058+
10351059
variable (R M N P Q)
10361060

10371061
/-- A tensor product analogue of `mul_left_comm`. -/
@@ -1121,16 +1145,19 @@ theorem tensorTensorTensorAssoc_symm_tmul (m : M) (n : N) (p : P) (q : Q) :
11211145
end TensorProduct
11221146

11231147
open scoped TensorProduct
1148+
11241149
namespace LinearMap
11251150

11261151
variable {N}
11271152

1128-
/-- `lTensor M f : M ⊗ N →ₗ M ⊗ P` is the natural linear map induced by `f : N →ₗ P`. -/
1153+
/-- `LinearMap.lTensor M f : M ⊗ N →ₗ M ⊗ P` is the natural linear map
1154+
induced by `f : N →ₗ P`. -/
11291155
def lTensor (f : N →ₗ[R] P) : M ⊗[R] N →ₗ[R] M ⊗[R] P :=
11301156
TensorProduct.map id f
11311157
#align linear_map.ltensor LinearMap.lTensor
11321158

1133-
/-- `rTensor f M : N₁ ⊗ M →ₗ N₂ ⊗ M` is the natural linear map induced by `f : N₁ →ₗ N₂`. -/
1159+
/-- `LinearMap.rTensor M f : N₁ ⊗ M →ₗ N₂ ⊗ M` is the natural linear map
1160+
induced by `f : N₁ →ₗ N₂`. -/
11341161
def rTensor (f : N →ₗ[R] P) : N ⊗[R] M →ₗ[R] P ⊗[R] M :=
11351162
TensorProduct.map f id
11361163
#align linear_map.rtensor LinearMap.rTensor
@@ -1355,6 +1382,114 @@ theorem lTensor_pow (f : N →ₗ[R] N) (n : ℕ) : f.lTensor M ^ n = (f ^ n).lT
13551382

13561383
end LinearMap
13571384

1385+
namespace LinearEquiv
1386+
1387+
variable {N}
1388+
1389+
/-- `LinearEquiv.lTensor M f : M ⊗ N ≃ₗ M ⊗ P` is the natural linear equivalence
1390+
induced by `f : N ≃ₗ P`. -/
1391+
def lTensor (f : N ≃ₗ[R] P) : M ⊗[R] N ≃ₗ[R] M ⊗[R] P := TensorProduct.congr (refl R M) f
1392+
1393+
/-- `LinearEquiv.rTensor M f : N₁ ⊗ M ≃ₗ N₂ ⊗ M` is the natural linear equivalence
1394+
induced by `f : N₁ ≃ₗ N₂`. -/
1395+
def rTensor (f : N ≃ₗ[R] P) : N ⊗[R] M ≃ₗ[R] P ⊗[R] M := TensorProduct.congr f (refl R M)
1396+
1397+
variable (g : P ≃ₗ[R] Q) (f : N ≃ₗ[R] P) (m : M) (n : N) (p : P) (x : M ⊗[R] N) (y : N ⊗[R] M)
1398+
1399+
@[simp] theorem coe_lTensor : lTensor M f = (f : N →ₗ[R] P).lTensor M := rfl
1400+
1401+
@[simp] theorem coe_lTensor_symm : (lTensor M f).symm = (f.symm : P →ₗ[R] N).lTensor M := rfl
1402+
1403+
@[simp] theorem coe_rTensor : rTensor M f = (f : N →ₗ[R] P).rTensor M := rfl
1404+
1405+
@[simp] theorem coe_rTensor_symm : (rTensor M f).symm = (f.symm : P →ₗ[R] N).rTensor M := rfl
1406+
1407+
@[simp] theorem lTensor_tmul : f.lTensor M (m ⊗ₜ n) = m ⊗ₜ f n := rfl
1408+
1409+
@[simp] theorem lTensor_symm_tmul : (f.lTensor M).symm (m ⊗ₜ p) = m ⊗ₜ f.symm p := rfl
1410+
1411+
@[simp] theorem rTensor_tmul : f.rTensor M (n ⊗ₜ m) = f n ⊗ₜ m := rfl
1412+
1413+
@[simp] theorem rTensor_symm_tmul : (f.rTensor M).symm (p ⊗ₜ m) = f.symm p ⊗ₜ m := rfl
1414+
1415+
lemma comm_trans_rTensor_trans_comm_eq (g : N ≃ₗ[R] P) :
1416+
TensorProduct.comm R Q N ≪≫ₗ rTensor Q g ≪≫ₗ TensorProduct.comm R P Q = lTensor Q g :=
1417+
toLinearMap_injective <| TensorProduct.ext rfl
1418+
1419+
lemma comm_trans_lTensor_trans_comm_eq (g : N ≃ₗ[R] P) :
1420+
TensorProduct.comm R N Q ≪≫ₗ lTensor Q g ≪≫ₗ TensorProduct.comm R Q P = rTensor Q g :=
1421+
toLinearMap_injective <| TensorProduct.ext rfl
1422+
1423+
theorem lTensor_trans : (f ≪≫ₗ g).lTensor M = f.lTensor M ≪≫ₗ g.lTensor M :=
1424+
toLinearMap_injective <| LinearMap.lTensor_comp M _ _
1425+
1426+
theorem lTensor_trans_apply : (f ≪≫ₗ g).lTensor M x = g.lTensor M (f.lTensor M x) :=
1427+
LinearMap.lTensor_comp_apply M _ _ x
1428+
1429+
theorem rTensor_trans : (f ≪≫ₗ g).rTensor M = f.rTensor M ≪≫ₗ g.rTensor M :=
1430+
toLinearMap_injective <| LinearMap.rTensor_comp M _ _
1431+
1432+
theorem rTensor_trans_apply : (f ≪≫ₗ g).rTensor M y = g.rTensor M (f.rTensor M y) :=
1433+
LinearMap.rTensor_comp_apply M _ _ y
1434+
1435+
theorem lTensor_mul (f g : N ≃ₗ[R] N) : (f * g).lTensor M = f.lTensor M * g.lTensor M :=
1436+
lTensor_trans M f g
1437+
1438+
theorem rTensor_mul (f g : N ≃ₗ[R] N) : (f * g).rTensor M = f.rTensor M * g.rTensor M :=
1439+
rTensor_trans M f g
1440+
1441+
variable (N)
1442+
1443+
@[simp] theorem lTensor_refl : (refl R N).lTensor M = refl R _ := TensorProduct.congr_refl_refl
1444+
1445+
theorem lTensor_refl_apply : (refl R N).lTensor M x = x := by rw [lTensor_refl, refl_apply]
1446+
1447+
@[simp] theorem rTensor_refl : (refl R N).rTensor M = refl R _ := TensorProduct.congr_refl_refl
1448+
1449+
theorem rTensor_refl_apply : (refl R N).rTensor M y = y := by rw [rTensor_refl, refl_apply]
1450+
1451+
variable {N}
1452+
1453+
@[simp] theorem rTensor_trans_lTensor (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) :
1454+
f.rTensor N ≪≫ₗ g.lTensor P = TensorProduct.congr f g :=
1455+
toLinearMap_injective <| LinearMap.lTensor_comp_rTensor M _ _
1456+
1457+
@[simp] theorem lTensor_trans_rTensor (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) :
1458+
g.lTensor M ≪≫ₗ f.rTensor Q = TensorProduct.congr f g :=
1459+
toLinearMap_injective <| LinearMap.rTensor_comp_lTensor M _ _
1460+
1461+
@[simp] theorem rTensor_trans_congr (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) (f' : S ≃ₗ[R] M) :
1462+
f'.rTensor _ ≪≫ₗ TensorProduct.congr f g = TensorProduct.congr (f' ≪≫ₗ f) g :=
1463+
toLinearMap_injective <| LinearMap.map_comp_rTensor M _ _ _
1464+
1465+
@[simp] theorem lTensor_trans_congr (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) (g' : S ≃ₗ[R] N) :
1466+
g'.lTensor _ ≪≫ₗ TensorProduct.congr f g = TensorProduct.congr f (g' ≪≫ₗ g) :=
1467+
toLinearMap_injective <| LinearMap.map_comp_lTensor M _ _ _
1468+
1469+
@[simp] theorem congr_trans_rTensor (f' : P ≃ₗ[R] S) (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) :
1470+
TensorProduct.congr f g ≪≫ₗ f'.rTensor _ = TensorProduct.congr (f ≪≫ₗ f') g :=
1471+
toLinearMap_injective <| LinearMap.rTensor_comp_map M _ _ _
1472+
1473+
@[simp] theorem congr_trans_lTensor (g' : Q ≃ₗ[R] S) (f : M ≃ₗ[R] P) (g : N ≃ₗ[R] Q) :
1474+
TensorProduct.congr f g ≪≫ₗ g'.lTensor _ = TensorProduct.congr f (g ≪≫ₗ g') :=
1475+
toLinearMap_injective <| LinearMap.lTensor_comp_map M _ _ _
1476+
1477+
variable {M}
1478+
1479+
@[simp] theorem rTensor_pow (f : M ≃ₗ[R] M) (n : ℕ) : f.rTensor N ^ n = (f ^ n).rTensor N := by
1480+
simpa only [one_pow] using TensorProduct.congr_pow f (1 : N ≃ₗ[R] N) n
1481+
1482+
@[simp] theorem rTensor_zpow (f : M ≃ₗ[R] M) (n : ℤ) : f.rTensor N ^ n = (f ^ n).rTensor N := by
1483+
simpa only [one_zpow] using TensorProduct.congr_zpow f (1 : N ≃ₗ[R] N) n
1484+
1485+
@[simp] theorem lTensor_pow (f : N ≃ₗ[R] N) (n : ℕ) : f.lTensor M ^ n = (f ^ n).lTensor M := by
1486+
simpa only [one_pow] using TensorProduct.congr_pow (1 : M ≃ₗ[R] M) f n
1487+
1488+
@[simp] theorem lTensor_zpow (f : N ≃ₗ[R] N) (n : ℤ) : f.lTensor M ^ n = (f ^ n).lTensor M := by
1489+
simpa only [one_zpow] using TensorProduct.congr_zpow (1 : M ≃ₗ[R] M) f n
1490+
1491+
end LinearEquiv
1492+
13581493
end Semiring
13591494

13601495
section Ring

scripts/style-exceptions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Mathlib/LinearAlgebra/Basis.lean : line 1 : ERR_NUM_LIN : 1800 file contains 164
6666
Mathlib/LinearAlgebra/Dual.lean : line 1 : ERR_NUM_LIN : 2000 file contains 1847 lines, try to split it up
6767
Mathlib/LinearAlgebra/LinearIndependent.lean : line 1 : ERR_NUM_LIN : 1700 file contains 1537 lines, try to split it up
6868
Mathlib/LinearAlgebra/Multilinear/Basic.lean : line 1 : ERR_NUM_LIN : 2000 file contains 1819 lines, try to split it up
69+
Mathlib/LinearAlgebra/TensorProduct/Basic.lean : line 1 : ERR_NUM_LIN : 1800 file contains 1660 lines, try to split it up
6970
Mathlib/Logic/Equiv/Basic.lean : line 1 : ERR_NUM_LIN : 2200 file contains 2065 lines, try to split it up
7071
Mathlib/Mathport/Attributes.lean : line 8 : ERR_MOD : Module docstring missing, or too late
7172
Mathlib/Mathport/Rename.lean : line 9 : ERR_MOD : Module docstring missing, or too late

0 commit comments

Comments
 (0)