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

Commit 34b61e3

Browse files
committed
chore(algebra/regular/*): generalisation linter (#13955)
1 parent 5253153 commit 34b61e3

File tree

2 files changed

+58
-39
lines changed

2 files changed

+58
-39
lines changed

src/algebra/regular/basic.lean

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,18 @@ lemma not_is_regular_zero [nontrivial R] : ¬ is_regular (0 : R) :=
241241

242242
end mul_zero_class
243243

244+
section mul_one_class
245+
246+
variable [mul_one_class R]
247+
248+
/-- If multiplying by `1` on either side is the identity, `1` is regular. -/
249+
@[to_additive "If adding `0` on either side is the identity, `0` is regular."]
250+
lemma is_regular_one : is_regular (1 : R) :=
251+
⟨λ a b ab, (one_mul a).symm.trans (eq.trans ab (one_mul b)),
252+
λ a b ab, (mul_one a).symm.trans (eq.trans ab (mul_one b))⟩
253+
254+
end mul_one_class
255+
244256
section comm_semigroup
245257

246258
variable [comm_semigroup R]
@@ -259,12 +271,6 @@ section monoid
259271

260272
variables [monoid R]
261273

262-
/-- In a monoid, `1` is regular. -/
263-
@[to_additive "In an additive monoid, `0` is regular."]
264-
lemma is_regular_one : is_regular (1 : R) :=
265-
⟨λ a b ab, (one_mul a).symm.trans (eq.trans ab (one_mul b)),
266-
λ a b ab, (mul_one a).symm.trans (eq.trans ab (mul_one b))⟩
267-
268274
/-- An element admitting a left inverse is left-regular. -/
269275
@[to_additive "An element admitting a left additive opposite is add-left-regular."]
270276
lemma is_left_regular_of_mul_eq_one (h : b * a = 1) : is_left_regular a :=

src/algebra/regular/smul.lean

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Authors: Damiano Testa
55
-/
66
import algebra.smul_with_zero
77
import algebra.regular.basic
8+
89
/-!
910
# Action of regular elements on a module
1011
@@ -76,35 +77,22 @@ lemma is_left_regular [has_mul R] {a : R} (h : is_smul_regular R a) :
7677
lemma is_right_regular [has_mul R] {a : R} (h : is_smul_regular R (mul_opposite.op a)) :
7778
is_right_regular a := h
7879

79-
end has_scalar
80-
81-
section monoid
82-
83-
variables [monoid R] [mul_action R M]
84-
85-
variable (M)
86-
87-
/-- One is `M`-regular always. -/
88-
@[simp] lemma one : is_smul_regular M (1 : R) :=
89-
λ a b ab, by rwa [one_smul, one_smul] at ab
90-
91-
variable {M}
92-
93-
lemma mul (ra : is_smul_regular M a) (rb : is_smul_regular M b) :
94-
is_smul_regular M (a * b) :=
80+
lemma mul [has_mul R] [is_scalar_tower R R M]
81+
(ra : is_smul_regular M a) (rb : is_smul_regular M b) : is_smul_regular M (a * b) :=
9582
ra.smul rb
9683

97-
lemma of_mul (ab : is_smul_regular M (a * b)) :
84+
lemma of_mul [has_mul R] [is_scalar_tower R R M] (ab : is_smul_regular M (a * b)) :
9885
is_smul_regular M b :=
9986
by { rw ← smul_eq_mul at ab, exact ab.of_smul _ }
10087

101-
@[simp] lemma mul_iff_right (ha : is_smul_regular M a) :
88+
@[simp] lemma mul_iff_right [has_mul R] [is_scalar_tower R R M] (ha : is_smul_regular M a) :
10289
is_smul_regular M (a * b) ↔ is_smul_regular M b :=
10390
⟨of_mul, ha.mul⟩
10491

10592
/-- Two elements `a` and `b` are `M`-regular if and only if both products `a * b` and `b * a`
10693
are `M`-regular. -/
107-
lemma mul_and_mul_iff : is_smul_regular M (a * b) ∧ is_smul_regular M (b * a) ↔
94+
lemma mul_and_mul_iff [has_mul R] [is_scalar_tower R R M] :
95+
is_smul_regular M (a * b) ∧ is_smul_regular M (b * a) ↔
10896
is_smul_regular M a ∧ is_smul_regular M b :=
10997
begin
11098
refine ⟨_, _⟩,
@@ -114,6 +102,24 @@ begin
114102
exact ⟨ha.mul hb, hb.mul ha⟩ }
115103
end
116104

105+
end has_scalar
106+
107+
section monoid
108+
109+
variables [monoid R] [mul_action R M]
110+
111+
variable (M)
112+
113+
/-- One is `M`-regular always. -/
114+
@[simp] lemma one : is_smul_regular M (1 : R) :=
115+
λ a b ab, by rwa [one_smul, one_smul] at ab
116+
117+
variable {M}
118+
119+
/-- An element of `R` admitting a left inverse is `M`-regular. -/
120+
lemma of_mul_eq_one (h : a * b = 1) : is_smul_regular M b :=
121+
of_mul (by { rw h, exact one M })
122+
117123
/-- Any power of an `M`-regular element is `M`-regular. -/
118124
lemma pow (n : ℕ) (ra : is_smul_regular M a) : is_smul_regular M (a ^ n) :=
119125
begin
@@ -133,10 +139,21 @@ end
133139

134140
end monoid
135141

142+
section monoid_smul
143+
144+
variables [monoid S] [has_scalar R M] [has_scalar R S] [mul_action S M] [is_scalar_tower R S M]
145+
146+
/-- An element of `S` admitting a left inverse in `R` is `M`-regular. -/
147+
lemma of_smul_eq_one (h : a • s = 1) : is_smul_regular M s :=
148+
of_smul a (by { rw h, exact one M })
149+
150+
end monoid_smul
151+
136152
section monoid_with_zero
137153

138-
variables [monoid_with_zero R] [monoid_with_zero S] [has_zero M] [mul_action_with_zero R M]
139-
[mul_action_with_zero R S] [mul_action_with_zero S M] [is_scalar_tower R S M]
154+
variables [monoid_with_zero R] [monoid_with_zero S] [has_zero M]
155+
[mul_action_with_zero R M] [mul_action_with_zero R S] [mul_action_with_zero S M]
156+
[is_scalar_tower R S M]
140157

141158
/-- The element `0` is `M`-regular if and only if `M` is trivial. -/
142159
protected lemma subsingleton (h : is_smul_regular M (0 : R)) : subsingleton M :=
@@ -162,19 +179,11 @@ zero_iff_subsingleton.mpr sM
162179
lemma not_zero [nM : nontrivial M] : ¬ is_smul_regular M (0 : R) :=
163180
not_zero_iff.mpr nM
164181

165-
/-- An element of `S` admitting a left inverse in `R` is `M`-regular. -/
166-
lemma of_smul_eq_one (h : a • s = 1) : is_smul_regular M s :=
167-
of_smul a (by { rw h, exact one M })
168-
169-
/-- An element of `R` admitting a left inverse is `M`-regular. -/
170-
lemma of_mul_eq_one (h : a * b = 1) : is_smul_regular M b :=
171-
of_mul (by { rw h, exact one M })
172-
173182
end monoid_with_zero
174183

175-
section comm_monoid
184+
section comm_semigroup
176185

177-
variables [comm_monoid R] [mul_action R M]
186+
variables [comm_semigroup R] [has_scalar R M] [is_scalar_tower R R M]
178187

179188
/-- A product is `M`-regular if and only if the factors are. -/
180189
lemma mul_iff : is_smul_regular M (a * b) ↔
@@ -184,7 +193,7 @@ begin
184193
exact ⟨λ ab, ⟨ab, by rwa mul_comm⟩, λ rab, rab.1
185194
end
186195

187-
end comm_monoid
196+
end comm_semigroup
188197

189198
end is_smul_regular
190199

@@ -203,7 +212,9 @@ end
203212

204213
end group
205214

206-
variables [monoid_with_zero R] [has_zero M] [mul_action_with_zero R M]
215+
section units
216+
217+
variables [monoid R] [mul_action R M]
207218

208219
/-- Any element in `Rˣ` is `M`-regular. -/
209220
lemma units.is_smul_regular (a : Rˣ) : is_smul_regular M (a : R) :=
@@ -215,3 +226,5 @@ begin
215226
rcases ua with ⟨a, rfl⟩,
216227
exact a.is_smul_regular M
217228
end
229+
230+
end units

0 commit comments

Comments
 (0)