arithmoi-0.6.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2016 Andrew Lelechenko
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
StabilityProvisional
PortabilityNon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.UniqueFactorisation

Description

An abstract type class for unique factorisation domains.

Synopsis

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.

Minimal complete definition

unPrime, factorise

Methods

unPrime :: Prime a -> a Source #

factorise :: a -> [(Prime a, Word)] Source #