Skip to content

Commit 39e4017

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 c841722 commit 39e4017

1 file changed

Lines changed: 14 additions & 58 deletions

File tree

Mathlib/RingTheory/TensorProduct.lean

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

161-
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
161+
#noalign algebra.tensor_product.mul_aux
162+
#noalign algebra.tensor_product.mul_aux_apply
176163

177164
/-- (Implementation detail)
178165
The multiplication map on `A ⊗[R] B`,
179166
as an `R`-bilinear map.
180167
-/
181168
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]
169+
TensorProduct.homTensorHomMap R A B A B
170+
∘ₗ TensorProduct.map (LinearMap.mul R A) (LinearMap.mul R B)
196171
#align algebra.tensor_product.mul Algebra.TensorProduct.mul
197172

198173
@[simp]
@@ -201,35 +176,16 @@ theorem mul_apply (a₁ a₂ : A) (b₁ b₂ : B) :
201176
rfl
202177
#align algebra.tensor_product.mul_apply Algebra.TensorProduct.mul_apply
203178

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
179+
#noalign algebra.tensor_product.mul_assoc'
180+
181+
protected theorem mul_assoc (x y z : A ⊗[R] B) : mul (mul x y) z = mul x (mul y z) := by
182+
-- restate as an equality of morphisms so that we can use `ext`
183+
suffices LinearMap.llcomp R _ _ _ mul ∘ₗ mul =
184+
(LinearMap.llcomp R _ _ _ LinearMap.lflip <| LinearMap.llcomp R _ _ _ mul.flip ∘ₗ mul).flip by
185+
exact FunLike.congr_fun (FunLike.congr_fun (FunLike.congr_fun this x) y) z
186+
ext xa xb ya yb za zb
187+
refine congr_arg₂ (· ⊗ₜ ·) (mul_assoc _ _ _) (mul_assoc _ _ _)
188+
233189
#align algebra.tensor_product.mul_assoc Algebra.TensorProduct.mul_assoc
234190

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

0 commit comments

Comments
 (0)