Created
March 6, 2019 15:05
-
-
Save timjb/439898770ef0d1a0b370a2e38f69396e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SizedTrees where | |
open import Agda.Builtin.Size | |
data list (A : Set₀) : Set₀ where | |
nil : list A | |
cons : A → list A → list A | |
map : ∀{A B} → (A → B) → list A → list B | |
map f nil = nil | |
map f (cons a l) = cons (f a) (map f l) | |
data tree (A : Set₀) : Size → Set₀ where | |
fork : ∀ {i} → A → list (tree A i) → tree A (↑ i) | |
map-tree : ∀ {i} {A B} → (A → B) → tree A i → tree B i | |
map-tree f (fork a l) = fork (f a) (map (map-tree f) l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment