{-# OPTIONS --postfix-projections #-}
module Generic where
open import Prelude
{-# NO_POSITIVITY_CHECK #-}
data Mu (i : Size) (F : Set → Set) : Set where
inn : ∀{j : Size< i} → F (Mu j F) → Mu i F
{-# NO_POSITIVITY_CHECK #-}
record Nu (i : Size) (F : Set → Set) : Set where
coinductive
field out : ∀{j : Size< i} → F (Nu j F)
open Nu public
inMu : ∀{F i} → (∃ j < i , F (Mu j F)) → Mu i F
inMu (^ t) = inn t
inMu∞ : ∀{F} → F (Mu ∞ F) → Mu ∞ F
inMu∞ t = inn t
outNu : ∀{F i} → Nu i F → ∀{j : Size< i} → F (Nu j F)
outNu r = out r
outNu∞ : ∀{F} → Nu ∞ F → F (Nu ∞ F)
outNu∞ r = out r
outMu : ∀{F i} → Mu i F → ∃ j < i , F (Mu j F)
outMu (inn t) = ^ t
inNu : ∀{F i} → (∀{j : Size< i} → F (Nu j F)) → Nu i F
inNu t .out = t