@@ -1,6 +1,7 @@
11module Data.Matrix
22
33import Data.Complex
4+import Data.ZZ
45
56%default total
67
@@ -215,7 +216,39 @@ instance Ring Float where
215216
216217instance RingWithUnity Float where
217218 unity = 1
219+
220+
221+instance Semigroup Nat where
222+ (<+>) = (+)
223+
224+instance Monoid Nat where
225+ neutral = 0
218226
227+instance VerifiedSemigroup Nat where
228+ semigroupOpIsAssociative = plusAssociative
229+
230+instance VerifiedMonoid Nat where
231+ monoidNeutralIsNeutralL = plusZeroRightNeutral
232+ monoidNeutralIsNeutralR = plusZeroLeftNeutral
233+
234+
235+instance Semigroup ZZ where
236+ (<+>) = (+)
237+
238+instance Monoid ZZ where
239+ neutral = 0
240+
241+instance Group ZZ where
242+ inverse = (* -1)
243+
244+instance AbelianGroup ZZ
245+
246+instance Ring ZZ where
247+ (<*>) = (*)
248+
249+instance RingWithUnity ZZ where
250+ unity = 1
251+
219252
220253instance Semigroup a => Semigroup (Complex a) where
221254 (<+>) (a :+ b) (c :+ d) = (a <+> c) :+ (b <+> d)
@@ -233,17 +266,3 @@ instance (Num a, AbelianGroup (Complex a)) => Ring (Complex a) where
233266
234267instance (Num a, Ring (Complex a)) => RingWithUnity (Complex a) where
235268 unity = (1 :+ 0)
236−
237−
238−instance Semigroup Nat where
239− (<+>) = (+)
240−
241−instance Monoid Nat where
242− neutral = 0
243−
244−instance VerifiedSemigroup Nat where
245− semigroupOpIsAssociative = plusAssociative
246−
247−instance VerifiedMonoid Nat where
248− monoidNeutralIsNeutralL = plusZeroRightNeutral
249− monoidNeutralIsNeutralR = plusZeroLeftNeutral