The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V05. Groups

Mathlib.Algebra.Group.Monoid

266 declarations and 2 deprecated aliases. Mathlib docs · Source

Monoids

This file defines additive and multiplicative algebraic structures with a distinguished zero or one, up to and including monoids. Structures that do not require an identity are defined in Mathlib.Algebra.Group.Semigroup.

Design note on AddMonoid and Monoid

An AddMonoid has a natural ℕ-action, defined by n • a = a + ... + a, that we want to declare as an instance as it makes it possible to use the language of linear algebra. However, there are often other natural ℕ-actions. For instance, for any semiring R, the space of polynomials Polynomial R has a natural R-action defined by multiplication on the coefficients. This means that Polynomial ℕ would have two natural ℕ-actions, which are equal but not defeq. The same goes for linear maps, tensor products, and so on (and even for ℕ itself).

To solve this issue, we embed an ℕ-action in the definition of an AddMonoid (which is by default equal to the naive action a + ... + a, but can be adjusted when needed), and declare a SMul ℕ α instance using this action. See Note [forgetful inheritance] for more explanations on this pattern.

For example, when we define Polynomial R, then we declare the ℕ-action to be by multiplication on each coefficient (using the ℕ-action on R that comes from the fact that R is an AddMonoid). In this way, the two natural SMul ℕ (Polynomial ℕ) instances are defeq.

The tactic to_additive transfers definitions and results from multiplicative monoids to additive monoids. To work, it has to map fields to fields. This means that we should also add corresponding fields to the multiplicative structure Monoid, which could solve defeq problems for powers if needed. These problems do not come up in practice, so most of the time we will not need to adjust the npow field when defining multiplicative objects.

We initialize the projections for the monoid structures for @[simps] here.

The lemmas generated for the npow/zpow projections will not apply to x ^ y, since the argument order of these projections does not match the argument order of ^. The nsmul/zsmul lemmas are correct.

def NSMul.ctorIdx E1 #

{M : Type u_2} → NSMul M → ℕ

def AddCancelCommMonoid.ctorIdx E1 #

{M : Type u_2} → AddCancelCommMonoid M → ℕ

def MulOneClass.ctorIdx E1 #

{M : Type u_2} → MulOneClass M → ℕ

def AddMonoid.ctorIdx E1 #

{M : Type u_2} → AddMonoid M → ℕ

def LeftCancelMonoid.ctorIdx E1 #

{M : Type u_2} → LeftCancelMonoid M → ℕ

def CommMonoid.ctorIdx E1 #

{M : Type u_2} → CommMonoid M → ℕ

theorem npowRec.match_1.congr_eq_2 E1 #

∀ {M : Type u_2} (motive : ℕ → M → Sort u_1) (x : ℕ) (x_1 : M) (h_1 : (x : M) → motive 0 x)
  (h_2 : (n : ℕ) → (a : M) → motive n.succ a) (n : ℕ) (a : M),
  x = n.succ →
    x_1 = a →
      (match x, x_1 with
        | 0, x => h_1 x
        | n.succ, a => h_2 n a) ≍
        h_2 n a

def CancelMonoid.ctorIdx E1 #

{M : Type u_2} → CancelMonoid M → ℕ

theorem npowRec'.match_1.congr_eq_1 E1 #

∀ {M : Type u_2} (motive : ℕ → M → Sort u_1) (x : ℕ) (x_1 : M) (h_1 : (x : M) → motive 0 x) (h_2 : (m : M) → motive 1 m)
  (h_3 : (k : ℕ) → (m : M) → motive k.succ.succ m) (x_2 : M),
  x = 0 →
    x_1 = x_2 →
      (match x, x_1 with
        | 0, x => h_1 x
        | 1, m => h_2 m
        | k.succ.succ, m => h_3 k m) ≍
        h_1 x_2

def NPow.ctorIdx E1 #

{M : Type u_2} → NPow M → ℕ

def AddCommMonoid.ctorIdx E1 #

{M : Type u_2} → AddCommMonoid M → ℕ

def AddZeroClass.ctorIdx E1 #

{M : Type u_2} → AddZeroClass M → ℕ

theorem npowRec'.match_1.congr_eq_3 E1 #

∀ {M : Type u_2} (motive : ℕ → M → Sort u_1) (x : ℕ) (x_1 : M) (h_1 : (x : M) → motive 0 x) (h_2 : (m : M) → motive 1 m)
  (h_3 : (k : ℕ) → (m : M) → motive k.succ.succ m) (k : ℕ) (m : M),
  x = k.succ.succ →
    x_1 = m →
      (match x, x_1 with
        | 0, x => h_1 x
        | 1, m => h_2 m
        | k.succ.succ, m => h_3 k m) ≍
        h_3 k m

def Monoid.ctorIdx E1 #

{M : Type u_2} → Monoid M → ℕ

theorem npowRec.match_1.congr_eq_1 E1 #

∀ {M : Type u_2} (motive : ℕ → M → Sort u_1) (x : ℕ) (x_1 : M) (h_1 : (x : M) → motive 0 x)
  (h_2 : (n : ℕ) → (a : M) → motive n.succ a) (x_2 : M),
  x = 0 →
    x_1 = x_2 →
      (match x, x_1 with
        | 0, x => h_1 x
        | n.succ, a => h_2 n a) ≍
        h_1 x_2

def AddCancelMonoid.ctorIdx E1 #

{M : Type u_2} → AddCancelMonoid M → ℕ

def MulOne.ctorIdx E1 #

{M : Type u_2} → MulOne M → ℕ

def AddLeftCancelMonoid.ctorIdx E1 #

{M : Type u_2} → AddLeftCancelMonoid M → ℕ

def AddRightCancelMonoid.ctorIdx E1 #

{M : Type u_2} → AddRightCancelMonoid M → ℕ

def RightCancelMonoid.ctorIdx E1 #

{M : Type u_2} → RightCancelMonoid M → ℕ

def AddZero.ctorIdx E1 #

{M : Type u_2} → AddZero M → ℕ

theorem npowRec'.match_1.congr_eq_2 E1 #

∀ {M : Type u_2} (motive : ℕ → M → Sort u_1) (x : ℕ) (x_1 : M) (h_1 : (x : M) → motive 0 x) (h_2 : (m : M) → motive 1 m)
  (h_3 : (k : ℕ) → (m : M) → motive k.succ.succ m) (m : M),
  x = 1 →
    x_1 = m →
      (match x, x_1 with
        | 0, x => h_1 x
        | 1, m => h_2 m
        | k.succ.succ, m => h_3 k m) ≍
        h_2 m

def CancelCommMonoid.ctorIdx E1 #

{M : Type u_2} → CancelCommMonoid M → ℕ

class AddZero E1 #

Type u_2 → Type u_2

Bundling an Add and Zero structure together without any axioms about their compatibility. See AddZeroClass for the additional assumption that 0 is an identity.

instance AddZero.toZero E0 #

{M : Type u_2} → [self : AddZero M] → Zero M

instance AddZero.toAdd E0 #

{M : Type u_2} → [self : AddZero M] → Add M

ctor AddZero.mk E0 #

{M : Type u_2} → [toZero : Zero M] → [toAdd : Add M] → AddZero M

class MulOne E1 #

Type u_2 → Type u_2

Bundling a Mul and One structure together without any axioms about their compatibility. See MulOneClass for the additional assumption that 1 is an identity.

theorem MulOne.ext E1 #

∀ {M : Type u_2} {x y : MulOne M}, One.one = One.one → Mul.mul = Mul.mul → x = y

theorem AddZero.ext E1 #

∀ {M : Type u_2} {x y : AddZero M}, Zero.zero = Zero.zero → Add.add = Add.add → x = y

theorem AddZero.ext_iff E0 #

∀ {M : Type u_2} {x y : AddZero M}, x = y ↔ Zero.zero = Zero.zero ∧ Add.add = Add.add

theorem MulOne.ext_iff E0 #

∀ {M : Type u_2} {x y : MulOne M}, x = y ↔ One.one = One.one ∧ Mul.mul = Mul.mul

instance MulOne.toOne E0 #

{M : Type u_2} → [self : MulOne M] → One M

ctor MulOne.mk E0 #

{M : Type u_2} → [toOne : One M] → [toMul : Mul M] → MulOne M

instance MulOne.toMul E0 #

{M : Type u_2} → [self : MulOne M] → Mul M

class IsDedekindFiniteAddMonoid E1 #

(M : Type u_2) → [AddZero M] → Prop

An additive monoid is Dedekind-finite if every left inverse is also a right inverse. Also called von Neumann-finite or directly finite.

ctor IsDedekindFiniteAddMonoid.mk E0 #

∀ {M : Type u_2} [inst : AddZero M], (∀ {a b : M}, a + b = 0 → b + a = 0) → IsDedekindFiniteAddMonoid M

theorem IsDedekindFiniteAddMonoid.add_eq_zero_symm E1 #

∀ {M : Type u_2} {inst : AddZero M} [self : IsDedekindFiniteAddMonoid M] {a b : M}, a + b = 0 → b + a = 0

class IsDedekindFiniteMonoid E1 #

(M : Type u_2) → [MulOne M] → Prop

A monoid is Dedekind-finite if every left inverse is also a right inverse. It is more common to talk about Dedekind-finite rings, but https://arxiv.org/abs/2102.01598 does define Dedekind-finite monoids in §2.2.

theorem isDedekindFiniteMonoid_iff E0 #

∀ (M : Type u_2) [inst : MulOne M], IsDedekindFiniteMonoid M ↔ ∀ {a b : M}, a * b = 1 → b * a = 1

ctor IsDedekindFiniteMonoid.mk E0 #

∀ {M : Type u_2} [inst : MulOne M], (∀ {a b : M}, a * b = 1 → b * a = 1) → IsDedekindFiniteMonoid M

theorem isDedekindFiniteAddMonoid_iff E0 #

∀ (M : Type u_2) [inst : AddZero M], IsDedekindFiniteAddMonoid M ↔ ∀ {a b : M}, a + b = 0 → b + a = 0

theorem IsDedekindFiniteMonoid.mul_eq_one_symm E1 #

∀ {M : Type u_2} {inst : MulOne M} [self : IsDedekindFiniteMonoid M] {a b : M}, a * b = 1 → b * a = 1

theorem add_eq_zero_comm E1 #

∀ {M : Type u_2} [inst : AddZero M] [IsDedekindFiniteAddMonoid M] {a b : M}, a + b = 0 ↔ b + a = 0

theorem mul_eq_one_comm E1 #

∀ {M : Type u_2} [inst : MulOne M] [IsDedekindFiniteMonoid M] {a b : M}, a * b = 1 ↔ b * a = 1

instance instIsDedekindFiniteMonoidOfIsMulCommutative E0 #

∀ (M : Type u_2) [inst : MulOne M] [IsMulCommutative M], IsDedekindFiniteMonoid M

instance instIsDedekindFiniteAddMonoidOfIsAddCommutative E0 #

∀ (M : Type u_2) [inst : AddZero M] [IsAddCommutative M], IsDedekindFiniteAddMonoid M

class AddZeroClass E1 #

Type u_2 → Type u_2

Typeclass for expressing that a type M with addition and a zero satisfies 0 + a = a and a + 0 = a for all a : M.

ctor AddZeroClass.mk E0 #

{M : Type u_2} → [toZero : Zero M] → [toAdd : Add M] → (∀ (a : M), 0 + a = a) → (∀ (a : M), a + 0 = a) → AddZeroClass M

instance AddZeroClass.toAddZero E0 #

{M : Type u_2} → [self : AddZeroClass M] → AddZero M

abbrev AddZeroClass.toZero E1 #

{M : Type u_2} → [self : AddZeroClass M] → Zero M

abbrev AddZeroClass.toAdd E1 #

{M : Type u_2} → [self : AddZeroClass M] → Add M

theorem AddZeroClass.zero_add E1 #

∀ {M : Type u_2} [self : AddZeroClass M] (a : M), 0 + a = a

Zero is a left neutral element for addition

theorem AddZeroClass.add_zero E1 #

∀ {M : Type u_2} [self : AddZeroClass M] (a : M), a + 0 = a

Zero is a right neutral element for addition

class MulOneClass E3 #

Type u_2 → Type u_2

Typeclass for expressing that a type M with multiplication and a one satisfies 1 * a = a and a * 1 = a for all a : M.

abbrev MulOneClass.toMul E1 #

{M : Type u_2} → [self : MulOneClass M] → Mul M

instance MulOneClass.toMulOne E0 #

{M : Type u_2} → [self : MulOneClass M] → MulOne M

abbrev MulOneClass.toOne E1 #

{M : Type u_2} → [self : MulOneClass M] → One M

ctor MulOneClass.mk E0 #

{M : Type u_2} → [toOne : One M] → [toMul : Mul M] → (∀ (a : M), 1 * a = a) → (∀ (a : M), a * 1 = a) → MulOneClass M

theorem MulOneClass.one_mul E2 #

∀ {M : Type u_2} [self : MulOneClass M] (a : M), 1 * a = a

One is a left neutral element for multiplication

theorem MulOneClass.mul_one E2 #

∀ {M : Type u_2} [self : MulOneClass M] (a : M), a * 1 = a

One is a right neutral element for multiplication

theorem MulOneClass.ext_iff E0 #

∀ {M : Type u_2} {m₁ m₂ : MulOneClass M}, m₁ = m₂ ↔ Mul.mul = Mul.mul

theorem AddZeroClass.ext_iff E0 #

∀ {M : Type u_2} {m₁ m₂ : AddZeroClass M}, m₁ = m₂ ↔ Add.add = Add.add

theorem MulOneClass.ext E1 #

∀ {M : Type u_2} ⦃m₁ m₂ : MulOneClass M⦄, Mul.mul = Mul.mul → m₁ = m₂

theorem AddZeroClass.ext E1 #

∀ {M : Type u_2} ⦃m₁ m₂ : AddZeroClass M⦄, Add.add = Add.add → m₁ = m₂

theorem zero_add E0 #

∀ {M : Type u_2} [inst : AddZeroClass M] (a : M), 0 + a = a

theorem one_mul E0 #

∀ {M : Type u_2} [inst : MulOneClass M] (a : M), 1 * a = a

theorem mul_one E0 #

∀ {M : Type u_2} [inst : MulOneClass M] (a : M), a * 1 = a

theorem add_zero E0 #

∀ {M : Type u_2} [inst : AddZeroClass M] (a : M), a + 0 = a

class IsUnital E1 #

(A : Type u_2) → [Mul A] → Prop

A multiplicative magma is unital if there exists a unit.

Note: Do not use this unless it is the only reasonable way to phrase or prove a statement. In general you should use NonUnitalRing, Ring, etc.

ctor IsUnital.mk E0 #

∀ {A : Type u_2} [inst : Mul A], (∃ u, ∀ (x : A), u * x = x ∧ x * u = x) → IsUnital A

theorem isUnital_iff E0 #

∀ (A : Type u_2) [inst : Mul A], IsUnital A ↔ ∃ u, ∀ (x : A), u * x = x ∧ x * u = x

theorem IsUnital.isUnital E1 #

∀ {A : Type u_2} {inst : Mul A} [self : IsUnital A], ∃ u, ∀ (x : A), u * x = x ∧ x * u = x

class IsNotUnital E1 #

(A : Type u_2) → [Mul A] → Prop

A multiplicative magma is not-unital if there does not exist a unit.

Note: Do not use this unless it is the only reasonable way to phrase or prove a statement. In general you should use NonUnitalRing, Ring, etc.

ctor IsNotUnital.mk E0 #

∀ {A : Type u_2} [inst : Mul A], (∀ (u : A), ∃ x, u * x ≠ x ∨ x * u ≠ x) → IsNotUnital A

theorem isNotUnital_iff E0 #

∀ (A : Type u_2) [inst : Mul A], IsNotUnital A ↔ ∀ (u : A), ∃ x, u * x ≠ x ∨ x * u ≠ x

theorem IsNotUnital.isNotUnital E1 #

∀ {A : Type u_2} {inst : Mul A} [self : IsNotUnital A] (u : A), ∃ x, u * x ≠ x ∨ x * u ≠ x

theorem not_isUnital_iff_isNotUnital E0 #

∀ {A : Type u_2} [inst : Mul A], ¬IsUnital A ↔ IsNotUnital A

theorem not_isNotUnital_iff_isUnital E0 #

∀ {A : Type u_2} [inst : Mul A], ¬IsNotUnital A ↔ IsUnital A

abbrev IsUnital.toMulOneClass E1 #

{A : Type u_2} → [inst : Mul A] → [IsUnital A] → MulOneClass A

A unital magma is MulOneClass.

This constructor is primarily intended to be used within proofs since it creates bad definitional equalities.

theorem MulOneClass.isUnital E1 #

∀ {A : Type u_2} [inst : MulOneClass A], IsUnital A

theorem npowRec_add E1 #

∀ {M : Type u_2} [inst : One M] [inst_1 : Semigroup M] (m n : ℕ),
  n ≠ 0 → ∀ (a : M), 1 * a = a → npowRec (m + n) a = npowRec m a * npowRec n a

theorem nsmulRec_add E1 #

∀ {M : Type u_2} [inst : Zero M] [inst_1 : AddSemigroup M] (m n : ℕ),
  n ≠ 0 → ∀ (a : M), 0 + a = a → nsmulRec (m + n) a = nsmulRec m a + nsmulRec n a

theorem nsmulRec_succ E1 #

∀ {M : Type u_2} [inst : Zero M] [inst_1 : AddSemigroup M] (n : ℕ),
  n ≠ 0 → ∀ (a : M), 0 + a = a → nsmulRec (n + 1) a = a + nsmulRec n a

theorem npowRec_succ E1 #

∀ {M : Type u_2} [inst : One M] [inst_1 : Semigroup M] (n : ℕ),
  n ≠ 0 → ∀ (a : M), 1 * a = a → npowRec (n + 1) a = a * npowRec n a

def LibraryNote.forgetful_inheritance E1 #

Batteries.Util.LibraryNote

Suppose that one can put two mathematical structures on a type, a rich one R and a poor one P, and that one can deduce the poor structure from the rich structure through a map F (called a forgetful functor) (think R = MetricSpace and P = TopologicalSpace). A possible implementation would be to have a type class rich containing a field R, a type class poor containing a field P, and an instance from rich to poor. However, this creates diamond problems, and a better approach is to let rich extend poor and have a field saying that F R = P.

To illustrate this, consider the pair MetricSpace / TopologicalSpace. Consider the topology on a product of two metric spaces. With the first approach, it could be obtained by going first from each metric space to its topology, and then taking the product topology. But it could also be obtained by considering the product metric space (with its sup distance) and then the topology coming from this distance. These would be the same topology, but not definitionally, which means that from the point of view of Lean's kernel, there would be two different TopologicalSpace instances on the product. This is not compatible with the way instances are designed and used: there should be at most one instance of a kind on each type. This approach has created an instance diamond that does not commute definitionally.

The second approach solves this issue. Now, a metric space contains both a distance, a topology, and a proof that the topology coincides with the one coming from the distance. When one defines the product of two metric spaces, one uses the sup distance and the product topology, and one has to give the proof that the sup distance induces the product topology. Following both sides of the instance diamond then gives rise (definitionally) to the product topology on the product space.

Another approach would be to have the rich type class take the poor type class as an instance parameter. It would solve the diamond problem, but it would lead to a blow up of the number of type classes one would need to declare to work with complicated classes, say a real inner product space, and would create exponential complexity when working with products of such complicated spaces, that are avoided by bundling things carefully as above.

Note that this description of this specific case of the product of metric spaces is oversimplified compared to mathlib, as there is an intermediate typeclass between MetricSpace and TopologicalSpace called UniformSpace. The above scheme is used at both levels, embedding a topology in the uniform space structure, and a uniform structure in the metric space structure.

Note also that, when P is a proposition, there is no such issue as any two proofs of P are definitionally equivalent in Lean.

To avoid boilerplate, there are some designs that can automatically fill the poor fields when creating a rich structure if one doesn't want to do something special about them. For instance, in the definition of metric spaces, default tactics fill the uniform space fields if they are not given explicitly. One can also have a helper function creating the rich structure from a structure with fewer fields, where the helper function fills the remaining fields. See for instance UniformSpace.ofCore or RealInnerProduct.ofCore.

For more details on this question, called the forgetful inheritance pattern, see Competing inheritance paths in dependent type theory: a case study in functional analysis.

def npowBinRec E1 #

{M : Type u_2} → [One M] → [Mul M] → ℕ → M → M

