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

Commit 1f47833

Browse files
adomaniVierkantor
andcommitted
feat(algebra/*, * : [regular, smul_with_zero, module/basic]): introduce mul_action_with_zero and M-regular elements (#6590)
This PR has been split and there are now two separate PRs. * #6590, this one, introducing `smul_with_zero` and `mul_action_with_zero`: two typeclasses to deal with multiplicative actions of `monoid_with_zero`, without the need to assume the presence of an addition! * #6659, introducing `M`-regular elements, called `smul_regular`: the analogue of `is_left_regular`, but defined for an action of `monoid_with_zero` on a module `M`. This PR is a preparation for introducing `M`-regular elements. From the doc-string: ### Introduce `smul_with_zero` In analogy with the usual monoid action on a Type `M`, we introduce an action of a `monoid_with_zero` on a Type with `0`. In particular, for Types `R` and `M`, both containing `0`, we define `smul_with_zero 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 `monoid_with_zero`, we introduce the typeclass `mul_action_with_zero R M`, mimicking group actions and having an absorbing `0` in `R`. 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; * associativity of the monoid. Next, in a separate file, I introduce `M`-regular elements for a `monoid_with_zero R` with a `mul_action_with_zero` on a module `M`. The definition is simply to require that an element `a : R` is `M`-regular if the smultiplication `M → M`, given by `m ↦ a • m` is injective. We also prove some basic facts about `M`-regular elements. The PR further changes three further the files * `data/polynomial/coeffs`; * `topology/algebra/module.lean`; * `analysis/normed_space/bounded_linear_maps`. The changes are prompted by a failure in CI. In each case, the change was tiny, mostly having to do with an exchange of a multiplication by a smultiplication or vice-versa. Co-authored-by: Vierkantor <vierkantor@vierkantor.com> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
1 parent abf2ab4 commit 1f47833

File tree

6 files changed

+99
-8
lines changed

6 files changed

+99
-8
lines changed

src/algebra/module/basic.lean

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ Authors: Nathaniel Thomas, Jeremy Avigad, Johannes Hölzl, Mario Carneiro
55
-/
66
import algebra.big_operators.basic
77
import algebra.group.hom
8-
import algebra.ring.basic
9-
import data.rat.cast
108
import group_theory.group_action.group
11-
import tactic.nth_rewrite
9+
import algebra.smul_with_zero
1210

1311
/-!
1412
# Modules over a ring
1513
1614
In this file we define
1715
1816
* `semimodule R M` : an additive commutative monoid `M` is a `semimodule` over a
19-
`semiring` `R` if for `r : R` and `x : M` their "scalar multiplication `r • x : M` is defined, and
17+
`semiring R` if for `r : R` and `x : M` their "scalar multiplication `r • x : M` is defined, and
2018
the operation `•` satisfies some natural associativity and distributivity axioms similar to those
2119
on a ring.
2220
@@ -57,9 +55,16 @@ variables {R : Type u} {k : Type u'} {S : Type v} {M : Type w} {M₂ : Type x} {
5755
section add_comm_monoid
5856
variables [semiring R] [add_comm_monoid M] [semimodule R M] (r s : R) (x y : M)
5957

58+
/-- A semimodule over a semiring automatically inherits a `mul_action_with_zero` structure. -/
59+
@[priority 100] -- see Note [lower instance priority]
60+
instance semimodule.to_mul_action_with_zero :
61+
mul_action_with_zero R M :=
62+
{ smul_zero := smul_zero,
63+
zero_smul := semimodule.zero_smul,
64+
..(infer_instance : mul_action R M) }
65+
6066
theorem add_smul : (r + s) • x = r • x + s • x := semimodule.add_smul r s x
6167
variables (R)
62-
@[simp] theorem zero_smul : (0 : R) • x = 0 := semimodule.zero_smul x
6368

6469
theorem two_smul : (2 : R) • x = x + x := by rw [bit0, add_smul, one_smul]
6570

src/algebra/regular.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,18 @@ end
227227
lemma is_regular.ne_zero [nontrivial R] (la : is_regular a) : a ≠ 0 :=
228228
la.left.ne_zero
229229

230+
/-- In a non-trivial ring, the element `0` is not left-regular -- with typeclasses. -/
231+
lemma not_is_left_regular_zero [nR : nontrivial R] : ¬ is_left_regular (0 : R) :=
232+
not_is_left_regular_zero_iff.mpr nR
233+
234+
/-- In a non-trivial ring, the element `0` is not right-regular -- with typeclasses. -/
235+
lemma not_is_right_regular_zero [nR : nontrivial R] : ¬ is_right_regular (0 : R) :=
236+
not_is_right_regular_zero_iff.mpr nR
237+
238+
/-- In a non-trivial ring, the element `0` is not regular -- with typeclasses. -/
239+
lemma not_is_regular_zero [nontrivial R] : ¬ is_regular (0 : R) :=
240+
λ h, is_regular.ne_zero h rfl
241+
230242
end mul_zero_class
231243

232244
section comm_semigroup

src/algebra/smul_with_zero.lean

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/-
2+
Copyright (c) 2021 Damiano Testa. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Damiano Testa
5+
-/
6+
import group_theory.group_action.defs
7+
/-!
8+
# Introduce `smul_with_zero`
9+
10+
In analogy with the usual monoid action on a Type `M`, we introduce an action of a
11+
`monoid_with_zero` on a Type with `0`.
12+
13+
In particular, for Types `R` and `M`, both containing `0`, we define `smul_with_zero R M` to
14+
be the typeclass where the products `r • 0` and `0 • m` vanish for all `r : R` and all `m : M`.
15+
16+
Moreover, in the case in which `R` is a `monoid_with_zero`, we introduce the typeclass
17+
`mul_action_with_zero R M`, mimicking group actions and having an absorbing `0` in `R`.
18+
Thus, the action is required to be compatible with
19+
20+
* the unit of the monoid, acting as the identity;
21+
* the zero of the monoid_with_zero, acting as zero;
22+
* associativity of the monoid.
23+
24+
We also add `instances`:
25+
26+
* any `monoid_with_zero` has a `mul_action_with_zero R R` acting on itself;
27+
-/
28+
29+
variables (R M : Type*)
30+
31+
section has_zero
32+
33+
variable [has_zero M]
34+
35+
/-- `smul_with_zero` is a class consisting of a Type `R` with `0 : R` and a scalar multiplication
36+
of `R` on a Type `M` with `0`, such that the equality `r • m = 0` holds if at least one among `r`
37+
or `m` equals `0`. -/
38+
class smul_with_zero [has_zero R] extends has_scalar R M :=
39+
(smul_zero : ∀ r : R, r • (0 : M) = 0)
40+
(zero_smul : ∀ m : M, (0 : R) • m = 0)
41+
42+
variables {M}
43+
44+
@[simp] lemma zero_smul [has_zero R] [smul_with_zero R M] (m : M) :
45+
(0 : R) • m = 0 :=
46+
smul_with_zero.zero_smul m
47+
48+
variables (M)
49+
50+
section monoid_with_zero
51+
52+
variable [monoid_with_zero R]
53+
54+
/-- An action of a monoid with zero `R` on a Type `M`, also with `0`, compatible with `0`
55+
(both in `R` and in `M`), with `1 ∈ R`, and with associativity of multiplication on the
56+
monoid `M`. -/
57+
class mul_action_with_zero extends mul_action R M :=
58+
-- these fields are copied from `smul_with_zero`, as `extends` behaves poorly
59+
(smul_zero : ∀ r : R, r • (0 : M) = 0)
60+
(zero_smul : ∀ m : M, (0 : R) • m = 0)
61+
62+
@[priority 100] -- see Note [lower instance priority]
63+
instance mul_action_with_zero.to_smul_with_zero [m : mul_action_with_zero R M] :
64+
smul_with_zero R M :=
65+
{..m}
66+
67+
instance monoid_with_zero.to_mul_action_with_zero : mul_action_with_zero R R :=
68+
{ smul_zero := mul_zero,
69+
zero_smul := zero_mul,
70+
..monoid.to_mul_action R }
71+
72+
end monoid_with_zero
73+
74+
end has_zero

src/analysis/normed_space/bounded_linear_maps.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ lemma is_bounded_bilinear_map_smul {𝕜' : Type*} [normed_field 𝕜']
279279

280280
lemma is_bounded_bilinear_map_mul :
281281
is_bounded_bilinear_map 𝕜 (λ (p : 𝕜 × 𝕜), p.1 * p.2) :=
282-
is_bounded_bilinear_map_smul
282+
by simp_rw ← smul_eq_mul; exact is_bounded_bilinear_map_smul
283283

284284
lemma is_bounded_bilinear_map_comp :
285285
is_bounded_bilinear_map 𝕜 (λ(p : (E →L[𝕜] F) × (F →L[𝕜] G)), p.2.comp p.1) :=

src/data/polynomial/coeff.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ begin
178178
rw [← f.sum_single] {occs := occurrences.pos [1]},
179179
refine sum_mem _ (λ i hi, _),
180180
change monomial i _ ∈ span _ _,
181-
rw [← C_mul_X_pow_eq_monomial, ← X_pow_mul],
181+
rw [← C_mul_X_pow_eq_monomial, ← X_pow_mul, ← smul_eq_mul],
182182
exact smul_mem _ _ (subset_span ⟨i, rfl⟩),
183183
end
184184

src/topology/algebra/module.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ variables [has_continuous_add M₂]
820820
instance : semimodule S (M →L[R] M₂) :=
821821
{ smul_zero := λ _, ext $ λ _, smul_zero _,
822822
zero_smul := λ _, ext $ λ _, zero_smul _ _,
823-
one_smul := λ _, ext $ λ _, one_smul _ _,
823+
one_smul := λ _, ext $ λ _, by exact one_smul _ _,
824824
mul_smul := λ _ _ _, ext $ λ _, mul_smul _ _ _,
825825
add_smul := λ _ _ _, ext $ λ _, add_smul _ _ _,
826826
smul_add := λ _ _ _, ext $ λ _, smul_add _ _ _ }

0 commit comments

Comments
 (0)