Last active
March 30, 2021 15:13
-
-
Save googleson78/7400f480a60f11fdebd61fff3216b5c0 to your computer and use it in GitHub Desktop.
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
{-# OPTIONS --no-unicode #-} | |
module BV where | |
data Two : Set where | |
ff tt : Two | |
data BV : Set where | |
end : BV | |
_-,_ : BV -> Two -> BV | |
infixl 10 _-,_ | |
suc : BV -> BV | |
suc end = end -, tt | |
suc (xs -, ff) = xs -, tt | |
suc (xs -, tt) = suc xs -, ff | |
idOrSuc : Two -> Two -> BV -> BV | |
idOrSuc tt tt xs = suc xs | |
idOrSuc _ _ xs = xs | |
xor : Two -> Two -> Two | |
xor ff ff = ff | |
xor ff tt = tt | |
xor tt ff = tt | |
xor tt tt = ff | |
_+B_ : BV -> BV -> BV | |
end +B ys = ys | |
xs@(_ -, _) +B end = xs | |
(xs -, x) +B (ys -, y) = idOrSuc x y (xs +B ys) -, xor x y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment