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
            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.

              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
                    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✝

                      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
                        Instances For
                          @[simp]
                          @[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
                            Instances For
                              @[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_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_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_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_map_Dom {X✝ Y✝ : Pointed} (f : X✝ Y✝) (a✝ : { x : X✝.X // x X✝.point }) :

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

                              Equations
                                Instances For