arithmoi-0.8.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 :: *) :: * #

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 # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Int
type Prime Integer # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Natural # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Word # 
Instance details

Defined in Math.NumberTheory.Primes.Types

type Prime Word
type Prime GaussianInteger # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

type Prime EisensteinInteger # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

type Prime (Prefactored a) # 
Instance details

Defined in Math.NumberTheory.Prefactored

type Prime (Prefactored a) = Prime a

class UniqueFactorisation a where #

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 #

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

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

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

Instances
UniqueFactorisation Int # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

Methods

unPrime :: Prime Int -> Int #

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

isPrime :: Int -> Maybe (Prime Int) #

UniqueFactorisation Integer # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation Natural # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation Word # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation GaussianInteger # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

UniqueFactorisation EisensteinInteger # 
Instance details

Defined in Math.NumberTheory.UniqueFactorisation

(Eq a, Num a, UniqueFactorisation a) => UniqueFactorisation (Prefactored a) # 
Instance details

Defined in Math.NumberTheory.Prefactored