Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines the LCMMonoid
subclass of the Monoid
class.
The LCMMonoid
subclass adds the lcm
operation, which takes two monoidal
arguments and finds their least common multiple, or (more generally) the
least monoid from which either argument can be subtracted with the </>
operation.
The LCMMonoid
class is for Abelian, i.e., Commutative
monoids.
Documentation
class GCDMonoid m => LCMMonoid m where Source #
Class of Abelian monoids that allow the least common multiple to be found for any two given values.
Operations must satisfy the following laws:
Reductivity
isJust
(lcm
a b</>
a)
isJust
(lcm
a b</>
b)
Uniqueness
all
isJust
[ c</>
a , c</>
b ,lcm
a b</>
c ] ==> (lcm
a b==
c)
Idempotence
lcm
a a==
a
Identity
lcm
mempty
a==
a
lcm
amempty
==
a
Commutativity
lcm
a b==
lcm
b a
Associativity
lcm
(lcm
a b) c==
lcm
a (lcm
b c)
Absorption
lcm
a (gcd
a b)==
a
gcd
a (lcm
a b)==
a
Distributivity
lcm
(a<>
b) (a<>
c)==
a<>
lcm
b c
lcm
(a<>
c) (b<>
c)==
lcm
a b<>
c
lcm
a (gcd
b c)==
gcd
(lcm
a b) (lcm
a c)
gcd
a (lcm
b c)==
lcm
(gcd
a b) (gcd
a c)
Instances
LCMMonoid IntSet Source # | |
LCMMonoid () Source # | |
Defined in Data.Monoid.LCM | |
LCMMonoid a => LCMMonoid (Dual a) Source # | |
LCMMonoid (Product Natural) Source # | |
LCMMonoid (Sum Natural) Source # | |
Ord a => LCMMonoid (Set a) Source # | |
(LCMMonoid a, LCMMonoid b) => LCMMonoid (a, b) Source # | |
Defined in Data.Monoid.LCM | |
(LCMMonoid a, LCMMonoid b, LCMMonoid c) => LCMMonoid (a, b, c) Source # | |
Defined in Data.Monoid.LCM | |
(LCMMonoid a, LCMMonoid b, LCMMonoid c, LCMMonoid d) => LCMMonoid (a, b, c, d) Source # | |
Defined in Data.Monoid.LCM |