Documentation

Mathlib.Init.Algebra.Classes

Note about Mathlib/Init/ #

The files in Mathlib/Init are leftovers from the port from Mathlib3. (They contain content moved from lean3 itself that Mathlib needed but was not moved to lean4.)

We intend to move all the content of these files out into the main Mathlib directory structure. Contributions assisting with this are appreciated.

(Yaël): The only things of interest in this file now are the unbundled algebra classes

Unbundled algebra classes #

These classes are part of an incomplete refactor described here on the github Wiki. However a subset of them are widely used in mathlib3, and it has been tricky to clean this up as this file was in core Lean 3.

By themselves, these classes are not good replacements for the Monoid / Group etc structures provided by mathlib, as they are not discoverable by simp unlike the current lemmas due to there being little to index on. The Wiki page linked above describes an algebraic normalizer, but it was never implemented in Lean 3.

Porting note: #

This file is ancient, and it would be good to replace it with a clean version that provides what mathlib4 actually needs.

I've omitted all the @[algebra] attributes, as they are not used elsewhere.

The section StrictWeakOrder has been omitted, but I've left the mathport output in place. Please delete if cleaning up.

I've commented out some classes which we think are completely unused in mathlib.

I've added many of the declarations to nolints.json. If you clean up this file, please add documentation to classes that we are keeping.

Mario made the following analysis of uses in mathlib3:

class IsSymmOp (α : Sort u) (β : Sort v) (op : ααβ) :
  • symm_op : ∀ (a b : α), op a b = op b a
Instances
    theorem IsSymmOp.symm_op {α : Sort u} {β : Sort v} {op : ααβ} [self : IsSymmOp α β op] (a : α) (b : α) :
    op a b = op b a
    @[reducible, inline, deprecated Std.Commutative]
    abbrev IsCommutative (α : Sort u) (op : ααα) :

    A commutative binary operation.

    Equations
    Instances For
      @[instance 100]
      instance isSymmOp_of_isCommutative (α : Sort u) (op : ααα) [Std.Commutative op] :
      IsSymmOp α α op
      Equations
      • =
      @[reducible, inline, deprecated Std.Associative]
      abbrev IsAssociative (α : Sort u) (op : ααα) :

      An associative binary operation.

      Equations
      Instances For
        @[reducible, inline, deprecated Std.LawfulLeftIdentity]
        abbrev IsLeftId (α : Sort u) (op : ααα) (o : outParam α) :

        A binary operation with a left identity.

        Equations
        Instances For
          @[reducible, inline, deprecated Std.LawfulRightIdentity]
          abbrev IsRightId (α : Sort u) (op : ααα) (o : outParam α) :

          A binary operation with a right identity.

          Equations
          Instances For
            class IsLeftCancel (α : Sort u) (op : ααα) :
            • left_cancel : ∀ (a b c : α), op a b = op a cb = c
            Instances
              theorem IsLeftCancel.left_cancel {α : Sort u} {op : ααα} [self : IsLeftCancel α op] (a : α) (b : α) (c : α) :
              op a b = op a cb = c
              class IsRightCancel (α : Sort u) (op : ααα) :
              • right_cancel : ∀ (a b c : α), op a b = op c ba = c
              Instances
                theorem IsRightCancel.right_cancel {α : Sort u} {op : ααα} [self : IsRightCancel α op] (a : α) (b : α) (c : α) :
                op a b = op c ba = c
                @[reducible, inline, deprecated Std.IdempotentOp]
                abbrev IsIdempotent (α : Sort u) (op : ααα) :
                Equations
                Instances For
                  @[instance 100]
                  instance isSymmOp_of_isSymm (α : Sort u) (r : ααProp) [IsSymm α r] :

                  The opposite of a symmetric relation is symmetric.

                  Equations
                  • =
                  @[deprecated]
                  class IsTotalPreorder (α : Sort u) (r : ααProp) extends IsTrans , IsTotal :

                  IsTotalPreorder X r means that the binary relation r on X is total and a preorder.

                    Instances
                      @[instance 100]
                      instance isTotalPreorder_isPreorder (α : Sort u) (r : ααProp) [s : IsTotalPreorder α r] :

                      Every total pre-order is a pre-order.

                      Equations
                      • =
                      @[deprecated]
                      class IsIncompTrans (α : Sort u) (lt : ααProp) :

                      IsIncompTrans X lt means that for lt a binary relation on X, the incomparable relation fun a b => ¬ lt a b ∧ ¬ lt b a is transitive.

                      • incomp_trans : ∀ (a b c : α), ¬lt a b ¬lt b a¬lt b c ¬lt c b¬lt a c ¬lt c a
                      Instances
                        theorem IsIncompTrans.incomp_trans {α : Sort u} {lt : ααProp} [self : IsIncompTrans α lt] (a : α) (b : α) (c : α) :
                        ¬lt a b ¬lt b a¬lt b c ¬lt c b¬lt a c ¬lt c a
                        @[deprecated, instance 100]
                        instance instIsIncompTransOfIsStrictWeakOrder (α : Sort u) (lt : ααProp) [IsStrictWeakOrder α lt] :
                        Equations
                        • =
                        @[deprecated]
                        theorem incomp_trans {α : Sort u} {r : ααProp} [IsIncompTrans α r] {a : α} {b : α} {c : α} :
                        ¬r a b ¬r b a¬r b c ¬r c b¬r a c ¬r c a
                        @[elab_without_expected_type, deprecated]
                        theorem incomp_trans_of {α : Sort u} (r : ααProp) [IsIncompTrans α r] {a : α} {b : α} {c : α} :
                        ¬r a b ¬r b a¬r b c ¬r c b¬r a c ¬r c a
                        @[deprecated]
                        def StrictWeakOrder.Equiv {α : Sort u} {r : ααProp} (a : α) (b : α) :
                        Equations
                        Instances For
                          @[deprecated]
                          theorem StrictWeakOrder.esymm {α : Sort u} {r : ααProp} {a : α} {b : α} :
                          @[deprecated]
                          theorem StrictWeakOrder.not_lt_of_equiv {α : Sort u} {r : ααProp} {a : α} {b : α} :
                          @[deprecated]
                          theorem StrictWeakOrder.not_lt_of_equiv' {α : Sort u} {r : ααProp} {a : α} {b : α} :
                          @[deprecated]
                          theorem StrictWeakOrder.erefl {α : Sort u} {r : ααProp} [IsStrictWeakOrder α r] (a : α) :
                          @[deprecated]
                          theorem StrictWeakOrder.etrans {α : Sort u} {r : ααProp} [IsStrictWeakOrder α r] {a : α} {b : α} {c : α} :
                          @[deprecated]
                          instance StrictWeakOrder.isEquiv {α : Sort u} {r : ααProp} [IsStrictWeakOrder α r] :
                          IsEquiv α StrictWeakOrder.Equiv
                          Equations
                          • =

                          The equivalence relation induced by lt

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[deprecated]
                            theorem isStrictWeakOrder_of_isTotalPreorder {α : Sort u} {le : ααProp} {lt : ααProp} [DecidableRel le] [IsTotalPreorder α le] (h : ∀ (a b : α), lt a b ¬le b a) :
                            @[deprecated]
                            instance instIsTotalPreorderLe {α : Type u_1} [LinearOrder α] :
                            IsTotalPreorder α fun (x x_1 : α) => x x_1
                            Equations
                            • =
                            @[deprecated]
                            instance isStrictWeakOrder_of_linearOrder {α : Type u_1} [LinearOrder α] :
                            IsStrictWeakOrder α fun (x x_1 : α) => x < x_1
                            Equations
                            • =
                            @[deprecated]
                            theorem lt_of_lt_of_incomp {α : Sort u} {lt : ααProp} [IsStrictWeakOrder α lt] [DecidableRel lt] {a : α} {b : α} {c : α} :
                            lt a b¬lt b c ¬lt c blt a c
                            @[deprecated]
                            theorem lt_of_incomp_of_lt {α : Sort u} {lt : ααProp} [IsStrictWeakOrder α lt] [DecidableRel lt] {a : α} {b : α} {c : α} :
                            ¬lt a b ¬lt b alt b clt a c
                            @[deprecated]
                            theorem eq_of_incomp {α : Sort u} {lt : ααProp} [IsTrichotomous α lt] {a : α} {b : α} :
                            ¬lt a b ¬lt b aa = b
                            @[deprecated]
                            theorem eq_of_eqv_lt {α : Sort u} {lt : ααProp} [IsTrichotomous α lt] {a : α} {b : α} :
                            @[deprecated]
                            theorem incomp_iff_eq {α : Sort u} {lt : ααProp} [IsTrichotomous α lt] [IsIrrefl α lt] (a : α) (b : α) :
                            ¬lt a b ¬lt b a a = b
                            @[deprecated]
                            theorem eqv_lt_iff_eq {α : Sort u} {lt : ααProp} [IsTrichotomous α lt] [IsIrrefl α lt] (a : α) (b : α) :