Skip to content

Commit f60239d

Browse files
committed
chore(RingTheory/TensorProduct): golf the proof and construction
This follows the approach taken in Algebra/DirectSum/Ring, which allows avoiding tedious induction by instead conjuring a weird equality of morphisms and using `ext`.
1 parent 0448c7c commit f60239d

1 file changed

Lines changed: 15 additions & 57 deletions

File tree

Mathlib/RingTheory/TensorProduct.lean

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -158,78 +158,36 @@ variable {B : Type v₂} [Semiring B] [Algebra R B]
158158
### The `R`-algebra structure on `A ⊗[R] B`
159159
-/
160160

161+
#noalign algebra.tensor_product.mul_aux
161162

162-
/-- (Implementation detail)
163-
The multiplication map on `A ⊗[R] B`,
164-
for a fixed pure tensor in the first argument,
165-
as an `R`-linear map.
166-
-/
167-
def mulAux (a₁ : A) (b₁ : B) : A ⊗[R] B →ₗ[R] A ⊗[R] B :=
168-
TensorProduct.map (LinearMap.mulLeft R a₁) (LinearMap.mulLeft R b₁)
169-
#align algebra.tensor_product.mul_aux Algebra.TensorProduct.mulAux
170-
171-
@[simp]
172-
theorem mulAux_apply (a₁ a₂ : A) (b₁ b₂ : B) :
173-
(mulAux a₁ b₁) (a₂ ⊗ₜ[R] b₂) = (a₁ * a₂) ⊗ₜ[R] (b₁ * b₂) :=
174-
rfl
175-
#align algebra.tensor_product.mul_aux_apply Algebra.TensorProduct.mulAux_apply
163+
#noalign algebra.tensor_product.mul_aux_apply
176164

177165
/-- (Implementation detail)
178166
The multiplication map on `A ⊗[R] B`,
179167
as an `R`-bilinear map.
180168
-/
181169
def mul : A ⊗[R] B →ₗ[R] A ⊗[R] B →ₗ[R] A ⊗[R] B :=
182-
TensorProduct.lift <|
183-
LinearMap.mk₂ R mulAux
184-
(fun x₁ x₂ y =>
185-
TensorProduct.ext' fun x' y' => by
186-
simp only [mulAux_apply, LinearMap.add_apply, add_mul, add_tmul])
187-
(fun c x y =>
188-
TensorProduct.ext' fun x' y' => by
189-
simp only [mulAux_apply, LinearMap.smul_apply, smul_tmul', smul_mul_assoc])
190-
(fun x y₁ y₂ =>
191-
TensorProduct.ext' fun x' y' => by
192-
simp only [mulAux_apply, LinearMap.add_apply, add_mul, tmul_add])
193-
fun c x y =>
194-
TensorProduct.ext' fun x' y' => by
195-
simp only [mulAux_apply, LinearMap.smul_apply, smul_tmul, smul_tmul', smul_mul_assoc]
170+
TensorProduct.homTensorHomMap R A B A B
171+
∘ₗ TensorProduct.map (LinearMap.mul R A) (LinearMap.mul R B)
196172
#align algebra.tensor_product.mul Algebra.TensorProduct.mul
197173

174+
198175
@[simp]
199176
theorem mul_apply (a₁ a₂ : A) (b₁ b₂ : B) :
200177
mul (a₁ ⊗ₜ[R] b₁) (a₂ ⊗ₜ[R] b₂) = (a₁ * a₂) ⊗ₜ[R] (b₁ * b₂) :=
201178
rfl
202179
#align algebra.tensor_product.mul_apply Algebra.TensorProduct.mul_apply
203180

204-
theorem mul_assoc' (mul : A ⊗[R] B →ₗ[R] A ⊗[R] B →ₗ[R] A ⊗[R] B)
205-
(h :
206-
∀ (a₁ a₂ a₃ : A) (b₁ b₂ b₃ : B),
207-
mul (mul (a₁ ⊗ₜ[R] b₁) (a₂ ⊗ₜ[R] b₂)) (a₃ ⊗ₜ[R] b₃) =
208-
mul (a₁ ⊗ₜ[R] b₁) (mul (a₂ ⊗ₜ[R] b₂) (a₃ ⊗ₜ[R] b₃))) :
209-
∀ x y z : A ⊗[R] B, mul (mul x y) z = mul x (mul y z) := by
210-
intros x y z
211-
refine TensorProduct.induction_on x ?_ ?_ ?_
212-
· simp only [LinearMap.map_zero, LinearMap.zero_apply]
213-
refine TensorProduct.induction_on y ?_ ?_ ?_
214-
· simp only [LinearMap.map_zero, forall_const, LinearMap.zero_apply]
215-
refine TensorProduct.induction_on z ?_ ?_ ?_
216-
· simp only [LinearMap.map_zero, forall_const]
217-
· intros
218-
simp only [h]
219-
· intros
220-
simp only [LinearMap.map_add, *]
221-
· intros
222-
simp only [LinearMap.map_add, *, LinearMap.add_apply]
223-
· intros
224-
simp only [LinearMap.map_add, *, LinearMap.add_apply]
225-
#align algebra.tensor_product.mul_assoc' Algebra.TensorProduct.mul_assoc'
226-
227-
protected theorem mul_assoc (x y z : A ⊗[R] B) : mul (mul x y) z = mul x (mul y z) :=
228-
mul_assoc' mul
229-
(by
230-
intros
231-
simp only [mul_apply, mul_assoc])
232-
x y z
181+
#noalign algebra.tensor_product.mul_assoc'
182+
183+
protected theorem mul_assoc (x y z : A ⊗[R] B) : mul (mul x y) z = mul x (mul y z) := by
184+
-- restate as an equality of morphisms so that we can use `ext`
185+
suffices LinearMap.llcomp R _ _ _ mul ∘ₗ mul =
186+
(LinearMap.llcomp R _ _ _ LinearMap.lflip <| LinearMap.llcomp R _ _ _ mul.flip ∘ₗ mul).flip by
187+
exact FunLike.congr_fun (FunLike.congr_fun (FunLike.congr_fun this x) y) z
188+
ext xa xb ya yb za zb
189+
refine congr_arg₂ (· ⊗ₜ ·) (mul_assoc _ _ _) (mul_assoc _ _ _)
190+
233191
#align algebra.tensor_product.mul_assoc Algebra.TensorProduct.mul_assoc
234192

235193
protected theorem one_mul (x : A ⊗[R] B) : mul (1 ⊗ₜ 1) x = x := by

0 commit comments

Comments
 (0)