Skip to content

Instantly share code, notes, and snippets.

@hallettj
Created April 18, 2014 20:56
Show Gist options
  • Save hallettj/11064048 to your computer and use it in GitHub Desktop.
Save hallettj/11064048 to your computer and use it in GitHub Desktop.
basic mathematical logic in Idris
module Logic
infixr 1 ==>
(==>) : Bool -> Bool -> Bool
False ==> _ = True
True ==> x = x
data Exists : (A : Type) -> (P : A -> Bool) -> Type where
exists : {A : Type} -> {P : A -> Bool} -> (a : A) -> so (P a) -> Exists A P
prop : Exists Integer (\n => n > 0)
prop = exists 2 oh
prop' : Exists Integer (\n => (n == 2) ==> (n /= 3))
prop' = exists 2 oh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment