Documentation

Mathlib.Tactic.CategoryTheory.Monoidal

Normalization of morphisms in monoidal categories #

This file provides a tactic that normalizes morphisms in monoidal categories. This is used in the string diagram widget given in Mathlib.Tactic.StringDiagram. We say that the morphism η in a monoidal category is in normal form if

  1. η is of the form α₀ ≫ η₀ ≫ α₁ ≫ η₁ ≫ ... αₘ ≫ ηₘ ≫ αₘ₊₁ where each αᵢ is a structural 2-morphism (consisting of associators and unitors),
  2. each ηᵢ is a non-structural 2-morphism of the form f₁ ◁ ... ◁ fₘ ◁ θ, and
  3. θ is of the form ι ▷ g₁ ▷ ... ▷ gₗ

Note that the structural morphisms αᵢ are not necessarily normalized, as the main purpose is to get a list of the non-structural morphisms out.

Currently, the primary application of the normalization tactic in mind is drawing string diagrams, which are graphical representations of morphisms in monoidal categories, in the infoview. When drawing string diagrams, we often ignore associators and unitors (i.e., drawing morphisms in strict monoidal categories). On the other hand, in Lean, it is considered difficult to formalize the concept of strict monoidal categories due to the feature of dependent type theory. The normalization tactic can remove associators and unitors from the expression, extracting the necessary data for drawing string diagrams.

