algebra.smul_with_zeroMathlib.Algebra.SMulWithZero

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(algebra, linear_algebra): unique instances over the trivial ring (#18160)

Also generalizes module.subsingleton to mul_action_with_zero.

matches https://github.com/leanprover-community/mathlib4/pull/1519

Diff
@@ -139,6 +139,15 @@ instance monoid_with_zero.to_opposite_mul_action_with_zero : mul_action_with_zer
 { ..mul_zero_class.to_opposite_smul_with_zero R,
   ..monoid.to_opposite_mul_action R }
 
+protected lemma mul_action_with_zero.subsingleton
+  [mul_action_with_zero R M] [subsingleton R] : subsingleton M :=
+⟨λ x y, by rw [←one_smul R x, ←one_smul R y, subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
+
+protected lemma mul_action_with_zero.nontrivial
+  [mul_action_with_zero R M] [nontrivial M] : nontrivial R :=
+(subsingleton_or_nontrivial R).resolve_left $ λ hR, not_subsingleton M $
+  by exactI mul_action_with_zero.subsingleton R M
+
 variables {R M} [mul_action_with_zero R M] [has_zero M'] [has_smul R M']
 
 /-- Pullback a `mul_action_with_zero` structure along an injective zero-preserving homomorphism.

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(algebra/smul_with_zero): a • b ≠ 0 → a ≠ 0 (#18086)

This matches existing mul lemmas

Diff
@@ -63,6 +63,13 @@ variables (R) {M} [has_zero R] [has_zero M] [smul_with_zero R M]
 
 @[simp] lemma zero_smul (m : M) : (0 : R) • m = 0 := smul_with_zero.zero_smul m
 
+variables {R} {a : R} {b : M}
+
+lemma smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 := h.symm ▸ zero_smul _ b
+lemma smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 := h.symm ▸ smul_zero a
+lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt $ λ h, smul_eq_zero_of_left h b
+lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt $ smul_eq_zero_of_right a
+
 variables {R M} [has_zero R'] [has_zero M'] [has_smul R M']
 
 /-- Pullback a `smul_with_zero` structure along an injective zero-preserving homomorphism.

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
 -/
-import Mathbin.Algebra.GroupPower.Basic
-import Mathbin.Algebra.Ring.Opposite
-import Mathbin.GroupTheory.GroupAction.Opposite
-import Mathbin.GroupTheory.GroupAction.Prod
+import Algebra.GroupPower.Basic
+import Algebra.Ring.Opposite
+import GroupTheory.GroupAction.Opposite
+import GroupTheory.GroupAction.Prod
 
 #align_import algebra.smul_with_zero from "leanprover-community/mathlib"@"dc17b6ac53b111affde68d96e5e7a0726816e2cf"
 
Diff
@@ -252,7 +252,7 @@ variable (M)
 def MulActionWithZero.compHom (f : R' →*₀ R) : MulActionWithZero R' M :=
   { SMulWithZero.compHom M f.toZeroHom with
     smul := (· • ·) ∘ f
-    mul_smul := fun r s m => by simp [mul_smul]
+    hMul_smul := fun r s m => by simp [mul_smul]
     one_smul := fun m => by simp }
 #align mul_action_with_zero.comp_hom MulActionWithZero.compHom
 -/
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
-
-! This file was ported from Lean 3 source module algebra.smul_with_zero
-! leanprover-community/mathlib commit dc17b6ac53b111affde68d96e5e7a0726816e2cf
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.GroupPower.Basic
 import Mathbin.Algebra.Ring.Opposite
 import Mathbin.GroupTheory.GroupAction.Opposite
 import Mathbin.GroupTheory.GroupAction.Prod
 
+#align_import algebra.smul_with_zero from "leanprover-community/mathlib"@"dc17b6ac53b111affde68d96e5e7a0726816e2cf"
+
 /-!
 # Introduce `smul_with_zero`
 
Diff
@@ -58,13 +58,16 @@ class SMulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
 #align smul_with_zero SMulWithZero
 -/
 
+#print MulZeroClass.toSMulWithZero /-
 instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R
     where
   smul := (· * ·)
   smul_zero := MulZeroClass.mul_zero
   zero_smul := MulZeroClass.zero_mul
 #align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZero
+-/
 
+#print MulZeroClass.toOppositeSMulWithZero /-
 /-- Like `mul_zero_class.to_smul_with_zero`, but multiplies on the right. -/
 instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero Rᵐᵒᵖ R
     where
@@ -72,6 +75,7 @@ instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero R
   smul_zero r := MulZeroClass.zero_mul _
   zero_smul := MulZeroClass.mul_zero
 #align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSMulWithZero
+-/
 
 variable (R) {M} [Zero R] [Zero M] [SMulWithZero R M]
 
@@ -84,9 +88,11 @@ theorem zero_smul (m : M) : (0 : R) • m = 0 :=
 
 variable {R} {a : R} {b : M}
 
+#print smul_eq_zero_of_left /-
 theorem smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 :=
   h.symm ▸ zero_smul _ b
 #align smul_eq_zero_of_left smul_eq_zero_of_left
+-/
 
 #print smul_eq_zero_of_right /-
 theorem smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 :=
@@ -148,17 +154,21 @@ def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M
 
 end Zero
 
+#print AddMonoid.natSMulWithZero /-
 instance AddMonoid.natSMulWithZero [AddMonoid M] : SMulWithZero ℕ M
     where
   smul_zero := nsmul_zero
   zero_smul := zero_nsmul
 #align add_monoid.nat_smul_with_zero AddMonoid.natSMulWithZero
+-/
 
+#print AddGroup.intSMulWithZero /-
 instance AddGroup.intSMulWithZero [AddGroup M] : SMulWithZero ℤ M
     where
   smul_zero := zsmul_zero
   zero_smul := zero_zsmul
 #align add_group.int_smul_with_zero AddGroup.intSMulWithZero
+-/
 
 section MonoidWithZero
 
@@ -177,34 +187,44 @@ class MulActionWithZero extends MulAction R M where
 #align mul_action_with_zero MulActionWithZero
 -/
 
+#print MulActionWithZero.toSMulWithZero /-
 -- see Note [lower instance priority]
 instance (priority := 100) MulActionWithZero.toSMulWithZero [m : MulActionWithZero R M] :
     SMulWithZero R M :=
   { m with }
 #align mul_action_with_zero.to_smul_with_zero MulActionWithZero.toSMulWithZero
+-/
 
+#print MonoidWithZero.toMulActionWithZero /-
 /-- See also `semiring.to_module` -/
 instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
   { MulZeroClass.toSMulWithZero R, Monoid.toMulAction R with }
 #align monoid_with_zero.to_mul_action_with_zero MonoidWithZero.toMulActionWithZero
+-/
 
+#print MonoidWithZero.toOppositeMulActionWithZero /-
 /-- Like `monoid_with_zero.to_mul_action_with_zero`, but multiplies on the right. See also
 `semiring.to_opposite_module` -/
 instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒᵖ R :=
   { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
+-/
 
+#print MulActionWithZero.subsingleton /-
 protected theorem MulActionWithZero.subsingleton [MulActionWithZero R M] [Subsingleton R] :
     Subsingleton M :=
   ⟨fun x y => by
     rw [← one_smul R x, ← one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
 #align mul_action_with_zero.subsingleton MulActionWithZero.subsingleton
+-/
 
+#print MulActionWithZero.nontrivial /-
 protected theorem MulActionWithZero.nontrivial [MulActionWithZero R M] [Nontrivial M] :
     Nontrivial R :=
   (subsingleton_or_nontrivial R).resolve_left fun hR =>
     not_subsingleton M <| MulActionWithZero.subsingleton R M
 #align mul_action_with_zero.nontrivial MulActionWithZero.nontrivial
+-/
 
 variable {R M} [MulActionWithZero R M] [Zero M'] [SMul R M']
 
@@ -246,6 +266,7 @@ section GroupWithZero
 
 variable {α β : Type _} [GroupWithZero α] [GroupWithZero β] [MulActionWithZero α β]
 
+#print smul_inv₀ /-
 theorem smul_inv₀ [SMulCommClass α β β] [IsScalarTower α β β] (c : α) (x : β) :
     (c • x)⁻¹ = c⁻¹ • x⁻¹ := by
   obtain rfl | hc := eq_or_ne c 0
@@ -255,13 +276,16 @@ theorem smul_inv₀ [SMulCommClass α β β] [IsScalarTower α β β] (c : α) (
   · refine' inv_eq_of_mul_eq_one_left _
     rw [smul_mul_smul, inv_mul_cancel hc, inv_mul_cancel hx, one_smul]
 #align smul_inv₀ smul_inv₀
+-/
 
 end GroupWithZero
 
+#print smulMonoidWithZeroHom /-
 /-- Scalar multiplication as a monoid homomorphism with zero. -/
 @[simps]
 def smulMonoidWithZeroHom {α β : Type _} [MonoidWithZero α] [MulZeroOneClass β]
     [MulActionWithZero α β] [IsScalarTower α β β] [SMulCommClass α β β] : α × β →*₀ β :=
   { smulMonoidHom with map_zero' := smul_zero _ }
 #align smul_monoid_with_zero_hom smulMonoidWithZeroHom
+-/
 
Diff
@@ -58,12 +58,6 @@ class SMulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
 #align smul_with_zero SMulWithZero
 -/
 
-/- warning: mul_zero_class.to_smul_with_zero -> MulZeroClass.toSMulWithZero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} R R (MulZeroClass.toHasZero.{u1} R _inst_1) (MulZeroClass.toHasZero.{u1} R _inst_1)
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} R R (MulZeroClass.toZero.{u1} R _inst_1) (MulZeroClass.toZero.{u1} R _inst_1)
-Case conversion may be inaccurate. Consider using '#align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZeroₓ'. -/
 instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R
     where
   smul := (· * ·)
@@ -71,12 +65,6 @@ instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R
   zero_smul := MulZeroClass.zero_mul
 #align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZero
 
-/- warning: mul_zero_class.to_opposite_smul_with_zero -> MulZeroClass.toOppositeSMulWithZero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.hasZero.{u1} R (MulZeroClass.toHasZero.{u1} R _inst_1)) (MulZeroClass.toHasZero.{u1} R _inst_1)
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.zero.{u1} R (MulZeroClass.toZero.{u1} R _inst_1)) (MulZeroClass.toZero.{u1} R _inst_1)
-Case conversion may be inaccurate. Consider using '#align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSMulWithZeroₓ'. -/
 /-- Like `mul_zero_class.to_smul_with_zero`, but multiplies on the right. -/
 instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero Rᵐᵒᵖ R
     where
@@ -96,12 +84,6 @@ theorem zero_smul (m : M) : (0 : R) • m = 0 :=
 
 variable {R} {a : R} {b : M}
 
-/- warning: smul_eq_zero_of_left -> smul_eq_zero_of_left is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} {M : Type.{u2}} [_inst_1 : Zero.{u1} R] [_inst_2 : Zero.{u2} M] [_inst_3 : SMulWithZero.{u1, u2} R M _inst_1 _inst_2] {a : R}, (Eq.{succ u1} R a (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R _inst_1)))) -> (forall (b : M), Eq.{succ u2} M (SMul.smul.{u1, u2} R M (SMulZeroClass.toHasSmul.{u1, u2} R M _inst_2 (SMulWithZero.toSmulZeroClass.{u1, u2} R M _inst_1 _inst_2 _inst_3)) a b) (OfNat.ofNat.{u2} M 0 (OfNat.mk.{u2} M 0 (Zero.zero.{u2} M _inst_2))))
-but is expected to have type
-  forall {R : Type.{u2}} {M : Type.{u1}} [_inst_1 : Zero.{u2} R] [_inst_2 : Zero.{u1} M] [_inst_3 : SMulWithZero.{u2, u1} R M _inst_1 _inst_2] {a : R}, (Eq.{succ u2} R a (OfNat.ofNat.{u2} R 0 (Zero.toOfNat0.{u2} R _inst_1))) -> (forall (b : M), Eq.{succ u1} M (HSMul.hSMul.{u2, u1, u1} R M M (instHSMul.{u2, u1} R M (SMulZeroClass.toSMul.{u2, u1} R M _inst_2 (SMulWithZero.toSMulZeroClass.{u2, u1} R M _inst_1 _inst_2 _inst_3))) a b) (OfNat.ofNat.{u1} M 0 (Zero.toOfNat0.{u1} M _inst_2)))
-Case conversion may be inaccurate. Consider using '#align smul_eq_zero_of_left smul_eq_zero_of_leftₓ'. -/
 theorem smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 :=
   h.symm ▸ zero_smul _ b
 #align smul_eq_zero_of_left smul_eq_zero_of_left
@@ -166,24 +148,12 @@ def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M
 
 end Zero
 
-/- warning: add_monoid.nat_smul_with_zero -> AddMonoid.natSMulWithZero is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : AddMonoid.{u1} M], SMulWithZero.{0, u1} Nat M Nat.hasZero (AddZeroClass.toHasZero.{u1} M (AddMonoid.toAddZeroClass.{u1} M _inst_1))
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : AddMonoid.{u1} M], SMulWithZero.{0, u1} Nat M (Zero.ofOfNat0.{0} Nat (instOfNatNat 0)) (AddMonoid.toZero.{u1} M _inst_1)
-Case conversion may be inaccurate. Consider using '#align add_monoid.nat_smul_with_zero AddMonoid.natSMulWithZeroₓ'. -/
 instance AddMonoid.natSMulWithZero [AddMonoid M] : SMulWithZero ℕ M
     where
   smul_zero := nsmul_zero
   zero_smul := zero_nsmul
 #align add_monoid.nat_smul_with_zero AddMonoid.natSMulWithZero
 
-/- warning: add_group.int_smul_with_zero -> AddGroup.intSMulWithZero is a dubious translation:
-lean 3 declaration is
-  forall {M : Type.{u1}} [_inst_1 : AddGroup.{u1} M], SMulWithZero.{0, u1} Int M Int.hasZero (AddZeroClass.toHasZero.{u1} M (AddMonoid.toAddZeroClass.{u1} M (SubNegMonoid.toAddMonoid.{u1} M (AddGroup.toSubNegMonoid.{u1} M _inst_1))))
-but is expected to have type
-  forall {M : Type.{u1}} [_inst_1 : AddGroup.{u1} M], SMulWithZero.{0, u1} Int M (Zero.ofOfNat0.{0} Int (instOfNatInt 0)) (NegZeroClass.toZero.{u1} M (SubNegZeroMonoid.toNegZeroClass.{u1} M (SubtractionMonoid.toSubNegZeroMonoid.{u1} M (AddGroup.toSubtractionMonoid.{u1} M _inst_1))))
-Case conversion may be inaccurate. Consider using '#align add_group.int_smul_with_zero AddGroup.intSMulWithZeroₓ'. -/
 instance AddGroup.intSMulWithZero [AddGroup M] : SMulWithZero ℤ M
     where
   smul_zero := zsmul_zero
@@ -207,59 +177,29 @@ class MulActionWithZero extends MulAction R M where
 #align mul_action_with_zero MulActionWithZero
 -/
 
