Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit d1b2d6e

Browse files
committed
fix(linear_algebra/tensor_algebra): Correct the precedence of ⊗ₜ[R] (#5619)
Previously, `a ⊗ₜ[R] b = c` was interpreted as `a ⊗ₜ[R] (b = c)` which was nonsense because `eq` is not in `Type`. I'm not sure whether `:0` is necessary, but it seems harmless. The `:100` is the crucial bugfix here.
1 parent 01e17a9 commit d1b2d6e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/linear_algebra/tensor_product.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def tensor_product : Type* :=
201201
variables {R}
202202

203203
localized "infix ` ⊗ `:100 := tensor_product _" in tensor_product
204-
localized "notation M ` ⊗[`:100 R `] ` N:100 := tensor_product R M N" in tensor_product
204+
localized "notation M ` ⊗[`:100 R `] `:0 N:100 := tensor_product R M N" in tensor_product
205205

206206
namespace tensor_product
207207

@@ -221,7 +221,7 @@ def tmul (m : M) (n : N) : M ⊗[R] N := add_con.mk' _ $ free_add_monoid.of (m,
221221
variables {R}
222222

223223
infix ` ⊗ₜ `:100 := tmul _
224-
notation x ` ⊗ₜ[`:100 R `] ` y := tmul R x y
224+
notation x ` ⊗ₜ[`:100 R `] `:0 y:100 := tmul R x y
225225

226226
@[elab_as_eliminator]
227227
protected theorem induction_on
@@ -234,15 +234,15 @@ add_con.induction_on z $ λ x, free_add_monoid.rec_on x C0 $ λ ⟨m, n⟩ y ih,
234234
by { rw add_con.coe_add, exact Cp C1 ih }
235235

236236
variables (M)
237-
@[simp] lemma zero_tmul (n : N) : (0 ⊗ₜ n : M[R] N) = 0 :=
237+
@[simp] lemma zero_tmul (n : N) : (0 : M) ⊗ₜ[R] n = 0 :=
238238
quotient.sound' $ add_con_gen.rel.of _ _ $ eqv.of_zero_left _
239239
variables {M}
240240

241241
lemma add_tmul (m₁ m₂ : M) (n : N) : (m₁ + m₂) ⊗ₜ n = m₁ ⊗ₜ n + m₂ ⊗ₜ[R] n :=
242242
eq.symm $ quotient.sound' $ add_con_gen.rel.of _ _ $ eqv.of_add_left _ _ _
243243

244244
variables (N)
245-
@[simp] lemma tmul_zero (m : M) : (m ⊗ₜ 0 : M ⊗[R] N) = 0 :=
245+
@[simp] lemma tmul_zero (m : M) : m ⊗ₜ[R] (0 : N) = 0 :=
246246
quotient.sound' $ add_con_gen.rel.of _ _ $ eqv.of_zero_right _
247247
variables {N}
248248

@@ -295,7 +295,7 @@ protected theorem smul_add (r : R') (x y : M ⊗[R] N) :
295295
add_monoid_hom.map_add _ _ _
296296

297297
theorem smul_tmul' (r : R') (m : M) (n : N) :
298-
r • (m ⊗ₜ n : M ⊗[R] N) = (r • m) ⊗ₜ n :=
298+
r • (m ⊗ₜ[R] n) = (r • m) ⊗ₜ n :=
299299
rfl
300300

301301
-- Most of the time we want the instance below this one, which is easier for typeclass resolution
@@ -336,18 +336,18 @@ variables {R M N}
336336
@[simp] lemma mk_apply (m : M) (n : N) : mk R M N m n = m ⊗ₜ n := rfl
337337

338338
lemma ite_tmul (x₁ : M) (x₂ : N) (P : Prop) [decidable P] :
339-
((if P then x₁ else 0) ⊗ₜ[R] x₂) = if P then (x₁ ⊗ₜ x₂) else 0 :=
339+
(if P then x₁ else 0) ⊗ₜ[R] x₂ = if P then x₁ ⊗ₜ x₂ else 0 :=
340340
by { split_ifs; simp }
341341

342342
lemma tmul_ite (x₁ : M) (x₂ : N) (P : Prop) [decidable P] :
343-
(x₁ ⊗ₜ[R] (if P then x₂ else 0)) = if P then (x₁ ⊗ₜ x₂) else 0 :=
343+
x₁ ⊗ₜ[R] (if P then x₂ else 0) = if P then x₁ ⊗ₜ x₂ else 0 :=
344344
by { split_ifs; simp }
345345

346346
section
347347
open_locale big_operators
348348

349349
lemma sum_tmul {α : Type*} (s : finset α) (m : α → M) (n : N) :
350-
((∑ a in s, m a) ⊗ₜ[R] n) = ∑ a in s, m a ⊗ₜ[R] n :=
350+
(∑ a in s, m a) ⊗ₜ[R] n = ∑ a in s, m a ⊗ₜ[R] n :=
351351
begin
352352
classical,
353353
induction s using finset.induction with a s has ih h,
@@ -356,7 +356,7 @@ begin
356356
end
357357

358358
lemma tmul_sum (m : M) {α : Type*} (s : finset α) (n : α → N) :
359-
(m ⊗ₜ[R] (∑ a in s, n a)) = ∑ a in s, m ⊗ₜ[R] n a :=
359+
m ⊗ₜ[R] (∑ a in s, n a) = ∑ a in s, m ⊗ₜ[R] n a :=
360360
begin
361361
classical,
362362
induction s using finset.induction with a s has ih h,

src/ring_theory/polynomial_algebra.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ begin
124124
end
125125

126126
lemma to_fun_linear_mul_tmul_mul (a₁ a₂ : A) (p₁ p₂ : polynomial R) :
127-
(to_fun_linear R A) ((a₁ * a₂) ⊗ₜ[R] p₁ * p₂) =
127+
(to_fun_linear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) =
128128
(to_fun_linear R A) (a₁ ⊗ₜ[R] p₁) * (to_fun_linear R A) (a₂ ⊗ₜ[R] p₂) :=
129129
begin
130130
dsimp [to_fun_linear],

src/ring_theory/tensor_product.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ section
463463
variables {R A B C}
464464

465465
lemma assoc_aux_1 (a₁ a₂ : A) (b₁ b₂ : B) (c₁ c₂ : C) :
466-
(tensor_product.assoc R A B C) (((a₁ * a₂) ⊗ₜ[R] b₁ * b₂) ⊗ₜ[R] c₁ * c₂) =
466+
(tensor_product.assoc R A B C) (((a₁ * a₂) ⊗ₜ[R] (b₁ * b₂)) ⊗ₜ[R] (c₁ * c₂)) =
467467
(tensor_product.assoc R A B C) ((a₁ ⊗ₜ[R] b₁) ⊗ₜ[R] c₁) *
468468
(tensor_product.assoc R A B C) ((a₂ ⊗ₜ[R] b₂) ⊗ₜ[R] c₂) :=
469469
rfl

0 commit comments

Comments
 (0)