Documentation

Mathlib.Data.Setoid.Basic

Equivalence relations #

This file defines the complete lattice of equivalence relations on a type, results about the inductively defined equivalence closure of a binary relation, and the analogues of some isomorphism theorems for quotients of arbitrary types.

Implementation notes #

The function Rel and lemmas ending in ' make it easier to talk about different equivalence relations on the same type.

The complete lattice instance for equivalence relations could have been defined by lifting the Galois insertion of equivalence relations on α into binary relations on α, and then using CompleteLattice.copy to define a complete lattice instance with more appropriate definitional equalities (a similar example is Filter.CompleteLattice in Order/Filter/Basic.lean). This does not save space, however, and is less clear.

Partitions are not defined as a separate structure here; users are encouraged to reason about them using the existing Setoid and its infrastructure.

Tags #

setoid, equivalence, iseqv, relation, equivalence relation

def Setoid.Rel {α : Type u_1} (r : Setoid α) :
ααProp

A version of Setoid.r that takes the equivalence relation as an explicit argument.

Equations
Instances For
    instance Setoid.decidableRel {α : Type u_1} (r : Setoid α) [h : DecidableRel Setoid.r] :
    Equations
    theorem Quotient.eq_rel {α : Type u_1} {r : Setoid α} {x : α} {y : α} :

    A version of Quotient.eq' compatible with Setoid.Rel, to make rewriting possible.

    theorem Setoid.ext' {α : Type u_1} {r : Setoid α} {s : Setoid α} (H : ∀ (a b : α), Setoid.Rel r a b Setoid.Rel s a b) :
    r = s
    theorem Setoid.ext_iff {α : Type u_1} {r : Setoid α} {s : Setoid α} :
    r = s ∀ (a b : α), Setoid.Rel r a b Setoid.Rel s a b
    theorem Setoid.eq_iff_rel_eq {α : Type u_1} {r₁ : Setoid α} {r₂ : Setoid α} :
    r₁ = r₂ Setoid.Rel r₁ = Setoid.Rel r₂

    Two equivalence relations are equal iff their underlying binary operations are equal.

    instance Setoid.instLESetoid {α : Type u_1} :
    LE (Setoid α)

    Defining for equivalence relations.

    Equations
    theorem Setoid.le_def {α : Type u_1} {r : Setoid α} {s : Setoid α} :
    r s ∀ {x y : α}, Setoid.Rel r x ySetoid.Rel s x y
    theorem Setoid.refl' {α : Type u_1} (r : Setoid α) (x : α) :
    theorem Setoid.symm' {α : Type u_1} (r : Setoid α) {x : α} {y : α} :
    Setoid.Rel r x ySetoid.Rel r y x
    theorem Setoid.trans' {α : Type u_1} (r : Setoid α) {x : α} {y : α} {z : α} :
    Setoid.Rel r x ySetoid.Rel r y zSetoid.Rel r x z
    theorem Setoid.comm' {α : Type u_1} (s : Setoid α) {x : α} {y : α} :
    def Setoid.ker {α : Type u_1} {β : Type u_2} (f : αβ) :

    The kernel of a function is an equivalence relation.

    Equations
    Instances For
      @[simp]
      theorem Setoid.ker_mk_eq {α : Type u_1} (r : Setoid α) :
      Setoid.ker Quotient.mk'' = r

      The kernel of the quotient map induced by an equivalence relation r equals r.

      theorem Setoid.ker_apply_mk_out {α : Type u_1} {β : Type u_2} {f : αβ} (a : α) :
      theorem Setoid.ker_apply_mk_out' {α : Type u_1} {β : Type u_2} {f : αβ} (a : α) :
      theorem Setoid.ker_def {α : Type u_1} {β : Type u_2} {f : αβ} {x : α} {y : α} :
      Setoid.Rel (Setoid.ker f) x y f x = f y
      def Setoid.prod {α : Type u_1} {β : Type u_2} (r : Setoid α) (s : Setoid β) :
      Setoid (α × β)

      Given types α, β, the product of two equivalence relations r on α and s on β: (x₁, x₂), (y₁, y₂) ∈ α × β are related by r.prod s iff x₁ is related to y₁ by r and x₂ is related to y₂ by s.

      Equations
      Instances For
        instance Setoid.instInfSetoid {α : Type u_1} :
        Inf (Setoid α)

        The infimum of two equivalence relations.

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Setoid.inf_def {α : Type u_1} {r : Setoid α} {s : Setoid α} :

        The infimum of 2 equivalence relations r and s is the same relation as the infimum of the underlying binary operations.

        theorem Setoid.inf_iff_and {α : Type u_1} {r : Setoid α} {s : Setoid α} {x : α} {y : α} :
        Setoid.Rel (r s) x y Setoid.Rel r x y Setoid.Rel s x y
        instance Setoid.instInfSetSetoid {α : Type u_1} :

        The infimum of a set of equivalence relations.

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Setoid.sInf_def {α : Type u_1} {s : Set (Setoid α)} :
        Setoid.Rel (sInf s) = sInf (Setoid.Rel '' s)

        The underlying binary operation of the infimum of a set of equivalence relations is the infimum of the set's image under the map to the underlying binary operation.

        Equations

        The complete lattice of equivalence relations on a type, with bottom element = and top element the trivial equivalence relation.

        Equations
        • One or more equations did not get rendered due to their size.
        @[simp]
        theorem Setoid.top_def {α : Type u_1} :
        @[simp]
        theorem Setoid.bot_def {α : Type u_1} :
        Setoid.Rel = fun x x_1 => x = x_1
        theorem Setoid.eq_top_iff {α : Type u_1} {s : Setoid α} :
        s = ∀ (x y : α), Setoid.Rel s x y
        theorem Setoid.eqvGen_eq {α : Type u_1} (r : ααProp) :
        EqvGen.Setoid r = sInf {s | ∀ ⦃x y : α⦄, r x ySetoid.Rel s x y}

        The inductively defined equivalence closure of a binary relation r is the infimum of the set of all equivalence relations containing r.

        theorem Setoid.sup_eq_eqvGen {α : Type u_1} (r : Setoid α) (s : Setoid α) :
        r s = EqvGen.Setoid fun x y => Setoid.Rel r x y Setoid.Rel s x y

        The supremum of two equivalence relations r and s is the equivalence closure of the binary relation x is related to y by r or s.

        theorem Setoid.sup_def {α : Type u_1} {r : Setoid α} {s : Setoid α} :

        The supremum of 2 equivalence relations r and s is the equivalence closure of the supremum of the underlying binary operations.

        theorem Setoid.sSup_eq_eqvGen {α : Type u_1} (S : Set (Setoid α)) :
        sSup S = EqvGen.Setoid fun x y => r, r S Setoid.Rel r x y

        The supremum of a set S of equivalence relations is the equivalence closure of the binary relation there exists r ∈ S relating x and y.

        theorem Setoid.sSup_def {α : Type u_1} {s : Set (Setoid α)} :
        sSup s = EqvGen.Setoid (sSup (Setoid.Rel '' s))

        The supremum of a set of equivalence relations is the equivalence closure of the supremum of the set's image under the map to the underlying binary operation.

        @[simp]
        theorem Setoid.eqvGen_of_setoid {α : Type u_1} (r : Setoid α) :
        EqvGen.Setoid Setoid.r = r

        The equivalence closure of an equivalence relation r is r.

        @[simp]
        theorem Setoid.eqvGen_idem {α : Type u_1} (r : ααProp) :

        Equivalence closure is idempotent.

        theorem Setoid.eqvGen_le {α : Type u_1} {r : ααProp} {s : Setoid α} (h : ∀ (x y : α), r x ySetoid.Rel s x y) :

        The equivalence closure of a binary relation r is contained in any equivalence relation containing r.

        theorem Setoid.eqvGen_mono {α : Type u_1} {r : ααProp} {s : ααProp} (h : (x y : α) → r x ys x y) :

        Equivalence closure of binary relations is monotone.

        def Setoid.gi {α : Type u_1} :
        GaloisInsertion EqvGen.Setoid Setoid.Rel

        There is a Galois insertion of equivalence relations on α into binary relations on α, with equivalence closure the lower adjoint.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Setoid.injective_iff_ker_bot {α : Type u_1} {β : Type u_2} (f : αβ) :

          A function from α to β is injective iff its kernel is the bottom element of the complete lattice of equivalence relations on α.

          theorem Setoid.ker_iff_mem_preimage {α : Type u_1} {β : Type u_2} {f : αβ} {x : α} {y : α} :
          Setoid.Rel (Setoid.ker f) x y x f ⁻¹' {f y}

          The elements related to x ∈ α by the kernel of f are those in the preimage of f(x) under f.

          def Setoid.liftEquiv {α : Type u_1} {β : Type u_2} (r : Setoid α) :
          { f // r Setoid.ker f } (Quotient rβ)

          Equivalence between functions α → β such that r x y → f x = f y and functions quotient r → β.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Setoid.lift_unique {α : Type u_1} {β : Type u_2} {r : Setoid α} {f : αβ} (H : r Setoid.ker f) (g : Quotient rβ) (Hg : f = g Quotient.mk'') :

            The uniqueness part of the universal property for quotients of an arbitrary type.

            theorem Setoid.ker_lift_injective {α : Type u_1} {β : Type u_2} (f : αβ) :
            Function.Injective (Quotient.lift f (_ : ∀ (x x_1 : α), x x_1x x_1))

            Given a map f from α to β, the natural map from the quotient of α by the kernel of f is injective.

            theorem Setoid.ker_eq_lift_of_injective {α : Type u_1} {β : Type u_2} {r : Setoid α} (f : αβ) (H : ∀ (x y : α), Setoid.Rel r x yf x = f y) (h : Function.Injective (Quotient.lift f H)) :

            Given a map f from α to β, the kernel of f is the unique equivalence relation on α whose induced map from the quotient of α to β is injective.

            noncomputable def Setoid.quotientKerEquivRange {α : Type u_1} {β : Type u_2} (f : αβ) :

            The first isomorphism theorem for sets: the quotient of α by the kernel of a function f bijects with f's image.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[simp]
              theorem Setoid.quotientKerEquivOfRightInverse_apply {α : Type u_1} {β : Type u_2} (f : αβ) (g : βα) (hf : Function.RightInverse g f) (a : Quotient (Setoid.ker f)) :
              ↑(Setoid.quotientKerEquivOfRightInverse f g hf) a = Quotient.liftOn' a f (_ : ∀ (x x_1 : α), Setoid.r x x_1Setoid.r x x_1)
              @[simp]
              theorem Setoid.quotientKerEquivOfRightInverse_symm_apply {α : Type u_1} {β : Type u_2} (f : αβ) (g : βα) (hf : Function.RightInverse g f) (b : β) :
              def Setoid.quotientKerEquivOfRightInverse {α : Type u_1} {β : Type u_2} (f : αβ) (g : βα) (hf : Function.RightInverse g f) :

              If f has a computable right-inverse, then the quotient by its kernel is equivalent to its domain.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def Setoid.quotientKerEquivOfSurjective {α : Type u_1} {β : Type u_2} (f : αβ) (hf : Function.Surjective f) :

                The quotient of α by the kernel of a surjective function f bijects with f's codomain.

                If a specific right-inverse of f is known, Setoid.quotientKerEquivOfRightInverse can be definitionally more useful.

                Equations
                Instances For
                  def Setoid.map {α : Type u_1} {β : Type u_2} (r : Setoid α) (f : αβ) :

                  Given a function f : α → β and equivalence relation r on α, the equivalence closure of the relation on f's image defined by 'x ≈ y iff the elements of f⁻¹(x) are related to the elements of f⁻¹(y) by r.'

                  Equations
                  Instances For
                    def Setoid.mapOfSurjective {α : Type u_1} {β : Type u_2} (r : Setoid α) (f : αβ) (h : Setoid.ker f r) (hf : Function.Surjective f) :

                    Given a surjective function f whose kernel is contained in an equivalence relation r, the equivalence relation on f's codomain defined by x ≈ y ↔ the elements of f⁻¹(x) are related to the elements of f⁻¹(y) by r.

                    Equations
                    Instances For
                      theorem Setoid.mapOfSurjective_eq_map {α : Type u_1} {β : Type u_2} {r : Setoid α} {f : αβ} (h : Setoid.ker f r) (hf : Function.Surjective f) :

                      A special case of the equivalence closure of an equivalence relation r equalling r.

                      @[reducible]
                      def Setoid.comap {α : Type u_1} {β : Type u_2} (f : αβ) (r : Setoid β) :

                      Given a function f : α → β, an equivalence relation r on β induces an equivalence relation on α defined by 'x ≈ y iff f(x) is related to f(y) by r'.

                      See note [reducible non-instances].

                      Equations
                      Instances For
                        theorem Setoid.comap_rel {α : Type u_1} {β : Type u_2} (f : αβ) (r : Setoid β) (x : α) (y : α) :
                        Setoid.Rel (Setoid.comap f r) x y Setoid.Rel r (f x) (f y)
                        theorem Setoid.comap_eq {α : Type u_1} {β : Type u_2} {f : αβ} {r : Setoid β} :
                        Setoid.comap f r = Setoid.ker (Quotient.mk'' f)

                        Given a map f : N → M and an equivalence relation r on β, the equivalence relation induced on α by f equals the kernel of r's quotient map composed with f.

                        noncomputable def Setoid.comapQuotientEquiv {α : Type u_1} {β : Type u_2} (f : αβ) (r : Setoid β) :
                        Quotient (Setoid.comap f r) ↑(Set.range (Quotient.mk'' f))

                        The second isomorphism theorem for sets.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          The third isomorphism theorem for sets.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def Setoid.correspondence {α : Type u_1} (r : Setoid α) :
                            { s // r s } ≃o Setoid (Quotient r)

                            Given an equivalence relation r on α, the order-preserving bijection between the set of equivalence relations containing r and the equivalence relations on the quotient of α by r.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[simp]
                              theorem Quotient.subsingleton_iff {α : Type u_1} {s : Setoid α} :
                              theorem Quot.subsingleton_iff {α : Type u_1} (r : ααProp) :