spe-0.6.3: Combinatorial species lite

MaintainerAnders Claesson <anders.claesson@gmail.com>
Safe HaskellSafe-Inferred

Math.Spe

Contents

Description

License : BSD-3

Species lite. See http://github.com/akc/spe for an introduction and examples.

Synopsis

The species type synonym

type Spe a c = [a] -> [c]Source

A combinatorial species is an endofunctor on the category of finite sets and bijections. We approximate this by a function as defined.

Constructions

(.+.) :: Spe a b -> Spe a c -> Spe a (Either b c)Source

Species addition.

assemble :: [Spe a c] -> Spe a cSource

The sum of a list of species of the same type.

(.*.) :: Spe a b -> Spe a c -> Spe a (b, c)Source

Species multiplication.

(<*.) :: Spe a b -> Spe a c -> Spe a (b, c)Source

Ordinal L-species multiplication. Given that the underlying set is sorted, elements in the left factor will be smaller than those in the right factor.

prod :: [Spe a b] -> Spe a [b]Source

The product of a list of species.

ordProd :: [Spe a b] -> Spe a [b]Source

The ordinal product of a list of L-species.

(.^) :: Spe a b -> Int -> Spe a [b]Source

The power F^k for species F.

(<^) :: Spe a b -> Int -> Spe a [b]Source

The ordinal power F^k for L-species F.

(><) :: Spe a b -> Spe a c -> Spe a (b, c)Source

The Cartesian product of two species.

o :: Spe [a] b -> Spe a c -> Spe a (b, [c])Source

The (partitional) composition F(G) of two species F and G. It is usually used infix.

dx :: Spe (Maybe a) b -> Spe a bSource

The derivative d/dX F of a species F.

pointed :: Spe a b -> Spe a (b, a)Source

The pointing operator.

ofSize :: Spe a c -> Int -> Spe a cSource

f ofSize n is like f on n element sets, but empty otherwise.

nonEmpty :: Spe a c -> Spe a cSource

No structure on the empty set, but otherwise the same.

Contact of order n

contact :: Ord b => Int -> Spe Int b -> Spe Int b -> BoolSource

Check whether two species have contact of order n.

Specific species

set :: Spe a [a]Source

The species of sets.

one :: Spe a [b]Source

The species characteristic of the empty set; the identity with respect to species multiplication.

x :: Spe a aSource

The singleton species.

kBal :: Int -> Spe a [[a]]Source

The species of ballots with k blocks.

bal :: Spe a [[a]]Source

The species of ballots.

par :: Spe a [[a]]Source

The species of set partitions.

kList :: Int -> Spe a [a]Source

The species of lists (linear orders) with k elements.

list :: Spe a [a]Source

The species of lists (linear orders).

cyc :: Spe a [a]Source

The species of cycles.

perm :: Spe a [[a]]Source

The species of permutations (sets of cycles).

kSubset :: Int -> Spe a [a]Source

The species of k element subsets.

subset :: Spe a [a]Source

The species of subsets. The definition given here is equivalent to subset = map fst . (set .*. set), but a bit more efficient.