diff options
author | Iain Lane <iain@orangesquash.org.uk> | 2014-08-05 09:11:47 +0100 |
---|---|---|
committer | Iain Lane <iain@orangesquash.org.uk> | 2014-08-05 09:11:47 +0100 |
commit | 84d43131c1027130bd54e74a699fd1132cda66de (patch) | |
tree | 5f0cb3f183c8109d9c8d659219d3b02cb3cf649a /src/Data/M/Indexed.agda | |
parent | 6d5228941fe84e810ba3e49cd3f2bbee902bdeef (diff) |
Imported Upstream version 0.8
Diffstat (limited to 'src/Data/M/Indexed.agda')
-rw-r--r-- | src/Data/M/Indexed.agda | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Data/M/Indexed.agda b/src/Data/M/Indexed.agda new file mode 100644 index 0000000..efd87f9 --- /dev/null +++ b/src/Data/M/Indexed.agda @@ -0,0 +1,42 @@ +------------------------------------------------------------------------ +-- The Agda standard library +-- +-- Indexed M-types (the dual of indexed W-types aka Petersson-Synek +-- trees). +------------------------------------------------------------------------ + +module Data.M.Indexed where + +open import Level +open import Coinduction +open import Data.Product +open import Data.Container.Indexed.Core +open import Function +open import Relation.Unary + +-- The family of indexed M-types. + +module _ {ℓ c r} {O : Set ℓ} (C : Container O O c r) where + + data M (o : O) : Set (ℓ ⊔ c ⊔ r) where + inf : ⟦ C ⟧ (∞ ∘ M) o → M o + + open Container C + + -- Projections. + + head : M ⊆ Command + head (inf (c , _)) = c + + tail : ∀ {o} (m : M o) (r : Response (head m)) → M (next (head m) r) + tail (inf (_ , k)) r = ♭ (k r) + + force : M ⊆ ⟦ C ⟧ M + force (inf (c , k)) = c , λ r → ♭ (k r) + + -- Coiteration. + + coit : ∀ {ℓ} {X : Pred O ℓ} → X ⊆ ⟦ C ⟧ X → X ⊆ M + coit ψ x = inf (proj₁ cs , λ r → ♯ coit ψ (proj₂ cs r)) + where + cs = ψ x |