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
data Bool : Set where | |
true : Bool | |
false : Bool | |
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
not : Bool -> Bool | |
not true = false | |
not false = true |
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
_&_ : Bool → Bool → Bool | |
true & true = true | |
false & _ = false | |
true & false = false |
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
notnot : Bool -> Bool | |
notnot x = not (not x) |
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
verytrue : Bool → Bool | |
verytrue = λ x → x & x |
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
_xor_ : Bool → Bool → Bool | |
_xor_ = λ x y → (x & (not y)) || ((not x) & y) |
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
_*_ : ℕ → ℕ → ℕ | |
zero * n = zero | |
(succ m) * n = n + (m * n) | |
factorial : ℕ → ℕ | |
factorial zero = succ zero | |
factorial (succ n) = (succ n) * (factorial n) |
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
data ℕ : Set where | |
zero : ℕ | |
succ : ℕ → ℕ |
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
_+_ : ℕ → ℕ → ℕ | |
zero + n = n | |
(succ m) + n = succ (m + n) |
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
forever : ℕ → ℕ | |
forever zero = zero | |
forever (succ n) = forever (succ (succ n)) |
OlderNewer