{-# OPTIONS --cubical-compatible --safe #-}
module Data.Container.Indexed.Core where
open import Level
open import Data.Product.Base using (Σ; Σ-syntax; _,_; ∃)
open import Relation.Unary
private variable
i o c r ℓ ℓ′ : Level
I : Set i
O : Set o
infix 5 _◃_/_
record Container (I : Set i) (O : Set o) c r : Set (i ⊔ o ⊔ suc c ⊔ suc r) where
constructor _◃_/_
field
Command : (o : O) → Set c
Response : ∀ {o} → Command o → Set r
next : ∀ {o} (c : Command o) → Response c → I
module _ (C : Container I O c r) (X : Pred I ℓ) where
open Container C
Subtrees : ∀ o → Command o → Set _
Subtrees o c = (r : Response c) → X (next c r)
⟦_⟧ : Pred O _
⟦_⟧ o = Σ (Command o) (Subtrees o)
module _ (C : Container I O c r) {X : Pred I ℓ} where
□ : Pred (Σ I X) ℓ′ → Pred (Σ O (⟦ C ⟧ X)) _
□ P (_ , _ , k) = ∀ r → P (_ , k r)
◇ : Pred (Σ I X) ℓ′ → Pred (Σ O (⟦ C ⟧ X)) _
◇ P (_ , _ , k) = ∃ λ r → P (_ , k r)