Skip to content

Instantly share code, notes, and snippets.

View siddhartha-gadgil's full-sized avatar

Siddhartha Gadgil siddhartha-gadgil

View GitHub Profile
open import Nat
onetwothree : List ℕ
onetwothree = 1 :: (2 :: (3 :: []))
{-# BUILTIN NATURAL ℕ #-}
{-# BUILTIN ZERO zero #-}
{-# BUILTIN SUC succ #-}
data List (A : Set) : Set where
[] : List A
_::_ : A → List A → List A
_*_ : ℕ → ℕ → ℕ
zero * n = zero
(succ m) * n = n + (m * n)
factorial : ℕ → ℕ
factorial zero = succ zero
factorial (succ n) = (succ n) * (factorial n)
forever : ℕ → ℕ
forever zero = zero
forever (succ n) = forever (succ (succ n))
_+_ : ℕ → ℕ → ℕ
zero + n = n
(succ m) + n = succ (m + n)
data ℕ : Set where
zero : ℕ
succ : ℕ → ℕ
_xor_ : Bool → Bool → Bool
_xor_ = λ x y → (x & (not y)) || ((not x) & y)
verytrue : Bool → Bool
verytrue = λ x → x & x
notnot : Bool -> Bool
notnot x = not (not x)