| Copyright | (c) 2016 Andrew Lelechenko |
|---|---|
| License | MIT |
| Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |
| Stability | Provisional |
| Portability | Non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Math.NumberTheory.UniqueFactorisation
Description
An abstract type class for unique factorisation domains.
- type family Prime (f :: *) :: *
- class UniqueFactorisation a where
Documentation
type family Prime (f :: *) :: * Source #
Type of primes of a given unique factorisation domain.
When the domain has exactly one unit, Prime t = t,
but when units are multiple more restricted types
(or at least newtypes) should be specified.
abs (unPrime n) == unPrime n must hold for all n of type Prime t
class UniqueFactorisation a where Source #
The following invariant must hold for n /= 0:
abs n == abs (product (map (\(p, k) -> unPrime p ^ k) (factorise n)))
The result of factorise should not contain zero powers and should not change after multiplication of the argument by domain's unit.