Skip to content

Commit cdda99e

Browse files
committed
fix(LinearAlgebra/TensorProduct): fix ⊗ₜ[R] precedence (#27589)
This PR makes `⊗ₜ[R]` have the same precedence as the infixl `⊗ₜ` notation. This also affects the pretty printer, making it consistent with `⊗ₜ`. Co-authored-by: Jovan Gerbscheid <56355248+JovanGerb@users.noreply.github.com>
1 parent c8bbf53 commit cdda99e

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ variable (M : Type v) [AddCommMonoid M] [Module R M]
292292

293293
-- This notation is necessary because we need to reason about `s ⊗ₜ m` where `s : S` and `m : M`;
294294
-- without this notation, one needs to work with `s : (restrictScalars f).obj ⟨S⟩`.
295-
scoped[ChangeOfRings]
296-
notation s "⊗ₜ[" R "," f "]" m => @TensorProduct.tmul R _ _ _ _ _ (Module.compHom _ f) _ s m
295+
scoped[ChangeOfRings] notation:100 s:100 " ⊗ₜ[" R "," f "] " m:101 =>
296+
@TensorProduct.tmul R _ _ _ _ _ (Module.compHom _ f) _ s m
297297

298298
end Unbundled
299299

@@ -345,12 +345,12 @@ variable {R : Type u₁} {S : Type u₂} [CommRing R] [CommRing S] (f : R →+*
345345

346346
@[simp]
347347
protected theorem smul_tmul {M : ModuleCat.{v} R} (s s' : S) (m : M) :
348-
s • (s'⊗ₜ[R,f]m : (extendScalars f).obj M) = (s * s')⊗ₜ[R,f]m :=
348+
s • (s' ⊗ₜ[R,f] m : (extendScalars f).obj M) = (s * s') ⊗ₜ[R,f] m :=
349349
rfl
350350

351351
@[simp]
352352
theorem map_tmul {M M' : ModuleCat.{v} R} (g : M ⟶ M') (s : S) (m : M) :
353-
(extendScalars f).map g (s⊗ₜ[R,f]m) = s⊗ₜ[R,f]g m :=
353+
(extendScalars f).map g (s ⊗ₜ[R,f] m) = s ⊗ₜ[R,f] g m :=
354354
rfl
355355

356356
variable {f}
@@ -633,7 +633,7 @@ def HomEquiv.toRestrictScalars {X Y} (g : (extendScalars f).obj X ⟶ Y) :
633633
-- TODO: after https://github.com/leanprover-community/mathlib4/pull/19511 we need to hint `(Y := ...)`.
634634
-- This suggests `restrictScalars` needs to be redesigned.
635635
ofHom (Y := (restrictScalars f).obj Y)
636-
{ toFun := fun x => g <| (1 : S)⊗ₜ[R,f]x
636+
{ toFun := fun x => g <| (1 : S) ⊗ₜ[R,f] x
637637
map_add' := fun _ _ => by dsimp; rw [tmul_add, map_add]
638638
map_smul' := fun r s => by
639639
letI : Module R S := Module.compHom S f
@@ -734,7 +734,7 @@ def Unit.map {X} : X ⟶ (extendScalars f ⋙ restrictScalars f).obj X :=
734734
-- TODO: after https://github.com/leanprover-community/mathlib4/pull/19511 we need to hint `(Y := ...)`.
735735
-- This suggests `restrictScalars` needs to be redesigned.
736736
ofHom (Y := (extendScalars f ⋙ restrictScalars f).obj X)
737-
{ toFun := fun x => (1 : S)⊗ₜ[R,f]x
737+
{ toFun := fun x => (1 : S) ⊗ₜ[R,f] x
738738
map_add' := fun x x' => by dsimp; rw [TensorProduct.tmul_add]
739739
map_smul' := fun r x => by
740740
letI m1 : Module R S := Module.compHom S f

Mathlib/LinearAlgebra/Contraction.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ theorem zero_prodMap_dualTensorHom (g : Module.Dual R N) (q : Q) :
9292

9393
theorem map_dualTensorHom (f : Module.Dual R M) (p : P) (g : Module.Dual R N) (q : Q) :
9494
TensorProduct.map (dualTensorHom R M P (f ⊗ₜ[R] p)) (dualTensorHom R N Q (g ⊗ₜ[R] q)) =
95-
dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] p ⊗ₜ[R] q) := by
95+
dualTensorHom R (M ⊗[R] N) (P ⊗[R] Q) (dualDistrib R M N (f ⊗ₜ g) ⊗ₜ[R] (p ⊗ₜ[R] q)) := by
9696
ext m n
9797
simp only [compr₂_apply, mk_apply, map_tmul, dualTensorHom_apply, dualDistrib_apply, ←
9898
smul_tmul_smul]

Mathlib/LinearAlgebra/PiTensorProduct.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,13 @@ def tmulEquiv :
888888

889889
@[simp]
890890
theorem tmulEquiv_apply (a : ι → M) (b : ι₂ → M) :
891-
tmulEquiv R M ((⨂ₜ[R] i, a i) ⊗ₜ[R] ⨂ₜ[R] i, b i) = ⨂ₜ[R] i, Sum.elim a b i := by
891+
tmulEquiv R M ((⨂ₜ[R] i, a i) ⊗ₜ[R] (⨂ₜ[R] i, b i)) = ⨂ₜ[R] i, Sum.elim a b i := by
892892
simp [tmulEquiv, Sum.elim]
893893

894894
@[simp]
895895
theorem tmulEquiv_symm_apply (a : ι ⊕ ι₂ → M) :
896896
(tmulEquiv R M).symm (⨂ₜ[R] i, a i) =
897-
(⨂ₜ[R] i, a (Sum.inl i)) ⊗ₜ[R] ⨂ₜ[R] i, a (Sum.inr i) := by
897+
(⨂ₜ[R] i, a (Sum.inl i)) ⊗ₜ[R] (⨂ₜ[R] i, a (Sum.inr i)) := by
898898
simp [tmulEquiv]
899899

900900
end tmulEquiv

Mathlib/LinearAlgebra/TensorProduct/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def tmul (m : M) (n : N) : M ⊗[R] N :=
126126
infixl:100 " ⊗ₜ " => tmul _
127127

128128
/-- The canonical function `M → N → M ⊗ N`. -/
129-
notation:100 x " ⊗ₜ[" R "] " y:100 => tmul R x y
129+
notation:100 x:100 " ⊗ₜ[" R "] " y:101 => tmul R x y
130130

131131
@[elab_as_elim, induction_eliminator]
132132
protected theorem induction_on {motive : M ⊗[R] N → Prop} (z : M ⊗[R] N)

Mathlib/RingTheory/Coalgebra/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ lemma sum_tmul_counit_eq {a : A} (repr : Coalgebra.Repr R a) :
120120
lemma sum_tmul_tmul_eq {a : A} (repr : Repr R a)
121121
(a₁ : (i : repr.ι) → Repr R (repr.left i)) (a₂ : (i : repr.ι) → Repr R (repr.right i)) :
122122
∑ i ∈ repr.index, ∑ j ∈ (a₁ i).index,
123-
(a₁ i).left j ⊗ₜ[R] (a₁ i).right j ⊗ₜ[R] repr.right i
123+
(a₁ i).left j ⊗ₜ[R] ((a₁ i).right j ⊗ₜ[R] repr.right i)
124124
= ∑ i ∈ repr.index, ∑ j ∈ (a₂ i).index,
125-
repr.left i ⊗ₜ[R] (a₂ i).left j ⊗ₜ[R] (a₂ i).right j := by
125+
repr.left i ⊗ₜ[R] ((a₂ i).left j ⊗ₜ[R] (a₂ i).right j) := by
126126
simpa [(a₂ _).eq, ← (a₁ _).eq, ← TensorProduct.tmul_sum,
127127
TensorProduct.sum_tmul, ← repr.eq] using congr($(coassoc (R := R)) a)
128128

Mathlib/RingTheory/Flat/Domain.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ lemma TensorProduct.map_injective_of_flat_flat_of_isDomain
4646
congr! 1
4747
ext p q
4848
-- `simp` solves the goal but it times out
49-
change (1 : K) ⊗ₜ[R] f p ⊗ₜ[R] g q = (AlgebraTensorModule.assoc R R K K M N)
49+
change (1 : K) ⊗ₜ[R] (f p ⊗ₜ[R] g q) = (AlgebraTensorModule.assoc R R K K M N)
5050
(((1 : K) • (algebraMap R K) 1 ⊗ₜ[R] f p) ⊗ₜ[R] g q)
5151
simp only [map_one, one_smul, AlgebraTensorModule.assoc_tmul]
5252

Mathlib/RingTheory/TensorProduct/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,12 +826,12 @@ variable {R A}
826826

827827
unseal mul in
828828
theorem assoc_aux_1 (a₁ a₂ : A) (b₁ b₂ : B) (c₁ c₂ : C) :
829-
(TensorProduct.assoc R A B C) (((a₁ * a₂) ⊗ₜ[R] (b₁ * b₂)) ⊗ₜ[R] (c₁ * c₂)) =
830-
(TensorProduct.assoc R A B C) ((a₁ ⊗ₜ[R] b₁) ⊗ₜ[R] c₁) *
831-
(TensorProduct.assoc R A B C) ((a₂ ⊗ₜ[R] b₂) ⊗ₜ[R] c₂) :=
829+
(TensorProduct.assoc R A B C) ((a₁ * a₂) ⊗ₜ[R] (b₁ * b₂) ⊗ₜ[R] (c₁ * c₂)) =
830+
(TensorProduct.assoc R A B C) (a₁ ⊗ₜ[R] b₁ ⊗ₜ[R] c₁) *
831+
(TensorProduct.assoc R A B C) (a₂ ⊗ₜ[R] b₂ ⊗ₜ[R] c₂) :=
832832
rfl
833833

834-
theorem assoc_aux_2 : (TensorProduct.assoc R A B C) ((1 ⊗ₜ[R] 1) ⊗ₜ[R] 1) = 1 :=
834+
theorem assoc_aux_2 : (TensorProduct.assoc R A B C) (1 ⊗ₜ[R] 1 ⊗ₜ[R] 1) = 1 :=
835835
rfl
836836

837837
variable (R A C D)

0 commit comments

Comments
 (0)