-/- warning: mul_action_with_zero.to_smul_with_zero -> MulActionWithZero.toSMulWithZero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : MonoidWithZero.{u1} R] [_inst_3 : Zero.{u2} M] [m : MulActionWithZero.{u1, u2} R M _inst_1 _inst_3], SMulWithZero.{u1, u2} R M (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R _inst_1))) _inst_3
-but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : MonoidWithZero.{u1} R] [_inst_3 : Zero.{u2} M] [m : MulActionWithZero.{u1, u2} R M _inst_1 _inst_3], SMulWithZero.{u1, u2} R M (MonoidWithZero.toZero.{u1} R _inst_1) _inst_3
-Case conversion may be inaccurate. Consider using '#align mul_action_with_zero.to_smul_with_zero MulActionWithZero.toSMulWithZeroₓ'. -/
 -- see Note [lower instance priority]
 instance (priority := 100) MulActionWithZero.toSMulWithZero [m : MulActionWithZero R M] :
     SMulWithZero R M :=
   { m with }
 #align mul_action_with_zero.to_smul_with_zero MulActionWithZero.toSMulWithZero
 
-/- warning: monoid_with_zero.to_mul_action_with_zero -> MonoidWithZero.toMulActionWithZero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} R R _inst_1 (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R _inst_1)))
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} R R _inst_1 (MonoidWithZero.toZero.{u1} R _inst_1)
-Case conversion may be inaccurate. Consider using '#align monoid_with_zero.to_mul_action_with_zero MonoidWithZero.toMulActionWithZeroₓ'. -/
 /-- See also `semiring.to_module` -/
 instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
   { MulZeroClass.toSMulWithZero R, Monoid.toMulAction R with }
 #align monoid_with_zero.to_mul_action_with_zero MonoidWithZero.toMulActionWithZero
 
-/- warning: monoid_with_zero.to_opposite_mul_action_with_zero -> MonoidWithZero.toOppositeMulActionWithZero is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.monoidWithZero.{u1} R _inst_1) (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R _inst_1)))
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.monoidWithZero.{u1} R _inst_1) (MonoidWithZero.toZero.{u1} R _inst_1)
-Case conversion may be inaccurate. Consider using '#align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZeroₓ'. -/
 /-- Like `monoid_with_zero.to_mul_action_with_zero`, but multiplies on the right. See also
 `semiring.to_opposite_module` -/
 instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒᵖ R :=
   { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
 
-/- warning: mul_action_with_zero.subsingleton -> MulActionWithZero.subsingleton is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : MonoidWithZero.{u1} R] [_inst_3 : Zero.{u2} M] [_inst_4 : MulActionWithZero.{u1, u2} R M _inst_1 _inst_3] [_inst_5 : Subsingleton.{succ u1} R], Subsingleton.{succ u2} M
-but is expected to have type
-  forall (R : Type.{u2}) (M : Type.{u1}) [_inst_1 : MonoidWithZero.{u2} R] [_inst_3 : Zero.{u1} M] [_inst_4 : MulActionWithZero.{u2, u1} R M _inst_1 _inst_3] [_inst_5 : Subsingleton.{succ u2} R], Subsingleton.{succ u1} M
-Case conversion may be inaccurate. Consider using '#align mul_action_with_zero.subsingleton MulActionWithZero.subsingletonₓ'. -/
 protected theorem MulActionWithZero.subsingleton [MulActionWithZero R M] [Subsingleton R] :
     Subsingleton M :=
   ⟨fun x y => by
     rw [← one_smul R x, ← one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
 #align mul_action_with_zero.subsingleton MulActionWithZero.subsingleton
 
-/- warning: mul_action_with_zero.nontrivial -> MulActionWithZero.nontrivial is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : MonoidWithZero.{u1} R] [_inst_3 : Zero.{u2} M] [_inst_4 : MulActionWithZero.{u1, u2} R M _inst_1 _inst_3] [_inst_5 : Nontrivial.{u2} M], Nontrivial.{u1} R
-but is expected to have type
-  forall (R : Type.{u2}) (M : Type.{u1}) [_inst_1 : MonoidWithZero.{u2} R] [_inst_3 : Zero.{u1} M] [_inst_4 : MulActionWithZero.{u2, u1} R M _inst_1 _inst_3] [_inst_5 : Nontrivial.{u1} M], Nontrivial.{u2} R
-Case conversion may be inaccurate. Consider using '#align mul_action_with_zero.nontrivial MulActionWithZero.nontrivialₓ'. -/
 protected theorem MulActionWithZero.nontrivial [MulActionWithZero R M] [Nontrivial M] :
     Nontrivial R :=
   (subsingleton_or_nontrivial R).resolve_left fun hR =>
@@ -306,12 +246,6 @@ section GroupWithZero
 
 variable {α β : Type _} [GroupWithZero α] [GroupWithZero β] [MulActionWithZero α β]
 
-/- warning: smul_inv₀ -> smul_inv₀ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : GroupWithZero.{u1} α] [_inst_2 : GroupWithZero.{u2} β] [_inst_3 : MulActionWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2))))] [_inst_4 : SMulCommClass.{u1, u2, u2} α β β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α (GroupWithZero.toMonoidWithZero.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) _inst_3))) (Mul.toSMul.{u2} β (MulZeroClass.toHasMul.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))))] [_inst_5 : IsScalarTower.{u1, u2, u2} α β β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α (GroupWithZero.toMonoidWithZero.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) _inst_3))) (Mul.toSMul.{u2} β (MulZeroClass.toHasMul.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2))))) (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α (GroupWithZero.toMonoidWithZero.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) _inst_3)))] (c : α) (x : β), Eq.{succ u2} β (Inv.inv.{u2} β (DivInvMonoid.toHasInv.{u2} β (GroupWithZero.toDivInvMonoid.{u2} β _inst_2)) (SMul.smul.{u1, u2} α β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α (GroupWithZero.toMonoidWithZero.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) _inst_3))) c x)) (SMul.smul.{u1, u2} α β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α (GroupWithZero.toMonoidWithZero.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} α β (GroupWithZero.toMonoidWithZero.{u1} α _inst_1) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β (MonoidWithZero.toMulZeroOneClass.{u2} β (GroupWithZero.toMonoidWithZero.{u2} β _inst_2)))) _inst_3))) (Inv.inv.{u1} α (DivInvMonoid.toHasInv.{u1} α (GroupWithZero.toDivInvMonoid.{u1} α _inst_1)) c) (Inv.inv.{u2} β (DivInvMonoid.toHasInv.{u2} β (GroupWithZero.toDivInvMonoid.{u2} β _inst_2)) x))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : GroupWithZero.{u2} α] [_inst_2 : GroupWithZero.{u1} β] [_inst_3 : MulActionWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2))] [_inst_4 : SMulCommClass.{u2, u1, u1} α β β (SMulZeroClass.toSMul.{u2, u1} α β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} α β (MonoidWithZero.toZero.{u2} α (GroupWithZero.toMonoidWithZero.{u2} α _inst_1)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) _inst_3))) (SMulZeroClass.toSMul.{u1, u1} β β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u1} β β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulZeroClass.toSMulWithZero.{u1} β (MulZeroOneClass.toMulZeroClass.{u1} β (MonoidWithZero.toMulZeroOneClass.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2))))))] [_inst_5 : IsScalarTower.{u2, u1, u1} α β β (SMulZeroClass.toSMul.{u2, u1} α β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} α β (MonoidWithZero.toZero.{u2} α (GroupWithZero.toMonoidWithZero.{u2} α _inst_1)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) _inst_3))) (SMulZeroClass.toSMul.{u1, u1} β β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u1} β β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulZeroClass.toSMulWithZero.{u1} β (MulZeroOneClass.toMulZeroClass.{u1} β (MonoidWithZero.toMulZeroOneClass.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)))))) (SMulZeroClass.toSMul.{u2, u1} α β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} α β (MonoidWithZero.toZero.{u2} α (GroupWithZero.toMonoidWithZero.{u2} α _inst_1)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) _inst_3)))] (c : α) (x : β), Eq.{succ u1} β (Inv.inv.{u1} β (GroupWithZero.toInv.{u1} β _inst_2) (HSMul.hSMul.{u2, u1, u1} α β β (instHSMul.{u2, u1} α β (SMulZeroClass.toSMul.{u2, u1} α β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} α β (MonoidWithZero.toZero.{u2} α (GroupWithZero.toMonoidWithZero.{u2} α _inst_1)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) _inst_3)))) c x)) (HSMul.hSMul.{u2, u1, u1} α β β (instHSMul.{u2, u1} α β (SMulZeroClass.toSMul.{u2, u1} α β (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} α β (MonoidWithZero.toZero.{u2} α (GroupWithZero.toMonoidWithZero.{u2} α _inst_1)) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} α β (GroupWithZero.toMonoidWithZero.{u2} α _inst_1) (MonoidWithZero.toZero.{u1} β (GroupWithZero.toMonoidWithZero.{u1} β _inst_2)) _inst_3)))) (Inv.inv.{u2} α (GroupWithZero.toInv.{u2} α _inst_1) c) (Inv.inv.{u1} β (GroupWithZero.toInv.{u1} β _inst_2) x))
-Case conversion may be inaccurate. Consider using '#align smul_inv₀ smul_inv₀ₓ'. -/
 theorem smul_inv₀ [SMulCommClass α β β] [IsScalarTower α β β] (c : α) (x : β) :
     (c • x)⁻¹ = c⁻¹ • x⁻¹ := by
   obtain rfl | hc := eq_or_ne c 0
