Created
April 20, 2018 20:04
-
-
Save xuanruiqi/68f7b1433e100424c6ab2d68e26654f9 to your computer and use it in GitHub Desktop.
Group theory in Idris
This file contains hidden or 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
| import public Data.ZZ | |
| record IsGroup (x : Type) ((*) : x -> x -> x) (e : x) where | |
| constructor PrfGrp | |
| associative : (a : x) -> (b : x) -> (c : x) -> a * (b * c) = (a * b) * c | |
| identity : (a : x) -> (a * e = a, e * a = a) | |
| inverse : (a : x) -> (a' : x ** (a * a' = e, a' * a = e)) | |
| intIsGroup : IsGroup ZZ (+) (Pos Z) | |
| intIsGroup = let assocInt = plusAssociativeZ | |
| identInt = \n => (plusZeroRightNeutralZ n, plusZeroLeftNeutralZ n) | |
| invInt = \n => (negate n ** (plusNegateInverseLZ n, plusNegateInverseRZ n)) | |
| in PrfGrp assocInt identInt invInt | |
| record IsAbelianGroup (x : Type) ((*) : x -> x -> x) (e : x) where | |
| constructor PrfAbelianGrp | |
| prfIsGrp : IsGroup x (*) e | |
| commutative : (a : x) -> (b : x) -> a * b = b * a | |
| intIsAbelianGroup : IsAbelianGroup ZZ (+) (Pos Z) | |
| intIsAbelianGroup = let prfIsGroup = intIsGroup | |
| commutative = plusCommutativeZ | |
| in PrfAbelianGrp prfIsGroup commutative |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment