arithmoi-0.8.0.0: Efficient basic number-theoretic functions.

Copyright (c) 2016 Andrew Lelechenko MIT Andrew Lelechenko Provisional Non-portable (GHC extensions) None Haskell2010

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.

abs (unPrime n) == unPrime n must hold for all n of type Prime t

Instances
 type Prime Int Source # Instance detailsDefined in Math.NumberTheory.Primes.Types type Prime Int type Prime Integer Source # Instance detailsDefined in Math.NumberTheory.Primes.Types type Prime Integer type Prime Natural Source # Instance detailsDefined in Math.NumberTheory.Primes.Types type Prime Natural type Prime Word Source # Instance detailsDefined in Math.NumberTheory.Primes.Types type Prime Word Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation type Prime (Prefactored a) Source # Instance detailsDefined in Math.NumberTheory.Prefactored type Prime (Prefactored a) = Prime a

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

Methods

unPrime :: Prime a -> a Source #

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

isPrime :: a -> Maybe (Prime a) Source #

isPrime :: (Eq a, Num a) => a -> Maybe (Prime a) Source #

Instances
 Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methodsfactorise :: Int -> [(Prime Int, Word)] Source # Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methodsfactorise :: Integer -> [(Prime Integer, Word)] Source # Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methodsfactorise :: Natural -> [(Prime Natural, Word)] Source # Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methodsfactorise :: Word -> [(Prime Word, Word)] Source # Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methods Source # Instance detailsDefined in Math.NumberTheory.UniqueFactorisation Methods Source # Instance detailsDefined in Math.NumberTheory.Prefactored Methodsfactorise :: Prefactored a -> [(Prime (Prefactored a), Word)] Source #