open import SOAS.Common
open import SOAS.Families.Core
open import Categories.Object.Initial
open import SOAS.Coalgebraic.Strength
import SOAS.Metatheory.MetaAlgebra
module SOAS.Metatheory.Renaming {T : Set}
(โ
F : Functor ๐ฝamiliesโ ๐ฝamiliesโ) (โ
:Str : Strength โ
F)
(๐ : Familyโ) (open SOAS.Metatheory.MetaAlgebra โ
F ๐)
(๐:Init : Initial ๐etaAlgebras)
where
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Abstract.Hom
import SOAS.Abstract.Coalgebra as โโก ; open โโก.Sorted
import SOAS.Abstract.Box as โก ; open โก.Sorted
open import SOAS.Coalgebraic.Map
open import SOAS.Metatheory.Algebra {T} โ
F
open import SOAS.Metatheory.Semantics โ
F โ
:Str ๐ ๐:Init
open import SOAS.Metatheory.Traversal โ
F โ
:Str ๐ ๐:Init
open Strength โ
:Str
module Renaming = โกTraversal ๐แต
๐ฃ๐๐ : ๐ โพฬฃ โก ๐
๐ฃ๐๐ = Renaming.๐ฅ๐ฃ๐๐ง
๐จ๐ : {ฮฑ ฯ : T}{ฮ : Ctx} โ ๐ ฮฑ ฮ โ ๐ ฮฑ (ฯ โ ฮ)
๐จ๐ t = ๐ฃ๐๐ t old
๐ฃ๐๐-comp : MapEqโ โแดฎ โแดฎ ๐๐๐ (ฮป t ฯ ฯฑ โ ๐ฃ๐๐ t (ฯฑ โ ฯ))
(ฮป t ฯ ฯฑ โ ๐ฃ๐๐ (๐ฃ๐๐ t ฯ) ฯฑ)
๐ฃ๐๐-comp = record
{ ฯ = ๐ง๐๐ฃ
; ฯ = ฮป x ฯ โ ๐ง๐๐ฃ (ฯ x)
; ฯ = ๐๐ง๐๐ฃ
; fโจ๐ฃโฉ = ๐ฅโจ๐งโฉ
; fโจ๐โฉ = ๐ฅโจ๐โฉ
; fโจ๐โฉ = ฮป{ {ฯ = ฯ}{ฯฑ}{t} โ begin
๐ฃ๐๐ (๐๐๐ t) (ฯฑ โ ฯ)
โกโจ ๐ฅโจ๐โฉ โฉ
๐๐๐ (str โแดฎ ๐ (โ
โ ๐ฃ๐๐ t) (ฯฑ โ ฯ))
โกโจ cong ๐๐๐ (str-dist ๐ (jแถ โแดฎ) (โ
โ ๐ฃ๐๐ t) ฯ ฯฑ) โฉ
๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) (โ
โ (precomp ๐ (j โ)) (โ
โ ๐ฃ๐๐ t)) ฯ) ฯฑ)
โกหโจ congr โ
.homomorphism (ฮป - โ ๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) - ฯ) ฯฑ)) โฉ
๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) (โ
โ (ฮป{ t ฯ ฯฑ โ ๐ฃ๐๐ t (ฯฑ โ ฯ)}) t) ฯ) ฯฑ)
โ }
; gโจ๐ฃโฉ = trans (๐ฅโโ ๐ฅโจ๐งโฉ) ๐ฅโจ๐งโฉ
; gโจ๐โฉ = trans (๐ฅโโ ๐ฅโจ๐โฉ) ๐ฅโจ๐โฉ
; gโจ๐โฉ = ฮป{ {ฯ = ฯ}{ฯฑ}{t} โ begin
๐ฃ๐๐ (๐ฃ๐๐ (๐๐๐ t) ฯ) ฯฑ
โกโจ ๐ฅโโ ๐ฅโจ๐โฉ โฉ
๐ฃ๐๐ (๐๐๐ (str โแดฎ ๐ (โ
โ ๐ฃ๐๐ t) ฯ)) ฯฑ
โกโจ ๐ฅโจ๐โฉ โฉ
๐๐๐ (str โแดฎ ๐ (โ
โ ๐ฃ๐๐ (str โแดฎ ๐ (โ
โ ๐ฃ๐๐ t) ฯ)) ฯฑ)
โกหโจ congr (str-natโ ๐ฃ๐๐ (โ
โ ๐ฃ๐๐ t) ฯ) (ฮป - โ ๐๐๐ (str โแดฎ ๐ - ฯฑ)) โฉ
๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) (โ
.Fโ (ฮป { hโฒ ฯ โ ๐ฃ๐๐ (hโฒ ฯ) }) (โ
โ ๐ฃ๐๐ t)) ฯ) ฯฑ)
โกหโจ congr โ
.homomorphism (ฮป - โ ๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) - ฯ) ฯฑ)) โฉ
๐๐๐ (str โแดฎ ๐ (str โแดฎ (โก ๐) (โ
โ (ฮป{ t ฯ ฯฑ โ ๐ฃ๐๐ (๐ฃ๐๐ t ฯ) ฯฑ}) t) ฯ) ฯฑ)
โ }
}
where
open โก-Reasoning
open Renaming
๐แต : Coalg ๐
๐แต = record { r = ๐ฃ๐๐ ; counit = โก๐ฅ๐ฃ๐๐ง-idโid
; comult = ฮป{ {t = t} โ MapEqโ.โ ๐ฃ๐๐-comp t } }
๐แดฎ : Coalgโ ๐
๐แดฎ = record { แต = ๐แต ; ฮท = ๐ง๐๐ฃ ; rโฮท = Renaming.๐ฅโจ๐งโฉ }