@@ -324,12 +258,6 @@ theorem smul_inv₀ [SMulCommClass α β β] [IsScalarTower α β β] (c : α) (
 
 end GroupWithZero
 
-/- warning: smul_monoid_with_zero_hom -> smulMonoidWithZeroHom is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : MonoidWithZero.{u1} α] [_inst_2 : MulZeroOneClass.{u2} β] [_inst_3 : MulActionWithZero.{u1, u2} α β _inst_1 (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2))] [_inst_4 : IsScalarTower.{u1, u2, u2} α β β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α _inst_1))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) _inst_3))) (Mul.toSMul.{u2} β (MulZeroClass.toHasMul.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2))) (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α _inst_1))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) _inst_3)))] [_inst_5 : SMulCommClass.{u1, u2, u2} α β β (SMulZeroClass.toHasSmul.{u1, u2} α β (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (SMulWithZero.toSmulZeroClass.{u1, u2} α β (MulZeroClass.toHasZero.{u1} α (MulZeroOneClass.toMulZeroClass.{u1} α (MonoidWithZero.toMulZeroOneClass.{u1} α _inst_1))) (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroClass.toHasZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)) _inst_3))) (Mul.toSMul.{u2} β (MulZeroClass.toHasMul.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)))], MonoidWithZeroHom.{max u1 u2, u2} (Prod.{u1, u2} α β) β (Prod.mulZeroOneClass.{u1, u2} α β (MonoidWithZero.toMulZeroOneClass.{u1} α _inst_1) _inst_2) _inst_2
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : MonoidWithZero.{u1} α] [_inst_2 : MulZeroOneClass.{u2} β] [_inst_3 : MulActionWithZero.{u1, u2} α β _inst_1 (MulZeroOneClass.toZero.{u2} β _inst_2)] [_inst_4 : IsScalarTower.{u1, u2, u2} α β β (SMulZeroClass.toSMul.{u1, u2} α β (MulZeroOneClass.toZero.{u2} β _inst_2) (SMulWithZero.toSMulZeroClass.{u1, u2} α β (MonoidWithZero.toZero.{u1} α _inst_1) (MulZeroOneClass.toZero.{u2} β _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroOneClass.toZero.{u2} β _inst_2) _inst_3))) (SMulZeroClass.toSMul.{u2, u2} β β (MulZeroOneClass.toZero.{u2} β _inst_2) (SMulWithZero.toSMulZeroClass.{u2, u2} β β (MulZeroOneClass.toZero.{u2} β _inst_2) (MulZeroOneClass.toZero.{u2} β _inst_2) (MulZeroClass.toSMulWithZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2)))) (SMulZeroClass.toSMul.{u1, u2} α β (MulZeroOneClass.toZero.{u2} β _inst_2) (SMulWithZero.toSMulZeroClass.{u1, u2} α β (MonoidWithZero.toZero.{u1} α _inst_1) (MulZeroOneClass.toZero.{u2} β _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroOneClass.toZero.{u2} β _inst_2) _inst_3)))] [_inst_5 : SMulCommClass.{u1, u2, u2} α β β (SMulZeroClass.toSMul.{u1, u2} α β (MulZeroOneClass.toZero.{u2} β _inst_2) (SMulWithZero.toSMulZeroClass.{u1, u2} α β (MonoidWithZero.toZero.{u1} α _inst_1) (MulZeroOneClass.toZero.{u2} β _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} α β _inst_1 (MulZeroOneClass.toZero.{u2} β _inst_2) _inst_3))) (SMulZeroClass.toSMul.{u2, u2} β β (MulZeroOneClass.toZero.{u2} β _inst_2) (SMulWithZero.toSMulZeroClass.{u2, u2} β β (MulZeroOneClass.toZero.{u2} β _inst_2) (MulZeroOneClass.toZero.{u2} β _inst_2) (MulZeroClass.toSMulWithZero.{u2} β (MulZeroOneClass.toMulZeroClass.{u2} β _inst_2))))], MonoidWithZeroHom.{max u2 u1, u2} (Prod.{u1, u2} α β) β (Prod.instMulZeroOneClassProd.{u1, u2} α β (MonoidWithZero.toMulZeroOneClass.{u1} α _inst_1) _inst_2) _inst_2
-Case conversion may be inaccurate. Consider using '#align smul_monoid_with_zero_hom smulMonoidWithZeroHomₓ'. -/
 /-- Scalar multiplication as a monoid homomorphism with zero. -/
 @[simps]
 def smulMonoidWithZeroHom {α β : Type _} [MonoidWithZero α] [MulZeroOneClass β]
Diff
@@ -147,9 +147,7 @@ protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function
     (smul : ∀ (a : R) (b), f (a • b) = a • f b) : SMulWithZero R M'
     where
   smul := (· • ·)
-  zero_smul m := by
-    rcases hf m with ⟨x, rfl⟩
-    simp [← smul]
+  zero_smul m := by rcases hf m with ⟨x, rfl⟩; simp [← smul]
   smul_zero c := by simp only [← f.map_zero, ← smul, smul_zero]
 #align function.surjective.smul_with_zero Function.Surjective.smulWithZero
 -/
Diff
@@ -75,7 +75,7 @@ instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R
 lean 3 declaration is
   forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.hasZero.{u1} R (MulZeroClass.toHasZero.{u1} R _inst_1)) (MulZeroClass.toHasZero.{u1} R _inst_1)
 but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.instZeroMulOpposite.{u1} R (MulZeroClass.toZero.{u1} R _inst_1)) (MulZeroClass.toZero.{u1} R _inst_1)
+  forall (R : Type.{u1}) [_inst_1 : MulZeroClass.{u1} R], SMulWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.zero.{u1} R (MulZeroClass.toZero.{u1} R _inst_1)) (MulZeroClass.toZero.{u1} R _inst_1)
 Case conversion may be inaccurate. Consider using '#align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSMulWithZeroₓ'. -/
 /-- Like `mul_zero_class.to_smul_with_zero`, but multiplies on the right. -/
 instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero Rᵐᵒᵖ R
@@ -236,7 +236,7 @@ instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
 lean 3 declaration is
   forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.monoidWithZero.{u1} R _inst_1) (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R _inst_1)))
 but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.instMonoidWithZeroMulOpposite.{u1} R _inst_1) (MonoidWithZero.toZero.{u1} R _inst_1)
+  forall (R : Type.{u1}) [_inst_1 : MonoidWithZero.{u1} R], MulActionWithZero.{u1, u1} (MulOpposite.{u1} R) R (MulOpposite.monoidWithZero.{u1} R _inst_1) (MonoidWithZero.toZero.{u1} R _inst_1)
 Case conversion may be inaccurate. Consider using '#align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZeroₓ'. -/
 /-- Like `monoid_with_zero.to_mul_action_with_zero`, but multiplies on the right. See also
 `semiring.to_opposite_module` -/
Diff
@@ -67,8 +67,8 @@ Case conversion may be inaccurate. Consider using '#align mul_zero_class.to_smul
 instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R
     where
   smul := (· * ·)
-  smul_zero := mul_zero
-  zero_smul := zero_mul
+  smul_zero := MulZeroClass.mul_zero
+  zero_smul := MulZeroClass.zero_mul
 #align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZero
 
 /- warning: mul_zero_class.to_opposite_smul_with_zero -> MulZeroClass.toOppositeSMulWithZero is a dubious translation:
@@ -81,8 +81,8 @@ Case conversion may be inaccurate. Consider using '#align mul_zero_class.to_oppo
 instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero Rᵐᵒᵖ R
     where
   smul := (· • ·)
-  smul_zero r := zero_mul _
-  zero_smul := mul_zero
+  smul_zero r := MulZeroClass.zero_mul _
+  zero_smul := MulZeroClass.mul_zero
 #align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSMulWithZero
 
 variable (R) {M} [Zero R] [Zero M] [SMulWithZero R M]

Changes in mathlib4

