|
| 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 |
0 commit comments