-
Notifications
You must be signed in to change notification settings - Fork 283
/
TensorProduct.lean
95 lines (80 loc) · 4.07 KB
/
TensorProduct.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/-
Copyright (c) 2020 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
import Mathlib.LinearAlgebra.Multilinear.Basic
import Mathlib.LinearAlgebra.TensorProduct.Basic
#align_import linear_algebra.multilinear.tensor_product from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
/-!
# Constructions relating multilinear maps and tensor products.
-/
suppress_compilation
namespace MultilinearMap
section DomCoprod
open TensorProduct
variable {R ι₁ ι₂ ι₃ ι₄ : Type*}
variable [CommSemiring R]
variable {N₁ : Type*} [AddCommMonoid N₁] [Module R N₁]
variable {N₂ : Type*} [AddCommMonoid N₂] [Module R N₂]
variable {N : Type*} [AddCommMonoid N] [Module R N]
/-- Given two multilinear maps `(ι₁ → N) → N₁` and `(ι₂ → N) → N₂`, this produces the map
`(ι₁ ⊕ ι₂ → N) → N₁ ⊗ N₂` by taking the coproduct of the domain and the tensor product
of the codomain.
This can be thought of as combining `Equiv.sumArrowEquivProdArrow.symm` with
`TensorProduct.map`, noting that the two operations can't be separated as the intermediate result
is not a `MultilinearMap`.
While this can be generalized to work for dependent `Π i : ι₁, N'₁ i` instead of `ι₁ → N`, doing so
introduces `Sum.elim N'₁ N'₂` types in the result which are difficult to work with and not defeq
to the simple case defined here. See [this zulip thread](
https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there.20code.20for.20X.3F/topic/Instances.20on.20.60sum.2Eelim.20A.20B.20i.60/near/218484619).
-/
@[simps apply]
def domCoprod (a : MultilinearMap R (fun _ : ι₁ => N) N₁)
(b : MultilinearMap R (fun _ : ι₂ => N) N₂) :
MultilinearMap R (fun _ : Sum ι₁ ι₂ => N) (N₁ ⊗[R] N₂) where
toFun v := (a fun i => v (Sum.inl i)) ⊗ₜ b fun i => v (Sum.inr i)
map_add' _ i p q := by
letI := (@Sum.inl_injective ι₁ ι₂).decidableEq
letI := (@Sum.inr_injective ι₁ ι₂).decidableEq
cases i <;> simp [TensorProduct.add_tmul, TensorProduct.tmul_add]
map_smul' _ i c p := by
letI := (@Sum.inl_injective ι₁ ι₂).decidableEq
letI := (@Sum.inr_injective ι₁ ι₂).decidableEq
cases i <;> simp [TensorProduct.smul_tmul', TensorProduct.tmul_smul]
#align multilinear_map.dom_coprod MultilinearMap.domCoprod
/-- A more bundled version of `MultilinearMap.domCoprod` that maps
`((ι₁ → N) → N₁) ⊗ ((ι₂ → N) → N₂)` to `(ι₁ ⊕ ι₂ → N) → N₁ ⊗ N₂`. -/
def domCoprod' :
MultilinearMap R (fun _ : ι₁ => N) N₁ ⊗[R] MultilinearMap R (fun _ : ι₂ => N) N₂ →ₗ[R]
MultilinearMap R (fun _ : Sum ι₁ ι₂ => N) (N₁ ⊗[R] N₂) :=
TensorProduct.lift <|
LinearMap.mk₂ R domCoprod
(fun m₁ m₂ n => by
ext
simp only [domCoprod_apply, TensorProduct.add_tmul, add_apply])
(fun c m n => by
ext
simp only [domCoprod_apply, TensorProduct.smul_tmul', smul_apply])
(fun m n₁ n₂ => by
ext
simp only [domCoprod_apply, TensorProduct.tmul_add, add_apply])
fun c m n => by
ext
simp only [domCoprod_apply, TensorProduct.tmul_smul, smul_apply]
#align multilinear_map.dom_coprod' MultilinearMap.domCoprod'
@[simp]
theorem domCoprod'_apply (a : MultilinearMap R (fun _ : ι₁ => N) N₁)
(b : MultilinearMap R (fun _ : ι₂ => N) N₂) : domCoprod' (a ⊗ₜ[R] b) = domCoprod a b :=
rfl
#align multilinear_map.dom_coprod'_apply MultilinearMap.domCoprod'_apply
/-- When passed an `Equiv.sumCongr`, `MultilinearMap.domDomCongr` distributes over
`MultilinearMap.domCoprod`. -/
theorem domCoprod_domDomCongr_sumCongr (a : MultilinearMap R (fun _ : ι₁ => N) N₁)
(b : MultilinearMap R (fun _ : ι₂ => N) N₂) (σa : ι₁ ≃ ι₃) (σb : ι₂ ≃ ι₄) :
(a.domCoprod b).domDomCongr (σa.sumCongr σb) =
(a.domDomCongr σa).domCoprod (b.domDomCongr σb) :=
rfl
#align multilinear_map.dom_coprod_dom_dom_congr_sum_congr MultilinearMap.domCoprod_domDomCongr_sumCongr
end DomCoprod
end MultilinearMap