HaskellForMaths-0.4.3: Combinatorics, group theory, commutative algebra, non-commutative algebra

Safe HaskellSafe-Infered



A module of simple utility functions which are used throughout the rest of the library



toSet :: Ord a => [a] -> [a]Source

mergeSet :: Ord a => [a] -> [a] -> [a]Source

pairs :: [a] -> [(a, a)]Source

ordpair :: Ord t => t -> t -> (t, t)Source

foldcmpl :: (t -> t -> Bool) -> [t] -> BoolSource

cmpfst :: Ord a => (a, b) -> (a, b1) -> OrderingSource

eqfst :: Eq a => (a, b) -> (a, b1) -> BoolSource

fromBase :: Num a => a -> [a] -> aSource

powersetdfs :: [a] -> [[a]]Source

Given a set xs, represented as an ordered list, powersetdfs xs returns the list of all subsets of xs, in lex order

powersetbfs :: [a] -> [[a]]Source

Given a set xs, represented as an ordered list, powersetbfs xs returns the list of all subsets of xs, in shortlex order

combinationsOf :: Int -> [a] -> [[a]]Source

Given a positive integer k, and a set xs, represented as a list, combinationsOf k xs returns all k-element subsets of xs. The result will be in lex order, relative to the order of the xs.

choose :: Integral a => a -> a -> aSource

choose n k is the number of ways of choosing k distinct elements from an n-set

class FinSet x whereSource

The class of finite sets


elts :: [x]Source

class Num a => HasInverses a whereSource

A class representing algebraic structures having an inverse operation. Although strictly speaking the Num precondition means that we are requiring the structure also to be a ring, we do sometimes bend the rules (eg permutation groups). Note also that we don't insist that every element has an inverse.


inverse :: a -> aSource


(Ord a, Show a) => HasInverses (Permutation a)

The HasInverses instance is what enables us to write g^-1 for the inverse of a group element.

HasInverses (GroupAlgebra Q)

Note that the inverse of a group algebra element can only be efficiently calculated if the group generated by the non-zero terms is very small (eg <100 elements).

(^-) :: (HasInverses a, Integral b) => a -> b -> aSource

A trick: x^-1 returns the inverse of x