Exponentiation by repeated squaring.

def nsmulBinRec E1 #

{M : Type u_2} → [Zero M] → [Add M] → ℕ → M → M

Scalar multiplication by repeated self-addition, the additive version of exponentiation by repeated squaring.

def nsmulBinRec.go E1 #

{M : Type u_2} → [Add M] → ℕ → M → M → M

Auxiliary tail-recursive implementation for nsmulBinRec.

def npowBinRec.go E1 #

{M : Type u_2} → [Mul M] → ℕ → M → M → M

Auxiliary tail-recursive implementation for npowBinRec.

def npowRec' E1 #

{M : Type u_2} → [One M] → [Mul M] → ℕ → M → M

A variant of npowRec which is a semigroup homomorphism from ℕ₊ to M.

def nsmulRec' E1 #

{M : Type u_2} → [Zero M] → [Add M] → ℕ → M → M

A variant of nsmulRec which is a semigroup homomorphism from ℕ₊ to M.

theorem npowRec'_succ E1 #

∀ {M : Type u_2} [inst : Mul M] [inst_1 : One M] {k : ℕ}, k ≠ 0 → ∀ (m : M), npowRec' (k + 1) m = npowRec' k m * m

theorem nsmulRec'_succ E1 #

∀ {M : Type u_2} [inst : Add M] [inst_1 : Zero M] {k : ℕ}, k ≠ 0 → ∀ (m : M), nsmulRec' (k + 1) m = nsmulRec' k m + m

theorem npowRec'_two_mul E1 #

∀ {M : Type u_2} [inst : Semigroup M] [inst_1 : One M] (k : ℕ) (m : M), npowRec' (2 * k) m = npowRec' k (m * m)

theorem nsmulRec'_two_add E1 #

∀ {M : Type u_2} [inst : AddSemigroup M] [inst_1 : Zero M] (k : ℕ) (m : M), nsmulRec' (2 * k) m = nsmulRec' k (m + m)

theorem npowRec'_mul_comm E1 #

∀ {M : Type u_2} [inst : Semigroup M] [inst_1 : One M] {k : ℕ}, k ≠ 0 → ∀ (m : M), m * npowRec' k m = npowRec' k m * m

theorem nsmulRec'_add_comm E1 #

∀ {M : Type u_2} [inst : AddSemigroup M] [inst_1 : Zero M] {k : ℕ},
  k ≠ 0 → ∀ (m : M), m + nsmulRec' k m = nsmulRec' k m + m

theorem nsmulRec_eq E0 #

∀ {M : Type u_2} [inst : AddSemigroup M] [inst_1 : Zero M] (k : ℕ) (m : M), nsmulRec (k + 1) m = 0 + nsmulRec' (k + 1) m

theorem npowRec_eq E0 #

∀ {M : Type u_2} [inst : Semigroup M] [inst_1 : One M] (k : ℕ) (m : M), npowRec (k + 1) m = 1 * npowRec' (k + 1) m

theorem npowBinRec.go_spec E1 #

∀ {M : Type u_2} [inst : Semigroup M] [inst_1 : One M] (k : ℕ) (m n : M),
  npowBinRec.go (k + 1) m n = m * npowRec' (k + 1) n

theorem nsmulBinRec.go_spec E1 #

∀ {M : Type u_2} [inst : AddSemigroup M] [inst_1 : Zero M] (k : ℕ) (m n : M),
  nsmulBinRec.go (k + 1) m n = m + nsmulRec' (k + 1) n

abbrev npowRecAuto E1 #

{M : Type u_2} → [Semigroup M] → [One M] → ℕ → M → M

An abbreviation for npowRec with an additional typeclass assumption on associativity so that we can use @[csimp] to replace it with an implementation by repeated squaring in compiled code.

abbrev nsmulRecAuto E1 #

{M : Type u_2} → [AddSemigroup M] → [Zero M] → ℕ → M → M

An abbreviation for nsmulRec with an additional typeclass assumptions on associativity so that we can use @[csimp] to replace it with an implementation by repeated doubling in compiled code as an automatic parameter.

abbrev npowBinRecAuto E1 #

{M : Type u_2} → [Semigroup M] → [One M] → ℕ → M → M

An abbreviation for npowBinRec with an additional typeclass assumption on associativity so that we can use it in @[csimp] for more performant code generation.

abbrev nsmulBinRecAuto E1 #

{M : Type u_2} → [AddSemigroup M] → [Zero M] → ℕ → M → M

An abbreviation for nsmulBinRec with an additional typeclass assumption on associativity so that we can use it in @[csimp] for more performant code generation as an automatic parameter.

theorem npowRec_eq_npowBinRec E1 #

@npowRecAuto = @npowBinRecAuto

theorem nsmulRec_eq_nsmulBinRec E1 #

@nsmulRecAuto = @nsmulBinRecAuto

theorem npowBinRec_zero E1 #

∀ {M : Type u_2} [inst : Mul M] [inst_1 : One M] (m : M), npowBinRec 0 m = 1

theorem nsmulBinRec_zero E1 #

∀ {M : Type u_2} [inst : Add M] [inst_1 : Zero M] (m : M), nsmulBinRec 0 m = 0

theorem npowBinRec_succ E1 #

∀ {M : Type u_2} [inst : Semigroup M] [inst_1 : One M] (n : ℕ) (m : M), npowBinRec (n + 1) m = npowBinRec n m * m

theorem nsmulBinRec_succ E1 #

∀ {M : Type u_2} [inst : AddSemigroup M] [inst_1 : Zero M] (n : ℕ) (m : M), nsmulBinRec (n + 1) m = nsmulBinRec n m + m

class NSMul E1 #

Type u_2 → Type u_2

NSMul is an implementation detail of AddMonoid. It is needed because it is impossible to extend SMul ℕ M and SMul ℤ M at the same time.

ctor NSMul.mk E0 #

{M : Type u_2} → (ℕ → M → M) → NSMul M

abbrev NSMul.nsmul E1 #

{M : Type u_2} → [self : NSMul M] → ℕ → M → M

Multiplication by a natural number. Set this to nsmulRec unless Module diamonds are possible.

class NPow E1 #

Type u_2 → Type u_2

NPow is an implementation detail of Monoid. It is needed because it is impossible to extend Pow M ℕ and Pow M ℤ at the same time.

ctor NPow.mk E0 #

{M : Type u_2} → (ℕ → M → M) → NPow M

abbrev NPow.npow E1 #

{M : Type u_2} → [self : NPow M] → ℕ → M → M

Raising to the power of a natural number.

instance NPow.toPow E0 #

{M : Type u_2} → [NPow M] → Pow M ℕ

instance NSMul.toSMul E0 #

{M : Type u_2} → [NSMul M] → SMul ℕ M

instance NSMul.ofSMul E0 #

{M : Type u_2} → [SMul ℕ M] → NSMul M

instance NPow.ofPow E0 #

{M : Type u_2} → [Pow M ℕ] → NPow M

class AddMonoid E3 #

Type u_2 → Type u_2

An AddMonoid is an AddSemigroup with an element 0 such that 0 + a = a + 0 = a.

instance AddMonoid.toAddSemigroup E0 #

{M : Type u_2} → [self : AddMonoid M] → AddSemigroup M

instance AddMonoid.toAddZeroClass E0 #

{M : Type u_2} → [self : AddMonoid M] → AddZeroClass M

abbrev AddMonoid.toZero E1 #

{M : Type u_2} → [self : AddMonoid M] → Zero M

theorem AddMonoid.add_zero E1 #

∀ {M : Type u_2} [self : AddMonoid M] (a : M), a + 0 = a

Zero is a right neutral element for addition

instance AddMonoid.toNSMul E0 #

{M : Type u_2} → [self : AddMonoid M] → NSMul M

ctor AddMonoid.mk E0 #

{M : Type u_2} →
  [toZero : Zero M] →
    [toAdd : Add M] →
      (∀ (a b c : M), a + b + c = a + (b + c)) →
        (∀ (a : M), 0 + a = a) →
          (∀ (a : M), a + 0 = a) →
            [toNSMul : NSMul M] →
              autoParam (∀ (x : M), 0 • x = 0) AddMonoid.nsmul_zero._autoParam →
                autoParam (∀ (n : ℕ) (x : M), (n + 1) • x = n • x + x) AddMonoid.nsmul_succ._autoParam → AddMonoid M

theorem AddMonoid.add_assoc E1 #

∀ {M : Type u_2} [self : AddMonoid M] (a b c : M), a + b + c = a + (b + c)

Addition is associative

abbrev AddMonoid.toAdd E1 #

{M : Type u_2} → [self : AddMonoid M] → Add M

theorem AddMonoid.zero_add E1 #

∀ {M : Type u_2} [self : AddMonoid M] (a : M), 0 + a = a

Zero is a left neutral element for addition

theorem AddMonoid.nsmul_zero E1 #

∀ {M : Type u_2} [self : AddMonoid M] (x : M), 0 • x = 0

Multiplication by (0 : ℕ) gives 0.

theorem AddMonoid.nsmul_succ E1 #

∀ {M : Type u_2} [self : AddMonoid M] (n : ℕ) (x : M), (n + 1) • x = n • x + x

Multiplication by (n + 1 : ℕ) behaves as expected.

class Monoid E3 #

Type u_2 → Type u_2

A Monoid is a Semigroup with an element 1 such that 1 * a = a * 1 = a.

instance Monoid.toMulOneClass E0 #

{M : Type u_2} → [self : Monoid M] → MulOneClass M

abbrev Monoid.toMul E1 #

{M : Type u_2} → [self : Monoid M] → Mul M

ctor Monoid.mk E0 #

{M : Type u_2} →
  [toOne : One M] →
    [toMul : Mul M] →
      (∀ (a b c : M), a * b * c = a * (b * c)) →
        (∀ (a : M), 1 * a = a) →
          (∀ (a : M), a * 1 = a) →
            [toNPow : NPow M] →
              autoParam (∀ (x : M), x ^ 0 = 1) Monoid.npow_zero._autoParam →
                autoParam (∀ (n : ℕ) (x : M), x ^ (n + 1) = x ^ n * x) Monoid.npow_succ._autoParam → Monoid M

theorem Monoid.mul_assoc E1 #

∀ {M : Type u_2} [self : Monoid M] (a b c : M), a * b * c = a * (b * c)

Multiplication is associative

theorem Monoid.one_mul E1 #

∀ {M : Type u_2} [self : Monoid M] (a : M), 1 * a = a

One is a left neutral element for multiplication

instance Monoid.toSemigroup E0 #

{M : Type u_2} → [self : Monoid M] → Semigroup M

abbrev Monoid.toOne E1 #

{M : Type u_2} → [self : Monoid M] → One M

theorem Monoid.mul_one E1 #

∀ {M : Type u_2} [self : Monoid M] (a : M), a * 1 = a

One is a right neutral element for multiplication

instance Monoid.toNPow E0 #

{M : Type u_2} → [self : Monoid M] → NPow M

theorem Monoid.npow_zero E1 #

∀ {M : Type u_2} [self : Monoid M] (x : M), x ^ 0 = 1

Raising to the power (0 : ℕ) gives 1.

theorem Monoid.npow_succ E1 #

∀ {M : Type u_2} [self : Monoid M] (n : ℕ) (x : M), x ^ (n + 1) = x ^ n * x

Raising to the power (n + 1 : ℕ) behaves as expected.

theorem npow_eq_pow E0 #

∀ {M : Type u_2} [inst : Monoid M] (n : ℕ) (x : M), NPow.npow n x = x ^ n

theorem nsmul_eq_smul E0 #

∀ {M : Type u_2} [inst : AddMonoid M] (n : ℕ) (x : M), NSMul.nsmul n x = n • x

theorem left_neg_eq_right_neg E1 #

∀ {M : Type u_2} [inst : AddMonoid M] {a b c : M}, b + a = 0 → a + c = 0 → b = c

theorem left_inv_eq_right_inv E1 #

∀ {M : Type u_2} [inst : Monoid M] {a b c : M}, b * a = 1 → a * c = 1 → b = c

theorem pow_zero E0 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 0 = 1

theorem zero_nsmul E0 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M), 0 • a = 0

theorem pow_succ E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (n : ℕ), a ^ (n + 1) = a ^ n * a

theorem succ_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (n : ℕ), (n + 1) • a = n • a + a

theorem pow_one E0 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 1 = a

theorem one_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M), 1 • a = a

theorem succ_nsmul' E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (n : ℕ), (n + 1) • a = a + n • a

theorem pow_succ' E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (n : ℕ), a ^ (n + 1) = a * a ^ n

theorem add_nsmul_add E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a b : M) (n : ℕ), n • (a + b) + a = a + n • (b + a)

theorem mul_pow_mul E1 #

∀ {M : Type u_2} [inst : Monoid M] (a b : M) (n : ℕ), (a * b) ^ n * a = a * (b * a) ^ n

theorem pow_mul_comm' E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (n : ℕ), a ^ n * a = a * a ^ n

theorem nsmul_add_comm' E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (n : ℕ), n • a + a = a + n • a

theorem pow_two E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 2 = a * a

Note that most of the lemmas about powers of two refer to it as sq.

theorem two_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M), 2 • a = a + a

theorem sq E3 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 2 = a * a

Alias of pow_two.


Note that most of the lemmas about powers of two refer to it as sq.

theorem three'_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M), 3 • a = a + a + a

theorem pow_three' E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 3 = a * a * a

theorem three_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M), 3 • a = a + (a + a)

theorem pow_three E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M), a ^ 3 = a * (a * a)

theorem one_pow E0 #

∀ {M : Type u_2} [inst : Monoid M] (n : ℕ), 1 ^ n = 1

theorem nsmul_zero E0 #

