{-# OPTIONS --without-K --exact-split --rewriting #-}
module Pi.Experiments.ShiftHIT where
open import lib.Basics
open import lib.types.Nat
open import lib.types.Fin
open import lib.types.Sigma
open import lib.types.List
open import lib.types.SetQuotient
postulate
C : ℕ → Type₀
module _ {n : ℕ} where
infixr 30 _↓_::_
postulate
nilC : C n
_↓_::_ : (k : Fin n) -> (l : ℕ) → C n → C n
cancel : ∀ (x : Fin n) -> (xs : C n) → xs == (x ↓ 1 :: (x ↓ 1 :: xs))
trunc : is-set (C n)
module CElim {i} {P : C n -> Type i}
(nilC* : P nilC)
(consC* : (k : Fin n) -> (l : ℕ) -> {c : C n} -> (p : P c) -> P (k ↓ l :: c))
(cancel* : (x : Fin n) -> {xs : C n} -> (xs* : P xs) -> xs* == consC* x 1 (consC* x (1) xs*) [ P ↓ (cancel x xs) ]) where
postulate
f : (c : C n) -> P c
f-nilC-β : f nilC ↦ nilC*
f-consC-β : (k : Fin n) (l : ℕ) (xs : C n) -> f (k ↓ l :: xs) ↦ consC* k l (f xs)
{-# REWRITE f-nilC-β #-}
{-# REWRITE f-consC-β #-}
postulate
f-cancel-β : (x : Fin n) -> (xs : C n) -> apd f (cancel x xs) == cancel* x (f xs)
module CRec {i} {P : Type i}
(nilC* : P) (consC* : (k : Fin n) -> (l : ℕ) -> P -> P)
(cancel* : (x : Fin n) (xs : P) -> xs == consC* x 1 (consC* x 1 xs)) where
private module CE = CElim {P = λ _ -> P}
nilC*
(λ k l p → consC* k l p)
(λ x {xs} xs* → ↓-cst-in (cancel* x xs*))
f : C n -> P
f = CE.f