Skip to content

Instantly share code, notes, and snippets.

@msmorgan
Created October 10, 2017 00:24
Show Gist options
  • Save msmorgan/2bceae10d8d21cb2d8e70e8ece95340b to your computer and use it in GitHub Desktop.
Save msmorgan/2bceae10d8d21cb2d8e70e8ece95340b to your computer and use it in GitHub Desktop.
module NotElem
import Data.Vect
%default Total
NotElem : (x : a) -> Vect n a -> Type
NotElem x ys = Not (Elem x ys)
notElem : DecEq a => (x : a) -> (ys : Vect n a) -> Dec (NotElem x ys)
notElem x ys with (isElem x ys)
notElem x ys | (Yes prf) = No ((\a, f => f a) prf)
notElem x ys | (No contra) = Yes contra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment