Documentation

Mathlib.CategoryTheory.Category.RelCat

Basics on the category of relations #

We define the category of types CategoryTheory.RelCat with binary relations as morphisms. Associating each function with the relation defined by its graph yields a faithful and essentially surjective functor graphFunctor that also characterizes all isomorphisms (see rel_iso_iff).

By flipping the arguments to a relation, we construct an equivalence opEquivalence between RelCat and its opposite.

A type synonym for Type u, which carries the category instance for which morphisms are binary relations.

Equations
Instances For

    The morphisms in the relation category are relations.

    • ofRel :: (
      • rel : Rel X Y

        The underlying relation between X and Y of a morphism X ⟶ Y for X Y : RelCat.

    • )
    Instances For

      The category of types with binary relations as morphisms.

      Equations
      • One or more equations did not get rendered due to their size.
      @[simp]
      theorem CategoryTheory.RelCat.rel_comp {X✝ Y✝ Z✝ : RelCat} (f : X✝.Hom Y✝) (g : Y✝.Hom Z✝) :
      @[simp]
      theorem CategoryTheory.RelCat.rel_id (x✝ : RelCat) (x1✝ x2✝ : x✝) :
      (CategoryStruct.id x✝).rel x1✝ x2✝ = (x1✝ = x2✝)
      theorem CategoryTheory.RelCat.Hom.ext {X Y : RelCat} (f g : X Y) (h : f.rel = g.rel) :
      f = g
      theorem CategoryTheory.RelCat.Hom.ext_iff {X Y : RelCat} {f g : X Y} :
      f = g f.rel = g.rel
      theorem CategoryTheory.RelCat.Hom.rel_comp_apply₂ {X Y Z : RelCat} (f : X Y) (g : Y Z) (x : X) (z : Z) :
      (CategoryStruct.comp f g).rel x z ∃ (y : Y), f.rel x y g.rel y z

      The essentially surjective faithful embedding from the category of types and functions into the category of types and relations.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[simp]
        @[deprecated CategoryTheory.RelCat.rel_graphFunctor_map (since := "2025-06-08")]
        theorem CategoryTheory.RelCat.graphFunctor_map {X Y : Type u} (f : X Y) (x : X) (y : Y) :
        (graphFunctor.map f).rel x y f x = y
        theorem CategoryTheory.RelCat.rel_iso_iff {X Y : RelCat} (r : X Y) :
        IsIso r ∃ (f : X Y), graphFunctor.map f.hom = r

        A relation is an isomorphism in RelCat iff it is the image of an isomorphism in Type u.

        The argument-swap isomorphism from RelCat to its opposite.

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

          The other direction of opFunctor.

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

            RelCat is self-dual: The map that swaps the argument order of a relation induces an equivalence between RelCat and its opposite.

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