{-# OPTIONS --safe --lossy-unification #-}
module Cubical.Tactics.CategorySolver.Solver where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Quiver.Base
open import Cubical.Categories.Category
open import Cubical.Categories.Constructions.Free.Category.Quiver as FreeCat
open import Cubical.Categories.Constructions.Power
open import Cubical.Categories.Functor.Base
open import Cubical.Categories.Instances.Sets
open import Cubical.Categories.UnderlyingGraph
private
variable
β β' : Level
open Category
open Functor
module Eval (π : Category β β') where
private
Wπ = FreeCat (CatβQuiver π)
semπ = Ξ΅ {π = π}
β¦_β§c = semπ .F-hom
π = PowerCategory (Wπ .ob) (SET (β-max β β'))
π : Functor Wπ π
π = PseudoYoneda {C = Wπ}
semYo : Functor Wπ π
semYo = rec _ (record {
_$g_ = π .F-ob
; _<$g>_ = Ξ» e β π .F-hom (FreeCat.Ξ· (CatβQuiver π) <$g> e)
})
eval : β {A B} β Wπ [ A , B ] β _
eval {A}{B} e = semYo .F-hom e
Yo-YoSem-agree : π β‘ semYo
Yo-YoSem-agree = FreeCatFunctorβ‘ _ _ _ (record
{ _$gα΄°_ = Ξ» _ β refl
; _<$g>α΄°_ = Ξ» _ β refl
})
solve : β {A B} β (eβ eβ : Wπ [ A , B ])
β eval eβ β‘ eval eβ
β β¦ eβ β§c β‘ β¦ eβ β§c
solve {A}{B} eβ eβ p = cong β¦_β§c (isFaithfulPseudoYoneda {C = Wπ} _ _ _ _ lem) where
lem : π βͺ eβ β« β‘ π βͺ eβ β«
lem = transport
(Ξ» i β Yo-YoSem-agree (~ i) βͺ eβ β« β‘ Yo-YoSem-agree (~ i) βͺ eβ β«)
p
solve : (π : Category β β')
β {A B : π .ob}
β (eβ eβ : FreeCat (CatβQuiver π) [ A , B ])
β (p : Eval.eval π eβ β‘ Eval.eval π eβ)
β _
solve = Eval.solve