Skip to content

Commit

Permalink
refactor(ring_theory/tensor_product): Speed up slow proofs (#10883)
Browse files Browse the repository at this point in the history
`alg_hom_of_linear_map_tensor_product` was causing timeouts, due to many uses of `simp`. This refactor speeds up the proofs.
  • Loading branch information
tb65536 committed Dec 20, 2021
1 parent 6ab0f90 commit f7b24fa
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/ring_theory/tensor_product.lean
Expand Up @@ -512,25 +512,22 @@ def alg_hom_of_linear_map_tensor_product
(w₁ : ∀ (a₁ a₂ : A) (b₁ b₂ : B), f ((a₁ * a₂) ⊗ₜ (b₁ * b₂)) = f (a₁ ⊗ₜ b₁) * f (a₂ ⊗ₜ b₂))
(w₂ : ∀ r, f ((algebra_map R A) r ⊗ₜ[R] 1) = (algebra_map R C) r):
A ⊗[R] B →ₐ[R] C :=
{ map_one' := by simpa using w₂ 1,
map_zero' := by simp,
map_mul' := λ x y,
begin
{ map_one' := by rw [←(algebra_map R C).map_one, ←w₂, (algebra_map R A).map_one]; refl,
map_zero' := by rw [linear_map.to_fun_eq_coe, map_zero],
map_mul' := λ x y, by
{ rw linear_map.to_fun_eq_coe,
apply tensor_product.induction_on x,
{ simp, },
{ rw [zero_mul, map_zero, zero_mul] },
{ intros a₁ b₁,
apply tensor_product.induction_on y,
{ simp, },
{ rw [mul_zero, map_zero, mul_zero] },
{ intros a₂ b₂,
simp [w₁], },
rw [tmul_mul_tmul, w₁] },
{ intros x₁ x₂ h₁ h₂,
simp at h₁, simp at h₂,
simp [mul_add, add_mul, h₁, h₂], }, },
rw [mul_add, map_add, map_add, mul_add, h₁, h₂] } },
{ intros x₁ x₂ h₁ h₂,
simp at h₁, simp at h₂,
simp [mul_add, add_mul, h₁, h₂], }
end,
commutes' := λ r, by simp [w₂],
rw [add_mul, map_add, map_add, add_mul, h₁, h₂] } },
commutes' := λ r, by rw [linear_map.to_fun_eq_coe, algebra_map_apply, w₂],
.. f }

@[simp]
Expand Down

0 comments on commit f7b24fa

Please sign in to comment.