{-# OPTIONS --safe #-}
module Cubical.HITs.James.Inductive.Reduced where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Univalence
open import Cubical.Data.Nat
open import Cubical.HITs.SequentialColimit
open import Cubical.HITs.James.Inductive.Base
renaming (πames to πamesConstruction ; πamesβ to πamesβConstruction)
private
variable
β : Level
module _
((X , xβ) : Pointed β) where
infixr 5 _β·_
data πRed : Type β where
[] : πRed
_β·_ : X β πRed β πRed
unit : (x : X)(xs : πRed) β xβ β· x β· xs β‘ x β· xβ β· xs
coh : (xs : πRed) β refl β‘ unit xβ xs
data πRedβ : Type β where
incl : πRed β πRedβ
push : (xs : πRed) β incl xs β‘ incl (xβ β· xs)
data πSquare (i j : I) : Type β where
[] : πSquare i j
_β·_ : X β πSquare i j β πSquare i j
incl : πSquare i j β πSquare i j
unit : (xs : πSquare i j) β incl xs β‘ xβ β· xs
inclβ· : (x : X)(xs : πSquare i j) β unit (x β· xs) i β‘ x β· unit xs i
coh : (xs : πSquare i j) β
PathP (Ξ» k β unit (unit xs (i β¨ k)) i β‘ unit (unit xs i) (i β¨ j β¨ k))
(Ξ» k β unit (unit xs i) (i β¨ j β§ k)) (inclβ· xβ xs)
πPath : I β Type β
πPath i = πSquare i (~ i)
π0 = πPath i0
π1 = πPath i1
data πPathβ (i : I) : Type β where
incl : πPath i β πPathβ i
push : (xs : πPath i) β incl xs β‘ incl (unit xs i)
π0β = πPathβ i0
π1β = πPathβ i1
π1βπRed : π1 β πRed
π1βπRed [] = []
π1βπRed (x β· xs) = x β· π1βπRed xs
π1βπRed (incl xs) = xβ β· π1βπRed xs
π1βπRed (inclβ· x xs i) = unit x (π1βπRed xs) i
π1βπRed (unit xs i) = xβ β· π1βπRed xs
π1βπRed (coh xs i j) = coh (π1βπRed xs) i j
πRedβπ1 : πRed β π1
πRedβπ1 [] = []
πRedβπ1 (x β· xs) = x β· πRedβπ1 xs
πRedβπ1 (unit x xs i) = inclβ· x (πRedβπ1 xs) i
πRedβπ1 (coh xs i j) = coh (πRedβπ1 xs) i j
πRedβπ1βπRed : (xs : πRed) β π1βπRed (πRedβπ1 xs) β‘ xs
πRedβπ1βπRed [] = refl
πRedβπ1βπRed (x β· xs) t = x β· πRedβπ1βπRed xs t
πRedβπ1βπRed (unit x xs i) t = unit x (πRedβπ1βπRed xs t) i
πRedβπ1βπRed (coh xs i j) t = coh (πRedβπ1βπRed xs t) i j
π1βπRedβπ1 : (xs : π1) β πRedβπ1 (π1βπRed xs) β‘ xs
π1βπRedβπ1 [] = refl
π1βπRedβπ1 (x β· xs) t = x β· π1βπRedβπ1 xs t
π1βπRedβπ1 (incl xs) = (Ξ» t β xβ β· π1βπRedβπ1 xs t) β sym (unit xs)
π1βπRedβπ1 (inclβ· x xs i) t = inclβ· x (π1βπRedβπ1 xs t) i
π1βπRedβπ1 (unit xs i) j =
hcomp (Ξ» k β Ξ»
{ (i = i0) β compPath-filler (Ξ» t β xβ β· π1βπRedβπ1 xs t) (sym (unit xs)) k j
; (i = i1) β xβ β· π1βπRedβπ1 xs j
; (j = i0) β xβ β· πRedβπ1 (π1βπRed xs)
; (j = i1) β unit xs (i β¨ ~ k)})
(xβ β· π1βπRedβπ1 xs j)
π1βπRedβπ1 (coh xs i j) t = coh (π1βπRedβπ1 xs t) i j
πRedββπ1β : πRedβ β π1β
πRedββπ1β (incl xs) = incl (πRedβπ1 xs)
πRedββπ1β (push xs i) = push (πRedβπ1 xs) i
π1ββπRedβ : π1β β πRedβ
π1ββπRedβ (incl xs) = incl (π1βπRed xs)
π1ββπRedβ (push xs i) = push (π1βπRed xs) i
πRedββπ1ββπRedβ : (xs : πRedβ) β π1ββπRedβ (πRedββπ1β xs) β‘ xs
πRedββπ1ββπRedβ (incl xs) t = incl (πRedβπ1βπRed xs t)
πRedββπ1ββπRedβ (push xs i) t = push (πRedβπ1βπRed xs t) i
π1ββπRedββπ1β : (xs : π1β) β πRedββπ1β (π1ββπRedβ xs) β‘ xs
π1ββπRedββπ1β (incl xs) t = incl (π1βπRedβπ1 xs t)
π1ββπRedββπ1β (push xs i) t = push (π1βπRedβπ1 xs t) i
π1ββπRedβ : π1β β πRedβ
π1ββπRedβ = isoToEquiv (iso π1ββπRedβ πRedββπ1β πRedββπ1ββπRedβ π1ββπRedββπ1β)
private
πames = πamesConstruction (X , xβ)
πamesβ = πamesβConstruction (X , xβ)
index : π0 β β
index [] = 0
index (x β· xs) = 1 + index xs
index (incl xs) = 1 + index xs
index (inclβ· x xs i) = 2 + index xs
index (unit xs i) = 1 + index xs
index (coh xs i j) = 2 + index xs
πamesβπ0 : {n : β} β πames n β π0
πamesβπ0 [] = []
πamesβπ0 (x β· xs) = x β· πamesβπ0 xs
πamesβπ0 (incl xs) = incl (πamesβπ0 xs)
πamesβπ0 (inclβ· x xs i) = inclβ· x (πamesβπ0 xs) i
πamesβπ0 (unit xs i) = unit (πamesβπ0 xs) i
πamesβπ0 (coh xs i j) = coh (πamesβπ0 xs) i j
π0βπames : (xs : π0) β πames (index xs)
π0βπames [] = []
π0βπames (x β· xs) = x β· π0βπames xs
π0βπames (incl xs) = incl (π0βπames xs)
π0βπames (inclβ· x xs i) = inclβ· x (π0βπames xs) i
π0βπames (unit xs i) = unit (π0βπames xs) i
π0βπames (coh xs i j) = coh (π0βπames xs) i j
π0βπamesβπ0 : (xs : π0) β πamesβπ0 (π0βπames xs) β‘ xs
π0βπamesβπ0 [] = refl
π0βπamesβπ0 (x β· xs) t = x β· π0βπamesβπ0 xs t
π0βπamesβπ0 (incl xs) t = incl (π0βπamesβπ0 xs t)
π0βπamesβπ0 (inclβ· x xs i) t = inclβ· x (π0βπamesβπ0 xs t) i
π0βπamesβπ0 (unit xs i) t = unit (π0βπamesβπ0 xs t) i
π0βπamesβπ0 (coh xs i j) t = coh (π0βπamesβπ0 xs t) i j
index-path : {n : β}(xs : πames n) β index (πamesβπ0 xs) β‘ n
index-path [] = refl
index-path (x β· xs) t = 1 + index-path xs t
index-path (incl xs) t = 1 + index-path xs t
index-path (inclβ· x xs i) t = 2 + index-path xs t
index-path (unit xs i) t = 1 + index-path xs t
index-path (coh xs i j) t = 2 + index-path xs t
πamesβπ0βπames : {n : β}(xs : πames n)
β PathP (Ξ» i β πames (index-path xs i)) (π0βπames (πamesβπ0 xs)) xs
πamesβπ0βπames [] = refl
πamesβπ0βπames (x β· xs) t = x β· πamesβπ0βπames xs t
πamesβπ0βπames (incl xs) t = incl (πamesβπ0βπames xs t)
πamesβπ0βπames (inclβ· x xs i) t = inclβ· x (πamesβπ0βπames xs t) i
πamesβπ0βπames (unit xs i) t = unit (πamesβπ0βπames xs t) i
πamesβπ0βπames (coh xs i j) t = coh (πamesβπ0βπames xs t) i j
πamesββπ0β : πamesβ β π0β
πamesββπ0β (incl xs) = incl (πamesβπ0 xs)
πamesββπ0β (push xs i) = push (πamesβπ0 xs) i
π0ββπamesβ : π0β β πamesβ
π0ββπamesβ (incl xs) = incl (π0βπames xs)
π0ββπamesβ (push xs i) = push (π0βπames xs) i
πamesββπ0ββπamesβ : (xs : πamesβ) β π0ββπamesβ (πamesββπ0β xs) β‘ xs
πamesββπ0ββπamesβ (incl xs) t = incl (πamesβπ0βπames xs t)
πamesββπ0ββπamesβ (push xs i) t = push (πamesβπ0βπames xs t) i
π0ββπamesββπ0β : (xs : π0β) β πamesββπ0β (π0ββπamesβ xs) β‘ xs
π0ββπamesββπ0β (incl xs) t = incl (π0βπamesβπ0 xs t)
π0ββπamesββπ0β (push xs i) t = push (π0βπamesβπ0 xs t) i
πamesββπ0β : πamesβ β π0β
πamesββπ0β = isoToEquiv (iso πamesββπ0β π0ββπamesβ π0ββπamesββπ0β πamesββπ0ββπamesβ)
πamesββπRedβ : πamesβ β πRedβ
πamesββπRedβ = compEquiv πamesββπ0β (compEquiv (pathToEquiv (Ξ» i β πPathβ i)) π1ββπRedβ)
private
eq1 : πamesββπRedβ .fst (incl []) β‘ incl []
eq1 = refl
eq2 : (x : X) β πamesββπRedβ .fst (incl (x β· [])) β‘ incl (x β· [])
eq2 _ = transportRefl _