Documentation

Mathlib.CategoryTheory.Category.PartialFun

The category of types with partial functions #

This defines PartialFun, the category of types equipped with partial functions.

This category is classically equivalent to the category of pointed types. The reason it doesn't hold constructively stems from the difference between Part and Option. Both can model partial functions, but the latter forces a decidable domain.

Precisely, PartialFunToPointed turns a partial function α →. β into a function Option α → Option β by sending to none the undefined values (and none to none). But being defined is (generally) undecidable while being sent to none is decidable. So it can't be constructive.

References #

def PartialFun :
Type (u_1 + 1)

The category of types equipped with partial functions.

Equations
Instances For

    Turns a type into a PartialFun.

    Equations
    Instances For
      def PartialFun.Iso.mk {α β : PartialFun} (e : α β) :
      α β

      Constructs a partial function isomorphism between types from an equivalence between them.

      Equations
      • PartialFun.Iso.mk e = { hom := fun (x : α) => (some (e x)), inv := fun (x : β) => (some (e.symm x)), hom_inv_id := , inv_hom_id := }
      Instances For
        @[simp]
        theorem PartialFun.Iso.mk_inv {α β : PartialFun} (e : α β) (x : β) :
        (PartialFun.Iso.mk e).inv x = (some (e.symm x))
        @[simp]
        theorem PartialFun.Iso.mk_hom {α β : PartialFun} (e : α β) (x : α) :
        (PartialFun.Iso.mk e).hom x = (some (e x))

        The forgetful functor from Type to PartialFun which forgets that the maps are total.

        Equations
        Instances For

          The functor which deletes the point of a pointed type. In return, this makes the maps partial. This is the computable part of the equivalence PartialFunEquivPointed.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[simp]
            theorem pointedToPartialFun_map {X✝ Y✝ : Pointed} (f : X✝ Y✝) (a✝ : { x : X✝.X // x X✝.point }) :
            pointedToPartialFun.map f a✝ = (PFun.toSubtype (fun (x : Y✝.X) => x Y✝.point) f.toFun Subtype.val) a✝
            @[simp]
            theorem pointedToPartialFun_obj (X : Pointed) :
            pointedToPartialFun.obj X = { x : X.X // x X.point }

            The functor which maps undefined values to a new point. This makes the maps total and creates pointed types. This is the noncomputable part of the equivalence PartialFunEquivPointed. It can't be computable because = Option.none is decidable while the domain of a general Part isn't.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[simp]
              theorem partialFunToPointed_obj (X : PartialFun) :
              partialFunToPointed.obj X = { X := Option X, point := none }
              @[simp]
              theorem partialFunToPointed_map {X✝ Y✝ : PartialFun} (f : X✝ Y✝) :
              partialFunToPointed.map f = { toFun := Option.elim' none fun (a : X✝) => (f a).toOption, map_point := }

              The equivalence induced by PartialFunToPointed and PointedToPartialFun. Part.equivOption made functorial.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem partialFunEquivPointed_counitIso_inv_app_toFun (X : Pointed) (a : ((CategoryTheory.Functor.id Pointed).obj X).X) :
                (partialFunEquivPointed.counitIso.inv.app X).toFun a = if h : a = X.point then none else some a, h
                @[simp]
                theorem partialFunEquivPointed_unitIso_inv_app (X : PartialFun) :
                partialFunEquivPointed.unitIso.inv.app X = (PartialFun.Iso.mk { toFun := fun (a : X) => some a, , invFun := fun (a : { x : Option X // ¬x = none }) => (↑a).get , left_inv := , right_inv := }).inv
                @[simp]
                theorem partialFunEquivPointed_counitIso_hom_app_toFun (X : Pointed) (a : ((pointedToPartialFun.comp partialFunToPointed).obj X).X) :
                (partialFunEquivPointed.counitIso.hom.app X).toFun a = Option.casesOn' a X.point Subtype.val
                @[simp]
                theorem partialFunEquivPointed_inverse_map_get_coe {X✝ Y✝ : Pointed} (f : X✝ Y✝) (a✝ : { x : X✝.X // x X✝.point }) (property : f.toFun a✝ Y✝.point) :
                ((partialFunEquivPointed.inverse.map f a✝).get property) = f.toFun a✝
                @[simp]
                theorem partialFunEquivPointed_inverse_map_Dom {X✝ Y✝ : Pointed} (f : X✝ Y✝) (a✝ : { x : X✝.X // x X✝.point }) :
                (partialFunEquivPointed.inverse.map f a✝).Dom = ¬f.toFun a✝ = Y✝.point
                @[simp]
                theorem partialFunEquivPointed_functor_map_toFun {X✝ Y✝ : PartialFun} (f : X✝ Y✝) (a✝ : Option X✝) :
                (partialFunEquivPointed.functor.map f).toFun a✝ = Option.elim' none (fun (a : X✝) => (f a).toOption) a✝
                @[simp]
                theorem partialFunEquivPointed_inverse_obj (X : Pointed) :
                partialFunEquivPointed.inverse.obj X = { x : X.X // ¬x = X.point }
                @[simp]
                @[simp]
                theorem partialFunEquivPointed_unitIso_hom_app (X : PartialFun) :
                partialFunEquivPointed.unitIso.hom.app X = (PartialFun.Iso.mk { toFun := fun (a : X) => some a, , invFun := fun (a : { x : Option X // ¬x = none }) => (↑a).get , left_inv := , right_inv := }).hom

                Forgetting that maps are total and making them total again by adding a point is the same as just adding a point.

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