The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V34. The tactics of Mathlib

Mathlib.Tactic.Widget.StringDiagram

83 declarations. Mathlib docs · Source

String Diagram Widget

This file provides meta infrastructure for displaying string diagrams for morphisms in monoidal categories in the infoview. To enable the string diagram widget, you need to import this file and inserting with_panel_widgets [Mathlib.Tactic.Widget.StringDiagram] at the beginning of the proof. Alternatively, you can also write

open Mathlib.Tactic.Widget
show_panel_widgets [local StringDiagram]

to enable the string diagram widget in the current section.

We also have the #string_diagram command. For example,

#string_diagram MonoidalCategory.whisker_exchange

displays the string diagram for the exchange law of the left and right whiskerings.

String diagrams are graphical representations of morphisms in monoidal categories, which are useful for rewriting computations. More precisely, objects in a monoidal category is represented by strings, and morphisms between two objects is represented by nodes connecting two strings associated with the objects. The tensor product X ⊗ Y corresponds to putting strings associated with X and Y horizontally (from left to right), and the composition of morphisms f : X ⟶ Y and g : Y ⟶ Z corresponds to connecting two nodes associated with f and g vertically (from top to bottom) by strings associated with Y.

Currently, the string diagram widget provided in this file deals with equalities of morphisms in monoidal categories. It displays string diagrams corresponding to the morphisms for the left-hand and right-hand sides of the equality.

Some examples can be found in MathlibTest/StringDiagram.lean.

When drawing string diagrams, it is common to ignore associators and unitors. We follow this convention. To do this, we need to extract non-structural morphisms that are not associators and unitors from lean expressions. This operation is performed using the Tactic.Monoidal.eval function.

A monoidal category can be viewed as a bicategory with a single object. The program in this file can also be used to display the string diagram for general bicategories. With this in mind we will sometimes refer to objects and morphisms in monoidal categories as 1-morphisms and 2-morphisms respectively, borrowing the terminology of bicategories. Note that the relation between monoidal categories and bicategories is formalized in Mathlib/CategoryTheory/Bicategory/SingleObj.lean, although the string diagram widget does not use it directly.

Objects in string diagrams

Widget for general string diagrams

theorem Mathlib.Tactic.Widget.StringDiagram.AtomNode.mk.injEq E0 #

∀ (vPos hPosSrc hPosTar : ℕ) (atom : Mathlib.Tactic.BicategoryLike.Atom) (vPos_1 hPosSrc_1 hPosTar_1 : ℕ)
  (atom_1 : Mathlib.Tactic.BicategoryLike.Atom),
  ({ vPos := vPos, hPosSrc := hPosSrc, hPosTar := hPosTar, atom := atom } =
      { vPos := vPos_1, hPosSrc := hPosSrc_1, hPosTar := hPosTar_1, atom := atom_1 }) =
    (vPos = vPos_1 ∧ hPosSrc = hPosSrc_1 ∧ hPosTar = hPosTar_1 ∧ atom = atom_1)

theorem Mathlib.Tactic.Widget.StringDiagram.Strand.mk.injEq E0 #

∀ (hPos : ℕ) (startPoint endPoint : Mathlib.Tactic.Widget.StringDiagram.Node)
  (atom₁ : Mathlib.Tactic.BicategoryLike.Atom₁) (hPos_1 : ℕ)
  (startPoint_1 endPoint_1 : Mathlib.Tactic.Widget.StringDiagram.Node) (atom₁_1 : Mathlib.Tactic.BicategoryLike.Atom₁),
  ({ hPos := hPos, startPoint := startPoint, endPoint := endPoint, atom₁ := atom₁ } =
      { hPos := hPos_1, startPoint := startPoint_1, endPoint := endPoint_1, atom₁ := atom₁_1 }) =
    (hPos = hPos_1 ∧ startPoint = startPoint_1 ∧ endPoint = endPoint_1 ∧ atom₁ = atom₁_1)

abbrev Mathlib.Tactic.Widget.StringDiagram.Kind.ctorElimType E1 #

{motive : Mathlib.Tactic.Widget.StringDiagram.Kind → Sort u} → ℕ → Sort (max 1 u)

theorem Mathlib.Tactic.Widget.StringDiagram.PenroseVar.mk.injEq E0 #