∀ {M : Type u_2} [inst : AddMonoid M] (n : ℕ), n • 0 = 0

theorem pow_add E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (m n : ℕ), a ^ (m + n) = a ^ m * a ^ n

theorem add_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (m n : ℕ), (m + n) • a = m • a + n • a

theorem nsmul_add_comm E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (m n : ℕ), m • a + n • a = n • a + m • a

theorem pow_mul_comm E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (m n : ℕ), a ^ m * a ^ n = a ^ n * a ^ m

theorem pow_mul E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (m n : ℕ), a ^ (m * n) = (a ^ m) ^ n

theorem mul_nsmul E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (m n : ℕ), (m * n) • a = n • m • a

theorem mul_nsmul' E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (m n : ℕ), (m * n) • a = m • n • a

theorem pow_mul' E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (m n : ℕ), a ^ (m * n) = (a ^ n) ^ m

theorem pow_right_comm E1 #

∀ {M : Type u_2} [inst : Monoid M] (a : M) (m n : ℕ), (a ^ m) ^ n = (a ^ n) ^ m

theorem nsmul_left_comm E1 #

∀ {M : Type u_2} [inst : AddMonoid M] (a : M) (m n : ℕ), n • m • a = m • n • a

theorem IsLeftRegular.mul_eq_one_symm E1 #

∀ {M : Type u_2} [inst : Monoid M] {a b : M}, IsLeftRegular a → a * b = 1 → b * a = 1

theorem IsAddLeftRegular.add_eq_zero_symm E1 #

∀ {M : Type u_2} [inst : AddMonoid M] {a b : M}, IsAddLeftRegular a → a + b = 0 → b + a = 0

theorem IsAddRightRegular.add_eq_zero_symm E1 #

∀ {M : Type u_2} [inst : AddMonoid M] {a b : M}, IsAddRightRegular a → b + a = 0 → a + b = 0

theorem IsRightRegular.mul_eq_one_symm E1 #

∀ {M : Type u_2} [inst : Monoid M] {a b : M}, IsRightRegular a → b * a = 1 → a * b = 1

instance instIsDedekindFiniteMonoidOfIsLeftCancelMul E0 #

∀ (M : Type u_2) [inst : Monoid M] [IsLeftCancelMul M], IsDedekindFiniteMonoid M

instance instIsDedekindFiniteAddMonoidOfIsLeftCancelAdd E0 #

∀ (M : Type u_2) [inst : AddMonoid M] [IsLeftCancelAdd M], IsDedekindFiniteAddMonoid M

instance instIsDedekindFiniteMonoidOfIsRightCancelMul E0 #

∀ (M : Type u_2) [inst : Monoid M] [IsRightCancelMul M], IsDedekindFiniteMonoid M

instance instIsDedekindFiniteAddMonoidOfIsRightCancelAdd E0 #

∀ (M : Type u_2) [inst : AddMonoid M] [IsRightCancelAdd M], IsDedekindFiniteAddMonoid M

theorem IsDedekindFiniteMonoid.of_exists_self_mul_eq_one E1 #

∀ (M : Type u_2) [inst : Monoid M], (∀ (x y : M), x * y = 1 → ∃ z, y * z = 1) → IsDedekindFiniteMonoid M

A monoid is Dedekind-finite if every element with a left inverse also has a right inverse.

theorem IsDedekindFiniteAddMonoid.of_exists_self_add_eq_zero E1 #

∀ (M : Type u_2) [inst : AddMonoid M], (∀ (x y : M), x + y = 0 → ∃ z, y + z = 0) → IsDedekindFiniteAddMonoid M

theorem IsDedekindFiniteMonoid.of_exists_mul_self_eq_one E1 #

∀ (M : Type u_2) [inst : Monoid M], (∀ (x y : M), x * y = 1 → ∃ z, z * x = 1) → IsDedekindFiniteMonoid M

A monoid is Dedekind-finite if every element with a right inverse also has a left inverse.

theorem IsDedekindFiniteAddMonoid.of_exists_add_self_eq_zero E1 #

∀ (M : Type u_2) [inst : AddMonoid M], (∀ (x y : M), x + y = 0 → ∃ z, z + x = 0) → IsDedekindFiniteAddMonoid M

abbrev IsUnital.toMonoid E1 #

{A : Type u_2} → [inst : Semigroup A] → [IsUnital A] → Monoid A

A unital semigroup is a monoid.

This constructor is primarily intended to be used within proofs since it creates bad definitional equalities.

class IsAddTorsionFree E1 #

(M : Type u_2) → [AddMonoid M] → Prop

An additive monoid is torsion-free if scalar multiplication by every non-zero element n : ℕ is injective on commuting elements (i.e., a + b = b + a → n • a = n • b → a = b).

For commutative additive monoids, this is equivalent to n • a = n • b → a = b. For additive groups, this is equivalent to n • a = 0 → a = 0.

Thus, this definition reconciles the notions of torsion-free for additive groups and commutative additive semigroups.

For more information, see this mathoverflow answer: https://mathoverflow.net/a/377268/95685

IsAddTorsionFree is weaker than HasUniqueDiv for general additive monoids, but equivalent to it for commutative ones. Prefer using HasUniqueDiv for commutative additive monoids, so that typeclass-search can derive both HasUniqueDiv and IsAddTorsionFree without us needing to introduce an expensive [AddCommMonoid M] [IsAddTorsionFree M] : HasUniqueDiv M instance loop.

TODO: Generalize this definition to additive semigroups once we have the PNat action.

theorem isAddTorsionFree_iff E0 #

∀ (M : Type u_2) [inst : AddMonoid M],
  IsAddTorsionFree M ↔ ∀ ⦃n : ℕ⦄, n ≠ 0 → ∀ ⦃a b : M⦄, AddCommute a b → n • a = n • b → a = b

ctor IsAddTorsionFree.mk E0 #

∀ {M : Type u_2} [inst : AddMonoid M],
  (∀ ⦃n : ℕ⦄, n ≠ 0 → ∀ ⦃a b : M⦄, AddCommute a b → n • a = n • b → a = b) → IsAddTorsionFree M

class IsMulTorsionFree E1 #

(M : Type u_2) → [Monoid M] → Prop

A monoid is torsion-free if exponentiation by every non-zero element n : ℕ is injective on commuting elements (i.e., a * b = b * a → a ^ n = b ^ n → a = b).

For commutative monoids, this is equivalent to a ^ n = b ^ n → a = b. For groups, this is equivalent to a ^ n = 1 → a = 1.

Thus, this definition reconciles the notions of torsion-free for groups and commutative semigroups.

For more information, see this mathoverflow answer: https://mathoverflow.net/a/377268/95685

IsMulTorsionFree is weaker than HasUniqueRoots for general monoids, but equivalent to it for commutative ones. Prefer using HasUniqueRoots over commutative monoids, so that typeclass-search can derive both HasUniqueRoots and IsMulTorsionFree without us needing to introduce an expensive [CommMonoid M] [IsMulTorsionFree M] : HasUniqueRoots M instance loop.

