{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core using (Category)
open import Categories.Category.Monoidal.Core using (Monoidal)
module Categories.Category.Monoidal.Scalars
{o ℓ e} {𝒞 : Category o ℓ e} (M : Monoidal 𝒞) where
open import Algebra.Bundles using (Monoid; CommutativeMonoid)
open import Categories.Object.Endomorphism 𝒞 using (Endo; Endo-∘-Monoid)
open import Categories.Category.Monoidal.Reasoning M
open import Categories.Category.Monoidal.Utilities M using (module Shorthands)
import Categories.Category.Monoidal.Properties M as MonoidalProps
open import Categories.Morphism.Reasoning 𝒞
open Category 𝒞
open Monoidal M
open Shorthands
open MonoidalProps.Kelly's
Scalar : Set _
Scalar = Endo unit
private
Scalar-Base-Monoid : Monoid _ _
Scalar-Base-Monoid = Endo-∘-Monoid unit
variable
A B C : Obj
s t : Scalar
open Monoid Scalar-Base-Monoid public using () renaming (_∙_ to _·ₛ_; ε to idₛ)
module Action where
infixl 7 _·ˡ_ _·ʳ_
_·ˡ_ : Scalar → A ⇒ B → A ⇒ B
s ·ˡ f = λ⇒ ∘ (s ⊗₁ f) ∘ λ⇐
_·ʳ_ : A ⇒ B → Scalar → A ⇒ B
f ·ʳ s = ρ⇒ ∘ (f ⊗₁ s) ∘ ρ⇐
·ˡ-resp-≈ : {f g : A ⇒ B} → s ≈ t → f ≈ g → s ·ˡ f ≈ t ·ˡ g
·ˡ-resp-≈ s≈t f≈g = ∘-resp-≈ʳ (∘-resp-≈ˡ (s≈t ⟩⊗⟨ f≈g))
·ʳ-resp-≈ : {f g : A ⇒ B} → f ≈ g → s ≈ t → f ·ʳ s ≈ g ·ʳ t
·ʳ-resp-≈ f≈g s≈t = ∘-resp-≈ʳ (∘-resp-≈ˡ (f≈g ⟩⊗⟨ s≈t))
id-·ˡ : ∀ {f : A ⇒ B} → idₛ ·ˡ f ≈ f
id-·ˡ {f = f} = begin
λ⇒ ∘ (idₛ ⊗₁ f) ∘ λ⇐ ≈⟨ pullˡ unitorˡ-commute-from ⟩
(f ∘ λ⇒) ∘ λ⇐ ≈⟨ cancelʳ unitorˡ.isoʳ ⟩
f ∎
id-·ʳ : ∀ {f : A ⇒ B} → f ·ʳ idₛ ≈ f
id-·ʳ {f = f} = begin
ρ⇒ ∘ (f ⊗₁ idₛ) ∘ ρ⇐ ≈⟨ pullˡ unitorʳ-commute-from ⟩
(f ∘ ρ⇒) ∘ ρ⇐ ≈⟨ cancelʳ unitorʳ.isoʳ ⟩
f ∎
·ˡ-∘ : ∀ {f : B ⇒ C} {g : A ⇒ B} →
(s ·ₛ t) ·ˡ (f ∘ g) ≈ (s ·ˡ f) ∘ (t ·ˡ g)
·ˡ-∘ {s = s} {t} {f} {g} = begin
λ⇒ ∘ ((s ·ₛ t) ⊗₁ (f ∘ g)) ∘ λ⇐ ≈⟨ refl⟩∘⟨ pushˡ ⊗-distrib-over-∘ ⟩
λ⇒ ∘ ((s ⊗₁ f) ∘ ((t ⊗₁ g) ∘ λ⇐)) ≈⟨ refl⟩∘⟨ refl⟩∘⟨ insertˡ unitorˡ.isoˡ ⟩
λ⇒ ∘ ((s ⊗₁ f) ∘ (λ⇐ ∘ (λ⇒ ∘ ((t ⊗₁ g) ∘ λ⇐)))) ≈⟨ assoc²εβ ⟩
(λ⇒ ∘ ((s ⊗₁ f) ∘ λ⇐)) ∘ (λ⇒ ∘ ((t ⊗₁ g) ∘ λ⇐)) ∎
·ʳ-∘ : ∀ {f : B ⇒ C} {g : A ⇒ B} →
(f ∘ g) ·ʳ (s ·ₛ t) ≈ (f ·ʳ s) ∘ (g ·ʳ t)
·ʳ-∘ {s = s} {t} {f} {g} = begin
ρ⇒ ∘ ((f ∘ g) ⊗₁ (s ·ₛ t)) ∘ ρ⇐ ≈⟨ refl⟩∘⟨ pushˡ ⊗-distrib-over-∘ ⟩
ρ⇒ ∘ ((f ⊗₁ s) ∘ ((g ⊗₁ t) ∘ ρ⇐)) ≈⟨ refl⟩∘⟨ refl⟩∘⟨ insertˡ unitorʳ.isoˡ ⟩
ρ⇒ ∘ ((f ⊗₁ s) ∘ (ρ⇐ ∘ (ρ⇒ ∘ ((g ⊗₁ t) ∘ ρ⇐)))) ≈⟨ assoc²εβ ⟩
(ρ⇒ ∘ ((f ⊗₁ s) ∘ ρ⇐)) ∘ (ρ⇒ ∘ ((g ⊗₁ t) ∘ ρ⇐)) ∎
unit-merge : ∀ {f : A ⇒ unit} {g : B ⇒ unit} →
f ∘ ρ⇒ ∘ (id ⊗₁ g) ≈ λ⇒ ∘ (f ⊗₁ g)
unit-merge {f = f} {g} = begin
f ∘ ρ⇒ ∘ (id ⊗₁ g) ≈⟨ pullˡ (⟺ unitorʳ-commute-from) ⟩
(ρ⇒ ∘ (f ⊗₁ id)) ∘ (id ⊗₁ g) ≈⟨ pullʳ merge₂ʳ ⟩
ρ⇒ ∘ (f ⊗₁ (id ∘ g)) ≈⟨ refl⟩∘⟨ refl⟩⊗⟨ identityˡ ⟩
ρ⇒ ∘ (f ⊗₁ g) ≈˘⟨ coherence₃ ⟩∘⟨refl ⟩
λ⇒ ∘ (f ⊗₁ g) ∎
open Action public
module Eckmann-Hilton where
private
absorbᵣ : ρ⇒ ∘ (id ⊗₁ s) ∘ ρ⇐ ≈ s
absorbᵣ {s} = begin
ρ⇒ ∘ (id ⊗₁ s) ∘ ρ⇐ ≈⟨ ⟺ coherence₃ ⟩∘⟨ refl⟩∘⟨ ⟺ coherence-inv₃ ⟩
λ⇒ ∘ (id ⊗₁ s) ∘ λ⇐ ≈⟨ id-·ˡ ⟩
s ∎
absorbₗ : λ⇒ ∘ (s ⊗₁ id) ∘ λ⇐ ≈ s
absorbₗ {s} = begin
λ⇒ ∘ (s ⊗₁ id) ∘ λ⇐ ≈⟨ coherence₃ ⟩∘⟨ refl⟩∘⟨ coherence-inv₃ ⟩
ρ⇒ ∘ (s ⊗₁ id) ∘ ρ⇐ ≈⟨ id-·ʳ ⟩
s ∎
·ʳ≈·ˡ : s ·ʳ t ≈ s ·ˡ t
·ʳ≈·ˡ = ⟺ coherence₃ ⟩∘⟨ refl⟩∘⟨ ⟺ coherence-inv₃
·ʳ-scalar : s ·ʳ t ≈ s ∘ t
·ʳ-scalar {s} {t} = begin
ρ⇒ ∘ (s ⊗₁ t) ∘ ρ⇐ ≈⟨ refl⟩∘⟨ serialize₁₂ ⟩∘⟨refl ⟩
ρ⇒ ∘ ((s ⊗₁ id) ∘ (id ⊗₁ t)) ∘ ρ⇐ ≈⟨ refl⟩∘⟨ assoc ⟩
ρ⇒ ∘ (s ⊗₁ id) ∘ (id ⊗₁ t) ∘ ρ⇐ ≈⟨ pullˡ unitorʳ-commute-from ⟩
(s ∘ ρ⇒) ∘ (id ⊗₁ t) ∘ ρ⇐ ≈⟨ assoc ⟩
s ∘ ρ⇒ ∘ (id ⊗₁ t) ∘ ρ⇐ ≈⟨ refl⟩∘⟨ absorbᵣ ⟩
s ∘ t ∎
·ˡ-scalar : s ·ˡ t ≈ t ∘ s
·ˡ-scalar {s} {t} = begin
λ⇒ ∘ (s ⊗₁ t) ∘ λ⇐ ≈⟨ refl⟩∘⟨ serialize₂₁ ⟩∘⟨refl ⟩
λ⇒ ∘ ((id ⊗₁ t) ∘ (s ⊗₁ id)) ∘ λ⇐ ≈⟨ refl⟩∘⟨ assoc ⟩
λ⇒ ∘ (id ⊗₁ t) ∘ (s ⊗₁ id) ∘ λ⇐ ≈⟨ pullˡ unitorˡ-commute-from ⟩
(t ∘ λ⇒) ∘ (s ⊗₁ id) ∘ λ⇐ ≈⟨ assoc ⟩
t ∘ λ⇒ ∘ (s ⊗₁ id) ∘ λ⇐ ≈⟨ refl⟩∘⟨ absorbₗ ⟩
t ∘ s ∎
scalar-comm : (s t : Scalar) → s ·ₛ t ≈ t ·ₛ s
scalar-comm s t = begin
s ∘ t ≈˘⟨ ·ʳ-scalar ⟩
s ·ʳ t ≈⟨ ·ʳ≈·ˡ ⟩
s ·ˡ t ≈⟨ ·ˡ-scalar ⟩
t ∘ s ∎
Scalar-Monoid : CommutativeMonoid _ _
Scalar-Monoid = record
{ Carrier = Scalar
; _≈_ = _≈_
; _∙_ = _·ₛ_
; ε = idₛ
; isCommutativeMonoid = record
{ isMonoid = Monoid.isMonoid Scalar-Base-Monoid
; comm = scalar-comm
}
}
open Eckmann-Hilton public