# Documentation

Mathlib.Tactic.CategoryTheory.Coherence

# A coherence tactic for monoidal categories, and ⊗≫ (composition up to associators) #

We provide a coherence tactic, which proves equations where the two sides differ by replacing strings of monoidal structural morphisms with other such strings. (The replacements are always equalities by the monoidal coherence theorem.)

A simpler version of this tactic is pure_coherence, which proves that any two morphisms (with the same source and target) in a monoidal category which are built out of associators and unitors are equal.

We also provide f ⊗≫ g, the monoidal_comp operation, which automatically inserts associators and unitors as needed to make the target of f match the source of g.

class Mathlib.Tactic.Coherence.LiftObj {C : Type u} (X : C) :

A typeclass carrying a choice of lift of an object from C to FreeMonoidalCategory C. It must be the case that projectObj id (LiftObj.lift x) = x by defeq.

Instances
class Mathlib.Tactic.Coherence.LiftHom {C : Type u} {X : C} {Y : C} (f : X Y) :

A typeclass carrying a choice of lift of a morphism from C to FreeMonoidalCategory C. It must be the case that projectMap id _ _ (LiftHom.lift f) = f by defeq.

Instances
instance Mathlib.Tactic.Coherence.LiftHom_associator_hom {C : Type u} (X : C) (Y : C) (Z : C) :
instance Mathlib.Tactic.Coherence.LiftHom_associator_inv {C : Type u} (X : C) (Y : C) (Z : C) :
instance Mathlib.Tactic.Coherence.LiftHom_comp {C : Type u} {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) :
instance Mathlib.Tactic.Coherence.LiftHom_tensor {C : Type u} {W : C} {X : C} {Y : C} {Z : C} (f : W X) (g : Y Z) :
class Mathlib.Tactic.Coherence.MonoidalCoherence {C : Type u} (X : C) (Y : C) :

A typeclass carrying a choice of monoidal structural isomorphism between two objects. Used by the ⊗≫ monoidal composition operator, and the coherence tactic.

Instances
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.refl_hom {C : Type u} (X : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom =
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.tensor_hom {C : Type u} (X : C) (Y : C) (Z : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.MonoidalCategory.tensorHom () Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.tensor_right_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.tensorHom () Mathlib.Tactic.Coherence.MonoidalCoherence.hom)
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.tensor_right'_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp (CategoryTheory.MonoidalCategory.tensorHom () Mathlib.Tactic.Coherence.MonoidalCoherence.hom)
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.left_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.left'_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.right_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.right'_hom {C : Type u} (X : C) (Y : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.assoc_hom {C : Type u} (X : C) (Y : C) (Z : C) (W : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp ().hom Mathlib.Tactic.Coherence.MonoidalCoherence.hom
@[simp]
theorem Mathlib.Tactic.Coherence.MonoidalCoherence.assoc'_hom {C : Type u} (W : C) (X : C) (Y : C) (Z : C) :
Mathlib.Tactic.Coherence.MonoidalCoherence.hom = CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom ().inv
def Mathlib.Tactic.Coherence.monoidalIso {C : Type u} (X : C) (Y : C) :
X Y

Construct an isomorphism between two objects in a monoidal category out of unitors and associators.

Instances For
def Mathlib.Tactic.Coherence.monoidalComp {C : Type u} {W : C} {X : C} {Y : C} {Z : C} (f : W X) (g : Y Z) :
W Z

Compose two morphisms in a monoidal category, inserting unitors and associators between as necessary.

Instances For

Compose two morphisms in a monoidal category, inserting unitors and associators between as necessary.

Instances For
noncomputable def Mathlib.Tactic.Coherence.monoidalIsoComp {C : Type u} {W : C} {X : C} {Y : C} {Z : C} (f : W X) (g : Y Z) :
W Z

Compose two isomorphisms in a monoidal category, inserting unitors and associators between as necessary.

Instances For

Compose two isomorphisms in a monoidal category, inserting unitors and associators between as necessary.

Instances For
@[simp]
theorem Mathlib.Tactic.Coherence.monoidalComp_refl {C : Type u} {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) :

Helper function for throwing exceptions.

Instances For

Helper function for throwing exceptions with respect to the main goal.

Instances For

Auxiliary definition for monoidal_coherence.

Instances For

Coherence tactic for monoidal categories.

Instances For

Coherence tactic for monoidal categories. Use pure_coherence instead, which is a frontend to this one.

Instances For

pure_coherence uses the coherence theorem for monoidal categories to prove the goal. It can prove any equality made up only of associators, unitors, and identities.

example {C : Type} [Category C] [MonoidalCategory C] :
(λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom :=
by pure_coherence


Users will typically just use the coherence tactic, which can also cope with identities 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 pure_coherence

Instances For
theorem Mathlib.Tactic.Coherence.assoc_liftHom {C : Type u} {W : C} {X : C} {Y : C} {Z : C} (f : W X) (g : X Y) (h : Y Z) :

Auxiliary simp lemma for the coherence tactic: this moves brackets to the left in order to expose a maximal prefix built out of unitors and associators.

Internal tactic used in coherence.

Rewrites an equation f = g as f₀ ≫ f₁ = g₀ ≫ g₁, where f₀ and g₀ are maximal prefixes of f and g (possibly after reassociating) which are "liftable" (i.e. expressible as compositions of unitors and associators).

Instances For
theorem Mathlib.Tactic.Coherence.insert_id_lhs {C : Type u_1} [] {X : C} {Y : C} (f : X Y) (g : X Y) :
f = g
theorem Mathlib.Tactic.Coherence.insert_id_rhs {C : Type u_1} [] {X : C} {Y : C} (f : X Y) (g : X Y) :
f = g

If either the lhs or rhs is not a composition, compose it on the right with an identity.

Instances For

The main part of coherence tactic.

Equations
Instances For

Use the coherence theorem for monoidal categories to solve equations in a monoidal equation, 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, coherence 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 pure_coherence.

(If you have very large equations on which coherence is unexpectedly failing, you may need to increase the typeclass search depth, using e.g. set_option synthInstance.maxSize 500.)

Instances For