The current plan on drawing string diagrams (#10581) is to use Penrose (https://github.com/penrose) via ProofWidget. However, it should be noted that the normalization procedure in this file does not rely on specific settings, allowing for broader application.

Future plans include the following. At least I (Yuma) would like to work on these in the future, but it might not be immediate. If anyone is interested, I would be happy to discuss.

Main definitions #

The context for evaluating expressions.

  • The expression for the underlying category.

Instances For

    Populate a context object for evaluating e.

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

      The monad for the normalization of 2-morphisms.

      Equations
      Instances For
        @[reducible, inline]

        Run a computation in the M monad.

        Equations
        Instances For

          Expressions for atomic 1-morphisms.

          Instances For

            Expressions for 1-morphisms.

            Instances For

              Converts a 1-morphism into a list of its components.

              Equations
              Instances For

                Returns 𝟙_ C if the expression e is of the form 𝟙_ C.

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

                  Returns (f, g) if the expression e is of the form f ⊗ g.

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

                    Construct a Mor₁ expression from a Lean expression.

                    Expressions for atomic structural 2-morphisms.

                    Instances For

                      Construct a StructuralAtom expression from a Lean expression.

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

                        Expressions for atomic non-structural 2-morphisms.

                        Instances For

                          Expressions of the form η ▷ f₁ ▷ ... ▷ fₙ.

                          Instances For

                            Expressions of the form f₁ ◁ ... ◁ fₙ ◁ η.

                            Instances For

                              Expressions for structural 2-morphisms.

                              Instances For

                                Normalized expressions for 2-morphisms.

                                Instances For

                                  The domain of a morphism.

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

                                    The codomain of a morphism.

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

                                      The domain of a 2-morphism.

                                      Equations
                                      Instances For

                                        The codomain of a 2-morphism.

                                        Equations
                                        Instances For

                                          The domain of a 2-morphism.

                                          Equations
                                          Instances For

                                            The codomain of a 2-morphism.

                                            Equations
                                            Instances For

                                              The inverse of the associator as a term of normalExpr.

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

                                                Construct a NormalExpr expression from a WhiskerLeftExpr expression.

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

                                                  If e is an expression of the form η ⊗≫ θ := η ≫ α ≫ θ in the monoidal category C, return the expression for α .

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    theorem Mathlib.Tactic.Monoidal.eval_comp {C : Type u} [CategoryTheory.Category.{v, u} C] {f : C} {g : C} {h : C} {η : f g} {η' : f g} {θ : g h} {θ' : g h} {ι : f h} (pf_η : η = η') (pf_θ : θ = θ') (pf_ηθ : CategoryTheory.CategoryStruct.comp η' θ' = ι) :
                                                    theorem Mathlib.Tactic.Monoidal.eval_monoidalComp {C : Type u} [CategoryTheory.Category.{v, u} C] {f : C} {g : C} {h : C} {i : C} {η : f g} {η' : f g} {α : g h} {θ : h i} {θ' : h i} {αθ : g i} {ηαθ : f i} (pf_η : η = η') (pf_θ : θ = θ') (pf_αθ : CategoryTheory.CategoryStruct.comp α θ' = αθ) (pf_ηαθ : CategoryTheory.CategoryStruct.comp η' αθ = ηαθ) :
                                                    theorem Mathlib.Tactic.Monoidal.evalWhiskerRight_cons_whisker {C : Type u} [CategoryTheory.Category.{v, u} C] {f : C} {g : C} {h : C} {i : C} {j : C} [CategoryTheory.MonoidalCategory C] {α : g CategoryTheory.MonoidalCategory.tensorObj f h} {η : h i} {ηs : CategoryTheory.MonoidalCategory.tensorObj f i j} {k : C} {η₁ : CategoryTheory.MonoidalCategory.tensorObj h k CategoryTheory.MonoidalCategory.tensorObj i k} {η₂ : CategoryTheory.MonoidalCategory.tensorObj f (CategoryTheory.MonoidalCategory.tensorObj h k) CategoryTheory.MonoidalCategory.tensorObj f (CategoryTheory.MonoidalCategory.tensorObj i k)} {ηs₁ : CategoryTheory.MonoidalCategory.tensorObj (CategoryTheory.MonoidalCategory.tensorObj f i) k CategoryTheory.MonoidalCategory.tensorObj j k} {ηs₂ : CategoryTheory.MonoidalCategory.tensorObj f (CategoryTheory.MonoidalCategory.tensorObj i k) CategoryTheory.MonoidalCategory.tensorObj j k} {η₃ : CategoryTheory.MonoidalCategory.tensorObj f (CategoryTheory.MonoidalCategory.tensorObj h k) CategoryTheory.MonoidalCategory.tensorObj j k} {η₄ : CategoryTheory.MonoidalCategory.tensorObj (CategoryTheory.MonoidalCategory.tensorObj f h) k CategoryTheory.MonoidalCategory.tensorObj j k} {η₅ : CategoryTheory.MonoidalCategory.tensorObj g k CategoryTheory.MonoidalCategory.tensorObj j k} (pf_η₁ : CategoryTheory.MonoidalCategory.whiskerRight (CategoryTheory.CategoryStruct.comp (CategoryTheory.CategoryStruct.id h) (CategoryTheory.CategoryStruct.comp η (CategoryTheory.CategoryStruct.id i))) k = η₁) (pf_η₂ : CategoryTheory.MonoidalCategory.whiskerLeft f η₁ = η₂) (pf_ηs₁ : CategoryTheory.MonoidalCategory.whiskerRight ηs k = ηs₁) (pf_ηs₂ : CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.associator f i k).inv ηs₁ = ηs₂) (pf_η₃ : CategoryTheory.CategoryStruct.comp η₂ ηs₂ = η₃) (pf_η₄ : CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.associator f h k).hom η₃ = η₄) (pf_η₅ : CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.whiskerRight α k) η₄ = η₅) :

                                                    Extract a Lean expression from a Mor₁ expression.

                                                    Equations
                                                    Instances For

                                                      Extract a Lean expression from a StructuralAtom expression.

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

                                                        Extract a Lean expression from a WhiskerRightExpr expression.

                                                        Equations
                                                        Instances For

                                                          Extract a Lean expression from a WhiskerLeftExpr expression.

                                                          Equations
                                                          Instances For

                                                            Extract a Lean expression from a NormalExpr expression.

                                                            Equations
                                                            Instances For

                                                              The result of evaluating an expression into normal form.

                                                              Instances For

                                                                Evaluate the expression of a 2-morphism into a normalized form.

                                                                normalize% η is the normalization of the 2-morphism η.

                                                                1. The normalized 2-morphism is of the form α₀ ≫ η₀ ≫ α₁ ≫ η₁ ≫ ... αₘ ≫ ηₘ ≫ αₘ₊₁ where each αᵢ is a structural 2-morphism (consisting of associators and unitors),
                                                                2. each ηᵢ is a non-structural 2-morphism of the form f₁ ◁ ... ◁ fₘ ◁ θ, and
                                                                3. θ is of the form ι ▷ g₁ ▷ ... ▷ gₗ
                                                                Equations
                                                                Instances For
                                                                  theorem mk_eq {α : Type u_1} (a : α) (b : α) (a' : α) (b' : α) (ha : a = a') (hb : b = b') (h : a' = b') :
                                                                  a = b

                                                                  Transform an equality between 2-morphisms into the equality between their normalizations.

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

                                                                    Normalize the both sides of an equality.

                                                                    Equations
                                                                    Instances For