TODO: Generalize this definition to semigroups once we have the PNat action.

theorem isMulTorsionFree_iff E0 #

∀ (M : Type u_2) [inst : Monoid M],
  IsMulTorsionFree M ↔ ∀ ⦃n : ℕ⦄, n ≠ 0 → ∀ ⦃a b : M⦄, Commute a b → a ^ n = b ^ n → a = b

ctor IsMulTorsionFree.mk E0 #

∀ {M : Type u_2} [inst : Monoid M],
  (∀ ⦃n : ℕ⦄, n ≠ 0 → ∀ ⦃a b : M⦄, Commute a b → a ^ n = b ^ n → a = b) → IsMulTorsionFree M

class HasUniqueDiv E1 #

(M : Type u_2) → [AddMonoid M] → Prop

An additive monoid has unique divisibility if scalar multiplication by every non-zero element n : ℕ is injective. This is the uniqueness counterpart to DivisibleBy which asserts existence.

HasUniqueDiv is stronger than IsAddTorsionFree for general additive monoids, but equivalent to it for commutative ones. Prefer using HasUniqueDiv for commutative additive monoids, so that typeclass-search can derive both HasUniqueDiv and IsAddTorsionFree without us needing to introduce an expensive [AddCommMonoid M] [IsAddTorsionFree M] : HasUniqueDiv M instance loop.

TODO: Generalize this definition to additive semigroups once we have the PNat action.

theorem hasUniqueDiv_iff E0 #

∀ (M : Type u_2) [inst : AddMonoid M], HasUniqueDiv M ↔ ∀ ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ n • a

ctor HasUniqueDiv.mk E0 #

∀ {M : Type u_2} [inst : AddMonoid M], (∀ ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ n • a) → HasUniqueDiv M

theorem HasUniqueDiv.nsmul_right_injective E1 #

∀ {M : Type u_2} {inst : AddMonoid M} [self : HasUniqueDiv M] ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ n • a

class HasUniqueRoots E1 #

(M : Type u_2) → [Monoid M] → Prop

A monoid has unique roots if exponentiation by every non-zero element n : ℕ is injective. This is the uniqueness counterpart to RootableBy which asserts existence.

HasUniqueRoots is stronger than IsMulTorsionFree for general monoids, but equivalent to it for commutative ones. Prefer using HasUniqueRoots for commutative monoids, so that typeclass-search can derive both HasUniqueRoots and IsMulTorsionFree without us needing to introduce an expensive [CommMonoid M] [IsMulTorsionFree M] : HasUniqueRoots M instance loop.

TODO: Generalize this definition to semigroups once we have the PNat action.

theorem hasUniqueRoots_iff E0 #

∀ (M : Type u_2) [inst : Monoid M], HasUniqueRoots M ↔ ∀ ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ a ^ n

ctor HasUniqueRoots.mk E0 #

∀ {M : Type u_2} [inst : Monoid M], (∀ ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ a ^ n) → HasUniqueRoots M

theorem HasUniqueRoots.pow_left_injective E1 #

∀ {M : Type u_2} {inst : Monoid M} [self : HasUniqueRoots M] ⦃n : ℕ⦄, n ≠ 0 → Function.Injective fun a ↦ a ^ n

instance instIsAddTorsionFreeOfhasUniqueDiv E0 #

∀ (M : Type u_2) [inst : AddMonoid M] [HasUniqueDiv M], IsAddTorsionFree M

instance instIsMulTorsionFreeOfHasUniqueRoots E0 #

∀ (M : Type u_2) [inst : Monoid M] [HasUniqueRoots M], IsMulTorsionFree M

class AddCommMonoid E3 #

Type u_2 → Type u_2

An additive commutative monoid is an additive monoid with commutative (+).

theorem AddCommMonoid.add_comm E2 #

∀ {M : Type u_2} [self : AddCommMonoid M] (a b : M), a + b = b + a

Addition is commutative in a commutative additive magma.

instance AddCommMonoid.toAddMonoid E0 #

{M : Type u_2} → [self : AddCommMonoid M] → AddMonoid M

instance AddCommMonoid.toAddCommSemigroup E0 #

{M : Type u_2} → [self : AddCommMonoid M] → AddCommSemigroup M

ctor AddCommMonoid.mk E0 #

{M : Type u_2} → [toAddMonoid : AddMonoid M] → (∀ (a b : M), a + b = b + a) → AddCommMonoid M

class CommMonoid E3 #

Type u_2 → Type u_2

A commutative monoid is a monoid with commutative (*).

instance CommMonoid.toCommSemigroup E0 #

{M : Type u_2} → [self : CommMonoid M] → CommSemigroup M

theorem CommMonoid.mul_comm E2 #

∀ {M : Type u_2} [self : CommMonoid M] (a b : M), a * b = b * a

Multiplication is commutative in a commutative multiplicative magma.

instance CommMonoid.toMonoid E0 #

{M : Type u_2} → [self : CommMonoid M] → Monoid M

ctor CommMonoid.mk E0 #

{M : Type u_2} → [toMonoid : Monoid M] → (∀ (a b : M), a * b = b * a) → CommMonoid M

instance instIsDedekindFiniteMonoid E0 #

∀ (M : Type u_2) [inst : CommMonoid M], IsDedekindFiniteMonoid M

Shortcut instance for IsCommutativeHMul M → IsDedekindFiniteMonoid M.

This is assigned default rather than low priority because it gives the most common examples of Dedekind-finite monoids and is used the most often. Benchmark results indicate default priority performs better than low or high priority.

instance instIsDedekindFiniteAddMonoid E0 #

∀ (M : Type u_2) [inst : AddCommMonoid M], IsDedekindFiniteAddMonoid M

class AddLeftCancelMonoid E1 #

Type u_2 → Type u_2

An additive monoid in which addition is left-cancellative. Main examples are ℕ and groups. This is the right typeclass for many sum lemmas, as having a zero is useful to define the sum over the empty set, so AddLeftCancelSemigroup is not enough.

instance AddLeftCancelMonoid.toAddLeftCancelSemigroup E0 #

{M : Type u_2} → [self : AddLeftCancelMonoid M] → AddLeftCancelSemigroup M

instance AddLeftCancelMonoid.toAddMonoid E0 #

{M : Type u_2} → [self : AddLeftCancelMonoid M] → AddMonoid M

ctor AddLeftCancelMonoid.mk E0 #

{M : Type u_2} → [toAddMonoid : AddMonoid M] → [toIsLeftCancelAdd : IsLeftCancelAdd M] → AddLeftCancelMonoid M

theorem AddLeftCancelMonoid.toIsLeftCancelAdd E1 #

∀ {M : Type u_2} [self : AddLeftCancelMonoid M], IsLeftCancelAdd M

class LeftCancelMonoid E1 #

Type u_2 → Type u_2

A monoid in which multiplication is left-cancellative.

ctor LeftCancelMonoid.mk E0 #

