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.

Instances For
    @[implicit_reducible]

    Turns a type into a PartialFun.

    Instances For
      @[implicit_reducible]
      def PartialFun.Iso.mk {α β : PartialFun} (e : α β) :
      α β

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

      Instances For
        @[simp]
        theorem PartialFun.Iso.mk_inv {α β : PartialFun} (e : α β) (x : β) :
        (mk e).inv x = (some (e.symm x))
        @[simp]
        theorem PartialFun.Iso.mk_hom {α β : PartialFun} (e : α β) (x : α) :
        (mk e).hom x = (some (e x))

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

        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.

          Instances For
            @[simp]
            theorem pointedToPartialFun_obj (X : Pointed) :
            pointedToPartialFun.obj X = { x : X.X // x X.point }
            @[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✝

            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.

            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.

              Instances For
                @[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
                @[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_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_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_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✝

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

                Instances For