Last active
August 5, 2021 16:00
-
-
Save appositum/2eb7dc833c49fb4aea4160a07f9d5658 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
infixr 5 <> | |
interface VerifiedMonoid (a : Type) where | |
mempty : a | |
(<>) : a -> a -> a | |
leftId : (x : a) -> mempty <> x = x | |
rightId : (x : a) -> x <> mempty = x | |
assoc : (x : a) -> (y : a) -> (z : a) -> x <> (y <> z) = (x <> y) <> z | |
[MonoidSum] VerifiedMonoid Nat where | |
mempty = 0 | |
(<>) = (+) | |
leftId n = Refl | |
rightId Z = Refl | |
rightId (S n) = cong (rightId n) | |
assoc Z y z = Refl | |
assoc (S x) y z = cong (assoc x y z) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment