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
.
- lift : CategoryTheory.FreeMonoidalCategory 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
Equations
- Mathlib.Tactic.Coherence.LiftObj_unit = { lift := CategoryTheory.FreeMonoidalCategory.Unit }
Equations
- One or more equations did not get rendered due to their size.
Equations
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
Equations
Equations
Equations
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- One or more equations did not get rendered due to their size.
- hom : X ⟶ Y
- isIso : CategoryTheory.IsIso Mathlib.Tactic.Coherence.MonoidalCoherence.hom
A typeclass carrying a choice of monoidal structural isomorphism between two objects.
Used by the ⊗≫
monoidal composition operator, and the coherence
tactic.
Instances
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Construct an isomorphism between two objects in a monoidal category out of unitors and associators.
Equations
- Mathlib.Tactic.Coherence.monoidalIso X Y = CategoryTheory.asIso Mathlib.Tactic.Coherence.MonoidalCoherence.hom
Instances For
Compose two morphisms in a monoidal category, inserting unitors and associators between as necessary.
Equations
- Mathlib.Tactic.Coherence.monoidalComp f g = CategoryTheory.CategoryStruct.comp f (CategoryTheory.CategoryStruct.comp Mathlib.Tactic.Coherence.MonoidalCoherence.hom g)
Instances For
Compose two morphisms in a monoidal category, inserting unitors and associators between as necessary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compose two isomorphisms in a monoidal category, inserting unitors and associators between as necessary.
Equations
- Mathlib.Tactic.Coherence.monoidalIsoComp f g = f ≪≫ CategoryTheory.asIso Mathlib.Tactic.Coherence.MonoidalCoherence.hom ≪≫ g
Instances For
Compose two isomorphisms in a monoidal category, inserting unitors and associators between as necessary.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper function for throwing exceptions.
Equations
- Mathlib.Tactic.Coherence.exception g msg = Lean.Meta.throwTacticEx `monoidal_coherence g msg
Instances For
Helper function for throwing exceptions with respect to the main goal.
Equations
- Mathlib.Tactic.Coherence.exception' msg = tryCatch (Lean.Elab.Tactic.liftMetaTactic fun g => Mathlib.Tactic.Coherence.exception g msg) fun x => Lean.throwError msg
Instances For
Auxiliary definition for monoidal_coherence
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Coherence tactic for monoidal categories.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Coherence tactic for monoidal categories.
Use pure_coherence
instead, which is a frontend to this one.
Equations
- One or more equations did not get rendered due to their size.
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
Equations
- Mathlib.Tactic.Coherence.pure_coherence = Lean.ParserDescr.node `Mathlib.Tactic.Coherence.pure_coherence 1024 (Lean.ParserDescr.nonReservedSymbol "pure_coherence" false)
Instances For
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).
Equations
- Mathlib.Tactic.Coherence.liftable_prefixes = Lean.ParserDescr.node `Mathlib.Tactic.Coherence.liftable_prefixes 1024 (Lean.ParserDescr.nonReservedSymbol "liftable_prefixes" false)
Instances For
If either the lhs or rhs is not a composition, compose it on the right with an identity.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The main part of coherence
tactic.
Equations
- One or more equations did not get rendered due to their size.
- Mathlib.Tactic.Coherence.coherence_loop 0 = Mathlib.Tactic.Coherence.exception' ((Lean.MessageData.ofFormat ∘ Std.format) "`coherence` tactic reached iteration limit")
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
.)
Equations
- Mathlib.Tactic.Coherence.coherence = Lean.ParserDescr.node `Mathlib.Tactic.Coherence.coherence 1024 (Lean.ParserDescr.nonReservedSymbol "coherence" false)