mathlib3
mathlib4
chore: Homogenise instances for MulOpposite/AddOpposite (#11485)

by declaring them all in where style with implicit type assumptions and inst prefix

Here to reduce the diff from #11203

Diff
@@ -155,7 +155,7 @@ instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
 /-- Like `MonoidWithZero.toMulActionWithZero`, but multiplies on the right. See also
 `Semiring.toOppositeModule` -/
 instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒᵖ R :=
-  { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
+  { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
 
 protected lemma MulActionWithZero.subsingleton
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -128,7 +128,6 @@ instance AddGroup.intSMulWithZero [AddGroup M] : SMulWithZero ℤ M where
 section MonoidWithZero
 
 variable [MonoidWithZero R] [MonoidWithZero R'] [Zero M]
-
 variable (R M)
 
 /-- An action of a monoid with zero `R` on a Type `M`, also with `0`, extends `MulAction` and
chore: replace λ by fun (#11301)

Per the style guidelines, λ is disallowed in mathlib. This is close to exhaustive; I left some tactic code alone when it seemed to me that tactic could be upstreamed soon.

Notes

  • In lines I was modifying anyway, I also converted => to .
  • Also contains some mild in-passing indentation fixes in Mathlib/Order/SupClosed.
  • Some doc comments still contained Lean 3 syntax λ x, , which I also replaced.
Diff
@@ -161,7 +161,7 @@ instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒ
 
 protected lemma MulActionWithZero.subsingleton
     [MulActionWithZero R M] [Subsingleton R] : Subsingleton M :=
-  ⟨λ x y => by
+  ⟨fun x y => by
     rw [← one_smul R x, ← one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
 #align mul_action_with_zero.subsingleton MulActionWithZero.subsingleton
 
feat: DistribSMul R R instance for NonUnitalNonAssocSemiring R (#10162)

Nonunital Nonassociative semirings act (in some sense) on themselves by multiplication, and this multiplication satisfies the requirements of the DistribSMul class. This is part of a refactor of HahnSeries that includes having HahnSeries Γ R act on HahnSeries Γ V for V an R-module.

I'm not sure about the best file for this instance. #find_home! suggested Mathlib.Algebra.SMulWithZero, but it looks a bit strange there.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -229,3 +229,8 @@ def smulMonoidWithZeroHom {α β : Type*} [MonoidWithZero α] [MulZeroOneClass 
   { smulMonoidHom with map_zero' := smul_zero _ }
 #align smul_monoid_with_zero_hom smulMonoidWithZeroHom
 #align smul_monoid_with_zero_hom_apply smulMonoidWithZeroHom_apply
+
+-- This instance seems a bit incongruous in this file, but `#find_home!` told me to put it here.
+instance NonUnitalNonAssocSemiring.toDistribSMul [NonUnitalNonAssocSemiring R] :
+    DistribSMul R R where
+  smul_add := mul_add
feat: HahnSeries smul order inequality (#9848)

Given a Hahn series x and a scalar r such that r • x ≠ 0, the order of r • x is not strictly less than the order of x. If the exponent poset is linearly ordered, the order of x is less than or equal to the order of r • x. (Note that the order of a Hahn series is not uniquely defined when the exponent poset is not linearly ordered.) This is a complement to the addition result HahnSeries.min_order_le_order_add.

Diff
@@ -75,12 +75,8 @@ variable {R} {a : R} {b : M}
 
 lemma smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 := h.symm ▸ zero_smul _ b
 #align smul_eq_zero_of_left smul_eq_zero_of_left
-lemma smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 := h.symm ▸ smul_zero a
-#align smul_eq_zero_of_right smul_eq_zero_of_right
 lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt fun h ↦ smul_eq_zero_of_left h b
 #align left_ne_zero_of_smul left_ne_zero_of_smul
-lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt <| smul_eq_zero_of_right a
-#align right_ne_zero_of_smul right_ne_zero_of_smul
 
 variable [Zero R'] [Zero M'] [SMul R M']
 
feat(Algebra/GroupPower): Miscellaneous lemmas (#9388)

Generalise pow_ite/ite_pow and give a version of pow_add_pow_le that doesn't require the exponent to be nonzero.

From LeanAPAP

Diff
@@ -178,7 +178,6 @@ protected lemma MulActionWithZero.nontrivial
 variable {R M}
 variable [MulActionWithZero R M] [Zero M'] [SMul R M'] (p : Prop) [Decidable p]
 
-@[simp]
 lemma ite_zero_smul (a : R) (b : M) : (if p then a else 0 : R) • b = if p then a • b else 0 := by
   rw [ite_smul, zero_smul]
 
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -79,7 +79,7 @@ lemma smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 := h.symm ▸ smul
 #align smul_eq_zero_of_right smul_eq_zero_of_right
 lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt fun h ↦ smul_eq_zero_of_left h b
 #align left_ne_zero_of_smul left_ne_zero_of_smul
-lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt $ smul_eq_zero_of_right a
+lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt <| smul_eq_zero_of_right a
 #align right_ne_zero_of_smul right_ne_zero_of_smul
 
 variable [Zero R'] [Zero M'] [SMul R M']
chore(*): drop $/<| before fun (#9361)

Subset of #9319

Diff
@@ -77,7 +77,7 @@ lemma smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 := h.symm ▸ zero_
 #align smul_eq_zero_of_left smul_eq_zero_of_left
 lemma smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 := h.symm ▸ smul_zero a
 #align smul_eq_zero_of_right smul_eq_zero_of_right
-lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt $ fun h ↦ smul_eq_zero_of_left h b
+lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt fun h ↦ smul_eq_zero_of_left h b
 #align left_ne_zero_of_smul left_ne_zero_of_smul
 lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt $ smul_eq_zero_of_right a
 #align right_ne_zero_of_smul right_ne_zero_of_smul
chore: Replace (· op ·) a by (a op ·) (#8843)

I used the regex \(\(· (.) ·\) (.)\), replacing with ($2 $1 ·).

Diff
@@ -112,7 +112,7 @@ variable (M)
 
 /-- Compose a `SMulWithZero` with a `ZeroHom`, with action `f r' • m` -/
 def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M where
-  smul := (· • ·) ∘ f
+  smul := (f · • ·)
   smul_zero m := smul_zero (f m)
   zero_smul m := by show (f 0) • m = 0; rw [map_zero, zero_smul]
 #align smul_with_zero.comp_hom SMulWithZero.compHom
feat: (if P then 1 else 0) • a (#8347)

Two simple lemmas, smul_ite_zero, and ite_smul_zero. Also delete Finset.sum_univ_ite since it is now provable by simp thanks to these.

Rename and turn around the following to match the direction that simp goes in:

  • ite_mul_zero_leftite_zero_mul
  • ite_mul_zero_rightmul_ite_zero
  • ite_and_mul_zeroite_zero_mul_ite_zero
Diff
@@ -176,7 +176,13 @@ protected lemma MulActionWithZero.nontrivial
 #align mul_action_with_zero.nontrivial MulActionWithZero.nontrivial
 
 variable {R M}
-variable [MulActionWithZero R M] [Zero M'] [SMul R M']
+variable [MulActionWithZero R M] [Zero M'] [SMul R M'] (p : Prop) [Decidable p]
+
+@[simp]
+lemma ite_zero_smul (a : R) (b : M) : (if p then a else 0 : R) • b = if p then a • b else 0 := by
+  rw [ite_smul, zero_smul]
+
+lemma boole_smul (a : M) : (if p then 1 else 0 : R) • a = if p then a else 0 := by simp
 
 /-- Pullback a `MulActionWithZero` structure along an injective zero-preserving homomorphism.
 See note [reducible non-instances]. -/
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -105,7 +105,7 @@ protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function
   zero_smul m := by
     rcases hf m with ⟨x, rfl⟩
     simp [← smul]
-  smul_zero c := by rw [←f.map_zero, ←smul, smul_zero]
+  smul_zero c := by rw [← f.map_zero, ← smul, smul_zero]
 #align function.surjective.smul_with_zero Function.Surjective.smulWithZero
 
 variable (M)
@@ -165,7 +165,8 @@ instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒ
 
 protected lemma MulActionWithZero.subsingleton
     [MulActionWithZero R M] [Subsingleton R] : Subsingleton M :=
-  ⟨λ x y => by rw [←one_smul R x, ←one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
+  ⟨λ x y => by
+    rw [← one_smul R x, ← one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
 #align mul_action_with_zero.subsingleton MulActionWithZero.subsingleton
 
 protected lemma MulActionWithZero.nontrivial
perf: remove overspecified fields (#6965)

This removes redundant field values of the form add := add for smaller terms and less unfolding during unification.

A list of all files containing a structure instance of the form { a1, ... with x1 := val, ... } where some xi is a field of some aj was generated by modifying the structure instance elaboration algorithm to print such overlaps to stdout in a custom toolchain.

Using that toolchain, I went through each file on the list and attempted to remove algebraic fields that overlapped and were redundant, eg add := add and not toFun (though some other ones did creep in). If things broke (which was the case in a couple of cases), I did not push further and reverted.

It is possible that pushing harder and trying to remove all redundant overlaps will yield further improvements.

Diff
@@ -198,7 +198,6 @@ variable (M)
 /-- Compose a `MulActionWithZero` with a `MonoidWithZeroHom`, with action `f r' • m` -/
 def MulActionWithZero.compHom (f : R' →*₀ R) : MulActionWithZero R' M :=
   { SMulWithZero.compHom M f.toZeroHom with
-    smul := (· • ·) ∘ f
     mul_smul := fun r s m => by show f (r * s) • m = (f r) • (f s) • m; simp [mul_smul]
     one_smul := fun m => by show (f 1) • m = m; simp }
 #align mul_action_with_zero.comp_hom MulActionWithZero.compHom
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -37,7 +37,7 @@ We also add an `instance`:
 -/
 
 
-variable {R R' M M' : Type _}
+variable {R R' M M' : Type*}
 
 section Zero
 
@@ -207,7 +207,7 @@ end MonoidWithZero
 
 section GroupWithZero
 
-variable {α β : Type _} [GroupWithZero α] [GroupWithZero β] [MulActionWithZero α β]
+variable {α β : Type*} [GroupWithZero α] [GroupWithZero β] [MulActionWithZero α β]
 
 theorem smul_inv₀ [SMulCommClass α β β] [IsScalarTower α β β] (c : α) (x : β) :
     (c • x)⁻¹ = c⁻¹ • x⁻¹ := by
@@ -223,7 +223,7 @@ end GroupWithZero
 
 /-- Scalar multiplication as a monoid homomorphism with zero. -/
 @[simps]
-def smulMonoidWithZeroHom {α β : Type _} [MonoidWithZero α] [MulZeroOneClass β]
+def smulMonoidWithZeroHom {α β : Type*} [MonoidWithZero α] [MulZeroOneClass β]
     [MulActionWithZero α β] [IsScalarTower α β β] [SMulCommClass α β β] : α × β →*₀ β :=
   { smulMonoidHom with map_zero' := smul_zero _ }
 #align smul_monoid_with_zero_hom smulMonoidWithZeroHom
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2021 Damiano Testa. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
-
-! This file was ported from Lean 3 source module algebra.smul_with_zero
-! leanprover-community/mathlib commit 966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.GroupPower.Basic
 import Mathlib.Algebra.Ring.Opposite
 import Mathlib.GroupTheory.GroupAction.Opposite
 import Mathlib.GroupTheory.GroupAction.Prod
 
+#align_import algebra.smul_with_zero from "leanprover-community/mathlib"@"966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2"
+
 /-!
 # Introduce `SMulWithZero`
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -117,7 +117,7 @@ variable (M)
 def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M where
   smul := (· • ·) ∘ f
   smul_zero m := smul_zero (f m)
-  zero_smul m := by show (f 0) • m = 0 ; rw [map_zero, zero_smul]
+  zero_smul m := by show (f 0) • m = 0; rw [map_zero, zero_smul]
 #align smul_with_zero.comp_hom SMulWithZero.compHom
 
 end Zero
chore: fix #align lines (#3640)

This PR fixes two things:

  • Most align statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align). This is often seen in the mathport output after ending calc blocks.
  • All remaining more-than-one-line #align statements. (This was needed for a script I wrote for #3630.)
Diff
@@ -109,7 +109,6 @@ protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function
     rcases hf m with ⟨x, rfl⟩
     simp [← smul]
   smul_zero c := by rw [←f.map_zero, ←smul, smul_zero]
-
 #align function.surjective.smul_with_zero Function.Surjective.smulWithZero
 
 variable (M)
@@ -119,7 +118,6 @@ def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M where
   smul := (· • ·) ∘ f
   smul_zero m := smul_zero (f m)
   zero_smul m := by show (f 0) • m = 0 ; rw [map_zero, zero_smul]
-
 #align smul_with_zero.comp_hom SMulWithZero.compHom
 
 end Zero
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -232,3 +232,4 @@ def smulMonoidWithZeroHom {α β : Type _} [MonoidWithZero α] [MulZeroOneClass
     [MulActionWithZero α β] [IsScalarTower α β β] [SMulCommClass α β β] : α × β →*₀ β :=
   { smulMonoidHom with map_zero' := smul_zero _ }
 #align smul_monoid_with_zero_hom smulMonoidWithZeroHom
+#align smul_monoid_with_zero_hom_apply smulMonoidWithZeroHom_apply
chore: update SHA for 4 files (#1842)

#1519 was merged without a chance to update the SHA.

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Damiano Testa
 
 ! This file was ported from Lean 3 source module algebra.smul_with_zero
-! leanprover-community/mathlib commit 550b58538991c8977703fdeb7c9d51a5aa27df11
+! leanprover-community/mathlib commit 966e0cf0685c9cedf8a3283ac69eef4d5f2eaca2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
Diff
@@ -168,6 +168,17 @@ instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒ
   { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
 
+protected lemma MulActionWithZero.subsingleton
+    [MulActionWithZero R M] [Subsingleton R] : Subsingleton M :=
+  ⟨λ x y => by rw [←one_smul R x, ←one_smul R y, Subsingleton.elim (1 : R) 0, zero_smul, zero_smul]⟩
+#align mul_action_with_zero.subsingleton MulActionWithZero.subsingleton
+
+protected lemma MulActionWithZero.nontrivial
+    [MulActionWithZero R M] [Nontrivial M] : Nontrivial R :=
+  (subsingleton_or_nontrivial R).resolve_left fun _ =>
+    not_subsingleton M <| MulActionWithZero.subsingleton R M
+#align mul_action_with_zero.nontrivial MulActionWithZero.nontrivial
+
 variable {R M}
 variable [MulActionWithZero R M] [Zero M'] [SMul R M']
 
Diff
@@ -74,7 +74,18 @@ theorem zero_smul (m : M) : (0 : R) • m = 0 :=
   SMulWithZero.zero_smul m
 #align zero_smul zero_smul
 
-variable {R} [Zero R'] [Zero M'] [SMul R M']
+variable {R} {a : R} {b : M}
+
+lemma smul_eq_zero_of_left (h : a = 0) (b : M) : a • b = 0 := h.symm ▸ zero_smul _ b
+#align smul_eq_zero_of_left smul_eq_zero_of_left
+lemma smul_eq_zero_of_right (a : R) (h : b = 0) : a • b = 0 := h.symm ▸ smul_zero a
+#align smul_eq_zero_of_right smul_eq_zero_of_right
+lemma left_ne_zero_of_smul : a • b ≠ 0 → a ≠ 0 := mt $ fun h ↦ smul_eq_zero_of_left h b
+#align left_ne_zero_of_smul left_ne_zero_of_smul
+lemma right_ne_zero_of_smul : a • b ≠ 0 → b ≠ 0 := mt $ smul_eq_zero_of_right a
+#align right_ne_zero_of_smul right_ne_zero_of_smul
+
+variable [Zero R'] [Zero M'] [SMul R M']
 
 /-- Pullback a `SMulWithZero` structure along an injective zero-preserving homomorphism.
 See note [reducible non-instances]. -/
chore: tidy various files (#1247)

Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com>

Diff
@@ -14,7 +14,7 @@ import Mathlib.GroupTheory.GroupAction.Opposite
 import Mathlib.GroupTheory.GroupAction.Prod
 
 /-!
-# Introduce `smul_with_zero`
+# Introduce `SMulWithZero`
 
 In analogy with the usual monoid action on a Type `M`, we introduce an action of a
 `MonoidWithZero` on a Type with `0`.
@@ -46,7 +46,7 @@ section Zero
 
 variable (R M)
 
-/-- `smulWithZero` is a class consisting of a Type `R` with `0 ∈ R` and a scalar multiplication
+/-- `SMulWithZero` is a class consisting of a Type `R` with `0 ∈ R` and a scalar multiplication
 of `R` on a Type `M` with `0`, such that the equality `r • m = 0` holds if at least one among `r`
 or `m` equals `0`. -/
 class SMulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
@@ -54,16 +54,14 @@ class SMulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
   zero_smul : ∀ m : M, (0 : R) • m = 0
 #align smul_with_zero SMulWithZero
 
-instance MulZeroClass.toSMulWithZero [MulZeroClass R] :
-    SMulWithZero R R where
+instance MulZeroClass.toSMulWithZero [MulZeroClass R] : SMulWithZero R R where
   smul := (· * ·)
   smul_zero := mul_zero
   zero_smul := zero_mul
 #align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZero
 
 /-- Like `MulZeroClass.toSMulWithZero`, but multiplies on the right. -/
-instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] :
-    SMulWithZero Rᵐᵒᵖ R where
+instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] : SMulWithZero Rᵐᵒᵖ R where
   smul := (· • ·)
   smul_zero _ := zero_mul _
   zero_smul := mul_zero
@@ -106,8 +104,7 @@ protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function
 variable (M)
 
 /-- Compose a `SMulWithZero` with a `ZeroHom`, with action `f r' • m` -/
-def SMulWithZero.compHom (f : ZeroHom R' R) :
-    SMulWithZero R' M where
+def SMulWithZero.compHom (f : ZeroHom R' R) : SMulWithZero R' M where
   smul := (· • ·) ∘ f
   smul_zero m := smul_zero (f m)
   zero_smul m := by show (f 0) • m = 0 ; rw [map_zero, zero_smul]
@@ -116,14 +113,12 @@ def SMulWithZero.compHom (f : ZeroHom R' R) :
 
 end Zero
 
-instance AddMonoid.natSMulWithZero [AddMonoid M] :
-    SMulWithZero ℕ M where
+instance AddMonoid.natSMulWithZero [AddMonoid M] : SMulWithZero ℕ M where
   smul_zero := _root_.nsmul_zero
   zero_smul := zero_nsmul
 #align add_monoid.nat_smul_with_zero AddMonoid.natSMulWithZero
 
-instance AddGroup.intSMulWithZero [AddGroup M] :
-    SMulWithZero ℤ M where
+instance AddGroup.intSMulWithZero [AddGroup M] : SMulWithZero ℤ M where
   smul_zero := zsmul_zero
   zero_smul := zero_zsmul
 #align add_group.int_smul_with_zero AddGroup.intSMulWithZero
@@ -157,7 +152,7 @@ instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
 #align monoid_with_zero.to_mul_action_with_zero MonoidWithZero.toMulActionWithZero
 
 /-- Like `MonoidWithZero.toMulActionWithZero`, but multiplies on the right. See also
-`semiring.toOppositeModule` -/
+`Semiring.toOppositeModule` -/
 instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒᵖ R :=
   { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
chore: fix casing per naming scheme (#1183)

Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2, add_monoid_hom --> AddMonoidHom

Remove \n from to_additive docstrings that were inserted by mathport.

Move files and directories with Gcd and Smul to GCD and SMul

Diff
@@ -19,7 +19,7 @@ import Mathlib.GroupTheory.GroupAction.Prod
 In analogy with the usual monoid action on a Type `M`, we introduce an action of a
 `MonoidWithZero` on a Type with `0`.
 
-In particular, for Types `R` and `M`, both containing `0`, we define `SmulWithZero R M` to
+In particular, for Types `R` and `M`, both containing `0`, we define `SMulWithZero R M` to
 be the typeclass where the products `r • 0` and `0 • m` vanish for all `r : R` and all `m : M`.
 
 Moreover, in the case in which `R` is a `MonoidWithZero`, we introduce the typeclass
@@ -27,7 +27,7 @@ Moreover, in the case in which `R` is a `MonoidWithZero`, we introduce the typec
 Thus, the action is required to be compatible with
 
 * the unit of the monoid, acting as the identity;
-* the zero of the monoid_with_zero, acting as zero;
+* the zero of the `MonoidWithZero`, acting as zero;
 * associativity of the monoid.
 
 We also add an `instance`:
@@ -49,52 +49,52 @@ variable (R M)
 /-- `smulWithZero` is a class consisting of a Type `R` with `0 ∈ R` and a scalar multiplication
 of `R` on a Type `M` with `0`, such that the equality `r • m = 0` holds if at least one among `r`
 or `m` equals `0`. -/
-class SmulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
+class SMulWithZero [Zero R] [Zero M] extends SMulZeroClass R M where
   /-- Scalar multiplication by the scalar `0` is `0`. -/
   zero_smul : ∀ m : M, (0 : R) • m = 0
-#align smul_with_zero SmulWithZero
+#align smul_with_zero SMulWithZero
 
-instance MulZeroClass.toSmulWithZero [MulZeroClass R] :
-    SmulWithZero R R where
+instance MulZeroClass.toSMulWithZero [MulZeroClass R] :
+    SMulWithZero R R where
   smul := (· * ·)
   smul_zero := mul_zero
   zero_smul := zero_mul
-#align mul_zero_class.to_smul_with_zero MulZeroClass.toSmulWithZero
+#align mul_zero_class.to_smul_with_zero MulZeroClass.toSMulWithZero
 
-/-- Like `MulZeroClass.toSmulWithZero`, but multiplies on the right. -/
-instance MulZeroClass.toOppositeSmulWithZero [MulZeroClass R] :
-    SmulWithZero Rᵐᵒᵖ R where
+/-- Like `MulZeroClass.toSMulWithZero`, but multiplies on the right. -/
+instance MulZeroClass.toOppositeSMulWithZero [MulZeroClass R] :
+    SMulWithZero Rᵐᵒᵖ R where
   smul := (· • ·)
   smul_zero _ := zero_mul _
   zero_smul := mul_zero
-#align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSmulWithZero
+#align mul_zero_class.to_opposite_smul_with_zero MulZeroClass.toOppositeSMulWithZero
 
-variable {M} [Zero R] [Zero M] [SmulWithZero R M]
+variable {M} [Zero R] [Zero M] [SMulWithZero R M]
 
 @[simp]
 theorem zero_smul (m : M) : (0 : R) • m = 0 :=
-  SmulWithZero.zero_smul m
+  SMulWithZero.zero_smul m
 #align zero_smul zero_smul
 
 variable {R} [Zero R'] [Zero M'] [SMul R M']
 
-/-- Pullback a `SmulWithZero` structure along an injective zero-preserving homomorphism.
+/-- Pullback a `SMulWithZero` structure along an injective zero-preserving homomorphism.
 See note [reducible non-instances]. -/
 @[reducible]
 protected def Function.Injective.smulWithZero (f : ZeroHom M' M) (hf : Function.Injective f)
     (smul : ∀ (a : R) (b), f (a • b) = a • f b) :
-    SmulWithZero R M' where
+    SMulWithZero R M' where
   smul := (· • ·)
   zero_smul a := hf <| by simp [smul]
   smul_zero a := hf <| by simp [smul]
 #align function.injective.smul_with_zero Function.Injective.smulWithZero
 
-/-- Pushforward a `SmulWithZero` structure along a surjective zero-preserving homomorphism.
+/-- Pushforward a `SMulWithZero` structure along a surjective zero-preserving homomorphism.
 See note [reducible non-instances]. -/
 @[reducible]
 protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function.Surjective f)
     (smul : ∀ (a : R) (b), f (a • b) = a • f b) :
-    SmulWithZero R M' where
+    SMulWithZero R M' where
   smul := (· • ·)
   zero_smul m := by
     rcases hf m with ⟨x, rfl⟩
@@ -105,28 +105,28 @@ protected def Function.Surjective.smulWithZero (f : ZeroHom M M') (hf : Function
 
 variable (M)
 
-/-- Compose a `SmulWithZero` with a `ZeroHom`, with action `f r' • m` -/
-def SmulWithZero.compHom (f : ZeroHom R' R) :
-    SmulWithZero R' M where
+/-- Compose a `SMulWithZero` with a `ZeroHom`, with action `f r' • m` -/
+def SMulWithZero.compHom (f : ZeroHom R' R) :
+    SMulWithZero R' M where
   smul := (· • ·) ∘ f
   smul_zero m := smul_zero (f m)
   zero_smul m := by show (f 0) • m = 0 ; rw [map_zero, zero_smul]
 
-#align smul_with_zero.comp_hom SmulWithZero.compHom
+#align smul_with_zero.comp_hom SMulWithZero.compHom
 
 end Zero
 
-instance AddMonoid.natSmulWithZero [AddMonoid M] :
-    SmulWithZero ℕ M where
+instance AddMonoid.natSMulWithZero [AddMonoid M] :
+    SMulWithZero ℕ M where
   smul_zero := _root_.nsmul_zero
   zero_smul := zero_nsmul
-#align add_monoid.nat_smul_with_zero AddMonoid.natSmulWithZero
+#align add_monoid.nat_smul_with_zero AddMonoid.natSMulWithZero
 
-instance AddGroup.intSmulWithZero [AddGroup M] :
-    SmulWithZero ℤ M where
+instance AddGroup.intSMulWithZero [AddGroup M] :
+    SMulWithZero ℤ M where
   smul_zero := zsmul_zero
   zero_smul := zero_zsmul
-#align add_group.int_smul_with_zero AddGroup.intSmulWithZero
+#align add_group.int_smul_with_zero AddGroup.intSMulWithZero
 
 section MonoidWithZero
 
@@ -138,7 +138,7 @@ variable (R M)
 is compatible with `0` (both in `R` and in `M`), with `1 ∈ R`, and with associativity of
 multiplication on the monoid `M`. -/
 class MulActionWithZero extends MulAction R M where
-  -- these fields are copied from `SmulWithZero`, as `extends` behaves poorly
+  -- these fields are copied from `SMulWithZero`, as `extends` behaves poorly
   /-- Scalar multiplication by any element send `0` to `0`. -/
   smul_zero : ∀ r : R, r • (0 : M) = 0
   /-- Scalar multiplication by the scalar `0` is `0`. -/
@@ -146,20 +146,20 @@ class MulActionWithZero extends MulAction R M where
 #align mul_action_with_zero MulActionWithZero
 
 -- see Note [lower instance priority]
-instance (priority := 100) MulActionWithZero.toSmulWithZero [m : MulActionWithZero R M] :
-    SmulWithZero R M :=
+instance (priority := 100) MulActionWithZero.toSMulWithZero [m : MulActionWithZero R M] :
+    SMulWithZero R M :=
   { m with }
-#align mul_action_with_zero.to_smul_with_zero MulActionWithZero.toSmulWithZero
+#align mul_action_with_zero.to_smul_with_zero MulActionWithZero.toSMulWithZero
 
 /-- See also `Semiring.toModule` -/
 instance MonoidWithZero.toMulActionWithZero : MulActionWithZero R R :=
-  { MulZeroClass.toSmulWithZero R, Monoid.toMulAction R with }
+  { MulZeroClass.toSMulWithZero R, Monoid.toMulAction R with }
 #align monoid_with_zero.to_mul_action_with_zero MonoidWithZero.toMulActionWithZero
 
 /-- Like `MonoidWithZero.toMulActionWithZero`, but multiplies on the right. See also
 `semiring.toOppositeModule` -/
 instance MonoidWithZero.toOppositeMulActionWithZero : MulActionWithZero Rᵐᵒᵖ R :=
-  { MulZeroClass.toOppositeSmulWithZero R, Monoid.toOppositeMulAction R with }
+  { MulZeroClass.toOppositeSMulWithZero R, Monoid.toOppositeMulAction R with }
 #align monoid_with_zero.to_opposite_mul_action_with_zero MonoidWithZero.toOppositeMulActionWithZero
 
 variable {R M}
@@ -185,7 +185,7 @@ variable (M)
 
 /-- Compose a `MulActionWithZero` with a `MonoidWithZeroHom`, with action `f r' • m` -/
 def MulActionWithZero.compHom (f : R' →*₀ R) : MulActionWithZero R' M :=
-  { SmulWithZero.compHom M f.toZeroHom with
+  { SMulWithZero.compHom M f.toZeroHom with
     smul := (· • ·) ∘ f
     mul_smul := fun r s m => by show f (r * s) • m = (f r) • (f s) • m; simp [mul_smul]
     one_smul := fun m => by show (f 1) • m = m; simp }
feat: port Algebra.SmulWithZero (#1130)

Dependencies 72

73 files ported (100.0%)
33612 lines ported (100.0%)

All dependencies are ported!