∀ (ident : String) (indices : List ℕ) (e : Lean.Expr) (ident_1 : String) (indices_1 : List ℕ) (e_1 : Lean.Expr),
  ({ ident := ident, indices := indices, e := e } = { ident := ident_1, indices := indices_1, e := e_1 }) =
    (ident = ident_1 ∧ indices = indices_1 ∧ e = e_1)

def Mathlib.Tactic.Widget.StringDiagram.Kind.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.Kind → ℕ

theorem Mathlib.Tactic.Widget.StringDiagram.Node.atom.inj E1 #

∀ {a a_1 : Mathlib.Tactic.Widget.StringDiagram.AtomNode},
  Mathlib.Tactic.Widget.StringDiagram.Node.atom a = Mathlib.Tactic.Widget.StringDiagram.Node.atom a_1 → a = a_1

theorem Mathlib.Tactic.Widget.StringDiagram.Node.id.inj E1 #

∀ {a a_1 : Mathlib.Tactic.Widget.StringDiagram.IdNode},
  Mathlib.Tactic.Widget.StringDiagram.Node.id a = Mathlib.Tactic.Widget.StringDiagram.Node.id a_1 → a = a_1

def Mathlib.Tactic.Widget.StringDiagram.PenroseVar.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.PenroseVar → ℕ

def Mathlib.Tactic.Widget.StringDiagram.AtomNode.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → ℕ

theorem Mathlib.Tactic.Widget.StringDiagram.IdNode.mk.injEq E0 #

∀ (vPos hPosSrc hPosTar : ℕ) (id : Mathlib.Tactic.BicategoryLike.Atom₁) (vPos_1 hPosSrc_1 hPosTar_1 : ℕ)
  (id_1 : Mathlib.Tactic.BicategoryLike.Atom₁),
  ({ vPos := vPos, hPosSrc := hPosSrc, hPosTar := hPosTar, id := id } =
      { vPos := vPos_1, hPosSrc := hPosSrc_1, hPosTar := hPosTar_1, id := id_1 }) =
    (vPos = vPos_1 ∧ hPosSrc = hPosSrc_1 ∧ hPosTar = hPosTar_1 ∧ id = id_1)

def Mathlib.Tactic.Widget.StringDiagram.IdNode.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → ℕ

theorem Mathlib.Tactic.Widget.StringDiagram.AtomNode.mk.inj E1 #

∀ {vPos hPosSrc hPosTar : ℕ} {atom : Mathlib.Tactic.BicategoryLike.Atom} {vPos_1 hPosSrc_1 hPosTar_1 : ℕ}
  {atom_1 : Mathlib.Tactic.BicategoryLike.Atom},
  { vPos := vPos, hPosSrc := hPosSrc, hPosTar := hPosTar, atom := atom } =
      { vPos := vPos_1, hPosSrc := hPosSrc_1, hPosTar := hPosTar_1, atom := atom_1 } →
    vPos = vPos_1 ∧ hPosSrc = hPosSrc_1 ∧ hPosTar = hPosTar_1 ∧ atom = atom_1

theorem Mathlib.Tactic.Widget.StringDiagram.PenroseVar.mk.inj E1 #

∀ {ident : String} {indices : List ℕ} {e : Lean.Expr} {ident_1 : String} {indices_1 : List ℕ} {e_1 : Lean.Expr},
  { ident := ident, indices := indices, e := e } = { ident := ident_1, indices := indices_1, e := e_1 } →
    ident = ident_1 ∧ indices = indices_1 ∧ e = e_1

theorem Mathlib.Tactic.Widget.StringDiagram.Strand.mk.inj E1 #

∀ {hPos : ℕ} {startPoint endPoint : Mathlib.Tactic.Widget.StringDiagram.Node}
  {atom₁ : Mathlib.Tactic.BicategoryLike.Atom₁} {hPos_1 : ℕ}
  {startPoint_1 endPoint_1 : Mathlib.Tactic.Widget.StringDiagram.Node} {atom₁_1 : Mathlib.Tactic.BicategoryLike.Atom₁},
  { hPos := hPos, startPoint := startPoint, endPoint := endPoint, atom₁ := atom₁ } =
      { hPos := hPos_1, startPoint := startPoint_1, endPoint := endPoint_1, atom₁ := atom₁_1 } →
    hPos = hPos_1 ∧ startPoint = startPoint_1 ∧ endPoint = endPoint_1 ∧ atom₁ = atom₁_1

abbrev Mathlib.Tactic.Widget.StringDiagram.Node.ctorElimType E1 #

{motive : Mathlib.Tactic.Widget.StringDiagram.Node → Sort u} → ℕ → Sort (max 1 u)

def Mathlib.Tactic.Widget.StringDiagram.Strand.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → ℕ

def Mathlib.Tactic.Widget.StringDiagram.Node.ctorIdx E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → ℕ

theorem Mathlib.Tactic.Widget.StringDiagram.Node.atom.injEq E0 #

∀ (a a_1 : Mathlib.Tactic.Widget.StringDiagram.AtomNode),
  (Mathlib.Tactic.Widget.StringDiagram.Node.atom a = Mathlib.Tactic.Widget.StringDiagram.Node.atom a_1) = (a = a_1)

theorem Mathlib.Tactic.Widget.StringDiagram.IdNode.mk.inj E1 #

∀ {vPos hPosSrc hPosTar : ℕ} {id : Mathlib.Tactic.BicategoryLike.Atom₁} {vPos_1 hPosSrc_1 hPosTar_1 : ℕ}
  {id_1 : Mathlib.Tactic.BicategoryLike.Atom₁},
  { vPos := vPos, hPosSrc := hPosSrc, hPosTar := hPosTar, id := id } =
      { vPos := vPos_1, hPosSrc := hPosSrc_1, hPosTar := hPosTar_1, id := id_1 } →
    vPos = vPos_1 ∧ hPosSrc = hPosSrc_1 ∧ hPosTar = hPosTar_1 ∧ id = id_1

theorem Mathlib.Tactic.Widget.StringDiagram.Node.id.injEq E0 #

∀ (a a_1 : Mathlib.Tactic.Widget.StringDiagram.IdNode),
  (Mathlib.Tactic.Widget.StringDiagram.Node.id a = Mathlib.Tactic.Widget.StringDiagram.Node.id a_1) = (a = a_1)

structure Mathlib.Tactic.Widget.StringDiagram.AtomNode E1 #

Type

Nodes for 2-morphisms in a string diagram.

ctor Mathlib.Tactic.Widget.StringDiagram.AtomNode.mk E0 #

ℕ → ℕ → ℕ → Mathlib.Tactic.BicategoryLike.Atom → Mathlib.Tactic.Widget.StringDiagram.AtomNode

abbrev Mathlib.Tactic.Widget.StringDiagram.AtomNode.vPos E1 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → ℕ

The vertical position of the node in the string diagram.

abbrev Mathlib.Tactic.Widget.StringDiagram.AtomNode.hPosSrc E1 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → ℕ

The horizontal position of the node in the string diagram, counting strings in domains.

abbrev Mathlib.Tactic.Widget.StringDiagram.AtomNode.hPosTar E1 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → ℕ

The horizontal position of the node in the string diagram, counting strings in codomains.

abbrev Mathlib.Tactic.Widget.StringDiagram.AtomNode.atom E1 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → Mathlib.Tactic.BicategoryLike.Atom

The underlying expression of the node.

structure Mathlib.Tactic.Widget.StringDiagram.IdNode E1 #

Type

Nodes for identity 2-morphisms in a string diagram.

ctor Mathlib.Tactic.Widget.StringDiagram.IdNode.mk E0 #

ℕ → ℕ → ℕ → Mathlib.Tactic.BicategoryLike.Atom₁ → Mathlib.Tactic.Widget.StringDiagram.IdNode

abbrev Mathlib.Tactic.Widget.StringDiagram.IdNode.vPos E1 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → ℕ

The vertical position of the node in the string diagram.

abbrev Mathlib.Tactic.Widget.StringDiagram.IdNode.hPosSrc E1 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → ℕ

The horizontal position of the node in the string diagram, counting strings in domains.

abbrev Mathlib.Tactic.Widget.StringDiagram.IdNode.hPosTar E1 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → ℕ

The horizontal position of the node in the string diagram, counting strings in codomains.

abbrev Mathlib.Tactic.Widget.StringDiagram.IdNode.id E1 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → Mathlib.Tactic.BicategoryLike.Atom₁

The underlying expression of the node.

inductive Mathlib.Tactic.Widget.StringDiagram.Node E1 #

