Documentation

CatCryptCore.Category.KlPMF

Kleisli Category of PMF as a Markov Category #

The Kleisli category of the PMF monad (probability mass functions), with Prod as tensor and PUnit as unit, forms a Markov category — the first non-trivial instance of MarkovCategory.

Full probability (PMF) rather than sub-probability (PMF (Option α)) is needed because discard_natural (f ≫ ε = ε) requires mass preservation. The key lemma is PMF.bind_const : (p.bind fun _ => q) = q, giving discard_natural for free.

Main results #

@[simp]
theorem CategoryTheory.KleisliCat.comp_apply {α β γ : KleisliCat PMF} (f : α β) (g : β γ) (x : α) :
CategoryStruct.comp f g x = (f x).bind g

Composition in KleisliCat PMF applies the first morphism then binds the second.

@[simp]

The identity morphism in KleisliCat PMF is PMF.pure.

@[simp]

Bridge between the generic pure and PMF.pure, needed because KleisliCat.id_def rewrites 𝟙 α to the generic monad pure.

Monoidal structure #

noncomputable def CategoryTheory.KleisliCat.whiskerLeftPMF (X : KleisliCat PMF) {Y₁ Y₂ : KleisliCat PMF} (f : Y₁ Y₂) :
(have this := X × Y₁; this) have this := X × Y₂; this

Left whiskering: tensors the identity on X with a morphism f on the right.

Equations
Instances For
    noncomputable def CategoryTheory.KleisliCat.whiskerRightPMF {X₁ X₂ : KleisliCat PMF} (f : X₁ X₂) (Y : KleisliCat PMF) :
    (have this := X₁ × Y; this) have this := X₂ × Y; this

    Right whiskering: tensors a morphism f on the left with the identity on Y.

    Equations
    Instances For
      noncomputable def CategoryTheory.KleisliCat.assocHomPMF (X : KleisliCat PMF) (Y : KleisliCat PMF) (Z : KleisliCat PMF) :
      (have this := (X × Y) × Z; this) have this := X × Y × Z; this

      Forward component of the associator.

      Equations
      Instances For
        noncomputable def CategoryTheory.KleisliCat.assocInvPMF (X : KleisliCat PMF) (Y : KleisliCat PMF) (Z : KleisliCat PMF) :
        (have this := X × Y × Z; this) have this := (X × Y) × Z; this

        Inverse component of the associator.

        Equations
        Instances For
          noncomputable def CategoryTheory.KleisliCat.assocIsoPMF (X : KleisliCat PMF) (Y : KleisliCat PMF) (Z : KleisliCat PMF) :
          (have this := (X × Y) × Z; this) have this := X × Y × Z; this

          Associator isomorphism for the tensor product.

          Equations
          Instances For
            noncomputable def CategoryTheory.KleisliCat.leftUnitorPMF (X : KleisliCat PMF) :
            (have this := PUnit.{u_2 + 1} × X; this) X

            Left unitor: PUnit ⊗ X ≅ X.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              noncomputable def CategoryTheory.KleisliCat.rightUnitorPMF (X : KleisliCat PMF) :
              (have this := X × PUnit.{u_2 + 1}; this) X

              Right unitor: X ⊗ PUnit ≅ X.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def CategoryTheory.KleisliCat.braidHomPMF (X : KleisliCat PMF) (Y : KleisliCat PMF) :
                (have this := X × Y; this) have this := Y × X; this

                Forward component of the braiding: swaps the two components.

                Equations
                Instances For
                  noncomputable def CategoryTheory.KleisliCat.braidIsoPMF (X : KleisliCat PMF) (Y : KleisliCat PMF) :
                  (have this := X × Y; this) have this := Y × X; this

                  Braiding isomorphism: swaps the two tensor factors.

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

                    Simp lemmas #

                    @[simp]
                    theorem CategoryTheory.KleisliCat.tensorHom_eq {X₁ Y₁ X₂ Y₂ : KleisliCat PMF} (f : X₁ Y₁) (g : X₂ Y₂) :

                    MonoidalCategory #

                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.

                    BraidedCategory and SymmetricCategory #

                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.

                    ComonObj (copy = diagonal, delete = terminal) #

                    @[implicit_reducible]

                    Every type in KleisliCat PMF is a comonoid object: comul is the diagonal and counit is the terminal map.

                    Equations

                    Every type in KleisliCat PMF is a commutative comonoid object.

                    CopyDiscardCategory #

                    theorem CategoryTheory.KleisliCat.tensorμ_apply (X₁ X₂ Y₁ Y₂ : KleisliCat PMF) (x₁ : X₁) (x₂ : X₂) (y₁ : Y₁) (y₂ : Y₂) :
                    MonoidalCategory.tensorμ X₁ X₂ Y₁ Y₂ ((x₁, x₂), y₁, y₂) = PMF.pure ((x₁, y₁), x₂, y₂)

                    The tensor strength tensorμ acts as a pure reshuffling on product types.

                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.

                    MarkovCategory #

                    @[implicit_reducible]

                    KleisliCat PMF is a Markov category: discarding after any stochastic map equals discarding directly.

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