Last active
May 29, 2024 00:25
-
-
Save lovely-error/7e88494a5fcb6b1b54312e4aa0b7a6d1 to your computer and use it in GitHub Desktop.
Vect as W type
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
{-# OPTIONS --type-in-type #-} | |
open import Agda.Builtin.Nat | |
open import Agda.Builtin.Bool | |
data Prod (L R : Set) : Set where | |
pair : L -> R -> Prod L R | |
data Unit : Set where | |
pt : Unit | |
data Sigma (A : Set)(f : A -> Set) : Set where | |
sigma : (a : A) -> f a -> Sigma A f | |
data Void : Set where | |
W : (T : Set) -> (T -> Set) -> Set | |
W T f = Sigma T f | |
Vect : Nat -> Set -> Set | |
Vect n T = W Bool λ i -> f i n T where | |
f : Bool -> Nat -> Set -> Set | |
f false zero T = Unit | |
f false (suc n) T = Void | |
f true zero T = Void | |
f true (suc n) T = Prod T (Vect n T) | |
test10 : Vect 3 Nat | |
test10 = sigma true (pair 1 (sigma true (pair 2 (sigma true (pair 3 (sigma false pt)))))) | |
test11 : Vect 0 Nat | |
test11 = sigma true {!!} -- no introduction forms found! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment