on master help sign in
Add Uninhabited instance for Any p []

This lets users use `absurd` to discharge proof obligations about Any.

commit7ca1a6facb898e691774535b32e5c2da2733f419 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateTue 22 Jul 2014, 13:52 (12 years ago) parent196bc76
1 file changed+4−1
libs/base/Data/Vect/Quantifiers.idr+4−1
libs/base/Data/Vect/Quantifiers.idr+4−1
@@ -5,9 +5,12 @@ data Any : (P : a -> Type) -> Vect n a -> Type where
55 There : {P : a -> Type} -> {xs : Vect n a} -> Any P xs -> Any P (x :: xs)
66
77anyNilAbsurd : {P : a -> Type} -> Any P Nil -> _|_
8−anyNilAbsurd (Here _) impossible
8+anyNilAbsurd (Here _) impossible
99anyNilAbsurd (There _) impossible
1010
11+instance Uninhabited (Any p Nil) where
12+ uninhabited = anyNilAbsurd
13+
1114anyElim : {xs : Vect n a} -> {P : a -> Type} -> (Any P xs -> b) -> (P x -> b) -> Any P (x :: xs) -> b
1215anyElim _ f (Here p) = f p
1316anyElim f _ (There p) = f p