Type

Nodes in a string diagram.

ctor Mathlib.Tactic.Widget.StringDiagram.Node.atom E0 #

Mathlib.Tactic.Widget.StringDiagram.AtomNode → Mathlib.Tactic.Widget.StringDiagram.Node

ctor Mathlib.Tactic.Widget.StringDiagram.Node.id E0 #

Mathlib.Tactic.Widget.StringDiagram.IdNode → Mathlib.Tactic.Widget.StringDiagram.Node

def Mathlib.Tactic.Widget.StringDiagram.Node.e E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → Lean.Expr

The underlying expression of a node.

def Mathlib.Tactic.Widget.StringDiagram.Node.srcList E1 #

Mathlib.Tactic.Widget.StringDiagram.Node →
  List (Mathlib.Tactic.Widget.StringDiagram.Node × Mathlib.Tactic.BicategoryLike.Atom₁)

The domain of the 2-morphism associated with a node as a list (the first component is the node itself).

def Mathlib.Tactic.Widget.StringDiagram.Node.tarList E1 #

Mathlib.Tactic.Widget.StringDiagram.Node →
  List (Mathlib.Tactic.Widget.StringDiagram.Node × Mathlib.Tactic.BicategoryLike.Atom₁)

The codomain of the 2-morphism associated with a node as a list (the first component is the node itself).

def Mathlib.Tactic.Widget.StringDiagram.Node.vPos E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → ℕ

The vertical position of a node in a string diagram.

def Mathlib.Tactic.Widget.StringDiagram.Node.hPosSrc E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → ℕ

The horizontal position of a node in a string diagram, counting strings in domains.

def Mathlib.Tactic.Widget.StringDiagram.Node.hPosTar E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → ℕ

The horizontal position of a node in a string diagram, counting strings in codomains.

structure Mathlib.Tactic.Widget.StringDiagram.Strand E1 #

Type

Strings in a string diagram.

ctor Mathlib.Tactic.Widget.StringDiagram.Strand.mk E0 #

ℕ →
  Mathlib.Tactic.Widget.StringDiagram.Node →
    Mathlib.Tactic.Widget.StringDiagram.Node →
      Mathlib.Tactic.BicategoryLike.Atom₁ → Mathlib.Tactic.Widget.StringDiagram.Strand

abbrev Mathlib.Tactic.Widget.StringDiagram.Strand.hPos E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → ℕ

The horizontal position of the strand in the string diagram.

abbrev Mathlib.Tactic.Widget.StringDiagram.Strand.startPoint E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → Mathlib.Tactic.Widget.StringDiagram.Node

The start point of the strand in the string diagram.

abbrev Mathlib.Tactic.Widget.StringDiagram.Strand.endPoint E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → Mathlib.Tactic.Widget.StringDiagram.Node

The end point of the strand in the string diagram.

abbrev Mathlib.Tactic.Widget.StringDiagram.Strand.atom₁ E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → Mathlib.Tactic.BicategoryLike.Atom₁

The underlying expression of the strand.

def Mathlib.Tactic.Widget.StringDiagram.Strand.vPos E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → ℕ

The vertical position of a strand in a string diagram.

def Mathlib.Tactic.BicategoryLike.WhiskerRight.nodes E1 #

ℕ → ℕ → ℕ → Mathlib.Tactic.BicategoryLike.WhiskerRight → List Mathlib.Tactic.Widget.StringDiagram.Node

The list of nodes associated with a 2-morphism. The position is counted from the specified natural numbers.

def Mathlib.Tactic.BicategoryLike.HorizontalComp.nodes E1 #

ℕ → ℕ → ℕ → Mathlib.Tactic.BicategoryLike.HorizontalComp → List Mathlib.Tactic.Widget.StringDiagram.Node

The list of nodes associated with a 2-morphism. The position is counted from the specified natural numbers.

def Mathlib.Tactic.BicategoryLike.WhiskerLeft.nodes E1 #

ℕ → ℕ → ℕ → Mathlib.Tactic.BicategoryLike.WhiskerLeft → List Mathlib.Tactic.Widget.StringDiagram.Node

The list of nodes associated with a 2-morphism. The position is counted from the specified natural numbers.

def Mathlib.Tactic.BicategoryLike.topNodes E1 #

{ρ : Type} →
  [Mathlib.Tactic.BicategoryLike.MonadMor₁ (Mathlib.Tactic.BicategoryLike.CoherenceM ρ)] →
    Mathlib.Tactic.BicategoryLike.WhiskerLeft →
      Mathlib.Tactic.BicategoryLike.CoherenceM ρ (List Mathlib.Tactic.Widget.StringDiagram.Node)

The list of nodes at the top of a string diagram.

def Mathlib.Tactic.BicategoryLike.NormalExpr.nodesAux E0 #

{ρ : Type} →
  [Mathlib.Tactic.BicategoryLike.MonadMor₁ (Mathlib.Tactic.BicategoryLike.CoherenceM ρ)] →
    ℕ →
      Mathlib.Tactic.BicategoryLike.NormalExpr →
        Mathlib.Tactic.BicategoryLike.CoherenceM ρ (List (List Mathlib.Tactic.Widget.StringDiagram.Node))

The list of nodes at the top of a string diagram. The position is counted from the specified natural number.

def Mathlib.Tactic.BicategoryLike.NormalExpr.nodes E1 #

{ρ : Type} →
  [Mathlib.Tactic.BicategoryLike.MonadMor₁ (Mathlib.Tactic.BicategoryLike.CoherenceM ρ)] →
    Mathlib.Tactic.BicategoryLike.NormalExpr →
      Mathlib.Tactic.BicategoryLike.CoherenceM ρ (List (List Mathlib.Tactic.Widget.StringDiagram.Node))

The list of nodes associated with a 2-morphism.

def Mathlib.Tactic.BicategoryLike.NormalExpr.strands E1 #

{ρ : Type} →
  [Mathlib.Tactic.BicategoryLike.MonadMor₁ (Mathlib.Tactic.BicategoryLike.CoherenceM ρ)] →
    Mathlib.Tactic.BicategoryLike.NormalExpr →
      Mathlib.Tactic.BicategoryLike.CoherenceM ρ (List (List Mathlib.Tactic.Widget.StringDiagram.Strand))

The list of strands associated with a 2-morphism.

structure Mathlib.Tactic.Widget.StringDiagram.PenroseVar E1 #

Type

A type for Penrose variables.

ctor Mathlib.Tactic.Widget.StringDiagram.PenroseVar.mk E0 #

String → List ℕ → Lean.Expr → Mathlib.Tactic.Widget.StringDiagram.PenroseVar

abbrev Mathlib.Tactic.Widget.StringDiagram.PenroseVar.ident E1 #

Mathlib.Tactic.Widget.StringDiagram.PenroseVar → String

The identifier of the variable.

abbrev Mathlib.Tactic.Widget.StringDiagram.PenroseVar.indices E1 #

Mathlib.Tactic.Widget.StringDiagram.PenroseVar → List ℕ

The indices of the variable.

abbrev Mathlib.Tactic.Widget.StringDiagram.PenroseVar.e E1 #

Mathlib.Tactic.Widget.StringDiagram.PenroseVar → Lean.Expr

The underlying expression of the variable.

instance Mathlib.Tactic.Widget.StringDiagram.instToStringPenroseVar E0 #

ToString Mathlib.Tactic.Widget.StringDiagram.PenroseVar

def Mathlib.Tactic.Widget.StringDiagram.Node.toPenroseVar E1 #

Mathlib.Tactic.Widget.StringDiagram.Node → Mathlib.Tactic.Widget.StringDiagram.PenroseVar

The penrose variable associated with a node.

def Mathlib.Tactic.Widget.StringDiagram.Strand.toPenroseVar E1 #

Mathlib.Tactic.Widget.StringDiagram.Strand → Mathlib.Tactic.Widget.StringDiagram.PenroseVar

The penrose variable associated with a strand.

def Mathlib.Tactic.Widget.StringDiagram.addPenroseVar E1 #

String → Mathlib.Tactic.Widget.StringDiagram.PenroseVar → ProofWidgets.Penrose.DiagramBuilderM Unit

Add the variable v with the type tp to the substance program.

def Mathlib.Tactic.Widget.StringDiagram.addConstructor E1 #

String →
  Mathlib.Tactic.Widget.StringDiagram.PenroseVar →
    String → List Mathlib.Tactic.Widget.StringDiagram.PenroseVar → ProofWidgets.Penrose.DiagramBuilderM Unit

Add constructor tp v := nm (vs) to the substance program.

def Mathlib.Tactic.Widget.StringDiagram.mkStringDiagram E1 #

List (List Mathlib.Tactic.Widget.StringDiagram.Node) →
  List (List Mathlib.Tactic.Widget.StringDiagram.Strand) → ProofWidgets.Penrose.DiagramBuilderM PUnit.{1}

Construct a string diagram from a Penrose substance program and expressions embeds to display as labels in the diagram.

def Mathlib.Tactic.Widget.StringDiagram.dsl E1 #

String

Penrose dsl file for string diagrams.

def Mathlib.Tactic.Widget.StringDiagram.sty E1 #

String

Penrose sty file for string diagrams.

inductive Mathlib.Tactic.Widget.StringDiagram.Kind E1 #

Type

The kind of the context.

ctor Mathlib.Tactic.Widget.StringDiagram.Kind.monoidal E0 #

Mathlib.Tactic.Widget.StringDiagram.Kind

ctor Mathlib.Tactic.Widget.StringDiagram.Kind.bicategory E0 #

Mathlib.Tactic.Widget.StringDiagram.Kind

ctor Mathlib.Tactic.Widget.StringDiagram.Kind.none E0 #

Mathlib.Tactic.Widget.StringDiagram.Kind

def Mathlib.Tactic.Widget.StringDiagram.Kind.name E1 #

Mathlib.Tactic.Widget.StringDiagram.Kind → Lean.Name

The name of the context.

def Mathlib.Tactic.Widget.StringDiagram.mkKind E1 #

Lean.Expr → Lean.MetaM Mathlib.Tactic.Widget.StringDiagram.Kind

Given an expression, return the kind of the context.

def Mathlib.Tactic.Widget.StringDiagram.stringM? E1 #

Lean.Expr → Lean.MetaM (Option ProofWidgets.Html)

Given a 2-morphism, return a string diagram. Otherwise none.

def Mathlib.Tactic.Widget.StringDiagram.mkEqHtml E1 #

ProofWidgets.Html → ProofWidgets.Html → ProofWidgets.Html

Help function for displaying two string diagrams in an equality.

def Mathlib.Tactic.Widget.StringDiagram.stringEqM? E1 #

Lean.Expr → Lean.MetaM (Option ProofWidgets.Html)

Given an equality between 2-morphisms, return a string diagram of the LHS and RHS. Otherwise none.

def Mathlib.Tactic.Widget.StringDiagram.stringMorOrEqM? E1 #

Lean.Expr → Lean.MetaM (Option ProofWidgets.Html)

Given an 2-morphism or equality between 2-morphisms, return a string diagram. Otherwise none.

def Mathlib.Tactic.Widget.StringDiagram.stringPresenter E1 #

ProofWidgets.ExprPresenter

The Expr presenter for displaying string diagrams.

def Mathlib.Tactic.Widget.StringDiagram.rpc E1 #

ProofWidgets.PanelWidgetProps → Lean.Server.RequestM (Lean.Server.RequestTask ProofWidgets.Html)

The RPC method for displaying string diagrams.

def Mathlib.Tactic.Widget.StringDiagram E1 #

ProofWidgets.Component ProofWidgets.PanelWidgetProps

Display the string diagrams if the goal is an equality of morphisms in a monoidal category.

def Mathlib.Tactic.Widget.stringDiagram E1 #

Lean.ParserDescr

Display the string diagram for a given term.

Example usage:

/- String diagram for the equality theorem. -/
#string_diagram MonoidalCategory.whisker_exchange

/- String diagram for the morphism. -/
variable {C : Type u} [Category.{v} C] [MonoidalCategory C] {X Y : C} (f : 𝟙_ C ⟶ X ⊗ Y) in
#string_diagram f

def Mathlib.Tactic.Widget.elabStringDiagramCmd E1 #

Lean.Elab.Command.CommandElab

Display the string diagram for a given term.

Example usage:

/- String diagram for the equality theorem. -/
#string_diagram MonoidalCategory.whisker_exchange

/- String diagram for the morphism. -/
variable {C : Type u} [Category.{v} C] [MonoidalCategory C] {X Y : C} (f : 𝟙_ C ⟶ X ⊗ Y) in
#string_diagram f