Skip to content

Commit

Permalink
chore(RingTheory/TensorProduct): golf a proof (#6211)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
eric-wieser committed Jul 28, 2023
1 parent 7bedbae commit 6cb636b
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions Mathlib/RingTheory/TensorProduct.lean
Expand Up @@ -201,35 +201,15 @@ theorem mul_apply (a₁ a₂ : A) (b₁ b₂ : B) :
rfl
#align algebra.tensor_product.mul_apply Algebra.TensorProduct.mul_apply

theorem mul_assoc' (mul : A ⊗[R] B →ₗ[R] A ⊗[R] B →ₗ[R] A ⊗[R] B)
(h :
∀ (a₁ a₂ a₃ : A) (b₁ b₂ b₃ : B),
mul (mul (a₁ ⊗ₜ[R] b₁) (a₂ ⊗ₜ[R] b₂)) (a₃ ⊗ₜ[R] b₃) =
mul (a₁ ⊗ₜ[R] b₁) (mul (a₂ ⊗ₜ[R] b₂) (a₃ ⊗ₜ[R] b₃))) :
∀ x y z : A ⊗[R] B, mul (mul x y) z = mul x (mul y z) := by
intros x y z
refine TensorProduct.induction_on x ?_ ?_ ?_
· simp only [LinearMap.map_zero, LinearMap.zero_apply]
refine TensorProduct.induction_on y ?_ ?_ ?_
· simp only [LinearMap.map_zero, forall_const, LinearMap.zero_apply]
refine TensorProduct.induction_on z ?_ ?_ ?_
· simp only [LinearMap.map_zero, forall_const]
· intros
simp only [h]
· intros
simp only [LinearMap.map_add, *]
· intros
simp only [LinearMap.map_add, *, LinearMap.add_apply]
· intros
simp only [LinearMap.map_add, *, LinearMap.add_apply]
#align algebra.tensor_product.mul_assoc' Algebra.TensorProduct.mul_assoc'

protected theorem mul_assoc (x y z : A ⊗[R] B) : mul (mul x y) z = mul x (mul y z) :=
mul_assoc' mul
(by
intros
simp only [mul_apply, mul_assoc])
x y z
#noalign algebra.tensor_product.mul_assoc'

protected theorem mul_assoc (x y z : A ⊗[R] B) : mul (mul x y) z = mul x (mul y z) := by
-- restate as an equality of morphisms so that we can use `ext`
suffices LinearMap.llcomp R _ _ _ mul ∘ₗ mul =
(LinearMap.llcomp R _ _ _ LinearMap.lflip <| LinearMap.llcomp R _ _ _ mul.flip ∘ₗ mul).flip by
exact FunLike.congr_fun (FunLike.congr_fun (FunLike.congr_fun this x) y) z
ext xa xb ya yb za zb
exact congr_arg₂ (· ⊗ₜ ·) (mul_assoc xa ya za) (mul_assoc xb yb zb)
#align algebra.tensor_product.mul_assoc Algebra.TensorProduct.mul_assoc

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

0 comments on commit 6cb636b

Please sign in to comment.