Documentation

Mathlib.Tactic.CategoryTheory.Coherence.Normalize

Normalization of 2-morphisms in bicategories #

This file provides a function that normalizes 2-morphisms in bicategories. The function also used to normalize morphisms in monoidal categories. This is used in the string diagram widget given in Mathlib/Tactic/Widget/StringDiagram.lean, as well as monoidal and bicategory tactics.

We say that the 2-morphism η in a bicategory 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 ι₁ ◫ ... ◫ ιₗ, and
  4. each ιᵢ is of the form κ ▷ g₁ ▷ ... ▷ gₖ.

Note that the horizontal composition is not currently defined for bicategories. In the monoidal category setting, the horizontal composition is defined as the tensorHom, denoted by .

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 string diagrams widget is to use Penrose (https://github.com/penrose) via ProofWidgets. 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 #

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

Instances For

    The underlying Mor₂ term of a WhiskerRight term.

    Instances For

      Expressions of the form η₁ ⊗ ... ⊗ ηₙ.

      Instances For

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

        Instances For

          The underlying Mor₂ term of a WhiskerLeft term.

          Instances For

            Whether a given 2-isomorphism is structural or not.

            Instances For
              @[reducible, inline]

              Expressions for structural isomorphisms. We do not impose the condition isStructural since it is not needed to write the tactic.

              Instances For

                Normalized expressions for 2-morphisms.

                Instances For

                  The underlying Mor₂ term of a NormalExpr term.

                  Instances For

                    A monad equipped with the ability to construct WhiskerRight terms.

                    Instances

                      A monad equipped with the ability to construct HorizontalComp terms.

                      Instances

                        A monad equipped with the ability to construct WhiskerLeft terms.

                        Instances

                          A monad equipped with the ability to construct NormalExpr terms.

                          Instances

                            The domain of a 2-morphism.

                            Instances For

                              The codomain of a 2-morphism.

                              Instances For

                                The domain of a 2-morphism.

                                Instances For

                                  The codomain of a 2-morphism.

                                  Instances For

                                    The domain of a 2-morphism.

                                    Instances For

                                      The codomain of a 2-morphism.

                                      Instances For

                                        The domain of a 2-morphism.

                                        Instances For

                                          The codomain of a 2-morphism.

                                          Instances For

                                            The identity 2-morphism as a term of normalExpr.

                                            Instances For

                                              The associator as a term of normalExpr.

                                              Instances For

                                                The inverse of the associator as a term of normalExpr.

                                                Instances For

                                                  The left unitor as a term of normalExpr.

                                                  Instances For

                                                    The inverse of the left unitor as a term of normalExpr.

                                                    Instances For

                                                      The right unitor as a term of normalExpr.

                                                      Instances For

                                                        The inverse of the right unitor as a term of normalExpr.

                                                        Instances For

                                                          Construct a NormalExpr expression from a WhiskerLeft expression.

                                                          Instances For

                                                            Construct a NormalExpr expression from a Lean expression for an atomic 2-morphism.

                                                            Instances For

                                                              Convert a NormalExpr expression into a list of WhiskerLeft expressions.

                                                              Instances For

                                                                The result of evaluating an expression into normal form.

                                                                • expr : NormalExpr

                                                                  The normalized expression of the 2-morphism.

                                                                • proof : Lean.Expr

                                                                  The proof that the normalized expression is equal to the original expression.

                                                                Instances For

                                                                  Evaluate the expression α ≫ β.

                                                                  Instances

                                                                    Evaluate the expression f ◁ η.

                                                                    • mkEvalWhiskerLeftNil (f : Mor₁) (α : Structural) : m Lean.Expr

                                                                      Evaluate f ◁ α

                                                                    • mkEvalWhiskerLeftOfCons (f : Atom₁) (α : Structural) (η : WhiskerLeft) (ηs θ : NormalExpr) (e_θ : Lean.Expr) : m Lean.Expr

                                                                      Evaluate f ◁ (α ≫ η ≫ ηs).

                                                                    • mkEvalWhiskerLeftComp (f g : Mor₁) (η η₁ η₂ η₃ η₄ : NormalExpr) (e_η₁ e_η₂ e_η₃ e_η₄ : Lean.Expr) : m Lean.Expr

                                                                      Evaluate (f ≫ g) ◁ η

                                                                    • mkEvalWhiskerLeftId (η η₁ η₂ : NormalExpr) (e_η₁ e_η₂ : Lean.Expr) : m Lean.Expr

                                                                      Evaluate 𝟙 _ ◁ η

                                                                    Instances

                                                                      Evaluate the expression η ▷ f.

                                                                      • mkEvalWhiskerRightAuxOf (η : WhiskerRight) (f : Atom₁) : m Lean.Expr

                                                                        Evaluate η ▷ f

                                                                      • mkEvalWhiskerRightAuxCons (f : Atom₁) (η : WhiskerRight) (ηs : HorizontalComp) (ηs' η₁ η₂ η₃ : NormalExpr) (e_ηs' e_η₁ e_η₂ e_η₃ : Lean.Expr) : m Lean.Expr

                                                                        Evaluate (η ◫ ηs) ▷ f

                                                                      • mkEvalWhiskerRightNil (α : Structural) (f : Mor₁) : m Lean.Expr

                                                                        Evaluate α ▷ f

                                                                      • mkEvalWhiskerRightConsOfOf (f : Atom₁) (α : Structural) (η : HorizontalComp) (ηs ηs₁ η₁ η₂ η₃ : NormalExpr) (e_ηs₁ e_η₁ e_η₂ e_η₃ : Lean.Expr) : m Lean.Expr

                                                                        Evaluate (α ≫ η ≫ ηs) ▷ j

                                                                      • mkEvalWhiskerRightConsWhisker (f : Atom₁) (g : Mor₁) (α : Structural) (η : WhiskerLeft) (ηs η₁ η₂ ηs₁ ηs₂ η₃ η₄ η₅ : NormalExpr) (e_η₁ e_η₂ e_ηs₁ e_ηs₂ e_η₃ e_η₄ e_η₅ : Lean.Expr) : m Lean.Expr

                                                                        Evaluate (α ≫ (f ◁ η) ≫ ηs) ▷ g

                                                                      • mkEvalWhiskerRightComp (g h : Mor₁) (η η₁ η₂ η₃ η₄ : NormalExpr) (e_η₁ e_η₂ e_η₃ e_η₄ : Lean.Expr) : m Lean.Expr

                                                                        Evaluate η ▷ (g ⊗ h)

                                                                      • mkEvalWhiskerRightId (η η₁ η₂ : NormalExpr) (e_η₁ e_η₂ : Lean.Expr) : m Lean.Expr

                                                                        Evaluate η ▷ 𝟙 _

                                                                      Instances

                                                                        Evaluate the expression η ◫ θ.

                                                                        • mkEvalHorizontalCompAuxOf (η : WhiskerRight) (θ : HorizontalComp) : m Lean.Expr

                                                                          Evaluate η ◫ θ

                                                                        • mkEvalHorizontalCompAuxCons (η : WhiskerRight) (ηs θ : HorizontalComp) (ηθ η₁ ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_η₁ e_ηθ₁ e_ηθ₂ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate (η ◫ ηs) ◫ θ

                                                                        • mkEvalHorizontalCompAux'Whisker (f : Atom₁) (η θ : WhiskerLeft) (ηθ ηθ₁ ηθ₂ ηθ₃ : NormalExpr) (e_ηθ e_ηθ₁ e_ηθ₂ e_ηθ₃ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate (f ◁ η) ◫ θ

                                                                        • mkEvalHorizontalCompAux'OfWhisker (f : Atom₁) (η : HorizontalComp) (θ : WhiskerLeft) (η₁ ηθ ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_η₁ e_ηθ₁ e_ηθ₂ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate η ◫ (f ◁ θ)

                                                                        • mkEvalHorizontalCompNilNil (α β : Structural) : m Lean.Expr

                                                                          Evaluate α ◫ β

                                                                        • mkEvalHorizontalCompNilCons (α β : Structural) (η : WhiskerLeft) (ηs η₁ ηs₁ η₂ η₃ : NormalExpr) (e_η₁ e_ηs₁ e_η₂ e_η₃ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate α ◫ (β ≫ η ≫ ηs)

                                                                        • mkEvalHorizontalCompConsNil (α β : Structural) (η : WhiskerLeft) (ηs η₁ ηs₁ η₂ η₃ : NormalExpr) (e_η₁ e_ηs₁ e_η₂ e_η₃ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate (α ≫ η ≫ ηs) ◫ β

                                                                        • mkEvalHorizontalCompConsCons (α β : Structural) (η θ : WhiskerLeft) (ηs θs ηθ ηθs ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_ηθs e_ηθ₁ e_ηθ₂ : Lean.Expr) : m Lean.Expr

                                                                          Evaluate (α ≫ η ≫ ηs) ◫ (β ≫ θ ≫ θs)

                                                                        Instances

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

                                                                          Instances

                                                                            Evaluate the expression α ≫ η into a normalized form.

                                                                            Instances For

                                                                              Evaluate the expression η ≫ θ into a normalized form.

                                                                              Instances For
                                                                                @[irreducible]

                                                                                Evaluate the expression f ◁ η into a normalized form.

                                                                                Instances For

                                                                                  Evaluate the expression η ▷ f into a normalized form.

                                                                                  def Mathlib.Tactic.BicategoryLike.traceProof {ρ : Type} (nm : Lean.Name) (result : Lean.Expr) :
                                                                                  CoherenceM ρ Unit

                                                                                  Trace the proof of the normalization.

                                                                                  Instances For

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

                                                                                    Instances For