fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
StructuralAtom.srcM [MonadMor₁ m] : StructuralAtom → m Mor₁ | .associator _ f g h => do comp₁M (← comp₁M f g) h | .leftUnitor _ f => do comp₁M (← id₁M f.src) f | .rightUnitor _ f => do comp₁M f (← id₁M f.tgt) | .id _ f => return f | .coherenceHom α => return α.src
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
StructuralAtom.srcM
The domain of a 2-isomorphism.
StructuralAtom.tgtM [MonadMor₁ m] : StructuralAtom → m Mor₁ | .associator _ f g h => do comp₁M f (← comp₁M g h) | .leftUnitor _ f => return f | .rightUnitor _ f => return f | .id _ f => return f | .coherenceHom α => return α.tgt
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
StructuralAtom.tgtM
The codomain of a 2-isomorphism.
Mor₂Iso.e : Mor₂Iso → Expr | .structuralAtom α => α.e | .comp e .. => e | .whiskerLeft e .. => e | .whiskerRight e .. => e | .horizontalComp e .. => e | .inv e .. => e | .coherenceComp e .. => e | .of η => η.e
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂Iso.e
The underlying lean expression of a 2-isomorphism.
Mor₂Iso.srcM {m : Type → Type} [Monad m] [MonadMor₁ m] : Mor₂Iso → m Mor₁ | .structuralAtom α => α.srcM | .comp _ f .. => return f | .whiskerLeft _ f g .. => do comp₁M f g | .whiskerRight _ f _ _ h => do comp₁M f h | .horizontalComp _ f₁ _ f₂ .. => do comp₁M f₁ f₂ | .inv _ _ g _ => return g | .coherenceComp _ f .. => return f | .of η => return η.src
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂Iso.srcM
The domain of a 2-isomorphism.
Mor₂Iso.tgtM {m : Type → Type} [Monad m] [MonadMor₁ m] : Mor₂Iso → m Mor₁ | .structuralAtom α => α.tgtM | .comp _ _ _ h .. => return h | .whiskerLeft _ f _ h _ => do comp₁M f h | .whiskerRight _ _ g _ h => do comp₁M g h | .horizontalComp _ _ g₁ _ g₂ _ _ => do comp₁M g₁ g₂ | .inv _ f _ _ => return f | .coherenceComp _ _ _ _ i .. => return i | .of η => return η.tgt
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂Iso.tgtM
The codomain of a 2-isomorphism.
MonadMor₂Iso (m : Type → Type) where /-- The expression for the associator `α_ f g h`. -/ associatorM (f g h : Mor₁) : m StructuralAtom /-- The expression for the left unitor `λ_ f`. -/ leftUnitorM (f : Mor₁) : m StructuralAtom /-- The expression for the right unitor `ρ_ f`. -/ rightUnitorM (f : Mor₁) : m StructuralAtom /-- The expression for the identity `Iso.refl f`. -/ id₂M (f : Mor₁) : m StructuralAtom /-- The expression for the coherence isomorphism `⊗𝟙 : f ⟶ g`. -/ coherenceHomM (f g : Mor₁) (inst : Expr) : m CoherenceHom /-- The expression for the composition `η ≪≫ θ`. -/ comp₂M (η θ : Mor₂Iso) : m Mor₂Iso /-- The expression for the left whiskering `whiskerLeftIso f η`. -/ whiskerLeftM (f : Mor₁) (η : Mor₂Iso) : m Mor₂Iso /-- The expression for the right whiskering `whiskerRightIso η h`. -/ whiskerRightM (η : Mor₂Iso) (h : Mor₁) : m Mor₂Iso /-- The expression for the horizontal composition `η ◫ θ`. -/ horizontalCompM (η θ : Mor₂Iso) : m Mor₂Iso /-- The expression for the inverse `Iso.symm η`. -/ symmM (η : Mor₂Iso) : m Mor₂Iso /-- The expression for the coherence composition `η ≪⊗≫ θ := η ≪≫ α ≪≫ θ`. -/ coherenceCompM (α : CoherenceHom) (η θ : Mor₂Iso) : m Mor₂Iso
class
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
MonadMor₂Iso
A monad equipped with the ability to construct `Mor₂Iso` terms.
associatorM' (f g h : Mor₁) : m Mor₂Iso := do return .structuralAtom <| ← MonadMor₂Iso.associatorM f g h
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
associatorM'
The expression for the associator `α_ f g h`.
leftUnitorM' (f : Mor₁) : m Mor₂Iso := do return .structuralAtom <| ← MonadMor₂Iso.leftUnitorM f
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
leftUnitorM'
The expression for the left unitor `λ_ f`.
rightUnitorM' (f : Mor₁) : m Mor₂Iso := do return .structuralAtom <| ← MonadMor₂Iso.rightUnitorM f
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
rightUnitorM'
The expression for the right unitor `ρ_ f`.
id₂M' (f : Mor₁) : m Mor₂Iso := do return .structuralAtom <| ← MonadMor₂Iso.id₂M f
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
id₂M'
The expression for the identity `Iso.refl f`.
coherenceHomM' (f g : Mor₁) (inst : Expr) : m Mor₂Iso := do return .structuralAtom <| .coherenceHom <| ← MonadMor₂Iso.coherenceHomM f g inst
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
coherenceHomM'
The expression for the coherence isomorphism `⊗𝟙 : f ⟶ g`.
Atom where /-- Extract a lean expression from an `Atom` expression. -/ e : Expr /-- The domain of a 2-morphism. -/ src : Mor₁ /-- The codomain of a 2-morphism. -/ tgt : Mor₁ deriving Inhabited
structure
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Atom
Expressions for atomic non-structural 2-morphisms.
IsoLift where /-- The expression for the 2-isomorphism. -/ e : Mor₂Iso /-- The expression for the proof that the forward direction of the 2-isomorphism is equal to the original 2-morphism. -/ eq : Expr
structure
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
IsoLift
`Mor₂` expressions defined below will have the `isoLift? : Option IsoLift` field. For `η : Mor₂` such that `η.isoLift? = some isoLift`, we have the following data: - `isoLift.e`: an expression for a 2-isomorphism `η'`, given as a `Mor₂Iso` term, - `isoLift.eq`: a lean expression for the proof that `η'.hom = η`.
Mor₂ : Type where /-- The expression for `Iso.hom`. -/ | isoHom (e : Expr) (isoLift : IsoLift) (iso : Mor₂Iso) : Mor₂ /-- The expression for `Iso.inv`. -/ | isoInv (e : Expr) (isoLift : IsoLift) (iso : Mor₂Iso) : Mor₂ /-- The expression for the identity `𝟙 f`. -/ | id (e : Expr) (isoLift : IsoLift) (f : Mor₁) : Mor₂ /-- The expression for the composition `η ≫ θ`. -/ | comp (e : Expr) (isoLift? : Option IsoLift) (f g h : Mor₁) (η θ : Mor₂) : Mor₂ /-- The expression for the left whiskering `f ◁ η` with `η : g ⟶ h`. -/ | whiskerLeft (e : Expr) (isoLift? : Option IsoLift) (f g h : Mor₁) (η : Mor₂) : Mor₂ /-- The expression for the right whiskering `η ▷ h` with `η : f ⟶ g`. -/ | whiskerRight (e : Expr) (isoLift? : Option IsoLift) (f g : Mor₁) (η : Mor₂) (h : Mor₁) : Mor₂ /-- The expression for the horizontal composition `η ◫ θ` with `η : f₁ ⟶ g₁` and `θ : f₂ ⟶ g₂`. -/ | horizontalComp (e : Expr) (isoLift? : Option IsoLift) (f₁ g₁ f₂ g₂ : Mor₁) (η θ : Mor₂) : Mor₂ /-- The expression for the coherence composition `η ⊗≫ θ := η ≫ α ≫ θ` with `η : f ⟶ g` and `θ : h ⟶ i`. -/ | coherenceComp (e : Expr) (isoLift? : Option IsoLift) (f g h i : Mor₁) (α : CoherenceHom) (η θ : Mor₂) : Mor₂ /-- The expression for an atomic non-structural 2-morphism. -/ | of (η : Atom) : Mor₂ deriving Inhabited
inductive
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂
Expressions for 2-morphisms.
MkMor₂ (m : Type → Type) where /-- Construct a `Mor₂` term from a lean expression. -/ ofExpr (e : Expr) : m Mor₂
class
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
MkMor₂
A monad equipped with the ability to construct `Mor₂` terms.
Mor₂.e : Mor₂ → Expr | .isoHom e .. => e | .isoInv e .. => e | .id e .. => e | .comp e .. => e | .whiskerLeft e .. => e | .whiskerRight e .. => e | .horizontalComp e .. => e | .coherenceComp e .. => e | .of η => η.e
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂.e
The underlying lean expression of a 2-morphism.
Mor₂.isoLift? : Mor₂ → Option IsoLift | .isoHom _ isoLift .. => some isoLift | .isoInv _ isoLift .. => some isoLift | .id _ isoLift .. => some isoLift | .comp _ isoLift? .. => isoLift? | .whiskerLeft _ isoLift? .. => isoLift? | .whiskerRight _ isoLift? .. => isoLift? | .horizontalComp _ isoLift? .. => isoLift? | .coherenceComp _ isoLift? .. => isoLift? | .of _ => none
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂.isoLift
`η.isoLift?` is a pair of a 2-isomorphism `η'` and a proof that `η'.hom = η`. If no such `η'` is found, returns `none`. This function does not seek `IsIso` instance.
Mor₂.srcM {m : Type → Type} [Monad m] [MonadMor₁ m] : Mor₂ → m Mor₁ | .isoHom _ _ iso => iso.srcM | .isoInv _ _ iso => iso.tgtM | .id _ _ f => return f | .comp _ _ f .. => return f | .whiskerLeft _ _ f g .. => do comp₁M f g | .whiskerRight _ _ f _ _ h => do comp₁M f h | .horizontalComp _ _ f₁ _ f₂ .. => do comp₁M f₁ f₂ | .coherenceComp _ _ f .. => return f | .of η => return η.src
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂.srcM
The domain of a 2-morphism.
Mor₂.tgtM {m : Type → Type} [Monad m] [MonadMor₁ m] : Mor₂ → m Mor₁ | .isoHom _ _ iso => iso.tgtM | .isoInv _ _ iso => iso.srcM | .id _ _ f => return f | .comp _ _ _ _ h .. => return h | .whiskerLeft _ _ f _ h _ => do comp₁M f h | .whiskerRight _ _ _ g _ h => do comp₁M g h | .horizontalComp _ _ _ g₁ _ g₂ _ _ => do comp₁M g₁ g₂ | .coherenceComp _ _ _ _ _ i .. => return i | .of η => return η.tgt
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Mor₂.tgtM
The codomain of a 2-morphism.
MonadMor₂ (m : Type → Type) where /-- The expression for `Iso.hom η`. -/ homM (η : Mor₂Iso) : m Mor₂ /-- The expression for `Iso.hom η`. -/ atomHomM (η : AtomIso) : m Atom /-- The expression for `Iso.inv η`. -/ invM (η : Mor₂Iso) : m Mor₂ /-- The expression for `Iso.inv η`. -/ atomInvM (η : AtomIso) : m Atom /-- The expression for the identity `𝟙 f`. -/ id₂M (f : Mor₁) : m Mor₂ /-- The expression for the composition `η ≫ θ`. -/ comp₂M (η θ : Mor₂) : m Mor₂ /-- The expression for the left whiskering `f ◁ η`. -/ whiskerLeftM (f : Mor₁) (η : Mor₂) : m Mor₂ /-- The expression for the right whiskering `η ▷ h`. -/ whiskerRightM (η : Mor₂) (h : Mor₁) : m Mor₂ /-- The expression for the horizontal composition `η ◫ θ`. -/ horizontalCompM (η θ : Mor₂) : m Mor₂ /-- The expression for the coherence composition `η ⊗≫ θ := η ≫ α ≫ θ`. -/ coherenceCompM (α : CoherenceHom) (η θ : Mor₂) : m Mor₂
class
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
MonadMor₂
A monad equipped with the ability to manipulate 2-morphisms.
NormalizedHom : Type /-- The identity 1-morphism `𝟙 a`. -/ | nil (e : Mor₁) (a : Obj) : NormalizedHom /-- The `cons` composes an atomic 1-morphism at the end of a normalized 1-morphism. -/ | cons (e : Mor₁) : NormalizedHom → Atom₁ → NormalizedHom deriving Inhabited
inductive
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
NormalizedHom
Type of normalized 1-morphisms `((... ≫ h) ≫ g) ≫ f`.
NormalizedHom.e : NormalizedHom → Mor₁ | NormalizedHom.nil e _ => e | NormalizedHom.cons e _ _ => e
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
NormalizedHom.e
The underlying expression of a normalized 1-morphism.
NormalizedHom.src : NormalizedHom → Obj | NormalizedHom.nil _ a => a | NormalizedHom.cons _ p _ => p.src
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
NormalizedHom.src
The domain of a normalized 1-morphism.
NormalizedHom.tgt : NormalizedHom → Obj | NormalizedHom.nil _ a => a | NormalizedHom.cons _ _ f => f.tgt
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
NormalizedHom.tgt
The codomain of a normalized 1-morphism.
normalizedHom.nilM [MonadMor₁ m] (a : Obj) : m NormalizedHom := do return NormalizedHom.nil (← id₁M a) a
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
normalizedHom.nilM
Construct the `NormalizedHom.nil` term in `m`.
NormalizedHom.consM [MonadMor₁ m] (p : NormalizedHom) (f : Atom₁) : m NormalizedHom := do return NormalizedHom.cons (← comp₁M p.e (.of f)) p f
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
NormalizedHom.consM
Construct a `NormalizedHom.cons` term in `m`.
Context (ρ : Type) where /-- Construct a context from a lean expression for a 2-morphism. -/ mkContext? : Expr → MetaM (Option ρ) export Context (mkContext?)
class
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
Context
`Context ρ` provides the context for manipulating 2-morphisms in a monoidal category or bicategory. In particular, we will store `MonoidalCategory` or `Bicategory` instance in a context, and use this through a reader monad when we construct the lean expressions for 2-morphisms.
mkContext {ρ : Type} [Context ρ] (e : Expr) : MetaM ρ := do match ← mkContext? e with | some c => return c | none => throwError "failed to construct a monoidal category or bicategory context from {e}"
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
mkContext
Construct a context from a lean expression for a 2-morphism.
State where /-- The cache for evaluating lean expressions of 1-morphisms into `Mor₁` terms. -/ cache : PersistentExprMap Mor₁ := {}
structure
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
State
The state for the `CoherenceM ρ` monad.
CoherenceM (ρ : Type) := ReaderT ρ <| StateT State MetaM
abbrev
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
CoherenceM
The monad for manipulating 2-morphisms in a monoidal category or bicategory.
CoherenceM.run {α ρ : Type} (x : CoherenceM ρ α) (ctx : ρ) (s : State := {}) : MetaM α := do Prod.fst <$> ReaderT.run x ctx s
def
Tactic
[ "Lean.Meta.Basic", "Mathlib.Init" ]
Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean
CoherenceM.run
Run the `CoherenceM ρ` monad.
WhiskerRight : Type /-- Construct the expression for an atomic 2-morphism. -/ | of (η : Atom) : WhiskerRight /-- Construct the expression for `η ▷ f`. -/ | whisker (e : Mor₂) (η : WhiskerRight) (f : Atom₁) : WhiskerRight deriving Inhabited
inductive
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerRight
Expressions of the form `η ▷ f₁ ▷ ... ▷ fₙ`.
WhiskerRight.e : WhiskerRight → Mor₂ | .of η => .of η | .whisker e .. => e
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerRight.e
The underlying `Mor₂` term of a `WhiskerRight` term.
HorizontalComp : Type | of (η : WhiskerRight) : HorizontalComp | cons (e : Mor₂) (η : WhiskerRight) (ηs : HorizontalComp) : HorizontalComp deriving Inhabited
inductive
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
HorizontalComp
Expressions of the form `η₁ ⊗ ... ⊗ ηₙ`.
HorizontalComp.e : HorizontalComp → Mor₂ | .of η => η.e | .cons e .. => e
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
HorizontalComp.e
The underlying `Mor₂` term of a `HorizontalComp` term.
WhiskerLeft : Type /-- Construct the expression for a right-whiskered 2-morphism. -/ | of (η : HorizontalComp) : WhiskerLeft /-- Construct the expression for `f ◁ η`. -/ | whisker (e : Mor₂) (f : Atom₁) (η : WhiskerLeft) : WhiskerLeft deriving Inhabited
inductive
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerLeft
Expressions of the form `f₁ ◁ ... ◁ fₙ ◁ η`.
WhiskerLeft.e : WhiskerLeft → Mor₂ | .of η => η.e | .whisker e .. => e
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerLeft.e
The underlying `Mor₂` term of a `WhiskerLeft` term.
Mor₂Iso.isStructural (α : Mor₂Iso) : Bool := match α with | .structuralAtom _ => true | .comp _ _ _ _ η θ => η.isStructural && θ.isStructural | .whiskerLeft _ _ _ _ η => η.isStructural | .whiskerRight _ _ _ η _ => η.isStructural | .horizontalComp _ _ _ _ _ η θ => η.isStructural && θ.isStructural | .inv _ _ _ η => η.isStructural | .coherenceComp _ _ _ _ _ _ η θ => η.isStructural && θ.isStructural | .of _ => false
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
Mor₂Iso.isStructural
Whether a given 2-isomorphism is structural or not.
Structural := Mor₂Iso
abbrev
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
Structural
Expressions for structural isomorphisms. We do not impose the condition `isStructural` since it is not needed to write the tactic.
NormalExpr : Type /-- Construct the expression for a structural 2-morphism. -/ | nil (e : Mor₂) (α : Structural) : NormalExpr /-- Construct the normalized expression of a 2-morphism `α ≫ η ≫ ηs` recursively. -/ | cons (e : Mor₂) (α : Structural) (η : WhiskerLeft) (ηs : NormalExpr) : NormalExpr deriving Inhabited
inductive
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
NormalExpr
Normalized expressions for 2-morphisms.
NormalExpr.e : NormalExpr → Mor₂ | .nil e .. => e | .cons e .. => e
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
NormalExpr.e
The underlying `Mor₂` term of a `NormalExpr` term.
MonadWhiskerRight (m : Type → Type) where /-- The expression for the right whiskering `η ▷ f`. -/ whiskerRightM (η : WhiskerRight) (f : Atom₁) : m WhiskerRight
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MonadWhiskerRight
A monad equipped with the ability to construct `WhiskerRight` terms.
MonadHorizontalComp (m : Type → Type) extends MonadWhiskerRight m where /-- The expression for the horizontal composition `η ◫ ηs`. -/ hConsM (η : WhiskerRight) (ηs : HorizontalComp) : m HorizontalComp
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MonadHorizontalComp
A monad equipped with the ability to construct `HorizontalComp` terms.
MonadWhiskerLeft (m : Type → Type) extends MonadHorizontalComp m where /-- The expression for the left whiskering `f ▷ η`. -/ whiskerLeftM (f : Atom₁) (η : WhiskerLeft) : m WhiskerLeft
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MonadWhiskerLeft
A monad equipped with the ability to construct `WhiskerLeft` terms.
MonadNormalExpr (m : Type → Type) extends MonadWhiskerLeft m where /-- The expression for the structural 2-morphism `α`. -/ nilM (α : Structural) : m NormalExpr /-- The expression for the normalized 2-morphism `α ≫ η ≫ ηs`. -/ consM (headStructural : Structural) (η : WhiskerLeft) (ηs : NormalExpr) : m NormalExpr variable {m : Type → Type} [Monad m] open MonadMor₁
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MonadNormalExpr
A monad equipped with the ability to construct `NormalExpr` terms.
WhiskerRight.srcM [MonadMor₁ m] : WhiskerRight → m Mor₁ | WhiskerRight.of η => return η.src | WhiskerRight.whisker _ η f => do comp₁M (← η.srcM) (.of f)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerRight.srcM
The domain of a 2-morphism.
WhiskerRight.tgtM [MonadMor₁ m] : WhiskerRight → m Mor₁ | WhiskerRight.of η => return η.tgt | WhiskerRight.whisker _ η f => do comp₁M (← η.tgtM) (.of f)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerRight.tgtM
The codomain of a 2-morphism.
HorizontalComp.srcM [MonadMor₁ m] : HorizontalComp → m Mor₁ | HorizontalComp.of η => η.srcM | HorizontalComp.cons _ η ηs => do comp₁M (← η.srcM) (← ηs.srcM)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
HorizontalComp.srcM
The domain of a 2-morphism.
HorizontalComp.tgtM [MonadMor₁ m] : HorizontalComp → m Mor₁ | HorizontalComp.of η => η.tgtM | HorizontalComp.cons _ η ηs => do comp₁M (← η.tgtM) (← ηs.tgtM)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
HorizontalComp.tgtM
The codomain of a 2-morphism.
WhiskerLeft.srcM [MonadMor₁ m] : WhiskerLeft → m Mor₁ | WhiskerLeft.of η => η.srcM | WhiskerLeft.whisker _ f η => do comp₁M (.of f) (← η.srcM)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerLeft.srcM
The domain of a 2-morphism.
WhiskerLeft.tgtM [MonadMor₁ m] : WhiskerLeft → m Mor₁ | WhiskerLeft.of η => η.tgtM | WhiskerLeft.whisker _ f η => do comp₁M (.of f) (← η.tgtM)
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
WhiskerLeft.tgtM
The codomain of a 2-morphism.
NormalExpr.srcM [MonadMor₁ m] : NormalExpr → m Mor₁ | NormalExpr.nil _ η => η.srcM | NormalExpr.cons _ α _ _ => α.srcM
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
NormalExpr.srcM
The domain of a 2-morphism.
NormalExpr.tgtM [MonadMor₁ m] : NormalExpr → m Mor₁ | NormalExpr.nil _ η => η.tgtM | NormalExpr.cons _ _ _ ηs => ηs.tgtM
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
NormalExpr.tgtM
The codomain of a 2-morphism.
idM (f : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| .structuralAtom <| ← MonadMor₂Iso.id₂M f
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
idM
The identity 2-morphism as a term of `normalExpr`.
associatorM (f g h : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| .structuralAtom <| ← MonadMor₂Iso.associatorM f g h
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
associatorM
The associator as a term of `normalExpr`.
associatorInvM (f g h : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| ← MonadMor₂Iso.symmM <| .structuralAtom <| ← MonadMor₂Iso.associatorM f g h
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
associatorInvM
The inverse of the associator as a term of `normalExpr`.
leftUnitorM (f : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| .structuralAtom <| ← MonadMor₂Iso.leftUnitorM f
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
leftUnitorM
The left unitor as a term of `normalExpr`.
leftUnitorInvM (f : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| ← MonadMor₂Iso.symmM <| .structuralAtom <| ← MonadMor₂Iso.leftUnitorM f
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
leftUnitorInvM
The inverse of the left unitor as a term of `normalExpr`.
rightUnitorM (f : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| .structuralAtom <| ← MonadMor₂Iso.rightUnitorM f
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
rightUnitorM
The right unitor as a term of `normalExpr`.
rightUnitorInvM (f : Mor₁) : m NormalExpr := do MonadNormalExpr.nilM <| ← MonadMor₂Iso.symmM <| .structuralAtom <| ← MonadMor₂Iso.rightUnitorM f
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
rightUnitorInvM
The inverse of the right unitor as a term of `normalExpr`.
ofM [MonadMor₁ m] (η : WhiskerLeft) : m NormalExpr := do MonadNormalExpr.consM ((.structuralAtom <| ← MonadMor₂Iso.id₂M (← η.srcM))) η (← MonadNormalExpr.nilM ((.structuralAtom <| ← MonadMor₂Iso.id₂M (← η.tgtM))))
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
ofM
Construct a `NormalExpr` expression from a `WhiskerLeft` expression.
ofAtomM [MonadMor₁ m] (η : Atom) : m NormalExpr := NormalExpr.ofM <| .of <| .of <| .of η
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
ofAtomM
Construct a `NormalExpr` expression from a Lean expression for an atomic 2-morphism.
NormalExpr.toList : NormalExpr → List WhiskerLeft | NormalExpr.nil _ _ => [] | NormalExpr.cons _ _ η ηs => η :: NormalExpr.toList ηs
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
NormalExpr.toList
Convert a `NormalExpr` expression into a list of `WhiskerLeft` expressions.
Eval.Result where /-- The normalized expression of the 2-morphism. -/ expr : NormalExpr /-- The proof that the normalized expression is equal to the original expression. -/ proof : Expr deriving Inhabited variable {m : Type → Type}
structure
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
Eval.Result
The result of evaluating an expression into normal form.
MkEvalComp (m : Type → Type) where /-- Evaluate `α ≫ β` -/ mkEvalCompNilNil (α β : Structural) : m Expr /-- Evaluate `α ≫ (β ≫ η ≫ ηs)` -/ mkEvalCompNilCons (α β : Structural) (η : WhiskerLeft) (ηs : NormalExpr) : m Expr /-- Evaluate `(α ≫ η ≫ ηs) ≫ θ` -/ mkEvalCompCons (α : Structural) (η : WhiskerLeft) (ηs θ ι : NormalExpr) (e_η : Expr) : m Expr
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MkEvalComp
Evaluate the expression `α ≫ β`.
MkEvalWhiskerLeft (m : Type → Type) where /-- Evaluate `f ◁ α` -/ mkEvalWhiskerLeftNil (f : Mor₁) (α : Structural) : m Expr /-- Evaluate `f ◁ (α ≫ η ≫ ηs)`. -/ mkEvalWhiskerLeftOfCons (f : Atom₁) (α : Structural) (η : WhiskerLeft) (ηs θ : NormalExpr) (e_θ : Expr) : m Expr /-- Evaluate `(f ≫ g) ◁ η` -/ mkEvalWhiskerLeftComp (f g : Mor₁) (η η₁ η₂ η₃ η₄ : NormalExpr) (e_η₁ e_η₂ e_η₃ e_η₄ : Expr) : m Expr /-- Evaluate `𝟙 _ ◁ η` -/ mkEvalWhiskerLeftId (η η₁ η₂ : NormalExpr) (e_η₁ e_η₂ : Expr) : m Expr
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MkEvalWhiskerLeft
Evaluate the expression `f ◁ η`.
MkEvalWhiskerRight (m : Type → Type) where /-- Evaluate `η ▷ f` -/ mkEvalWhiskerRightAuxOf (η : WhiskerRight) (f : Atom₁) : m Expr /-- Evaluate `(η ◫ ηs) ▷ f` -/ mkEvalWhiskerRightAuxCons (f : Atom₁) (η : WhiskerRight) (ηs : HorizontalComp) (ηs' η₁ η₂ η₃ : NormalExpr) (e_ηs' e_η₁ e_η₂ e_η₃ : Expr) : m Expr /-- Evaluate `α ▷ f` -/ mkEvalWhiskerRightNil (α : Structural) (f : Mor₁) : m Expr /-- Evaluate ` (α ≫ η ≫ ηs) ▷ j` -/ mkEvalWhiskerRightConsOfOf (f : Atom₁) (α : Structural) (η : HorizontalComp) (ηs ηs₁ η₁ η₂ η₃ : NormalExpr) (e_ηs₁ e_η₁ e_η₂ e_η₃ : Expr) : m Expr /-- Evaluate `(α ≫ (f ◁ η) ≫ ηs) ▷ g` -/ mkEvalWhiskerRightConsWhisker (f : Atom₁) (g : Mor₁) (α : Structural) (η : WhiskerLeft) (ηs η₁ η₂ ηs₁ ηs₂ η₃ η₄ η₅ : NormalExpr) (e_η₁ e_η₂ e_ηs₁ e_ηs₂ e_η₃ e_η₄ e_η₅ : Expr) : m Expr /-- Evaluate `η ▷ (g ⊗ h)` -/ mkEvalWhiskerRightComp (g h : Mor₁) (η η₁ η₂ η₃ η₄ : NormalExpr) (e_η₁ e_η₂ e_η₃ e_η₄ : Expr) : m Expr /-- Evaluate `η ▷ 𝟙 _` -/ mkEvalWhiskerRightId (η η₁ η₂ : NormalExpr) (e_η₁ e_η₂ : Expr) : m Expr
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MkEvalWhiskerRight
Evaluate the expression `η ▷ f`.
MkEvalHorizontalComp (m : Type → Type) where /-- Evaluate `η ◫ θ` -/ mkEvalHorizontalCompAuxOf (η : WhiskerRight) (θ : HorizontalComp) : m Expr /-- Evaluate `(η ◫ ηs) ◫ θ` -/ mkEvalHorizontalCompAuxCons (η : WhiskerRight) (ηs θ : HorizontalComp) (ηθ η₁ ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_η₁ e_ηθ₁ e_ηθ₂ : Expr) : m Expr /-- Evaluate `(f ◁ η) ◫ θ` -/ mkEvalHorizontalCompAux'Whisker (f : Atom₁) (η θ : WhiskerLeft) (ηθ ηθ₁ ηθ₂ ηθ₃ : NormalExpr) (e_ηθ e_ηθ₁ e_ηθ₂ e_ηθ₃ : Expr) : m Expr /-- Evaluate `η ◫ (f ◁ θ)` -/ mkEvalHorizontalCompAux'OfWhisker (f : Atom₁) (η : HorizontalComp) (θ : WhiskerLeft) (η₁ ηθ ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_η₁ e_ηθ₁ e_ηθ₂ : Expr) : m Expr /-- Evaluate `α ◫ β` -/ mkEvalHorizontalCompNilNil (α β : Structural) : m Expr /-- Evaluate `α ◫ (β ≫ η ≫ ηs)` -/ mkEvalHorizontalCompNilCons (α β : Structural) (η : WhiskerLeft) (ηs η₁ ηs₁ η₂ η₃ : NormalExpr) (e_η₁ e_ηs₁ e_η₂ e_η₃ : Expr) : m Expr /-- Evaluate `(α ≫ η ≫ ηs) ◫ β` -/ mkEvalHorizontalCompConsNil (α β : Structural) (η : WhiskerLeft) (ηs : NormalExpr) (η₁ ηs₁ η₂ η₃ : NormalExpr) (e_η₁ e_ηs₁ e_η₂ e_η₃ : Expr) : m Expr /-- Evaluate `(α ≫ η ≫ ηs) ◫ (β ≫ θ ≫ θs)` -/ mkEvalHorizontalCompConsCons (α β : Structural) (η θ : WhiskerLeft) (ηs θs ηθ ηθs ηθ₁ ηθ₂ : NormalExpr) (e_ηθ e_ηθs e_ηθ₁ e_ηθ₂ : Expr) : m Expr
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MkEvalHorizontalComp
Evaluate the expression `η ◫ θ`.
MkEval (m : Type → Type) extends MkEvalComp m, MkEvalWhiskerLeft m, MkEvalWhiskerRight m, MkEvalHorizontalComp m where /-- Evaluate the expression `η ≫ θ` into a normalized form. -/ mkEvalComp (η θ : Mor₂) (η' θ' ηθ : NormalExpr) (e_η e_θ e_ηθ : Expr) : m Expr /-- Evaluate the expression `f ◁ η` into a normalized form. -/ mkEvalWhiskerLeft (f : Mor₁) (η : Mor₂) (η' θ : NormalExpr) (e_η e_θ : Expr) : m Expr /-- Evaluate the expression `η ▷ f` into a normalized form. -/ mkEvalWhiskerRight (η : Mor₂) (h : Mor₁) (η' θ : NormalExpr) (e_η e_θ : Expr) : m Expr /-- Evaluate the expression `η ◫ θ` into a normalized form. -/ mkEvalHorizontalComp (η θ : Mor₂) (η' θ' ι : NormalExpr) (e_η e_θ e_ι : Expr) : m Expr /-- Evaluate the atomic 2-morphism `η` into a normalized form. -/ mkEvalOf (η : Atom) : m Expr /-- Evaluate the expression `η ⊗≫ θ := η ≫ α ≫ θ` into a normalized form. -/ mkEvalMonoidalComp (η θ : Mor₂) (α : Structural) (η' θ' αθ ηαθ : NormalExpr) (e_η e_θ e_αθ e_ηαθ : Expr) : m Expr variable {ρ : Type} variable [MonadMor₂Iso (CoherenceM ρ)] [MonadNormalExpr (CoherenceM ρ)] [MkEval (CoherenceM ρ)] open MkEvalComp MonadMor₂Iso MonadNormalExpr
class
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
MkEval
Evaluate the expression of a 2-morphism into a normalized form.
evalCompNil (α : Structural) : NormalExpr → CoherenceM ρ Eval.Result | .nil _ β => do return ⟨← nilM (← comp₂M α β), ← mkEvalCompNilNil α β⟩ | .cons _ β η ηs => do return ⟨← consM (← comp₂M α β) η ηs, ← mkEvalCompNilCons α β η ηs⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalCompNil
Evaluate the expression `α ≫ η` into a normalized form.
evalComp : NormalExpr → NormalExpr → CoherenceM ρ Eval.Result | .nil _ α, η => do evalCompNil α η | .cons _ α η ηs, θ => do let ⟨ι, e_ι⟩ ← evalComp ηs θ return ⟨← consM α η ι, ← mkEvalCompCons α η ηs θ ι e_ι⟩ open MkEvalWhiskerLeft variable [MonadMor₁ (CoherenceM ρ)] [MonadMor₂Iso (CoherenceM ρ)]
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalComp
Evaluate the expression `η ≫ θ` into a normalized form.
evalWhiskerLeft : Mor₁ → NormalExpr → CoherenceM ρ Eval.Result | f, .nil _ α => do return ⟨← nilM (← whiskerLeftM f α), ← mkEvalWhiskerLeftNil f α⟩ | .of f, .cons _ α η ηs => do let η' ← MonadWhiskerLeft.whiskerLeftM f η let ⟨θ, e_θ⟩ ← evalWhiskerLeft (.of f) ηs let η'' ← consM (← whiskerLeftM (.of f) α) η' θ return ⟨η'', ← mkEvalWhiskerLeftOfCons f α η ηs θ e_θ⟩ | .comp _ f g, η => do let ⟨θ, e_θ⟩ ← evalWhiskerLeft g η let ⟨ι, e_ι⟩ ← evalWhiskerLeft f θ let h ← η.srcM let h' ← η.tgtM let ⟨ι', e_ι'⟩ ← evalComp ι (← NormalExpr.associatorInvM f g h') let ⟨ι'', e_ι''⟩ ← evalComp (← NormalExpr.associatorM f g h) ι' return ⟨ι'', ← mkEvalWhiskerLeftComp f g η θ ι ι' ι'' e_θ e_ι e_ι' e_ι''⟩ | .id _ _, η => do let f ← η.srcM let g ← η.tgtM let ⟨η', e_η'⟩ ← evalComp η (← NormalExpr.leftUnitorInvM g) let ⟨η'', e_η''⟩ ← evalComp (← NormalExpr.leftUnitorM f) η' return ⟨η'', ← mkEvalWhiskerLeftId η η' η'' e_η' e_η''⟩ open MkEvalWhiskerRight MkEvalHorizontalComp mutual
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalWhiskerLeft
Evaluate the expression `f ◁ η` into a normalized form.
partial evalWhiskerRightAux : HorizontalComp → Atom₁ → CoherenceM ρ Eval.Result | .of η, f => do let η' ← NormalExpr.ofM <| .of <| .of <| ← MonadWhiskerRight.whiskerRightM η f return ⟨η', ← mkEvalWhiskerRightAuxOf η f⟩ | .cons _ η ηs, f => do let ⟨ηs', e_ηs'⟩ ← evalWhiskerRightAux ηs f let ⟨η₁, e_η₁⟩ ← evalHorizontalComp (← NormalExpr.ofM <| .of <| .of η) ηs' let ⟨η₂, e_η₂⟩ ← evalComp η₁ (← NormalExpr.associatorInvM (← η.tgtM) (← ηs.tgtM) (.of f)) let ⟨η₃, e_η₃⟩ ← evalComp (← NormalExpr.associatorM (← η.srcM) (← ηs.srcM) (.of f)) η₂ return ⟨η₃, ← mkEvalWhiskerRightAuxCons f η ηs ηs' η₁ η₂ η₃ e_ηs' e_η₁ e_η₂ e_η₃⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalWhiskerRightAux
Evaluate the expression `η ▷ f` into a normalized form.
partial evalWhiskerRight : NormalExpr → Mor₁ → CoherenceM ρ Eval.Result | .nil _ α, h => do return ⟨← nilM (← whiskerRightM α h), ← mkEvalWhiskerRightNil α h⟩ | .cons _ α (.of η) ηs, .of f => do let ⟨ηs₁, e_ηs₁⟩ ← evalWhiskerRight ηs (.of f) let ⟨η₁, e_η₁⟩ ← evalWhiskerRightAux η f let ⟨η₂, e_η₂⟩ ← evalComp η₁ ηs₁ let ⟨η₃, e_η₃⟩ ← evalCompNil (← whiskerRightM α (.of f)) η₂ return ⟨η₃, ← mkEvalWhiskerRightConsOfOf f α η ηs ηs₁ η₁ η₂ η₃ e_ηs₁ e_η₁ e_η₂ e_η₃⟩ | .cons _ α (.whisker _ f η) ηs, h => do let g ← η.srcM let g' ← η.tgtM let ⟨η₁, e_η₁⟩ ← evalWhiskerRight (← consM (← id₂M' g) η (← NormalExpr.idM g')) h let ⟨η₂, e_η₂⟩ ← evalWhiskerLeft (.of f) η₁ let ⟨ηs₁, e_ηs₁⟩ ← evalWhiskerRight ηs h let α' ← whiskerRightM α h let ⟨ηs₂, e_ηs₂⟩ ← evalComp (← NormalExpr.associatorInvM (.of f) g' h) ηs₁ let ⟨η₃, e_η₃⟩ ← evalComp η₂ ηs₂ let ⟨η₄, e_η₄⟩ ← evalComp (← NormalExpr.associatorM (.of f) g h) η₃ let ⟨η₅, e_η₅⟩ ← evalComp (← nilM α') η₄ return ⟨η₅, ← mkEvalWhiskerRightConsWhisker f h α η ηs η₁ η₂ ηs₁ ηs₂ η₃ η₄ η₅ e_η₁ e_η₂ e_ηs₁ e_ηs₂ e_η₃ e_η₄ e_η₅⟩ | η, .comp _ g h => do let ⟨η₁, e_η₁⟩ ← evalWhiskerRight η g let ⟨η₂, e_η₂⟩ ← evalWhiskerRight η₁ h let f ← η.srcM let f' ← η.tgtM let ⟨η₃, e_η₃⟩ ← evalComp η₂ (← NormalExpr.associatorM f' g h) let ⟨η₄, e_η₄⟩ ← evalComp (← NormalExpr.associatorInvM f g h) η₃ return ⟨η₄, ← mkEvalWhiskerRightComp g h η η₁ η₂ η₃ η₄ e_η₁ e_η₂ e_η₃ e_η₄⟩ | η, .id _ _ => do let f ← η.srcM let g ← η.tgtM let ⟨η₁, e_η₁⟩ ← evalComp η (← NormalExpr.rightUnitorInvM g) let ⟨η₂, e_η₂⟩ ← evalComp (← NormalExpr.rightUnitorM f) η₁ return ⟨η₂, ← mkEvalWhiskerRightId η η₁ η₂ e_η₁ e_η₂⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalWhiskerRight
Evaluate the expression `η ▷ f` into a normalized form.
partial evalHorizontalCompAux : HorizontalComp → HorizontalComp → CoherenceM ρ Eval.Result | .of η, θ => do return ⟨← NormalExpr.ofM <| .of <| ← MonadHorizontalComp.hConsM η θ, ← mkEvalHorizontalCompAuxOf η θ⟩ | .cons _ η ηs, θ => do let α ← NormalExpr.associatorM (← η.srcM) (← ηs.srcM) (← θ.srcM) let α' ← NormalExpr.associatorInvM (← η.tgtM) (← ηs.tgtM) (← θ.tgtM) let ⟨ηθ, e_ηθ⟩ ← evalHorizontalCompAux ηs θ let ⟨η₁, e_η₁⟩ ← evalHorizontalComp (← NormalExpr.ofM <| .of <| .of η) ηθ let ⟨ηθ₁, e_ηθ₁⟩ ← evalComp η₁ α' let ⟨ηθ₂, e_ηθ₂⟩ ← evalComp α ηθ₁ return ⟨ηθ₂, ← mkEvalHorizontalCompAuxCons η ηs θ ηθ η₁ ηθ₁ ηθ₂ e_ηθ e_η₁ e_ηθ₁ e_ηθ₂⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalHorizontalCompAux
Evaluate the expression `η ⊗ θ` into a normalized form.
partial evalHorizontalCompAux' : WhiskerLeft → WhiskerLeft → CoherenceM ρ Eval.Result | .of η, .of θ => evalHorizontalCompAux η θ | .whisker _ f η, θ => do let ⟨ηθ, e_ηθ⟩ ← evalHorizontalCompAux' η θ let ⟨ηθ₁, e_ηθ₁⟩ ← evalWhiskerLeft (.of f) ηθ let ⟨ηθ₂, e_ηθ₂⟩ ← evalComp ηθ₁ (← NormalExpr.associatorInvM (.of f) (← η.tgtM) (← θ.tgtM)) let ⟨ηθ₃, e_ηθ₃⟩ ← evalComp (← NormalExpr.associatorM (.of f) (← η.srcM) (← θ.srcM)) ηθ₂ return ⟨ηθ₃, ← mkEvalHorizontalCompAux'Whisker f η θ ηθ ηθ₁ ηθ₂ ηθ₃ e_ηθ e_ηθ₁ e_ηθ₂ e_ηθ₃⟩ | .of η, .whisker _ f θ => do let ⟨η₁, e_η₁⟩ ← evalWhiskerRightAux η f let ⟨ηθ, e_ηθ⟩ ← evalHorizontalComp η₁ (← NormalExpr.ofM θ) let ⟨ηθ₁, e_ηθ₁⟩ ← evalComp ηθ (← NormalExpr.associatorM (← η.tgtM) (.of f) (← θ.tgtM)) let ⟨ηθ₂, e_ηθ₂⟩ ← evalComp (← NormalExpr.associatorInvM (← η.srcM) (.of f) (← θ.srcM)) ηθ₁ return ⟨ηθ₂, ← mkEvalHorizontalCompAux'OfWhisker f η θ ηθ η₁ ηθ₁ ηθ₂ e_η₁ e_ηθ e_ηθ₁ e_ηθ₂⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalHorizontalCompAux'
Evaluate the expression `η ⊗ θ` into a normalized form.
partial evalHorizontalComp : NormalExpr → NormalExpr → CoherenceM ρ Eval.Result | .nil _ α, .nil _ β => do return ⟨← nilM <| ← horizontalCompM α β, ← mkEvalHorizontalCompNilNil α β⟩ | .nil _ α, .cons _ β η ηs => do let ⟨η₁, e_η₁⟩ ← evalWhiskerLeft (← α.tgtM) (← NormalExpr.ofM η) let ⟨ηs₁, e_ηs₁⟩ ← evalWhiskerLeft (← α.tgtM) ηs let ⟨η₂, e_η₂⟩ ← evalComp η₁ ηs₁ let ⟨η₃, e_η₃⟩ ← evalCompNil (← horizontalCompM α β) η₂ return ⟨η₃, ← mkEvalHorizontalCompNilCons α β η ηs η₁ ηs₁ η₂ η₃ e_η₁ e_ηs₁ e_η₂ e_η₃⟩ | .cons _ α η ηs, .nil _ β => do let ⟨η₁, e_η₁⟩ ← evalWhiskerRight (← NormalExpr.ofM η) (← β.tgtM) let ⟨ηs₁, e_ηs₁⟩ ← evalWhiskerRight ηs (← β.tgtM) let ⟨η₂, e_η₂⟩ ← evalComp η₁ ηs₁ let ⟨η₃, e_η₃⟩ ← evalCompNil (← horizontalCompM α β) η₂ return ⟨η₃, ← mkEvalHorizontalCompConsNil α β η ηs η₁ ηs₁ η₂ η₃ e_η₁ e_ηs₁ e_η₂ e_η₃⟩ | .cons _ α η ηs, .cons _ β θ θs => do let ⟨ηθ, e_ηθ⟩ ← evalHorizontalCompAux' η θ let ⟨ηθs, e_ηθs⟩ ← evalHorizontalComp ηs θs let ⟨ηθ₁, e_ηθ₁⟩ ← evalComp ηθ ηθs let ⟨ηθ₂, e_ηθ₂⟩ ← evalCompNil (← horizontalCompM α β) ηθ₁ return ⟨ηθ₂, ← mkEvalHorizontalCompConsCons α β η θ ηs θs ηθ ηθs ηθ₁ ηθ₂ e_ηθ e_ηθs e_ηθ₁ e_ηθ₂⟩
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
evalHorizontalComp
Evaluate the expression `η ⊗ θ` into a normalized form.
traceProof (nm : Name) (result : Expr) : CoherenceM ρ Unit := do withTraceNode nm (fun _ => return m!"{checkEmoji} {← inferType result}") do if ← isTracingEnabledFor nm then addTrace nm m!"proof: {result}"
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
traceProof
Trace the proof of the normalization.
eval (nm : Name) (e : Mor₂) : CoherenceM ρ Eval.Result := do withTraceNode nm (fun _ => return m!"eval: {e.e}") do match e with | .isoHom _ _ α => withTraceNode nm (fun _ => return m!"Iso.hom") do match α with | .structuralAtom α => return ⟨← nilM <| .structuralAtom α, ← mkEqRefl e.e⟩ | .of η => let η ← MonadMor₂.atomHomM η let result ← mkEvalOf η traceProof nm result return ⟨← NormalExpr.ofAtomM η, result⟩ | _ => throwError "not implemented. try dsimp first." | .isoInv _ _ α => withTraceNode nm (fun _ => return m!"Iso.inv") do match α with | .structuralAtom α => return ⟨← nilM <| (← symmM (.structuralAtom α)), ← mkEqRefl e.e⟩ | .of η => let η ← MonadMor₂.atomInvM η let result ← mkEvalOf η traceProof nm result return ⟨← NormalExpr.ofAtomM η, result⟩ | _ => throwError "not implemented. try dsimp first." | .id _ _ f => let α ← MonadMor₂Iso.id₂M f return ⟨← nilM <| .structuralAtom α, ← mkEqRefl e.e⟩ | .comp _ _ _ _ _ η θ => withTraceNode nm (fun _ => return m!"comp") do let ⟨η', e_η⟩ ← eval nm η let ⟨θ', e_θ⟩ ← eval nm θ let ⟨ηθ, pf⟩ ← evalComp η' θ' let result ← mkEvalComp η θ η' θ' ηθ e_η e_θ pf traceProof nm result return ⟨ηθ, result⟩ | .whiskerLeft _ _ f _ _ η => withTraceNode nm (fun _ => return m!"whiskerLeft") do let ⟨η', e_η⟩ ← eval nm η let ⟨θ, e_θ⟩ ← evalWhiskerLeft f η' let result ← mkEvalWhiskerLeft f η η' θ e_η e_θ traceProof nm result return ⟨θ, result⟩ | .whiskerRight _ _ _ _ η h => withTraceNode nm (fun _ => return m!"whiskerRight") do let ⟨η', e_η⟩ ← eval nm η let ⟨θ, e_θ⟩ ← evalWhiskerRight η' h let result ← mkEvalWhiskerRight η h η' θ e_η e_θ traceProof nm result return ⟨θ, result⟩ | .coherenceComp _ _ _ _ _ _ α₀ η θ => withTraceNode nm (fun _ => return m!"monoidalComp") do let ⟨η', e_η⟩ ← eval nm η let α₀ := .structuralAtom <| .coherenceHom α₀ let α ← nilM α₀ let ⟨θ', e_θ⟩ ← eval nm θ let ⟨αθ, e_αθ⟩ ← evalComp α θ' let ⟨ηαθ, e_ηαθ⟩ ← evalComp η' αθ let result ← mkEvalMonoidalComp η θ α₀ η' θ' αθ ηαθ e_η e_θ e_αθ e_ηαθ ...
def
Tactic
[ "Lean.Meta.AppBuilder", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean
eval
Evaluate the expression of a 2-morphism into a normalized form.
Normalize.Result where /-- The normalized 1-morphism. -/ normalizedHom : NormalizedHom /-- The 2-morphism from the original 1-morphism to the normalized 1-morphism. -/ toNormalize : Mor₂Iso deriving Inhabited open Mor₂Iso MonadMor₂Iso variable {ρ : Type} [Context ρ] [MonadMor₁ (CoherenceM ρ)] [MonadMor₂Iso (CoherenceM ρ)]
structure
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
Normalize.Result
The result of normalizing a 1-morphism.
normalize (p : NormalizedHom) (f : Mor₁) : CoherenceM ρ Normalize.Result := do match f with | .id _ _ => return ⟨p, ← rightUnitorM' p.e⟩ | .comp _ f g => let ⟨pf, η_f⟩ ← normalize p f let η_f' ← whiskerRightM η_f g let ⟨pfg, η_g⟩ ← normalize pf g let η ← comp₂M η_f' η_g let α ← symmM (← associatorM' p.e f g) let η' ← comp₂M α η return ⟨pfg, η'⟩ | .of f => let pf ← NormalizedHom.consM p f let α ← id₂M' pf.e return ⟨pf, α⟩
def
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
normalize
Meta version of `CategoryTheory.FreeBicategory.normalizeIso`.
MonadNormalizeNaturality (m : Type → Type) where /-- The naturality for the associator. -/ mkNaturalityAssociator (p pf pfg pfgh : NormalizedHom) (f g h : Mor₁) (η_f η_g η_h : Mor₂Iso) : m Expr /-- The naturality for the left unitor. -/ mkNaturalityLeftUnitor (p pf : NormalizedHom) (f : Mor₁) (η_f : Mor₂Iso) : m Expr /-- The naturality for the right unitor. -/ mkNaturalityRightUnitor (p pf : NormalizedHom) (f : Mor₁) (η_f : Mor₂Iso) : m Expr /-- The naturality for the identity. -/ mkNaturalityId (p pf : NormalizedHom) (f : Mor₁) (η_f : Mor₂Iso) : m Expr /-- The naturality for the composition. -/ mkNaturalityComp (p pf : NormalizedHom) (f g h : Mor₁) (η θ η_f η_g η_h : Mor₂Iso) (ih_η ih_θ : Expr) : m Expr /-- The naturality for the left whiskering. -/ mkNaturalityWhiskerLeft (p pf pfg : NormalizedHom) (f g h : Mor₁) (η η_f η_fg η_fh : Mor₂Iso) (ih_η : Expr) : m Expr /-- The naturality for the right whiskering. -/ mkNaturalityWhiskerRight (p pf pfh : NormalizedHom) (f g h : Mor₁) (η η_f η_g η_fh : Mor₂Iso) (ih_η : Expr) : m Expr /-- The naturality for the horizontal composition. -/ mkNaturalityHorizontalComp (p pf₁ pf₁f₂ : NormalizedHom) (f₁ g₁ f₂ g₂ : Mor₁) (η θ η_f₁ η_g₁ η_f₂ η_g₂ : Mor₂Iso) (ih_η ih_θ : Expr) : m Expr /-- The naturality for the inverse. -/ mkNaturalityInv (p pf : NormalizedHom) (f g : Mor₁) (η η_f η_g : Mor₂Iso) (ih_η : Expr) : m Expr open MonadNormalizeNaturality variable [MonadCoherehnceHom (CoherenceM ρ)] [MonadNormalizeNaturality (CoherenceM ρ)]
class
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
MonadNormalizeNaturality
Lemmas to prove the meta version of `CategoryTheory.FreeBicategory.normalize_naturality`.
partial naturality (nm : Name) (p : NormalizedHom) (η : Mor₂Iso) : CoherenceM ρ Expr := do let result ← match η with | .of _ => throwError m!"could not find a structural isomorphism, but {η.e}" | .coherenceComp _ _ _ _ _ α η θ => withTraceNode nm (fun _ => return m!"monoidalComp") do let α ← MonadCoherehnceHom.unfoldM α let αθ ← comp₂M α θ let ηαθ ← comp₂M η αθ naturality nm p ηαθ | .structuralAtom η => match η with | .coherenceHom α => withTraceNode nm (fun _ => return m!"coherenceHom") do let α ← MonadCoherehnceHom.unfoldM α naturality nm p α | .associator _ f g h => withTraceNode nm (fun _ => return m!"associator") do let ⟨pf, η_f⟩ ← normalize p f let ⟨pfg, η_g⟩ ← normalize pf g let ⟨pfgh, η_h⟩ ← normalize pfg h mkNaturalityAssociator p pf pfg pfgh f g h η_f η_g η_h | .leftUnitor _ f => withTraceNode nm (fun _ => return m!"leftUnitor") do let ⟨pf, η_f⟩ ← normalize p f mkNaturalityLeftUnitor p pf f η_f | .rightUnitor _ f => withTraceNode nm (fun _ => return m!"rightUnitor") do let ⟨pf, η_f⟩ ← normalize p f mkNaturalityRightUnitor p pf f η_f | .id _ f => withTraceNode nm (fun _ => return m!"id") do let ⟨pf, η_f⟩ ← normalize p f mkNaturalityId p pf f η_f | .comp _ f g h η θ => withTraceNode nm (fun _ => return m!"comp") do let ⟨pf, η_f⟩ ← normalize p f let ⟨_, η_g⟩ ← normalize p g let ⟨_, η_h⟩ ← normalize p h let ih_η ← naturality nm p η let ih_θ ← naturality nm p θ mkNaturalityComp p pf f g h η θ η_f η_g η_h ih_η ih_θ | .whiskerLeft _ f g h η => withTraceNode nm (fun _ => return m!"whiskerLeft") do let ⟨pf, η_f⟩ ← normalize p f let ⟨pfg, η_fg⟩ ← normalize pf g let ⟨_, η_fh⟩ ← normalize pf h let ih ← naturality nm pf η mkNaturalityWhiskerLeft p pf pfg f g h η η_f η_fg η_fh ih | .whiskerRight _ f g η h => withTraceNode nm (fun _ => return m!"whiskerRight") do let ⟨pf, η_f⟩ ← normalize p f let ⟨_, η_g⟩ ← normalize p g let ⟨pfh, η_fh⟩ ← normalize pf h let ih ← naturality nm p η mkNaturalityWhiskerRight p pf pfh f g h η η_f η_g η_fh ih | .horizontalComp _ f₁ g₁ f₂ g₂ η θ => withTraceNode nm (fun _ => return m!"hComp") do let ⟨pf₁, η_f₁⟩ ← normalize p f₁ let ⟨_, η_g₁⟩ ← normalize p g₁ let ⟨pf₁f₂, η_f₂⟩ ← normalize pf₁ f₂ let ⟨_, η_g₂⟩ ← normalize pf₁ g₂ let ih_η ← naturality nm p η ...
def
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
naturality
Meta version of `CategoryTheory.FreeBicategory.normalize_naturality`.
MkEqOfNaturality (m : Type → Type) where /-- Auxiliary function for `pureCoherence`. -/ mkEqOfNaturality (η θ : Expr) (η' θ' : IsoLift) (η_f η_g : Mor₂Iso) (Hη Hθ : Expr) : m Expr export MkEqOfNaturality (mkEqOfNaturality)
class
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
MkEqOfNaturality
Prove the equality between structural isomorphisms using the naturality of `normalize`.
pureCoherence (ρ : Type) [Context ρ] [MkMor₂ (CoherenceM ρ)] [MonadMor₁ (CoherenceM ρ)] [MonadMor₂Iso (CoherenceM ρ)] [MonadCoherehnceHom (CoherenceM ρ)] [MonadNormalizeNaturality (CoherenceM ρ)] [MkEqOfNaturality (CoherenceM ρ)] (nm : Name) (mvarId : MVarId) : MetaM (List MVarId) := mvarId.withContext do withTraceNode nm (fun ex => match ex with | .ok _ => return m!"{checkEmoji} coherence equality: {← mvarId.getType}" | .error err => return m!"{crossEmoji} {err.toMessageData}") do let e ← instantiateMVars <| ← mvarId.getType let some (_, η, θ) := (← whnfR e).eq? | throwError "coherence requires an equality goal" let ctx : ρ ← mkContext η CoherenceM.run (ctx := ctx) do let some ηIso := (← MkMor₂.ofExpr η).isoLift? | throwError "could not find a structural isomorphism, but {η}" let some θIso := (← MkMor₂.ofExpr θ).isoLift? | throwError "could not find a structural isomorphism, but {θ}" let f ← ηIso.e.srcM let g ← ηIso.e.tgtM let a := f.src let nil ← normalizedHom.nilM a let ⟨_, η_f⟩ ← normalize nil f let ⟨_, η_g⟩ ← normalize nil g let Hη ← withTraceNode nm (fun ex => do return m!"{exceptEmoji ex} LHS") do naturality nm nil ηIso.e let Hθ ← withTraceNode nm (fun ex => do return m!"{exceptEmoji ex} RHS") do naturality nm nil θIso.e let H ← mkEqOfNaturality η θ ηIso θIso η_f η_g Hη Hθ mvarId.apply H
def
Tactic
[ "Lean.Meta.Tactic.Apply", "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes" ]
Mathlib/Tactic/CategoryTheory/Coherence/PureCoherence.lean
pureCoherence
Close the goal of the form `η = θ`, where `η` and `θ` are 2-isomorphisms made up only of associators, unitors, and identities.
monoidalNf (mvarId : MVarId) : MetaM (List MVarId) := do BicategoryLike.normalForm Monoidal.Context `monoidal mvarId @[inherit_doc monoidalNf] elab "monoidal_nf" : tactic => withMainContext do replaceMainGoal (← monoidalNf (← getMainGoal))
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Basic", "Mathlib.Tactic.CategoryTheory.Monoidal.Normalize", "Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Basic.lean
monoidalNf
Normalize the both sides of an equality.
monoidal (mvarId : MVarId) : MetaM (List MVarId) := BicategoryLike.main Monoidal.Context `monoidal mvarId @[inherit_doc monoidal] elab "monoidal" : tactic => withMainContext do replaceMainGoal <| ← monoidal <| ← getMainGoal
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Basic", "Mathlib.Tactic.CategoryTheory.Monoidal.Normalize", "Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Basic.lean
monoidal
Use the coherence theorem for monoidal categories to solve equations in a monoidal category, where the two sides only differ by replacing strings of monoidal structural morphisms (that is, associators, unitors, and identities) with different strings of structural morphisms with the same source and target. That is, `monoidal` can handle goals of the form `a ≫ f ≫ b ≫ g ≫ c = a' ≫ f ≫ b' ≫ g ≫ c'` where `a = a'`, `b = b'`, and `c = c'` can be proved using `monoidal_coherence`.
srcExpr (η : Expr) : MetaM Expr := do match (← whnfR (← inferType η)).getAppFnArgs with | (``Quiver.Hom, #[_, _, f, _]) => return f | _ => throwError m!"{η} is not a morphism"
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
srcExpr
The domain of a morphism.
tgtExpr (η : Expr) : MetaM Expr := do match (← whnfR (← inferType η)).getAppFnArgs with | (``Quiver.Hom, #[_, _, _, g]) => return g | _ => throwError m!"{η} is not a morphism"
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
tgtExpr
The codomain of a morphism.
srcExprOfIso (η : Expr) : MetaM Expr := do match (← whnfR (← inferType η)).getAppFnArgs with | (``Iso, #[_, _, f, _]) => return f | _ => throwError m!"{η} is not a morphism"
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
srcExprOfIso
The domain of an isomorphism.
tgtExprOfIso (η : Expr) : MetaM Expr := do match (← whnfR (← inferType η)).getAppFnArgs with | (``Iso, #[_, _, _, g]) => return g | _ => throwError m!"{η} is not a morphism" initialize registerTraceClass `monoidal
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
tgtExprOfIso
The codomain of an isomorphism.
Context where /-- The level for morphisms. -/ level₂ : Level /-- The level for objects. -/ level₁ : Level /-- The expression for the underlying category. -/ C : Q(Type level₁) /-- The category instance. -/ instCat : Q(Category.{level₂, level₁} $C) /-- The monoidal category instance. -/ instMonoidal? : Option Q(MonoidalCategory.{level₂, level₁} $C)
structure
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
Context
The context for evaluating expressions.
mkContext? (e : Expr) : MetaM (Option Context) := do let e ← instantiateMVars e let type ← instantiateMVars <| ← inferType e match (← whnfR type).getAppFnArgs with | (``Quiver.Hom, #[_, _, f, _]) => let C ← instantiateMVars <| ← inferType f let .succ level₁ ← getLevel C | return none let .succ level₂ ← getLevel type | return none let some instCat ← synthInstance? (mkAppN (.const ``Category [level₂, level₁]) #[C]) | return none let instMonoidal? ← synthInstance? (mkAppN (.const ``MonoidalCategory [level₂, level₁]) #[C, instCat]) return some ⟨level₂, level₁, C, instCat, instMonoidal?⟩ | _ => return none
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
mkContext
Populate a `context` object for evaluating `e`.
MonoidalM := CoherenceM Context
abbrev
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
MonoidalM
The monad for the normalization of 2-morphisms.
synthMonoidalError {α : Type} : MetaM α := do throwError "failed to find monoidal category instance"
def
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
synthMonoidalError
Throw an error if the monoidal category instance is not found.
structuralIsoOfExpr_comp {f g h : C} (η : f ⟶ g) (η' : f ≅ g) (ih_η : η'.hom = η) (θ : g ⟶ h) (θ' : g ≅ h) (ih_θ : θ'.hom = θ) : (η' ≪≫ θ').hom = η ≫ θ := by simp [ih_η, ih_θ]
theorem
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
structuralIsoOfExpr_comp
null
StructuralOfExpr_monoidalComp {f g h i : C} [MonoidalCoherence g h] (η : f ⟶ g) (η' : f ≅ g) (ih_η : η'.hom = η) (θ : h ⟶ i) (θ' : h ≅ i) (ih_θ : θ'.hom = θ) : (η' ≪⊗≫ θ').hom = η ⊗≫ θ := by simp [ih_η, ih_θ, monoidalIsoComp, monoidalComp] variable [MonoidalCategory C]
theorem
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
StructuralOfExpr_monoidalComp
null
structuralIsoOfExpr_whiskerLeft (f : C) {g h : C} (η : g ⟶ h) (η' : g ≅ h) (ih_η : η'.hom = η) : (whiskerLeftIso f η').hom = f ◁ η := by simp [ih_η]
theorem
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
structuralIsoOfExpr_whiskerLeft
null
structuralIsoOfExpr_whiskerRight {f g : C} (h : C) (η : f ⟶ g) (η' : f ≅ g) (ih_η : η'.hom = η) : (whiskerRightIso η' h).hom = η ▷ h := by simp [ih_η]
theorem
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
structuralIsoOfExpr_whiskerRight
null
structuralIsoOfExpr_horizontalComp {f₁ g₁ f₂ g₂ : C} (η : f₁ ⟶ g₁) (η' : f₁ ≅ g₁) (ih_η : η'.hom = η) (θ : f₂ ⟶ g₂) (θ' : f₂ ≅ g₂) (ih_θ : θ'.hom = θ) : (η' ⊗ᵢ θ').hom = η ⊗ₘ θ := by simp [ih_η, ih_θ]
theorem
Tactic
[ "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "Mathlib.Tactic.CategoryTheory.MonoidalComp" ]
Mathlib/Tactic/CategoryTheory/Monoidal/Datatypes.lean
structuralIsoOfExpr_horizontalComp
null