{M : Type u_2} → [toMonoid : Monoid M] → [toIsLeftCancelMul : IsLeftCancelMul M] → LeftCancelMonoid M

instance LeftCancelMonoid.toLeftCancelSemigroup E0 #

{M : Type u_2} → [self : LeftCancelMonoid M] → LeftCancelSemigroup M

instance LeftCancelMonoid.toMonoid E0 #

{M : Type u_2} → [self : LeftCancelMonoid M] → Monoid M

theorem LeftCancelMonoid.toIsLeftCancelMul E1 #

∀ {M : Type u_2} [self : LeftCancelMonoid M], IsLeftCancelMul M

class AddRightCancelMonoid E1 #

Type u_2 → Type u_2

An additive monoid in which addition is right-cancellative. Main examples are ℕ and groups. This is the right typeclass for many sum lemmas, as having a zero is useful to define the sum over the empty set, so AddRightCancelSemigroup is not enough.

theorem AddRightCancelMonoid.toIsRightCancelAdd E1 #

∀ {M : Type u_2} [self : AddRightCancelMonoid M], IsRightCancelAdd M

instance AddRightCancelMonoid.toAddMonoid E0 #

{M : Type u_2} → [self : AddRightCancelMonoid M] → AddMonoid M

instance AddRightCancelMonoid.toAddRightCancelSemigroup E0 #

{M : Type u_2} → [self : AddRightCancelMonoid M] → AddRightCancelSemigroup M

ctor AddRightCancelMonoid.mk E0 #

{M : Type u_2} → [toAddMonoid : AddMonoid M] → [toIsRightCancelAdd : IsRightCancelAdd M] → AddRightCancelMonoid M

class RightCancelMonoid E1 #

Type u_2 → Type u_2

A monoid in which multiplication is right-cancellative.

theorem RightCancelMonoid.toIsRightCancelMul E1 #

∀ {M : Type u_2} [self : RightCancelMonoid M], IsRightCancelMul M

instance RightCancelMonoid.toRightCancelSemigroup E0 #

{M : Type u_2} → [self : RightCancelMonoid M] → RightCancelSemigroup M

instance RightCancelMonoid.toMonoid E0 #

{M : Type u_2} → [self : RightCancelMonoid M] → Monoid M

ctor RightCancelMonoid.mk E0 #

{M : Type u_2} → [toMonoid : Monoid M] → [toIsRightCancelMul : IsRightCancelMul M] → RightCancelMonoid M

class AddCancelMonoid E1 #

Type u_2 → Type u_2

An additive monoid in which addition is cancellative on both sides. Main examples are ℕ and groups. This is the right typeclass for many sum lemmas, as having a zero is useful to define the sum over the empty set, so AddRightCancelMonoid is not enough.

instance AddCancelMonoid.toAddRightCancelMonoid E0 #

{M : Type u_2} → [self : AddCancelMonoid M] → AddRightCancelMonoid M

instance AddCancelMonoid.toAddLeftCancelMonoid E0 #

{M : Type u_2} → [self : AddCancelMonoid M] → AddLeftCancelMonoid M

theorem AddCancelMonoid.toIsRightCancelAdd E1 #

∀ {M : Type u_2} [self : AddCancelMonoid M], IsRightCancelAdd M

ctor AddCancelMonoid.mk E0 #

{M : Type u_2} →
  [toAddLeftCancelMonoid : AddLeftCancelMonoid M] → [toIsRightCancelAdd : IsRightCancelAdd M] → AddCancelMonoid M

class CancelMonoid E1 #

Type u_2 → Type u_2

A monoid in which multiplication is cancellative.

instance CancelMonoid.toRightCancelMonoid E0 #

{M : Type u_2} → [self : CancelMonoid M] → RightCancelMonoid M

theorem CancelMonoid.toIsRightCancelMul E1 #

∀ {M : Type u_2} [self : CancelMonoid M], IsRightCancelMul M

instance CancelMonoid.toLeftCancelMonoid E0 #

{M : Type u_2} → [self : CancelMonoid M] → LeftCancelMonoid M

ctor CancelMonoid.mk E0 #

{M : Type u_2} → [toLeftCancelMonoid : LeftCancelMonoid M] → [toIsRightCancelMul : IsRightCancelMul M] → CancelMonoid M

class AddCancelCommMonoid E1 #

Type u_2 → Type u_2

Commutative version of AddCancelMonoid.

ctor AddCancelCommMonoid.mk E0 #

{M : Type u_2} → [toAddCommMonoid : AddCommMonoid M] → [toIsLeftCancelAdd : IsLeftCancelAdd M] → AddCancelCommMonoid M

theorem AddCancelCommMonoid.toIsLeftCancelAdd E1 #

∀ {M : Type u_2} [self : AddCancelCommMonoid M], IsLeftCancelAdd M

instance AddCancelCommMonoid.toAddCommMonoid E0 #

{M : Type u_2} → [self : AddCancelCommMonoid M] → AddCommMonoid M

instance AddCancelCommMonoid.toAddLeftCancelMonoid E0 #

{M : Type u_2} → [self : AddCancelCommMonoid M] → AddLeftCancelMonoid M

class CancelCommMonoid E1 #

Type u_2 → Type u_2

Commutative version of CancelMonoid.

instance CancelCommMonoid.toCommMonoid E0 #

{M : Type u_2} → [self : CancelCommMonoid M] → CommMonoid M

ctor CancelCommMonoid.mk E0 #

{M : Type u_2} → [toCommMonoid : CommMonoid M] → [toIsLeftCancelMul : IsLeftCancelMul M] → CancelCommMonoid M

instance CancelCommMonoid.toLeftCancelMonoid E0 #

{M : Type u_2} → [self : CancelCommMonoid M] → LeftCancelMonoid M

theorem CancelCommMonoid.toIsLeftCancelMul E1 #

∀ {M : Type u_2} [self : CancelCommMonoid M], IsLeftCancelMul M

instance CancelCommMonoid.toCancelMonoid E0 #

(M : Type u_2) → [CancelCommMonoid M] → CancelMonoid M

instance AddCancelCommMonoid.toAddCancelMonoid E0 #

(M : Type u_2) → [AddCancelCommMonoid M] → AddCancelMonoid M

instance CancelMonoid.toIsCancelMul E0 #

∀ (M : Type u_2) [inst : CancelMonoid M], IsCancelMul M

Any CancelMonoid G satisfies IsCancelMul G.

instance AddCancelMonoid.toIsCancelAdd E0 #

∀ (M : Type u_2) [inst : AddCancelMonoid M], IsCancelAdd M

Any AddCancelMonoid G satisfies IsCancelAdd G.

Deprecated aliases

NameNew nameSince
IsAddTorsionFree.pow_left_injectiveIsAddTorsionFree.eq_of_nsmul_eq_nsmul_of_addCommute2026-09-29
IsMulTorsionFree.pow_left_injectiveIsMulTorsionFree.eq_of_pow_eq_pow_of_commute2026-09-29