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
| .coherenceCo... | 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
| .coh... | 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 S... | 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 : Mo... | 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? .. => iso... | 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₂ .. => d... | 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₂ ... | 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... | 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 _ ... | 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 Inhabi... | 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 NormalExp... | 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) (η... | 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) ◁ η` -/
m... | 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
... | 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) : ... | 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 normal... | 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 ... | 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_η₁... | 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_η₂⟩ ← ... | 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)
... | 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.associatorIn... | 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₁⟩ ← evalW... | 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 η =>
... | 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 (C... | 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 (... | 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... | 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 α ← MonadCoherehnceHo... | 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.withContex... | 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, `mo... |
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?... | 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... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.