-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Combinatorics, group theory, commutative algebra, non-commutative algebra -- -- A library of maths code in the areas of combinatorics, group theory, -- commutative algebra, and non-commutative algebra. The library is -- mainly intended as an educational resource, but does have efficient -- implementations of several fundamental algorithms. @package HaskellForMaths @version 0.4.9 module Math.Algebra.Group.StringRewriting -- | Given a list of rewrite rules of the form (left,right), and a word, -- rewrite it by repeatedly replacing any left substring in the word by -- the corresponding right rewrite :: Eq a => [([a], [a])] -> [a] -> [a] rewrite1 :: Eq a => ([a], [a]) -> [a] -> Maybe [a] splitSubstring :: Eq a => [a] -> [a] -> Maybe ([a], [a]) findOverlap :: Eq a => [a] -> [a] -> Maybe ([a], [a], [a]) knuthBendix1 :: Ord a => [([a], [a])] -> [([a], [a])] ordpair :: (Ord (t a), Foldable t) => t a -> t a -> Maybe (t a, t a) shortlex :: (Ord (t a), Foldable t) => t a -> t a -> Ordering knuthBendix2 :: Ord a => [([a], [a])] -> [([a], [a])] merge :: Ord a => [a] -> [a] -> [a] knuthBendix3 :: Ord a => [([a], [a])] -> [([a], [a])] -- | Implementation of the Knuth-Bendix algorithm. Given a list of -- relations, return a confluent rewrite system. The algorithm is not -- guaranteed to terminate. knuthBendix :: Ord a => [([a], [a])] -> [([a], [a])] -- | Given generators and a confluent rewrite system, return (normal forms -- of) all elements nfs :: Ord a => ([a], [([a], [a])]) -> [[a]] -- | Given generators and relations, return (normal forms of) all elements elts :: Ord a => ([a], [([a], [a])]) -> [[a]] newtype SGen S :: Int -> SGen s_ :: Int -> SGen s1 :: SGen s2 :: SGen s3 :: SGen _S :: () => Int -> ([SGen], [([SGen], [a])]) _S' :: Int -> ([SGen], [([SGen], [SGen])]) tri :: Int -> Int -> Int -> ([Char], [([Char], [Char])]) _D :: Int -> Int -> Int -> ([Char], [([Char], [Char])]) instance GHC.Classes.Ord Math.Algebra.Group.StringRewriting.SGen instance GHC.Classes.Eq Math.Algebra.Group.StringRewriting.SGen instance GHC.Show.Show Math.Algebra.Group.StringRewriting.SGen -- | A module defining the type and operations of free k-vector spaces over -- a basis b (for a field k) module Math.Algebras.VectorSpace -- | Given a field type k and a basis type b, Vect k b is the type of the -- free k-vector space over b. Elements (values) of Vect k b consist of -- k-linear combinations of elements (values) of b. -- -- In order for Vect k b to be a vector space, it is necessary that k is -- a field (that is, an instance of Fractional). In practice, we often -- relax this condition, and require that k is a ring (that is, an -- instance of Num). In that case, Vect k b should more correctly be -- called (the type of) the free k-module over b. -- -- Most of the code requires that b is an instance of Ord. This is -- primarily to enable us to simplify to a normal form. newtype Vect k b V :: [(b, k)] -> Vect k b -- | Return the coefficient of the specified basis element in a vector coeff :: (Num k, Eq b) => b -> Vect k b -> k -- | Remove the term for a specified basis element from a vector removeTerm :: (Eq k, Num k, Ord b) => b -> Vect k b -> Vect k b -- | The zero vector zerov :: Vect k b -- | Addition of vectors add :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b -- | Addition of vectors (same as add) (<+>) :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b infixl 6 <+> -- | Sum of a list of vectors sumv :: (Eq k, Num k, Ord b) => [Vect k b] -> Vect k b -- | Negation of a vector negatev :: (Eq k, Num k) => Vect k b -> Vect k b -- | Subtraction of vectors (<->) :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -> Vect k b infixl 6 <-> -- | Scalar multiplication (on the left) smultL :: (Eq k, Num k) => k -> Vect k b -> Vect k b -- | Same as smultL. Mnemonic is "multiply through (from the left)" (*>) :: (Eq k, Num k) => k -> Vect k b -> Vect k b infixr 7 *> -- | Scalar multiplication on the right smultR :: (Eq k, Num k) => Vect k b -> k -> Vect k b -- | Same as smultR. Mnemonic is "multiply through (from the right)" (<*) :: (Eq k, Num k) => Vect k b -> k -> Vect k b infixl 7 <* -- | Convert an element of Vect k b into normal form. Normal form consists -- in having the basis elements in ascending order, with no duplicates, -- and all coefficients non-zero nf :: (Eq k, Num k, Ord b) => Vect k b -> Vect k b -- | A linear map between vector spaces A and B can be defined by giving -- its action on the basis elements of A. The action on all elements of A -- then follows by linearity. -- -- If we have A = Vect k a, B = Vect k b, and f :: a -> Vect k b is a -- function from the basis elements of A into B, then linear f -- is the linear map that this defines by linearity. linear :: (Eq k, Num k, Ord b) => (a -> Vect k b) -> Vect k a -> Vect k b -- | Trivial k is the field k considered as a k-vector space. In maths, we -- would not normally make a distinction here, but in the code, we need -- this if we want to be able to put k as one side of a tensor product. type Trivial k = Vect k () -- | Wrap an element of the field k to an element of the trivial k-vector -- space wrap :: (Eq k, Num k) => k -> Vect k () -- | Unwrap an element of the trivial k-vector space to an element of the -- field k unwrap :: Num k => Vect k () -> k -- | Given a finite vector space basis b, Dual b can be used to represent a -- basis for the dual vector space. The intention is that for a given -- individual basis element b_i, (Dual b_i) represents the indicator -- function for b_i, which takes b_i to 1 and all other basis elements to -- 0. -- -- (Note that if the basis b is infinite, then Dual b may only represent -- a sub-basis of the dual vector space.) newtype Dual b Dual :: b -> Dual b instance GHC.Classes.Ord b => GHC.Classes.Ord (Math.Algebras.VectorSpace.Dual b) instance GHC.Classes.Eq b => GHC.Classes.Eq (Math.Algebras.VectorSpace.Dual b) instance GHC.Classes.Ord Math.Algebras.VectorSpace.EBasis instance GHC.Classes.Eq Math.Algebras.VectorSpace.EBasis instance (GHC.Classes.Ord b, GHC.Classes.Ord k) => GHC.Classes.Ord (Math.Algebras.VectorSpace.Vect k b) instance (GHC.Classes.Eq b, GHC.Classes.Eq k) => GHC.Classes.Eq (Math.Algebras.VectorSpace.Vect k b) instance GHC.Show.Show basis => GHC.Show.Show (Math.Algebras.VectorSpace.Dual basis) instance GHC.Show.Show Math.Algebras.VectorSpace.EBasis instance (GHC.Show.Show k, GHC.Classes.Eq k, GHC.Num.Num k, GHC.Show.Show b) => GHC.Show.Show (Math.Algebras.VectorSpace.Vect k b) instance GHC.Base.Functor (Math.Algebras.VectorSpace.Vect k) instance GHC.Num.Num k => GHC.Base.Applicative (Math.Algebras.VectorSpace.Vect k) instance GHC.Num.Num k => GHC.Base.Monad (Math.Algebras.VectorSpace.Vect k) -- | A module defining direct sum and tensor product of vector spaces module Math.Algebras.TensorProduct -- | A type for constructing a basis for the direct sum of vector spaces. -- The direct sum of Vect k a and Vect k b is Vect k (DSum a b) type DSum a b = Either a b -- | Injection of left summand into direct sum i1 :: Vect k a -> Vect k (DSum a b) -- | Injection of right summand into direct sum i2 :: Vect k b -> Vect k (DSum a b) -- | The coproduct of two linear functions (with the same target). -- Satisfies the universal property that f == coprodf f g . i1 and g == -- coprodf f g . i2 coprodf :: (Eq k, Num k, Ord t) => (Vect k a -> Vect k t) -> (Vect k b -> Vect k t) -> Vect k (DSum a b) -> Vect k t -- | Projection onto left summand from direct sum p1 :: (Eq k, Num k, Ord a) => Vect k (DSum a b) -> Vect k a -- | Projection onto right summand from direct sum p2 :: (Eq k, Num k, Ord b) => Vect k (DSum a b) -> Vect k b -- | The product of two linear functions (with the same source). Satisfies -- the universal property that f == p1 . prodf f g and g == p2 . prodf f -- g prodf :: (Eq k, Num k, Ord a, Ord b) => (Vect k s -> Vect k a) -> (Vect k s -> Vect k b) -> Vect k s -> Vect k (DSum a b) -- | The direct sum of two vector space elements dsume :: (Eq k, Num k, Ord a, Ord b) => Vect k a -> Vect k b -> Vect k (DSum a b) infix 6 `dsume` -- | The direct sum of two linear functions. Satisfies the universal -- property that f == p1 . dsumf f g . i1 and g == p2 . dsumf f g . i2 dsumf :: (Eq k, Num k, Ord a, Ord b, Ord a', Ord b') => (Vect k a -> Vect k a') -> (Vect k b -> Vect k b') -> Vect k (DSum a b) -> Vect k (DSum a' b') infix 6 `dsumf` -- | A type for constructing a basis for the tensor product of vector -- spaces. The tensor product of Vect k a and Vect k b is Vect k (Tensor -- a b) type Tensor a b = (a, b) -- | The tensor product of two vector space elements te :: Num k => Vect k a -> Vect k b -> Vect k (Tensor a b) infix 7 `te` -- | The tensor product of two linear functions tf :: (Eq k, Num k, Ord a', Ord b') => (Vect k a -> Vect k a') -> (Vect k b -> Vect k b') -> Vect k (Tensor a b) -> Vect k (Tensor a' b') infix 7 `tf` assocL :: Vect k (Tensor a (Tensor b c)) -> Vect k (Tensor (Tensor a b) c) assocR :: Vect k (Tensor (Tensor a b) c) -> Vect k (Tensor a (Tensor b c)) unitInL :: Vect k a -> Vect k (Tensor () a) unitOutL :: Vect k (Tensor () a) -> Vect k a unitInR :: Vect k a -> Vect k (Tensor a ()) unitOutR :: Vect k (Tensor a ()) -> Vect k a twist :: (Eq k, Num k, Ord a, Ord b) => Vect k (Tensor a b) -> Vect k (Tensor b a) distrL :: (Eq k, Num k, Ord a, Ord b, Ord c) => Vect k (Tensor a (DSum b c)) -> Vect k (DSum (Tensor a b) (Tensor a c)) undistrL :: (Eq k, Num k, Ord a, Ord b, Ord c) => Vect k (DSum (Tensor a b) (Tensor a c)) -> Vect k (Tensor a (DSum b c)) distrR :: Vect k (Tensor (DSum a b) c) -> Vect k (DSum (Tensor a c) (Tensor b c)) undistrR :: Vect k (DSum (Tensor a c) (Tensor b c)) -> Vect k (Tensor (DSum a b) c) ev :: (Eq k, Num k, Ord b) => Vect k (Tensor (Dual b) b) -> k delta :: (Eq a, Num p) => a -> a -> p reify :: (Eq k, Num k, Ord b) => Vect k (Dual b) -> Vect k b -> k -- | A module defining various algebraic structures that can be defined on -- vector spaces - specifically algebra, coalgebra, bialgebra, Hopf -- algebra, module, comodule module Math.Algebras.Structures -- | Monoid class Mon m munit :: Mon m => m mmult :: Mon m => m -> m -> m -- | Caution: If we declare an instance Algebra k b, then we are saying -- that the vector space Vect k b is a k-algebra. In other words, we are -- saying that b is the basis for a k-algebra. So a more accurate name -- for this class would have been AlgebraBasis. class Algebra k b unit :: Algebra k b => k -> Vect k b mult :: Algebra k b => Vect k (Tensor b b) -> Vect k b -- | Sometimes it is more convenient to work with this version of unit. unit' :: (Eq k, Num k, Algebra k b) => Vect k () -> Vect k b -- | An instance declaration for Coalgebra k b is saying that the vector -- space Vect k b is a k-coalgebra. class Coalgebra k b counit :: Coalgebra k b => Vect k b -> k comult :: Coalgebra k b => Vect k b -> Vect k (Tensor b b) -- | Sometimes it is more convenient to work with this version of counit. counit' :: (Eq k, Num k, Coalgebra k b) => Vect k b -> Vect k () -- | A bialgebra is an algebra which is also a coalgebra, subject to the -- compatibility conditions that counit and comult must be algebra -- morphisms (or equivalently, that unit and mult must be coalgebra -- morphisms) class (Algebra k b, Coalgebra k b) => Bialgebra k b class Bialgebra k b => HopfAlgebra k b antipode :: HopfAlgebra k b => Vect k b -> Vect k b newtype Op b Op :: b -> Op b newtype SetCoalgebra b SC :: b -> SetCoalgebra b newtype MonoidCoalgebra m MC :: m -> MonoidCoalgebra m class Algebra k a => Module k a m action :: Module k a m => Vect k (Tensor a m) -> Vect k m (*.) :: (Module k a m, Num k) => Vect k a -> Vect k m -> Vect k m class Coalgebra k c => Comodule k c n coaction :: Comodule k c n => Vect k n -> Vect k (Tensor c n) -- | A pairing is a non-degenerate bilinear form U x V -> k. We are -- typically interested in pairings having additional properties. For -- example: -- --
-- [t,u,v,x,y,z] = map glexvar ["t","u","v","x","y","z"] --module Math.CommutativeAlgebra.Polynomial -- | In order to work with monomials, we need to be able to multiply them -- and divide them. Multiplication is defined by the Mon (monoid) class. -- Division is defined in this class. The functions here are primarily -- intended for internal use only. class (Eq m, Show m, Mon m) => Monomial m mdivides :: Monomial m => m -> m -> Bool mdiv :: Monomial m => m -> m -> m mgcd :: Monomial m => m -> m -> m mlcm :: Monomial m => m -> m -> m mcoprime :: Monomial m => m -> m -> Bool mdeg :: Monomial m => m -> Int mproperlydivides :: Monomial m => m -> m -> Bool -- | We want to be able to construct monomials over any set of variables -- that we choose. Although we will often use String as the type of our -- variables, it is useful to define polymorphic types for monomials. class MonomialConstructor m mvar :: MonomialConstructor m => v -> m v mindices :: MonomialConstructor m => m v -> [(v, Int)] -- | var v creates a variable in the vector space of polynomials. -- For example, if we want to work in Q[x,y,z], we might define: -- --
-- [x,y,z] = map var ["x","y","z"] :: [GlexPoly Q String] ---- -- Notice that, in general, it is necessary to provide a type annotation -- so that the compiler knows which field and which term order to use. var :: (Num k, MonomialConstructor m) => v -> Vect k (m v) -- | The underlying implementation of monomials in variables of type v. -- Most often, we will be interested in MonImpl String, with the variable -- "x" represented by M 1 [("x",1)]. However, other types can be used -- instead. -- -- No Ord instance is defined for MonImpl v, so it cannot be used as the -- basis for a free vector space of polynomials. Instead, several -- different newtype wrappers are provided, corresponding to different -- monomial orderings. data MonImpl v M :: Int -> [(v, Int)] -> MonImpl v -- | A type representing monomials with Lex ordering. -- -- Lex stands for lexicographic ordering. For example, in Lex ordering, -- monomials up to degree two would be ordered as follows: -- x^2+xy+xz+x+y^2+yz+y+z^2+z+1. newtype Lex v Lex :: MonImpl v -> Lex v -- | A type representing polynomials with Lex term ordering. type LexPoly k v = Vect k (Lex v) -- | lexvar v creates a variable in the algebra of commutative -- polynomials over Q with Lex term ordering. It is provided as a -- shortcut, to avoid having to provide a type annotation, as with -- var. For example, the following code creates variables called -- x, y and z: -- --
-- [x,y,z] = map lexvar ["x","y","z"] --lexvar :: v -> LexPoly Q v -- | A type representing monomials with Glex ordering. -- -- Glex stands for graded lexicographic. Thus monomials are ordered first -- by degree, then by lexicographic order. For example, in Glex ordering, -- monomials up to degree two would be ordered as follows: -- x^2+xy+xz+y^2+yz+z^2+x+y+z+1. newtype Glex v Glex :: MonImpl v -> Glex v -- | A type representing polynomials with Glex term ordering. type GlexPoly k v = Vect k (Glex v) -- | glexvar v creates a variable in the algebra of commutative -- polynomials over Q with Glex term ordering. It is provided as a -- shortcut, to avoid having to provide a type annotation, as with -- var. For example, the following code creates variables called -- x, y and z: -- --
-- [x,y,z] = map glexvar ["x","y","z"] --glexvar :: v -> GlexPoly Q v -- | A type representing monomials with Grevlex ordering. -- -- Grevlex stands for graded reverse lexicographic. Thus monomials are -- ordered first by degree, then by reverse lexicographic order. For -- example, in Grevlex ordering, monomials up to degree two would be -- ordered as follows: x^2+xy+y^2+xz+yz+z^2+x+y+z+1. -- -- In general, Grevlex leads to the smallest Groebner bases. newtype Grevlex v Grevlex :: MonImpl v -> Grevlex v -- | A type representing polynomials with Grevlex term ordering. type GrevlexPoly k v = Vect k (Grevlex v) -- | grevlexvar v creates a variable in the algebra of commutative -- polynomials over Q with Grevlex term ordering. It is provided as a -- shortcut, to avoid having to provide a type annotation, as with -- var. For example, the following code creates variables called -- x, y and z: -- --
-- [x,y,z] = map grevlexvar ["x","y","z"] --grevlexvar :: v -> GrevlexPoly Q v data Elim2 a b Elim2 :: !a -> !b -> Elim2 a b -- | Given (Num k, MonomialConstructor m), then Vect k (m v) is the free -- commutative algebra over v. As such, it is a monad (in the -- mathematical sense). The following pseudo-code (not legal Haskell) -- shows how this would work: -- --
-- instance (Num k, Monomial m) => Monad (\v -> Vect k (m v)) where -- return = var -- (>>=) = bind ---- -- bind corresponds to variable substitution, so v `bind` f -- returns the result of making the substitutions encoded in f into v. -- -- Note that the type signature is slightly more general than that -- required by (>>=). For a monad, we would only require: -- --
-- bind :: (MonomialConstructor m, Num k, Ord (m v), Show (m v), Algebra k (m v)) => -- Vect k (m u) -> (u -> Vect k (m v)) -> Vect k (m v) ---- -- Instead, the given type signature allows us to substitute in elements -- of any algebra. This is occasionally useful. -- -- bind performs variable substitution bind :: (Eq k, Num k, MonomialConstructor m, Ord a, Show a, Algebra k a) => Vect k (m v) -> (v -> Vect k a) -> Vect k a flipbind :: (Num k, Ord b, Eq k, Show b, Algebra k b, MonomialConstructor m) => (t -> Vect k b) -> Vect k (m t) -> Vect k b -- | Evaluate a polynomial at a point. For example eval (x^2+y^2) -- [(x,1),(y,2)] evaluates x^2+y^2 at the point (x,y)=(1,2). eval :: (Eq k, Num k, MonomialConstructor m, Eq (m v), Show v) => Vect k (m v) -> [(Vect k (m v), k)] -> k -- | Perform variable substitution on a polynomial. For example subst -- (x*z-y^2) [(x,u^2),(y,u*v),(z,v^2)] performs the substitution x -- -> u^2, y -> u*v, z -> v^2. subst :: (Eq k, Num k, MonomialConstructor m, Eq (m u), Show u, Ord (m v), Show (m v), Algebra k (m v)) => Vect k (m u) -> [(Vect k (m u), Vect k (m v))] -> Vect k (m v) -- | List the variables used in a polynomial vars :: (Num k, Ord k, MonomialConstructor m, Ord (m v)) => Vect k (m v) -> [Vect k (m v)] lt :: () => Vect k b -> (b, k) lm :: () => Vect b c -> c lc :: () => Vect c a -> c deg :: Monomial m => Vect k m -> Int toMonic :: (Eq k, Ord b, Show b, Algebra k b, Fractional k) => Vect k b -> Vect k b tdivides :: Monomial m => (m, b1) -> (m, b2) -> Bool tdiv :: (Monomial a, Fractional b) => (a, b) -> (a, b) -> (a, b) tgcd :: (Monomial a, Num b1) => (a, b2) -> (a, b3) -> (a, b1) tmult :: (Mon a, Num b) => (a, b) -> (a, b) -> (a, b) (*->) :: (Mon b, Num k) => (b, k) -> Vect k b -> Vect k b infixl 7 *-> quotRemMP :: (Monomial m, Fractional b, Eq b, Ord m, Algebra b m) => Vect b m -> [Vect b m] -> ([Vect b m], Vect b m) rewrite :: (Eq b, Ord m, Algebra b m, Monomial m, Fractional b) => Vect b m -> [Vect b m] -> Vect b m -- | f %% gs is the reduction of a polynomial f with respect to a -- list of polynomials gs. In the case where the gs are a Groebner basis -- for an ideal I, then f %% gs is the equivalence class -- representative of f in R/I, and is zero if and only if f is in I. (%%) :: (Eq k, Fractional k, Monomial m, Ord m, Algebra k m) => Vect k m -> [Vect k m] -> Vect k m infixl 7 %% instance GHC.Base.Functor (Math.CommutativeAlgebra.Polynomial.Elim2 a) instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance Math.CommutativeAlgebra.Polynomial.MonomialConstructor Math.CommutativeAlgebra.Polynomial.Grevlex instance (GHC.Classes.Ord v, GHC.Show.Show v) => Math.CommutativeAlgebra.Polynomial.Monomial (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance GHC.Classes.Ord v => Math.Algebras.Structures.Mon (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance GHC.Base.Functor Math.CommutativeAlgebra.Polynomial.Grevlex instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance Math.CommutativeAlgebra.Polynomial.MonomialConstructor Math.CommutativeAlgebra.Polynomial.Glex instance (GHC.Classes.Ord v, GHC.Show.Show v) => Math.CommutativeAlgebra.Polynomial.Monomial (Math.CommutativeAlgebra.Polynomial.Glex v) instance GHC.Classes.Ord v => Math.Algebras.Structures.Mon (Math.CommutativeAlgebra.Polynomial.Glex v) instance GHC.Base.Functor Math.CommutativeAlgebra.Polynomial.Glex instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.CommutativeAlgebra.Polynomial.Glex v) instance Math.CommutativeAlgebra.Polynomial.MonomialConstructor Math.CommutativeAlgebra.Polynomial.Lex instance (GHC.Classes.Ord v, GHC.Show.Show v) => Math.CommutativeAlgebra.Polynomial.Monomial (Math.CommutativeAlgebra.Polynomial.Lex v) instance GHC.Classes.Ord v => Math.Algebras.Structures.Mon (Math.CommutativeAlgebra.Polynomial.Lex v) instance GHC.Base.Functor Math.CommutativeAlgebra.Polynomial.Lex instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.CommutativeAlgebra.Polynomial.Lex v) instance GHC.Base.Functor Math.CommutativeAlgebra.Polynomial.MonImpl instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.CommutativeAlgebra.Polynomial.MonImpl v) instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance (Math.Algebras.Structures.Mon a, Math.Algebras.Structures.Mon b) => Math.Algebras.Structures.Mon (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance (Math.CommutativeAlgebra.Polynomial.Monomial a, Math.CommutativeAlgebra.Polynomial.Monomial b) => Math.CommutativeAlgebra.Polynomial.Monomial (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord a, Math.Algebras.Structures.Mon a, GHC.Classes.Ord b, Math.Algebras.Structures.Mon b) => Math.Algebras.Structures.Algebra k (Math.CommutativeAlgebra.Polynomial.Elim2 a b) instance GHC.Show.Show v => GHC.Show.Show (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord v, GHC.Show.Show v) => Math.Algebras.Structures.Algebra k (Math.CommutativeAlgebra.Polynomial.Grevlex v) instance GHC.Show.Show v => GHC.Show.Show (Math.CommutativeAlgebra.Polynomial.Glex v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.CommutativeAlgebra.Polynomial.Glex v) instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord v, GHC.Show.Show v) => Math.Algebras.Structures.Algebra k (Math.CommutativeAlgebra.Polynomial.Glex v) instance GHC.Show.Show v => GHC.Show.Show (Math.CommutativeAlgebra.Polynomial.Lex v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.CommutativeAlgebra.Polynomial.Lex v) instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord v, GHC.Show.Show v) => Math.Algebras.Structures.Algebra k (Math.CommutativeAlgebra.Polynomial.Lex v) instance GHC.Show.Show v => GHC.Show.Show (Math.CommutativeAlgebra.Polynomial.MonImpl v) instance GHC.Classes.Ord v => Math.Algebras.Structures.Mon (Math.CommutativeAlgebra.Polynomial.MonImpl v) instance (GHC.Classes.Ord v, GHC.Show.Show v) => Math.CommutativeAlgebra.Polynomial.Monomial (Math.CommutativeAlgebra.Polynomial.MonImpl v) instance Math.CommutativeAlgebra.Polynomial.MonomialConstructor Math.CommutativeAlgebra.Polynomial.MonImpl instance (GHC.Classes.Eq k, GHC.Real.Fractional k, Math.CommutativeAlgebra.Polynomial.Monomial m, GHC.Classes.Ord m, Math.Algebras.Structures.Algebra k m) => GHC.Real.Fractional (Math.Algebras.VectorSpace.Vect k m) -- | A module providing an efficient implementation of the Buchberger -- algorithm for calculating the (reduced) Groebner basis for an ideal, -- together with some straightforward applications. module Math.CommutativeAlgebra.GroebnerBasis sPoly :: (Eq b3, Ord b, Algebra b3 b, Fractional b3, Monomial b) => Vect b3 b -> Vect b3 b -> Vect b3 b isGB :: (Eq b3, Fractional b3, Monomial b, Ord b, Algebra b3 b) => [Vect b3 b] -> Bool gb1 :: (Fractional b3, Monomial b, Ord b, Algebra b3 b, Eq b3) => [Vect b3 b] -> [Vect b3 b] pairWith :: () => (a1 -> a1 -> a2) -> [a1] -> [a2] reduce :: (Fractional k, Monomial b, Ord k, Ord b, Algebra k b) => [Vect k b] -> [Vect k b] gb2 :: (Fractional k, Monomial b, Ord k, Ord b, Algebra k b) => [Vect k b] -> [Vect k b] (!) :: () => [a] -> Int -> a gb2a :: (Fractional k, Monomial b, Ord k, Ord b, Algebra k b) => [Vect k b] -> [Vect k b] gb3 :: (Fractional k, Monomial b, Ord k, Ord b, Algebra k b) => [Vect k b] -> [Vect k b] gb4 :: (Fractional k, Monomial b, Ord b, Ord k, Algebra k b) => [Vect k b] -> [Vect k b] mergeBy :: () => (a -> a -> Ordering) -> [a] -> [a] -> [a] -- | Given a list of polynomials over a field, return a Groebner basis for -- the ideal generated by the polynomials. gb :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] sugar :: (Monomial m1, Monomial m2, Monomial m3) => Vect b1 m2 -> Vect b2 m3 -> m1 -> Int cmpNormal :: (Ord a1, Ord b) => ((a2, a1), (a3, b)) -> ((a4, a1), (a5, b)) -> Ordering cmpSug :: (Ord a1, Ord b, Ord c, Num a1) => ((a1, b), (a2, c)) -> ((a1, b), (a3, c)) -> Ordering memberGB :: (Eq k, Fractional k, Monomial m, Ord m, Algebra k m) => Vect k m -> [Vect k m] -> Bool -- | memberI f gs returns whether f is in the ideal generated by -- gs memberI :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => Vect k m -> [Vect k m] -> Bool -- | Given ideals I and J, their sum is defined as I+J = {f+g | f <- I, -- g <- J}. -- -- If fs and gs are generators for I and J, then sumI fs gs -- returns generators for I+J. -- -- The geometric interpretation is that the variety of the sum is the -- intersection of the varieties, ie V(I+J) = V(I) intersect V(J) sumI :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Vect k m] -- | Given ideals I and J, their product I.J is the ideal generated by all -- products {f.g | f <- I, g <- J}. -- -- If fs and gs are generators for I and J, then productI fs gs -- returns generators for I.J. -- -- The geometric interpretation is that the variety of the product is the -- union of the varieties, ie V(I.J) = V(I) union V(J) productI :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Vect k m] -- | The intersection of ideals I and J is the set of all polynomials which -- belong to both I and J. -- -- If fs and gs are generators for I and J, then intersectI fs -- gs returns generators for the intersection of I and J -- -- The geometric interpretation is that the variety of the intersection -- is the union of the varieties, ie V(I intersect J) = V(I) union V(J). -- -- The reason for prefering the intersection over the product is that the -- intersection of radical ideals is radical, whereas the product need -- not be. intersectI :: (Fractional k, Ord k, Monomial m, Ord m) => [Vect k m] -> [Vect k m] -> [Vect k m] toElimFst :: (Functor f, Mon b) => f a -> f (Elim2 a b) toElimSnd :: (Functor f, Mon a) => f b -> f (Elim2 a b) isElimFst :: (Eq a, Mon a) => Vect b1 (Elim2 a b2) -> Bool fromElimSnd :: Functor f => f (Elim2 a b) -> f b eliminateFst :: (Fractional b1, Monomial a, Monomial b2, Ord b1, Ord a, Ord b2) => [Vect b1 (Elim2 a b2)] -> [Vect b1 b2] -- | Given ideals I and J, their quotient is defined as I:J = {f | f <- -- R, f.g is in I for all g in J}. -- -- If fs and gs are generators for I and J, then quotientI fs gs -- returns generators for I:J. -- -- The ideal quotient is the algebraic analogue of the Zariski closure of -- a difference of varieties. V(I:J) contains the Zariski closure of -- V(I)-V(J), with equality if k is algebraically closed and I is a -- radical ideal. quotientI :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Vect k m] quotientP :: (Monomial m, Fractional k, Algebra k m, Ord m, Ord k) => [Vect k m] -> Vect k m -> [Vect k m] -- | eliminate vs gs returns the elimination ideal obtained from -- the ideal generated by gs by eliminating the variables vs. eliminate :: (Eq k, Fractional k, Ord k, MonomialConstructor m, Monomial (m v), Ord (m v)) => [Vect k (m v)] -> [Vect k (m v)] -> [Vect k (m v)] mbasis :: (Ord a, Num a) => [a] -> [a] -- | Given variables vs, and a Groebner basis gs, mbasisQA vs gs -- returns a monomial basis for the quotient algebra k[vs]/<gs>. -- For example, mbasisQA [x,y] [x^2+y^2-1] returns a monomial -- basis for k[x,y]/<x^2+y^2-1>. In general, the monomial basis is -- likely to be infinite. mbasisQA :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Vect k m] -- | Given an ideal I, the leading term ideal lt(I) consists of the leading -- terms of all elements of I. If I is generated by gs, then ltIdeal -- gs returns generators for lt(I). ltIdeal :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] numMonomials :: Integral a => a -> a -> Integer -- | Given variables vs, and a homogeneous ideal gs, hilbertFunQA vs -- gs returns the Hilbert function for the quotient algebra -- k[vs]/<gs>. Given an integer i, the Hilbert function returns the -- number of degree i monomials in a basis for k[vs]/<gs>. For a -- homogeneous ideal, this number is independent of the monomial ordering -- used (even though the elements of the monomial basis themselves are -- dependent on the ordering). -- -- If the ideal I is not homogeneous, then R/I is not graded, and the -- Hilbert function is not well-defined. Specifically, the number of -- degree i monomials in a basis is likely to depend on which monomial -- ordering you use. hilbertFunQA :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> Int -> Integer hilbertSeriesQA1 :: (Ord k, Fractional k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Int] -- | Given variables vs, and a homogeneous ideal gs, hilbertSeriesQA vs -- gs returns the Hilbert series for the quotient algebra -- k[vs]/<gs>. The Hilbert series should be interpreted as a formal -- power series where the coefficient of t^i is the Hilbert function -- evaluated at i. That is, the i'th element in the series is the number -- of degree i monomials in a basis for k[vs]/<gs>. hilbertSeriesQA :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> [Integer] -- | In the case where every variable v occurs in some generator g of the -- homogeneous ideal (the usual case), then the vs can be inferred from -- the gs. hilbertSeriesQA' gs returns the Hilbert series for -- the quotient algebra k[vs]/<gs>. hilbertSeriesQA' :: (Fractional k, Ord k, MonomialConstructor m, Ord (m v), Monomial (m v), Algebra k (m v)) => [Vect k (m v)] -> [Integer] -- | For i >> 0, the Hilbert function becomes a polynomial in i, -- called the Hilbert polynomial. hilbertPolyQA :: (Fractional k, Ord k, Monomial m, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> GlexPoly Q String hilbertPolyQA' :: (Fractional k, Ord k, MonomialConstructor m, Ord (m v), Monomial (m v), Algebra k (m v)) => [Vect k (m v)] -> GlexPoly Q String dim :: (Fractional k, Monomial m, Ord k, Ord m, Algebra k m) => [Vect k m] -> [Vect k m] -> Int dim' :: (Fractional k, MonomialConstructor m, Ord k, Ord (m v), Monomial (m v), Algebra k (m v)) => [Vect k (m v)] -> Int -- | A module for working with directed graphs (digraphs). Some of the -- functions are specifically for working with directed acyclic graphs -- (DAGs), that is, directed graphs containing no cycles. module Math.Combinatorics.Digraph -- | A digraph is represented as DG vs es, where vs is the list of -- vertices, and es is the list of edges. Edges are directed: an edge -- (u,v) means an edge from u to v. A digraph is considered to be in -- normal form if both es and vs are in ascending order. This is the -- preferred form, and some functions will only work for digraphs in -- normal form. data Digraph v DG :: [v] -> [(v, v)] -> Digraph v nf :: Ord v => Digraph v -> Digraph v vertices :: () => Digraph v -> [v] edges :: () => Digraph v -> [(v, v)] predecessors :: Eq a => Digraph a -> a -> [a] successors :: Eq a => Digraph a -> a -> [a] adjLists :: Ord a => Digraph a -> (Map a [a], Map a [a]) digraphIsos1 :: (Eq a1, Eq a2) => Digraph a1 -> Digraph a2 -> [[(a1, a2)]] digraphIsos2 :: (Ord k2, Ord k1) => Digraph k2 -> Digraph k1 -> [[(k2, k1)]] heightPartitionDAG :: Ord k => Digraph k -> [[k]] isDAG :: Ord a => Digraph a -> Bool dagIsos :: (Ord a1, Ord a2) => Digraph a2 -> Digraph a1 -> [[(a2, a1)]] -- | Are the two DAGs isomorphic? isDagIso :: (Ord a, Ord b) => Digraph a -> Digraph b -> Bool perms :: () => [a] -> [[a]] isoRepDAG1 :: Ord k => Digraph k -> Digraph Int isoRepDAG2 :: (Ord b, Num b, Enum b, Ord a) => Digraph a -> [(a, b)] isoRepDAG3 :: Ord v => Digraph v -> Digraph Int -- | Given a directed acyclic graph (DAG), return a canonical -- representative for its isomorphism class. isoRepDAG dag is -- isomorphic to dag. It follows that if isoRepDAG dagA == -- isoRepDAG dagB then dagA is isomorphic to dagB. -- Conversely, isoRepDAG dag is the minimal element in the -- isomorphism class, subject to some constraints. It follows that if -- dagA is isomorphic to dagB, then isoRepDAG dagA -- == isoRepDAG dagB. -- -- The algorithm of course is faster on some DAGs than others: roughly -- speaking, it prefers "tall" DAGs (long chains) to "wide" DAGs (long -- antichains), and it prefers asymmetric DAGs (ie those with smaller -- automorphism groups). isoRepDAG :: Ord a => Digraph a -> Digraph Int instance GHC.Show.Show v => GHC.Show.Show (Math.Combinatorics.Digraph.Digraph v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.Combinatorics.Digraph.Digraph v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.Combinatorics.Digraph.Digraph v) instance GHC.Base.Functor Math.Combinatorics.Digraph.Digraph -- | A module for doing arithmetic in permutation groups. -- -- Group elements are represented as permutations of underlying sets, and -- are entered and displayed using a Haskell-friendly version of cycle -- notation. For example, the permutation (1 2 3)(4 5) would be entered -- as p [[1,2,3],[4,5]], and displayed as [[1,2,3],[4,5]]. -- Permutations can be defined over arbitrary underlying sets (types), -- not just the integers. -- -- If g and h are group elements, then the expressions -- g*h and g^-1 calculate product and inverse -- respectively. module Math.Algebra.Group.PermutationGroup rotateL :: () => [a] -> [a] -- | A type for permutations, considered as functions or actions which can -- be performed on an underlying set. newtype Permutation a P :: Map a a -> Permutation a fmapP :: Ord a => (t -> a) -> Permutation t -> Permutation a -- | Construct a permutation from a list of cycles. For example, p -- [[1,2,3],[4,5]] returns the permutation that sends 1 to 2, 2 to -- 3, 3 to 1, 4 to 5, 5 to 4. p :: Ord a => [[a]] -> Permutation a fromPairs :: Ord a => [(a, a)] -> Permutation a fromPairs' :: Ord a => [(a, a)] -> Permutation a toPairs :: () => Permutation a -> [(a, a)] fromList :: Ord a => [a] -> Permutation a supp :: () => Permutation a -> [a] -- | x .^ g returns the image of a vertex or point x under the action of -- the permutation g. For example, 1 .^ p [[1,2,3]] returns 2. -- The dot is meant to be a mnemonic for point or vertex. (.^) :: Ord a => a -> Permutation a -> a -- | b -^ g returns the image of an edge or block b under the action of the -- permutation g. For example, [1,2] -^ p [[1,4],[2,3]] returns -- [3,4]. The dash is meant to be a mnemonic for edge or line or block. (-^) :: Ord a => [a] -> Permutation a -> [a] fromCycles :: Ord a => [[a]] -> Permutation a toCycles :: Ord a => Permutation a -> [[a]] cycleOf :: Ord t => Permutation t -> t -> [t] parity :: Ord a => Permutation a -> Int sign :: (Num a1, Ord a2) => Permutation a2 -> a1 orderElt :: Ord a => Permutation a -> Int -- | g ~^ h returns the conjugate of g by h, that is, h^-1*g*h. The tilde -- is meant to a mnemonic, because conjugacy is an equivalence relation. (~^) :: Ord a => Permutation a -> Permutation a -> Permutation a infix 8 ~^ comm :: (HasInverses a, Num a) => a -> a -> a closureS :: Ord a => [a] -> [a -> a] -> Set a closure :: Ord a => [a] -> [a -> a] -> [a] orbit :: Ord t1 => (t1 -> t2 -> t1) -> t1 -> [t2] -> [t1] -- | x .^^ gs returns the orbit of the point or vertex x under the action -- of the gs (.^^) :: Ord a => a -> [Permutation a] -> [a] orbitP :: Ord t => [Permutation t] -> t -> [t] orbitV :: Ord t => [Permutation t] -> t -> [t] -- | b -^^ gs returns the orbit of the block or edge b under the action of -- the gs (-^^) :: Ord a => [a] -> [Permutation a] -> [[a]] orbitB :: Ord a => [Permutation a] -> [a] -> [[a]] orbitE :: Ord a => [Permutation a] -> [a] -> [[a]] action :: Ord t => [t] -> (t -> t) -> Permutation t orbits :: Ord a => [Permutation a] -> [[a]] -- | _C n returns generators for Cn, the cyclic group of order n _C :: Integral a => a -> [Permutation a] _D :: Integral a => a -> [Permutation a] _D2 :: Integral a => a -> [Permutation a] -- | _S n returns generators for Sn, the symmetric group on [1..n] _S :: Integral a => a -> [Permutation a] -- | _A n returns generators for An, the alternating group on [1..n] _A :: Integral a => a -> [Permutation a] -- | Given generators for groups H and K, acting on sets A and B -- respectively, return generators for the direct product H*K, acting on -- the disjoint union A+B (= Either A B) dp :: (Ord a, Ord b) => [Permutation a] -> [Permutation b] -> [Permutation (Either a b)] wr :: (Ord a2, Ord a1) => [Permutation a2] -> [Permutation a1] -> [Permutation (a2, a1)] toSn :: (Ord a1, Num a1, Enum a1, Ord a2) => [Permutation a2] -> [Permutation a1] fromDigits :: (Ord p, Num p) => Permutation [p] -> Permutation p fromDigits' :: Num p => [p] -> p fromBinary :: (Ord p, Num p) => Permutation [p] -> Permutation p fromBinary' :: Num p => [p] -> p -- | Given generators for a group, return a (sorted) list of all elements -- of the group. Implemented using a naive closure algorithm, so only -- suitable for small groups (|G| < 10000) elts :: (Num a, Ord a) => [a] -> [a] eltsS :: (Ord a, Num a) => [a] -> Set a -- | Given generators for a group, return the order of the group (the -- number of elements). Implemented using a naive closure algorithm, so -- only suitable for small groups (|G| < 10000) order :: (Num a, Ord a) => [a] -> Int isMember :: (Ord a, Num a) => [a] -> a -> Bool minsupp :: () => Permutation c -> c orderTGS :: (Num a, Ord c) => [Permutation c] -> a eltsTGS :: Ord c => [Permutation c] -> [Permutation c] tgsFromSgs :: Ord a => [Permutation a] -> [Permutation a] -- | Given a strong generating set, return the order of the group it -- generates. Note that the SGS is assumed to be relative to the natural -- order of the points on which the group acts. orderSGS :: Ord a => [Permutation a] -> Integer -- | Given a base and strong generating set, return the order of the group -- it generates. orderBSGS :: Ord a => ([a], [Permutation a]) -> Integer gens :: (Ord a, Num a) => [a] -> [a] (~^^) :: Ord a => Permutation a -> [Permutation a] -> [Permutation a] conjClass :: Ord a => [Permutation a] -> Permutation a -> [Permutation a] -- | conjClassReps gs returns conjugacy class representatives and sizes for -- the group generated by gs. This implementation is only suitable for -- use with small groups (|G| < 10000). conjClassReps :: (Ord a, Show a) => [Permutation a] -> [(Permutation a, Int)] reduceGens :: (Num a, Ord a) => [a] -> [a] isSubgp :: (Foldable t, Ord a, Num a) => t a -> [a] -> Bool -- | Return the subgroups of a group. Only suitable for use on small groups -- (eg < 100 elts) subgps :: (Ord a, Show a) => [Permutation a] -> [[Permutation a]] isMinimal :: Ord a => Permutation a -> Bool centralizer :: (Num a, Ord a, Foldable t) => [a] -> t a -> [a] centre :: (Num a, Ord a) => [a] -> [a] normalizer :: Ord a => [Permutation a] -> [Permutation a] -> [Permutation a] stabilizer :: Ord a => [Permutation a] -> a -> [Permutation a] ptStab :: Ord a => [Permutation a] -> [a] -> [Permutation a] setStab :: Ord a => [Permutation a] -> [a] -> [Permutation a] normalClosure :: Ord a => [Permutation a] -> [Permutation a] -> [Permutation a] commutatorGp :: Ord a => [Permutation a] -> [Permutation a] -> [Permutation a] derivedSubgp :: Ord a => [Permutation a] -> [Permutation a] (-*-) :: (Ord b, Num b) => [b] -> [b] -> [b] (-*) :: (Ord a, Num a) => [a] -> a -> [a] (*-) :: (Ord a, Num a) => a -> [a] -> [a] -- | isNormal gs ks returns True if <ks> is normal in <gs>. -- Note, it is caller's responsibility to ensure that <ks> is a -- subgroup of <gs> (ie that each k is in <gs>). isNormal :: (Ord a, Show a) => [Permutation a] -> [Permutation a] -> Bool -- | Return the normal subgroups of a group. Only suitable for use on small -- groups (eg < 100 elts) normalSubgps :: (Ord a, Show a) => [Permutation a] -> [[Permutation a]] isSimple :: (Ord a, Show a) => [Permutation a] -> Bool cosets :: (Num a, Ord a) => [a] -> [a] -> [[a]] -- | quotientGp gs ks returns <gs> / <ks> quotientGp :: (Ord a, Show a) => [Permutation a] -> [Permutation a] -> [Permutation Int] -- | Synonym for quotientGp (//) :: (Ord a, Show a) => [Permutation a] -> [Permutation a] -> [Permutation Int] (~~^) :: Ord a => [Permutation a] -> Permutation a -> [Permutation a] conjugateSubgps :: Ord a => [Permutation a] -> [Permutation a] -> [[Permutation a]] subgpAction :: (Num a1, Enum a1, Ord a1, Ord a2) => [Permutation a2] -> [Permutation a2] -> [Permutation a1] rrpr :: (Ord a, Num a) => [a] -> a -> Permutation a rrpr' :: (Ord a, Num a) => [a] -> a -> Permutation a permutationMatrix :: (Ord a1, Num a2) => [a1] -> Permutation a1 -> [[a2]] instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Algebra.Group.PermutationGroup.Permutation a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Algebra.Group.PermutationGroup.Permutation a) instance (GHC.Classes.Ord a, GHC.Show.Show a) => GHC.Show.Show (Math.Algebra.Group.PermutationGroup.Permutation a) instance GHC.Classes.Ord a => GHC.Num.Num (Math.Algebra.Group.PermutationGroup.Permutation a) instance GHC.Classes.Ord a => Math.Core.Utils.HasInverses (Math.Algebra.Group.PermutationGroup.Permutation a) -- | A module for doing arithmetic in the group algebra. -- -- Group elements are represented as permutations of the integers, and -- are entered and displayed using a Haskell-friendly version of cycle -- notation. For example, the permutation (1 2 3)(4 5) would be entered -- as p [[1,2,3],[4,5]], and displayed as [[1,2,3],[4,5]]. -- -- Given a field K and group G, the group algebra KG is the free K-vector -- space over the elements of G. Elements of the group algebra consist of -- arbitrary K-linear combinations of elements of G. For example, p -- [[1,2,3]] + 2 * p [[1,2],[3,4]] module Math.Algebras.GroupAlgebra type GroupAlgebra k = Vect k (Permutation Int) -- | Construct a permutation, as an element of the group algebra, from a -- list of cycles. For example, p [[1,2],[3,4,5]] constructs the -- permutation (1 2)(3 4 5), which is displayed as [[1,2],[3,4,5]]. p :: [[Int]] -> GroupAlgebra Q instance GHC.Show.Show a => GHC.Show.Show (Math.Algebras.GroupAlgebra.X a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Algebras.GroupAlgebra.X a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Algebras.GroupAlgebra.X a) instance Math.Core.Utils.HasInverses (Math.Algebras.GroupAlgebra.GroupAlgebra Math.Core.Field.Q) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Algebra k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Coalgebra k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Bialgebra k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.HopfAlgebra k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Module k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) GHC.Types.Int instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Module k (Math.Algebra.Group.PermutationGroup.Permutation GHC.Types.Int) [GHC.Types.Int] module Math.Algebra.Group.SchreierSims cosetRepsGx :: Ord k => [Permutation k] -> k -> Map k (Permutation k) schreierGeneratorsGx :: Ord a => (a, Map a (Permutation a)) -> [Permutation a] -> [Permutation a] sift :: Ord k => [(k, Map k (Permutation k))] -> Permutation k -> Maybe (Permutation k) findBase :: Ord a => [Permutation a] -> a -- | Given generators for a permutation group, return a strong generating -- set. The result is calculated using Schreier-Sims algorithm, and is -- relative to the base implied by the Ord instance sgs :: (Ord a, Show a) => [Permutation a] -> [Permutation a] bsgs :: Ord a => [Permutation a] -> [(a, Map a (Permutation a))] bsgs' :: Ord a => [a] -> [Permutation a] -> [(a, Map a (Permutation a))] newLevel :: Ord k => [k] -> [Permutation k] -> ([k], ((k, Map k (Permutation k)), [Permutation k])) newLevel' :: Ord k => k -> [Permutation k] -> ((k, Map k (Permutation k)), [Permutation k]) ss :: Ord a => [a] -> [Permutation a] -> [((a, Map a (Permutation a)), [Permutation a])] ss' :: Ord a => [a] -> [((a, Map a (Permutation a)), [Permutation a])] -> [((a, Map a (Permutation a)), [Permutation a])] -> [((a, Map a (Permutation a)), [Permutation a])] isMemberBSGS :: Ord k => [(k, Map k (Permutation k))] -> Permutation k -> Bool eltsBSGS :: Num b => [(a, Map k b)] -> [b] cartProd :: () => [[a]] -> [[a]] orderBSGS :: () => [(a1, Map k a2)] -> Integer -- | Given generators for a group, determine whether a permutation is a -- member of the group, using Schreier-Sims algorithm isMember :: (Ord t, Show t) => [Permutation t] -> Permutation t -> Bool -- | Given generators for a group, return a (sorted) list of all elements -- of the group, using Schreier-Sims algorithm elts :: (Ord t, Show t) => [Permutation t] -> [Permutation t] -- | Given generators for a group, return the order of the group (the -- number of elements), using Schreier-Sims algorithm order :: (Ord t, Show t) => [Permutation t] -> Integer isSubgp :: (Foldable t, Ord k) => t (Permutation k) -> [Permutation k] -> Bool isNormal :: Ord k => [Permutation k] -> [Permutation k] -> Bool index :: (Ord t1, Ord t2, Show t1, Show t2) => [Permutation t1] -> [Permutation t2] -> Integer reduceGens :: Ord a => [Permutation a] -> [Permutation a] reduceGensBSGS :: Ord a => [Permutation a] -> ([Permutation a], [(a, Map a (Permutation a))]) normalClosure :: Ord a => [Permutation a] -> [Permutation a] -> [Permutation a] commutatorGp :: Ord a => [Permutation a] -> [Permutation a] -> [Permutation a] derivedSubgp :: Ord a => [Permutation a] -> [Permutation a] -- | A module defining a polymorphic data type for (simple, undirected) -- graphs, together with constructions of some common families of graphs, -- new from old constructions, and calculation of simple properties of -- graphs. module Math.Combinatorics.Graph set :: Ord b => [b] -> [b] powerset :: () => [a] -> [[a]] -- | Datatype for graphs, represented as a list of vertices and a list of -- edges. For most purposes, graphs are required to be in normal form. A -- graph G vs es is in normal form if (i) vs is in ascending order -- without duplicates, (ii) es is in ascending order without duplicates, -- (iii) each e in es is a 2-element list [x,y], x<y data Graph a G :: [a] -> [[a]] -> Graph a -- | Convert a graph to normal form. The input is assumed to be a valid -- graph apart from order nf :: Ord a => Graph a -> Graph a isSetSystem :: Ord a => [a] -> [[a]] -> Bool isGraph :: Ord a => [a] -> [[a]] -> Bool -- | Safe constructor for graph from lists of vertices and edges. graph -- (vs,es) checks that vs and es are valid before returning the graph. graph :: Ord t => ([t], [[t]]) -> Graph t toGraph :: Ord a => ([a], [[a]]) -> Graph a vertices :: () => Graph a -> [a] edges :: () => Graph a -> [[a]] incidenceMatrix :: (Eq a1, Num a2) => Graph a1 -> [[a2]] fromIncidenceMatrix :: (Num t, Enum t, Ord t, Num a, Eq a) => [[a]] -> Graph t adjacencyMatrix :: (Num a2, Ord a1) => Graph a1 -> [[a2]] fromAdjacencyMatrix :: (Eq a, Num a) => [[a]] -> Graph Int -- | The null graph on n vertices is the graph with no edges nullGraph :: Integral t => t -> Graph t -- | The null graph, with no vertices or edges nullGraph' :: Graph Int -- | c n is the cyclic graph on n vertices c :: Integral t => t -> Graph t -- | k n is the complete graph on n vertices k :: Integral t => t -> Graph t -- | kb m n is the complete bipartite graph on m and n vertices kb :: Integral t => t -> t -> Graph t -- | kb' m n is the complete bipartite graph on m left and n right vertices kb' :: Integral t => t -> t -> Graph (Either t t) -- | q k is the graph of the k-cube q :: Integral t => Int -> Graph t q' :: Integral t => Int -> Graph [t] tetrahedron :: Graph Integer cube :: Graph Integer octahedron :: Graph Integer dodecahedron :: Graph Integer icosahedron :: Graph Integer prism :: Int -> Graph (Int, Int) to1n :: (Ord t, Num t, Enum t, Ord a) => Graph a -> Graph t -- | Given a graph with vertices which are lists of small integers, eg -- [1,2,3], return a graph with vertices which are the numbers obtained -- by interpreting these as digits, eg 123. The caller is responsible for -- ensuring that this makes sense (eg that the small integers are all -- < 10) fromDigits :: Integral a => Graph [a] -> Graph a -- | Given a graph with vertices which are lists of 0s and 1s, return a -- graph with vertices which are the numbers obtained by interpreting -- these as binary digits. For example, [1,1,0] -> 6. fromBinary :: Integral a => Graph [a] -> Graph a petersen :: Graph [Integer] complement :: Ord t => Graph t -> Graph t -- | The restriction of a graph to a subset of the vertices restriction :: Eq a => Graph a -> [a] -> Graph a inducedSubgraph :: Eq a => Graph a -> [a] -> Graph a lineGraph :: (Num t, Enum t, Ord t, Ord a) => Graph a -> Graph t lineGraph' :: Ord a => Graph a -> Graph [a] cartProd :: (Ord a1, Ord a2) => Graph a2 -> Graph a1 -> Graph (a2, a1) order :: () => Graph a -> Int size :: () => Graph a -> Int valency :: Eq a => Graph a -> a -> Int valencies :: Eq a => Graph a -> [(Int, Int)] valencyPartition :: Eq b => Graph b -> [[b]] regularParam :: Eq a => Graph a -> Maybe Int -- | A graph is regular if all vertices have the same valency (degree) isRegular :: Eq t => Graph t -> Bool -- | A 3-regular graph is called a cubic graph isCubic :: Eq t => Graph t -> Bool nbrs :: Eq a => Graph a -> a -> [a] findPaths :: Eq a => Graph a -> a -> a -> [[a]] -- | Within a graph G, the distance d(u,v) between vertices u, v is length -- of the shortest path from u to v distance :: Eq a => Graph a -> a -> a -> Int -- | The diameter of a graph is maximum distance between two distinct -- vertices diameter :: Ord t => Graph t -> Int findCycles :: Eq a => Graph a -> a -> [[a]] -- | The girth of a graph is the size of the smallest cycle that it -- contains. Note: If the graph contains no cycles, we return -1, -- representing infinity. girth :: Eq t => Graph t -> Int distancePartition :: Ord a => Graph a -> a -> [[a]] distancePartitionS :: Ord a => [a] -> Set [a] -> a -> [[a]] component :: Ord a => Graph a -> a -> [a] -- | Is the graph connected? isConnected :: Ord t => Graph t -> Bool components :: Ord a => Graph a -> [[a]] j :: Int -> Int -> Int -> Graph [Int] -- | kneser n k returns the kneser graph KG n,k - whose vertices are the -- k-element subsets of [1..n], with edges between disjoint subsets kneser :: Int -> Int -> Graph [Int] johnson :: Int -> Int -> Graph [Int] bipartiteKneser :: Int -> Int -> Graph (Either [Int] [Int]) desargues1 :: Graph (Either [Int] [Int]) gp :: Integral b => b -> b -> Graph (Either b b) petersen2 :: Graph (Either Integer Integer) prism' :: Integral b => b -> Graph (Either b b) durer :: Graph (Either Integer Integer) mobiusKantor :: Graph (Either Integer Integer) dodecahedron2 :: Graph (Either Integer Integer) desargues2 :: Graph (Either Integer Integer) instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.Graph.Graph a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Combinatorics.Graph.Graph a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.Graph.Graph a) instance GHC.Base.Functor Math.Combinatorics.Graph.Graph module Math.Combinatorics.GraphAuts -- | A graph is vertex-transitive if its automorphism group acts -- transitively on the vertices. Thus, given any two distinct vertices, -- there is an automorphism mapping one to the other. isVertexTransitive :: Ord t => Graph t -> Bool -- | A graph is edge-transitive if its automorphism group acts transitively -- on the edges. Thus, given any two distinct edges, there is an -- automorphism mapping one to the other. isEdgeTransitive :: Ord t => Graph t -> Bool -- | A graph is arc-transitive (or flag-transitive) if its automorphism -- group acts transitively on arcs. (An arc is an ordered pair of -- adjacent vertices.) isArcTransitive :: Ord t => Graph t -> Bool is2ArcTransitive :: Ord t => Graph t -> Bool is3ArcTransitive :: Ord t => Graph t -> Bool is4ArcTransitive :: Ord t => Graph t -> Bool -- | A graph is n-arc-transitive if its automorphism group is transitive on -- n-arcs. (An n-arc is an ordered sequence (v0,...,vn) of adjacent -- vertices, with crossings allowed but not doubling back.) isnArcTransitive :: Ord t => Int -> Graph t -> Bool -- | A graph is distance transitive if given any two ordered pairs of -- vertices (u,u') and (v,v') with d(u,u') == d(v,v'), there is an -- automorphism of the graph that takes (u,u') to (v,v') isDistanceTransitive :: Ord t => Graph t -> Bool -- | Given a graph g, graphAuts g returns a strong generating set -- for the automorphism group of g. graphAuts :: Ord a => Graph a -> [Permutation a] -- | Given the incidence graph of an incidence structure between points and -- blocks (for example, a set system), incidenceAuts g returns a -- strong generating set for the automorphism group of the incidence -- structure. The generators are represented as permutations of the -- points. The incidence graph should be represented with the points on -- the left and the blocks on the right. incidenceAuts :: (Ord p, Ord b) => Graph (Either p b) -> [Permutation p] graphAuts7 :: Ord a => Graph a -> ([a], [Permutation a]) graphAuts8 :: Ord a => Graph a -> ([a], [Permutation a]) incidenceAuts2 :: (Ord a, Ord b) => Graph (Either a b) -> ([Either a b], [Permutation (Either a b)]) -- | Is the permutation an automorphism of the graph? isGraphAut :: Ord t => Graph t -> Permutation t -> Bool -- | Is the permutation an automorphism of the incidence structure -- represented by the graph? (Note that an incidence graph colours points -- as Left, blocks as Right, and a permutation that swaps points and -- blocks, even if it is an automorphism of the graph, does not represent -- an automorphism of the incidence structure. Instead, a point-block -- crossover is called a duality.) isIncidenceAut :: (Ord p, Ord b) => Graph (Either p b) -> Permutation (Either p b) -> Bool graphIsos :: (Ord a2, Ord a1) => Graph a1 -> Graph a2 -> [[(a1, a2)]] incidenceIsos :: (Ord b2, Ord b3, Ord a, Ord b1) => Graph (Either a b1) -> Graph (Either b2 b3) -> [[(a, b2)]] -- | Are the two graphs isomorphic? isGraphIso :: (Ord a, Ord b) => Graph a -> Graph b -> Bool -- | Are the two incidence structures represented by these incidence graphs -- isomorphic? isIncidenceIso :: (Ord p1, Ord b1, Ord p2, Ord b2) => Graph (Either p1 b1) -> Graph (Either p2 b2) -> Bool instance GHC.Base.Functor Math.Combinatorics.GraphAuts.SearchTree instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.GraphAuts.SearchTree a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Combinatorics.GraphAuts.SearchTree a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.GraphAuts.SearchTree a) -- | Constructions of the finite geometries AG(n,Fq) and PG(n,Fq), their -- points, lines and flats, together with the incidence graphs between -- points and lines. module Math.Combinatorics.FiniteGeometry -- | ptsAG n fq returns the points of the affine geometry AG(n,Fq), where -- fq are the elements of Fq ptsAG :: Int -> [a] -> [[a]] -- | ptsPG n fq returns the points of the projective geometry PG(n,Fq), -- where fq are the elements of Fq ptsPG :: Num a => Int -> [a] -> [[a]] pnf :: (Eq a, Fractional a) => [a] -> [a] ispnf :: (Eq a, Num a) => [a] -> Bool -- | Given a list of points in AG(n,Fq), return their closure, the smallest -- flat containing them closureAG :: (Num a, Ord a, FinSet a) => [[a]] -> [[a]] lineAG :: (Ord a, FinSet a, Num a) => [[a]] -> [[a]] -- | Given a set of points in PG(n,Fq), return their closure, the smallest -- flat containing them closurePG :: (Num a, Ord a, FinSet a) => [[a]] -> [[a]] linePG :: (Ord a, Num a, FinSet a) => [[a]] -> [[a]] qtorial :: (Integral a, Integral b) => b -> a -> a qnomial :: (Integral a, Integral b) => b -> b -> a -> a numFlatsPG :: (Integral a, Integral b) => b -> a -> b -> a numFlatsAG :: (Integral b, Integral a) => b -> a -> b -> a qtorials :: Integral b => b -> [b] qnomials :: Num a => a -> [[a]] data ZeroOneStar Zero :: ZeroOneStar One :: ZeroOneStar Star :: ZeroOneStar rrefs :: Int -> Int -> [[[ZeroOneStar]]] -- | flatsPG n fq k returns the k-flats in PG(n,Fq), where fq are -- the elements of Fq. The returned flats are represented as matrices in -- reduced row echelon form, the rows of which are the points that -- generate the flat. The full set of points in the flat can be recovered -- by calling closurePG flatsPG :: (Eq a, Num a) => Int -> [a] -> Int -> [[[a]]] -- | flatsAG n fq k returns the k-flats in AG(n,Fq), where fq are the -- elements of Fq. flatsAG :: (Eq a, Num a) => Int -> [a] -> Int -> [[[a]]] -- | The lines (1-flats) in PG(n,fq) linesPG :: (Eq a, Num a) => Int -> [a] -> [[[a]]] -- | The lines (1-flats) in AG(n,fq) linesAG :: (Eq a, Num a) => Int -> [a] -> [[[a]]] linesAG1 :: (Ord a, FinSet a, Num a) => Int -> [a] -> [[[a]]] linesAG2 :: (Num a, Ord a, FinSet a) => Int -> [a] -> [[[a]]] -- | Incidence graph of PG(n,fq), considered as an incidence structure -- between points and lines incidenceGraphPG :: (Num a, Ord a, FinSet a) => Int -> [a] -> Graph (Either [a] [[a]]) -- | Incidence graph of AG(n,fq), considered as an incidence structure -- between points and lines incidenceGraphAG :: (Num a, Ord a, FinSet a) => Int -> [a] -> Graph (Either [a] [[a]]) orderGL :: (Num a, Integral b) => b -> a -> a orderAff :: (Integral b, Num a) => b -> a -> a orderPGL :: (Integral a, Integral b) => b -> a -> a heawood :: Graph Integer instance GHC.Classes.Eq Math.Combinatorics.FiniteGeometry.ZeroOneStar instance GHC.Show.Show Math.Combinatorics.FiniteGeometry.ZeroOneStar module Math.Combinatorics.Poset -- | A poset is represented as a pair (set,po), where set is the underlying -- set of the poset, and po is the partial order relation newtype Poset t Poset :: ([t], t -> t -> Bool) -> Poset t implies :: Bool -> Bool -> Bool isReflexive :: () => ([t], t -> t -> Bool) -> Bool isAntisymmetric :: Eq a => ([a], a -> a -> Bool) -> Bool isTransitive :: () => ([t], t -> t -> Bool) -> Bool isPoset :: Eq t => ([t], t -> t -> Bool) -> Bool poset :: Eq t => ([t], t -> t -> Bool) -> Poset t intervals :: () => Poset b -> [(b, b)] interval :: () => Poset a -> (a, a) -> [a] -- | A chain is a poset in which every pair of elements is comparable (ie -- either x <= y or y <= x). It is therefore a linear or total -- order. chainN n is the poset consisting of the numbers [1..n] ordered -- by (<=) chainN :: Int -> Poset Int -- | An antichain is a poset in which distinct elements are incomparable. -- antichainN n is the poset consisting of [1..n], with x <= y only -- when x == y. antichainN :: Int -> Poset Int divides :: Integral a => a -> a -> Bool divisors :: Integral a => a -> [a] -- | posetD n is the lattice of (positive) divisors of n posetD :: Int -> Poset Int powerset :: () => [a] -> [[a]] -- | posetB n is the lattice of subsets of [1..n] ordered by inclusion posetB :: Int -> Poset [Int] partitions :: () => [a] -> [[[a]]] isRefinement :: Ord a => [[a]] -> [[a]] -> Bool -- | posetP n is the lattice of set partitions of [1..n], ordered by -- refinement posetP :: Int -> Poset [[Int]] intervalPartitions :: (Eq a, Num a) => [a] -> [[[a]]] isInterval :: (Eq a, Num a) => [a] -> Bool intervalPartitions2 :: () => [a] -> [[[a]]] integerPartitions :: (Ord a, Num a) => a -> [[a]] isIPRefinement :: (Ord a, Num a) => [a] -> [a] -> Bool -- | posetIP n is the poset of integer partitions of n, ordered by -- refinement posetIP :: Int -> Poset [Int] subspaces :: (Eq a, Num a) => [a] -> Int -> [[[a]]] isSubspace :: (Foldable t, Eq a, Num a) => t [a] -> [[a]] -> Bool -- | posetL n fq is the lattice of subspaces of the vector space Fq^n, -- ordered by inclusion. Subspaces are represented by their reduced row -- echelon form. Example usage: posetL 2 f3 posetL :: (Eq fq, Num fq) => Int -> [fq] -> Poset [[fq]] -- | The subposet of a poset satisfying a predicate subposet :: Poset a -> (a -> Bool) -> Poset a -- | The direct sum of two posets dsum :: Poset a -> Poset b -> Poset (Either a b) -- | The direct product of two posets dprod :: Poset a -> Poset b -> Poset (a, b) -- | The dual of a poset dual :: Poset a -> Poset a -- | Given a poset (X,<=), we say that y covers x, written x -< y, if -- x < y and there is no z in X with x < z < y. The Hasse -- digraph of a poset is the digraph whose vertices are the elements of -- the poset, with an edge between every pair (x,y) with x -< y. The -- Hasse digraph can be represented diagrammatically as a Hasse diagram, -- by drawing x below y whenever x -< y. hasseDigraph :: Eq a => Poset a -> Digraph a -- | Given a DAG (directed acyclic graph), return the poset consisting of -- the vertices of the DAG, ordered by reachability. This can be used to -- recover a poset from its Hasse digraph. reachabilityPoset :: Ord a => Digraph a -> Poset a isOrderPreserving :: (a -> b) -> Poset a -> Poset b -> Bool orderIsos01 :: () => Poset a1 -> Poset a2 -> [[(a1, a2)]] -- | Are the two posets order-isomorphic? isOrderIso :: (Ord a, Ord b) => Poset a -> Poset b -> Bool -- | Find all order isomorphisms between two posets orderIsos :: (Ord a, Ord b) => Poset a -> Poset b -> [[(a, b)]] orderAuts1 :: Ord b => Poset b -> [[(b, b)]] -- | A linear extension of a poset is a linear ordering of the elements -- which extends the partial order. Equivalently, it is an ordering -- [x1..xn] of the underlying set, such that if xi <= xj then i <= -- j. isLinext :: () => Poset t -> [t] -> Bool -- | Linear extensions of a poset linexts :: () => Poset t -> [[t]] instance GHC.Classes.Eq t => GHC.Classes.Eq (Math.Combinatorics.Poset.Poset t) instance GHC.Show.Show t => GHC.Show.Show (Math.Combinatorics.Poset.Poset t) -- | A module defining the following Combinatorial Hopf Algebras, together -- with coalgebra or Hopf algebra morphisms between them: -- --
-- [x,y,z] = map glexVar ["x","y","z"] :: GlexPoly Q String --glexVar :: Num k => v -> GlexPoly k v class Monomial m var :: Monomial m => v -> Vect Q (m v) powers :: Monomial m => m v -> [(v, Int)] -- | In effect, we have (Num k, Monomial m) => Monad (v -> Vect k (m -- v)), with return = var, and (>>=) = bind. However, we can't -- express this directly in Haskell, firstly because of the Ord b -- constraint, secondly because Haskell doesn't support type functions. bind :: (Monomial m, Eq k, Num k, Ord b, Show b, Algebra k b) => Vect k (m v) -> (v -> Vect k b) -> Vect k b lt :: () => Vect k b -> (b, k) class DivisionBasis b dividesB :: DivisionBasis b => b -> b -> Bool divB :: DivisionBasis b => b -> b -> b dividesT :: DivisionBasis b1 => (b1, b2) -> (b1, b3) -> Bool divT :: (DivisionBasis a, Fractional b) => (a, b) -> (a, b) -> (a, b) quotRemMP :: (DivisionBasis b2, Fractional b1, Eq b1, Ord b2, Show b2, Algebra b1 b2) => Vect b1 b2 -> [Vect b1 b2] -> ([Vect b1 b2], Vect b1 b2) -- | (%%) reduces a polynomial with respect to a list of polynomials. (%%) :: (Eq k, Fractional k, Ord b, Show b, Algebra k b, DivisionBasis b) => Vect k b -> [Vect k b] -> Vect k b infixl 7 %% instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.Algebras.Commutative.GlexMonomial v) instance GHC.Classes.Ord v => Math.Algebras.Commutative.DivisionBasis (Math.Algebras.Commutative.GlexMonomial v) instance Math.Algebras.Commutative.Monomial Math.Algebras.Commutative.GlexMonomial instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.Algebras.Commutative.GlexMonomial v) instance GHC.Show.Show v => GHC.Show.Show (Math.Algebras.Commutative.GlexMonomial v) instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord v) => Math.Algebras.Structures.Algebra k (Math.Algebras.Commutative.GlexMonomial v) instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Coalgebra k (Math.Algebras.Commutative.GlexMonomial v) -- | A module providing functions to construct and investigate (small, -- finite) matroids. module Math.Combinatorics.Matroid implies :: Bool -> Bool -> Bool exists :: Foldable t => t a -> Bool unique :: () => [a] -> a shortlex :: (Foldable t, Ord (t a)) => t a -> t a -> Ordering isShortlex :: (Foldable t, Ord (t a)) => [t a] -> Bool toShortlex :: (Ord (t a), Foldable t) => [t a] -> [t a] isClutter :: Ord a => [[a]] -> Bool deletions :: () => [a] -> [[a]] closedUnderSubsets :: Ord a => [[a]] -> Bool -- | The data structure that we use to store the bases of the matroid data TrieSet a TS :: [(a, TrieSet a)] -> TrieSet a tsshow :: Show a => TrieSet a -> [Char] tsempty :: () => TrieSet a tsinsert :: Ord a => [a] -> TrieSet a -> TrieSet a tsmember :: Eq a => [a] -> TrieSet a -> Bool tssubmember :: Ord a => [a] -> TrieSet a -> Bool tstolist :: () => TrieSet a -> [[a]] tsfromlist :: (Foldable t, Ord a) => t [a] -> TrieSet a -- | A datatype to represent a matroid. M es bs is the matroid -- whose elements are es, and whose bases are bs. The -- normal form is for the es to be in order, for each of the -- bs individually to be in order. (So the TrieSet should have -- the property that any path from the root to a leaf is strictly -- increasing). data Matroid a M :: [a] -> TrieSet a -> Matroid a -- | Return the elements over which the matroid is defined. elements :: Matroid t -> [t] -- | Return all the independent sets of a matroid, in shortlex order. indeps :: Ord a => Matroid a -> [[a]] isIndependent :: Ord a => Matroid a -> [a] -> Bool isDependent :: Ord a => Matroid a -> [a] -> Bool -- | Are these the independent sets of a matroid? (The sets must -- individually be ordered.) isMatroidIndeps :: Ord a => [[a]] -> Bool -- | Construct a matroid from its elements and its independent sets. fromIndeps :: Ord a => [a] -> [[a]] -> Matroid a fromIndeps1 :: Ord a => [a] -> [[a]] -> Matroid a -- | Given a matrix, represented as a list of rows, number the columns -- [1..], and construct the matroid whose independent sets correspond to -- those sets of columns which are linearly independent (or in case there -- are repetitions, those multisets of columns which are sets, and which -- are linearly independent). vectorMatroid :: (Eq k, Fractional k) => [[k]] -> Matroid Int -- | Given a list of vectors (or rows of a matrix), number the vectors -- (rows) [1..], and construct the matroid whose independent sets -- correspond to those sets of vectors (rows) which are linearly -- independent (or in case there are repetitions, those multisets which -- are sets, and which are linearly independent). vectorMatroid' :: (Eq k, Fractional k) => [[k]] -> Matroid Int -- | Given the edges of an undirected graph, number the edges [1..], and -- construct the matroid whose independent sets correspond to those sets -- of edges which contain no cycle. The bases therefore correspond to -- maximal forests within the graph. The edge set is allowed to contain -- loops or parallel edges. cycleMatroid :: Ord a => [[a]] -> Matroid Int cycleMatroid' :: Ord a => [[a]] -> Matroid [a] -- | Given a matroid over an arbitrary type, relabel to obtain a matroid -- over the integers. to1n :: Ord a => Matroid a -> Matroid Int incidenceGraphB :: Ord t => Matroid t -> Graph (Either t [t]) incidenceGraphC :: Ord t => Matroid t -> Graph (Either t [t]) incidenceGraphH :: Ord t => Matroid t -> Graph (Either t [t]) matroidIsos :: (Ord b2, Ord a) => Matroid a -> Matroid b2 -> [[(a, b2)]] -- | Are the two matroids isomorphic? isMatroidIso :: (Ord a, Ord b) => Matroid a -> Matroid b -> Bool -- | Return the automorphisms of the matroid. matroidAuts :: Ord a => Matroid a -> [Permutation a] -- | A circuit in a matroid is a minimal dependent set. isCircuit :: Ord a => Matroid a -> [a] -> Bool -- | Return all circuits for the given matroid, in shortlex order. circuits :: Ord a => Matroid a -> [[a]] -- | Are the given sets the circuits of some matroid? isMatroidCircuits :: Ord a => [[a]] -> Bool -- | Reconstruct a matroid from its elements and circuits. fromCircuits :: Ord a => [a] -> [[a]] -> Matroid a -- | An element e in a matroid M is a loop if {e} is a circuit of M. isLoop :: Ord a => Matroid a -> a -> Bool -- | Elements f and g in a matroid M are parallel if {f,g} is a circuit of -- M. isParallel :: Ord a => Matroid a -> a -> a -> Bool -- | A matroid is simple if it has no loops or parallel elements isSimple :: Ord a => Matroid a -> Bool -- | A base or basis in a matroid is a maximal independent set. isBase :: Ord a => Matroid a -> [a] -> Bool -- | Return all bases for the given matroid bases :: Ord a => Matroid a -> [[a]] -- | Are the given sets the bases of some matroid? isMatroidBases :: Ord a => [[a]] -> Bool -- | Reconstruct a matroid from its elements and bases. fromBases :: Ord a => [a] -> [[a]] -> Matroid a -- | Given a matroid m, a basis b, and an element e, fundamentalCircuit -- m b e returns the unique circuit contained in b union {e}, which -- is called the fundamental circuit of e with respect to b. fundamentalCircuit :: Ord a => Matroid a -> [a] -> a -> [a] uniformMatroid :: Int -> Int -> Matroid Int -- | The uniform matroid U m n is the matroid whose independent sets are -- all subsets of [1..n] with m or fewer elements. u :: Int -> Int -> Matroid Int restriction1 :: Ord a => Matroid a -> [a] -> Matroid a -- | The restriction of a matroid to a subset of its elements restriction :: Ord a => Matroid a -> [a] -> Matroid a -- | Given a matroid m, rankfun m is the rank function on subsets -- of its element set rankfun :: Ord a => Matroid a -> [a] -> Int -- | The rank of a matroid is the cardinality of a basis rank :: Ord a => Matroid a -> Int -- | Reconstruct a matroid from its elements and rank function fromRankfun :: Ord a => [a] -> ([a] -> Int) -> Matroid a -- | Given a matroid m, closure m is the closure operator on -- subsets of its element set closure :: Ord a => Matroid a -> [a] -> [a] -- | Reconstruct a matroid from its elements and closure operator fromClosure :: Ord a => [a] -> ([a] -> [a]) -> Matroid a -- | A flat in a matroid is a closed set, that is a set which is equal to -- its own closure isFlat :: Ord a => Matroid a -> [a] -> Bool flats1 :: Ord a => Matroid a -> [[a]] coveringFlats :: Ord a => Matroid a -> [a] -> [[a]] minimalFlat :: Ord a => Matroid a -> [a] -- | The flats of a matroid are its closed sets. They form a lattice under -- inclusion. flats :: Ord a => Matroid a -> [[a]] -- | Reconstruct a matroid from its flats. (The flats must be given in -- shortlex order.) fromFlats :: Ord a => [[a]] -> Matroid a fromFlats' :: Ord a => [[a]] -> Matroid a -- | A subset of the elements in a matroid is spanning if its closure is -- all the elements isSpanning :: Ord a => Matroid a -> [a] -> Bool -- | A hyperplane is a flat whose rank is one less than that of the matroid isHyperplane :: Ord a => Matroid a -> [a] -> Bool hyperplanes1 :: Ord a => Matroid a -> [[a]] hyperplanes :: Ord a => Matroid a -> [[a]] isMatroidHyperplanes :: Ord a => [a] -> [[a]] -> Bool fromHyperplanes1 :: Ord a => [a] -> [[a]] -> Matroid a -- | Reconstruct a matroid from its elements and hyperplanes fromHyperplanes :: Ord a => [a] -> [[a]] -> Matroid a -- | Given a list of points in k^n, number the points [1..], and construct -- the matroid whose independent sets correspond to those sets of points -- which are affinely independent. -- -- A multiset of points in k^n is said to be affinely dependent if it -- contains two identical points, or three collinear points, or four -- coplanar points, or ... - and affinely independent otherwise. affineMatroid :: (Eq k, Fractional k) => [[k]] -> Matroid Int -- | fromGeoRep returns a matroid from a geometric representation -- consisting of dependent flats of various ranks. Given lists of -- dependent rank 0 flats (loops), rank 1 flats (points), rank 2 flats -- (lines) and rank 3 flats (planes), fromGeoRep loops points lines -- planes returns the matroid having these as dependent flats. Note -- that if all the elements lie in the same plane, then this should still -- be listed as an argument. fromGeoRep :: Ord a => [[a]] -> [[a]] -> [[a]] -> [[a]] -> Matroid a minimal :: Ord a => [[a]] -> [[a]] -- | A simple matroid has no loops or parallel elements, hence its -- geometric representation has no loops or dependent points. -- simpleFromGeoRep lines planes returns the simple matroid -- having these dependent flats. simpleFromGeoRep :: Ord a => [[a]] -> [[a]] -> Matroid a isSimpleGeoRep :: Ord a => [[a]] -> [[a]] -> Bool isCircuitHyperplane :: Ord a => Matroid a -> [a] -> Bool -- | List the circuit-hyperplanes of a matroid. circuitHyperplanes :: Ord a => Matroid a -> [[a]] -- | Given a matroid m, and a set of elements b which is both a circuit and -- a hyperplane in m, then relaxation m b is the matroid which -- is obtained by adding b as a new basis. This corresponds to removing b -- from the geometric representation of m. relaxation :: Ord a => Matroid a -> [a] -> Matroid a ex161 :: Num a => [[a]] transversalGraph :: (Num b1, Enum b1) => [[a1]] -> [(Either a1 b2, Either a2 b1)] partialMatchings :: Ord a => [(a, a)] -> [[(a, a)]] -- | Given a set of elements es, and a sequence as = [a1,...,am] of subsets -- of es, return the matroid whose independent sets are the partial -- transversals of the as. transversalMatroid :: Ord a => [a] -> [[a]] -> Matroid a -- | The dual matroid dual :: Ord a => Matroid a -> Matroid a isCoindependent :: Ord a => Matroid a -> [a] -> Bool isCobase :: Ord a => Matroid a -> [a] -> Bool isCocircuit :: Ord a => Matroid a -> [a] -> Bool cocircuits :: Ord a => Matroid a -> [[a]] isColoop :: Ord a => Matroid a -> a -> Bool isCoparallel :: Ord a => Matroid a -> a -> a -> Bool deletion :: Ord a => Matroid a -> [a] -> Matroid a (\\\) :: Ord a => Matroid a -> [a] -> Matroid a contraction :: Ord a => Matroid a -> [a] -> Matroid a (///) :: Ord a => Matroid a -> [a] -> Matroid a -- | A matroid is (2-)connected if, for every pair of distinct elements, -- there is a circuit containing both isConnected :: Ord a => Matroid a -> Bool component :: Ord a => Matroid a -> a -> [a] -- | The direct sum of two matroids dsum :: (Ord a, Ord b) => Matroid a -> Matroid b -> Matroid (Either a b) -- | matroidPG n fq returns the projective geometry PG(n,Fq), -- where fq is a list of the elements of Fq matroidPG :: (Eq a, Fractional a) => Int -> [a] -> Matroid Int -- | matroidAG n fq returns the affine geometry AG(n,Fq), where fq -- is a list of the elements of Fq matroidAG :: (Eq a, Fractional a) => Int -> [a] -> Matroid Int -- | Given a matroid m, the fundamental-circuit incidence matrix relative -- to a base b has rows indexed by the elements of b, and columns indexed -- by the elements not in b. The bi, ej entry is 1 if bi is in the -- fundamental circuit of ej relative to b, and 0 otherwise. fundamentalCircuitIncidenceMatrix :: (Ord a, Num k) => Matroid a -> [a] -> [[k]] fundamentalCircuitIncidenceMatrix' :: (Ord a1, Num a2) => Matroid a1 -> [a1] -> [[a2]] fcim :: (Ord a, Num k) => Matroid a -> [a] -> [[k]] fcim' :: (Ord a1, Num a2) => Matroid a1 -> [a1] -> [[a2]] markNonInitialRCs :: (Eq a, Num a) => [[a]] -> [[ZeroOneStar]] substStars :: Num a => [[ZeroOneStar]] -> [a] -> [[[a]]] starSubstitutionsV :: Num a => [a] -> [ZeroOneStar] -> [[a]] representations1 :: (Fractional a1, Ord a1, Ord a2) => [a1] -> Matroid a2 -> [[[a1]]] fcig :: Ord a => Matroid a -> [a] -> [[a]] markedfcim :: Ord a => Matroid a -> [a] -> [[ZeroOneStar]] representations2 :: (Fractional a1, Ord a1, Ord a2) => [a1] -> Matroid a2 -> [[[a1]]] -- | Find representations of the matroid m over fq. Specifically, this -- function will find one representative of each projective equivalence -- class of representation. representations :: (Eq fq, Fractional fq, Ord a) => [fq] -> Matroid a -> [[[fq]]] -- | Is the matroid representable over Fq? For example, to find out whether -- a matroid m is binary, evaluate isRepresentable f2 m. isRepresentable :: (Eq fq, Fractional fq, Ord a) => [fq] -> Matroid a -> Bool -- | A binary matroid is a matroid which is representable over F2 isBinary :: Ord a => Matroid a -> Bool -- | A ternary matroid is a matroid which is representable over F3 isTernary :: Ord a => Matroid a -> Bool data LMR a b L :: a -> LMR a b Mid :: LMR a b R :: b -> LMR a b seriesConnection :: (Ord a1, Ord a2) => (Matroid a1, a1) -> (Matroid a2, a2) -> Matroid (LMR a1 a2) parallelConnection :: (Ord a1, Ord a2) => (Matroid a1, a1) -> (Matroid a2, a2) -> Matroid (LMR a1 a2) twoSum :: (Ord a1, Ord a2) => (Matroid a1, a1) -> (Matroid a2, a2) -> Matroid (LMR a1 a2) matroidUnion :: Ord a => Matroid a -> Matroid a -> Matroid a -- | The Fano plane F7 = PG(2,F2) f7 :: Matroid Int -- | F7-, the relaxation of the Fano plane by removal of a line f7m :: Matroid Int -- | The Pappus configuration from projective geometry pappus :: Matroid Int -- | Relaxation of the Pappus configuration by removal of a line nonPappus :: Matroid Int -- | The Desargues configuration desargues :: Matroid Int vamosMatroid1 :: (Ord a, Num a, Enum a) => Matroid a vamosMatroid :: (Ord a, Num a) => Matroid a -- | The Vamos matroid V8. It is not representable over any field. v8 :: Matroid Int -- | P8 is a minor-minimal matroid that is not representable over F4, F8, -- F16, ... . It is Fq-representable if and only if q is not a power of -- 2. p8 :: Matroid Int p8' :: (Ord a, Num a) => Matroid a -- | P8- is a relaxation of P8. It is Fq-representable if and only if q -- >= 4. p8m :: Matroid Int -- | P8-- is a relaxation of P8-. It is a minor-minimal matroid that is not -- representable over F4. It is Fq-representable if and only if q >= -- 5. p8mm :: Matroid Int wheelGraph :: (Num a, Enum a) => a -> Graph a mw4 :: Matroid Int w4' :: Matroid Int w4 :: (Ord a, Num a) => Matroid a isBinary2 :: Ord a => Matroid a -> Bool x :: GlexPoly Integer String rankPoly1 :: Ord a => Matroid a -> GlexPoly Integer String -- | Given a matroid m over elements es, the rank polynomial is a -- polynomial r(x,y), which is essentially a generating function for the -- subsets of es, enumerated by size and rank. It is efficiently -- calculated using deletion and contraction. -- -- It has the property that r(0,0) is the number of bases in m, r(1,0) is -- the number of independent sets, r(0,1) is the number of spanning sets. -- It can also be used to derive the chromatic polynomial of a graph, the -- weight enumerator of a linear code, and more. rankPoly :: Ord a => Matroid a -> GlexPoly Integer String numBases :: Ord a => Matroid a -> Integer numIndeps :: Ord a => Matroid a -> Integer numSpanning :: Ord a => Matroid a -> Integer indepCounts :: Ord a => Matroid a -> [Int] whitney2nd :: Ord a => Matroid a -> [Int] whitney1st :: Ord a => Matroid a -> [Int] instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Math.Combinatorics.Matroid.LMR a b) instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Math.Combinatorics.Matroid.LMR a b) instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Math.Combinatorics.Matroid.LMR a b) instance GHC.Base.Functor Math.Combinatorics.Matroid.Matroid instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.Matroid.Matroid a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.Matroid.Matroid a) instance GHC.Base.Functor Math.Combinatorics.Matroid.TrieSet instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Combinatorics.Matroid.TrieSet a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.Matroid.TrieSet a) instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.Matroid.TrieSet a) module Math.Algebras.LaurentPoly data LaurentMonomial LM :: Int -> [(String, Int)] -> LaurentMonomial type LaurentPoly k = Vect k LaurentMonomial lvar :: String -> LaurentPoly Q q :: LaurentPoly Q q' :: LaurentPoly Q instance GHC.Classes.Ord Math.Algebras.LaurentPoly.LaurentMonomial instance GHC.Classes.Eq Math.Algebras.LaurentPoly.LaurentMonomial instance (GHC.Classes.Eq k, GHC.Real.Fractional k) => GHC.Real.Fractional (Math.Algebras.LaurentPoly.LaurentPoly k) instance GHC.Show.Show Math.Algebras.LaurentPoly.LaurentMonomial instance Math.Algebras.Structures.Mon Math.Algebras.LaurentPoly.LaurentMonomial instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Algebra k Math.Algebras.LaurentPoly.LaurentMonomial -- | A module defining the affine plane and its symmetries module Math.Algebras.AffinePlane data XY X :: XY Y :: XY x :: GlexPoly Q XY y :: GlexPoly Q XY data ABCD A :: ABCD B :: ABCD C :: ABCD D :: ABCD a :: Monomial m => Vect Q (m ABCD) b :: Monomial m => Vect Q (m ABCD) c :: Monomial m => Vect Q (m ABCD) d :: Monomial m => Vect Q (m ABCD) newtype SL2 v SL2 :: GlexMonomial v -> SL2 v sl2Var :: Num k => v -> Vect k (SL2 v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.Algebras.AffinePlane.SL2 v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.Algebras.AffinePlane.SL2 v) instance GHC.Classes.Ord Math.Algebras.AffinePlane.ABCD instance GHC.Classes.Eq Math.Algebras.AffinePlane.ABCD instance GHC.Classes.Ord Math.Algebras.AffinePlane.XY instance GHC.Classes.Eq Math.Algebras.AffinePlane.XY instance GHC.Show.Show v => GHC.Show.Show (Math.Algebras.AffinePlane.SL2 v) instance Math.Algebras.Structures.Algebra Math.Algebra.Field.Base.Q (Math.Algebras.AffinePlane.SL2 Math.Algebras.AffinePlane.ABCD) instance Math.Algebras.Commutative.Monomial Math.Algebras.AffinePlane.SL2 instance Math.Algebras.Structures.Coalgebra Math.Algebra.Field.Base.Q (Math.Algebras.AffinePlane.SL2 Math.Algebras.AffinePlane.ABCD) instance Math.Algebras.Structures.Bialgebra Math.Algebra.Field.Base.Q (Math.Algebras.AffinePlane.SL2 Math.Algebras.AffinePlane.ABCD) instance Math.Algebras.Structures.HopfAlgebra Math.Algebra.Field.Base.Q (Math.Algebras.AffinePlane.SL2 Math.Algebras.AffinePlane.ABCD) instance GHC.Show.Show Math.Algebras.AffinePlane.ABCD instance GHC.Show.Show Math.Algebras.AffinePlane.XY -- | A module providing a type for non-commutative polynomials. module Math.Algebra.NonCommutative.NCPoly newtype Monomial v M :: [v] -> Monomial v divM :: Eq v => Monomial v -> Monomial v -> Maybe (Monomial v, Monomial v) newtype NPoly r v NP :: [(Monomial v, r)] -> NPoly r v cmpTerm :: Ord a => (a, b1) -> (a, b2) -> Ordering mergeTerms :: (Ord a, Eq b, Num b) => [(a, b)] -> [(a, b)] -> [(a, b)] collect :: (Num a1, Eq a2, Eq a1) => [(a2, a1)] -> [(a2, a1)] data Var X :: Var Y :: Var Z :: Var -- | Create a non-commutative variable for use in forming non-commutative -- polynomials. For example, we could define x = var "x", y = var "y". -- Then x*y /= y*x. var :: Num k => v -> NPoly k v x :: NPoly Q Var y :: NPoly Q Var z :: NPoly Q Var lm :: () => NPoly r v -> Monomial v lc :: () => NPoly r v -> r lt :: () => NPoly r v -> NPoly r v quotRemNP :: (Fractional r, Ord v, Show v, Eq r) => NPoly r v -> [NPoly r v] -> ([(NPoly r v, NPoly r v)], NPoly r v) remNP :: (Fractional r, Ord v, Show v, Eq r) => NPoly r v -> [NPoly r v] -> NPoly r v (%%) :: (Fractional r, Ord v, Show v, Eq r) => NPoly r v -> [NPoly r v] -> NPoly r v infixl 7 %% remNP2 :: (Num r, Ord v, Show v, Eq r) => NPoly r v -> [NPoly r v] -> NPoly r v toMonic :: (Eq r, Ord v, Show v, Fractional r) => NPoly r v -> NPoly r v inject :: (Num r, Eq r, Eq v, Show v) => r -> NPoly r v subst :: (Num r1, Ord v1, Show v1, Eq r1, Eq v2, Eq r2, Show r2, Show v2, Num r2) => [(NPoly r2 v2, NPoly r1 v1)] -> NPoly r1 v2 -> NPoly r1 v1 class Invertible a inv :: Invertible a => a -> a (^-) :: (Integral b, Invertible a, Num a) => a -> b -> a instance GHC.Classes.Ord Math.Algebra.NonCommutative.NCPoly.Var instance GHC.Classes.Eq Math.Algebra.NonCommutative.NCPoly.Var instance (GHC.Classes.Eq v, GHC.Classes.Eq r) => GHC.Classes.Eq (Math.Algebra.NonCommutative.NCPoly.NPoly r v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.Algebra.NonCommutative.NCPoly.Monomial v) instance GHC.Show.Show Math.Algebra.NonCommutative.NCPoly.Var instance (GHC.Classes.Ord r, GHC.Classes.Ord v) => GHC.Classes.Ord (Math.Algebra.NonCommutative.NCPoly.NPoly r v) instance (GHC.Show.Show r, GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.Algebra.NonCommutative.NCPoly.NPoly r v) instance (GHC.Classes.Eq r, GHC.Num.Num r, GHC.Classes.Ord v, GHC.Show.Show v) => GHC.Num.Num (Math.Algebra.NonCommutative.NCPoly.NPoly r v) instance (GHC.Classes.Eq k, GHC.Real.Fractional k, GHC.Classes.Ord v, GHC.Show.Show v) => GHC.Real.Fractional (Math.Algebra.NonCommutative.NCPoly.NPoly k v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.Algebra.NonCommutative.NCPoly.Monomial v) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.Algebra.NonCommutative.NCPoly.Monomial v) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Num.Num (Math.Algebra.NonCommutative.NCPoly.Monomial v) module Math.Algebra.NonCommutative.GSBasis findOverlap :: Eq a => Monomial a -> Monomial a -> Maybe (Monomial a, Monomial a, Monomial a) sPoly :: (Eq r, Num r, Ord v, Show v) => NPoly r v -> NPoly r v -> NPoly r v gb1 :: (Fractional r, Ord v, Show v, Eq r) => [NPoly r v] -> [NPoly r v] reduce :: (Fractional r, Ord r, Ord v, Show v) => [NPoly r v] -> [NPoly r v] gb :: (Show v, Fractional r, Ord v, Ord r) => [NPoly r v] -> [NPoly r v] gb' :: (Fractional r, Ord r, Ord v, Show v) => [NPoly r v] -> [NPoly r v] gb2 :: (Fractional r, Ord v, Show v, Eq r) => [NPoly r v] -> [NPoly r v] gb2' :: (Fractional r, Ord v, Show v, Eq r) => [NPoly r v] -> [(NPoly r v, NPoly r v, NPoly r v, NPoly r v)] mbasisQA :: (Eq r, Fractional r, Ord v, Show v) => [NPoly r v] -> [NPoly r v] -> [NPoly r v] -- | A module defining the tensor, symmetric, and exterior algebras. This -- module has been partially superceded by Math.Algebras.TensorAlgebra, -- which should be used in preference. This module is likely to be -- removed at some point. module Math.Algebra.NonCommutative.TensorAlgebra data Basis E :: Int -> Basis e_ :: Int -> NPoly Q Basis e1 :: NPoly Q Basis e2 :: NPoly Q Basis e3 :: NPoly Q Basis e4 :: NPoly Q Basis dim :: () => NPoly r Basis -> Int tensorBasis :: Int -> [NPoly Q Basis] extRelations :: Int -> [NPoly Q Basis] extnf :: NPoly Q Basis -> NPoly Q Basis exteriorBasis :: Int -> [NPoly Q Basis] symRelations :: Int -> [NPoly Q Basis] symnf :: NPoly Q Basis -> NPoly Q Basis symmetricBasis :: Int -> [NPoly Q Basis] weylRelations :: Int -> [NPoly Q Basis] weylnf :: Int -> NPoly Q Basis -> NPoly Q Basis weylBasis :: Int -> [NPoly Q Basis] data WeylGens X :: Int -> WeylGens D :: Int -> WeylGens d_ :: Int -> NPoly Q WeylGens x_ :: Int -> NPoly Q WeylGens d1 :: NPoly Q WeylGens d2 :: NPoly Q WeylGens d3 :: NPoly Q WeylGens x1 :: NPoly Q WeylGens x2 :: NPoly Q WeylGens x3 :: NPoly Q WeylGens comm :: Num a => a -> a -> a delta :: (Eq a, Num p) => a -> a -> p weylRelations' :: Int -> [NPoly Q WeylGens] weylnf' :: NPoly Q WeylGens -> NPoly Q WeylGens weylBasis' :: Int -> [NPoly Q WeylGens] instance GHC.Classes.Ord Math.Algebra.NonCommutative.TensorAlgebra.WeylGens instance GHC.Classes.Eq Math.Algebra.NonCommutative.TensorAlgebra.WeylGens instance GHC.Classes.Ord Math.Algebra.NonCommutative.TensorAlgebra.Basis instance GHC.Classes.Eq Math.Algebra.NonCommutative.TensorAlgebra.Basis instance GHC.Show.Show Math.Algebra.NonCommutative.TensorAlgebra.WeylGens instance GHC.Show.Show Math.Algebra.NonCommutative.TensorAlgebra.Basis module Math.Algebra.Field.Extension newtype UPoly a UP :: [a] -> UPoly a x :: UPoly Integer showUP :: (Eq a, Num a, Show a) => [Char] -> [a] -> [Char] toUPoly :: (Eq a, Num a) => [a] -> UPoly a (<+>) :: (Eq a, Num a) => [a] -> [a] -> [a] (<*>) :: (Num a, Eq a) => [a] -> [a] -> [a] convert :: (Eq a, Num a) => UPoly Integer -> UPoly a deg :: () => UPoly a -> Int lt :: () => UPoly a -> a monomial :: Num a => a -> Int -> UPoly a quotRemUP :: (Eq k, Fractional k) => UPoly k -> UPoly k -> (UPoly k, UPoly k) modUP :: (Eq k, Fractional k) => UPoly k -> UPoly k -> UPoly k extendedEuclidUP :: (Eq k, Fractional k) => UPoly k -> UPoly k -> (UPoly k, UPoly k, UPoly k) class PolynomialAsType k poly pvalue :: PolynomialAsType k poly => (k, poly) -> UPoly k data ExtensionField k poly Ext :: UPoly k -> ExtensionField k poly (/>) :: (Eq a, Fractional a) => a -> UPoly a -> UPoly a embed :: (Eq k, Num k) => UPoly Integer -> ExtensionField k poly polys :: (Eq a, Eq t, Num a, Num t) => t -> [a] -> [UPoly a] data ConwayF4 type F4 = ExtensionField F2 ConwayF4 f4 :: [F4] a4 :: F4 data ConwayF8 type F8 = ExtensionField F2 ConwayF8 f8 :: [F8] a8 :: F8 data ConwayF9 type F9 = ExtensionField F3 ConwayF9 f9 :: [F9] a9 :: F9 data ConwayF16 type F16 = ExtensionField F2 ConwayF16 f16 :: [F16] a16 :: F16 data ConwayF25 type F25 = ExtensionField F5 ConwayF25 f25 :: [F25] a25 :: F25 data ConwayF27 type F27 = ExtensionField F3 ConwayF27 f27 :: [F27] a27 :: F27 data ConwayF32 type F32 = ExtensionField F2 ConwayF32 f32 :: [F32] a32 :: F32 frobeniusAut :: FiniteField a => a -> a degree :: Foldable t => t a -> Int data Sqrt a Sqrt :: a -> Sqrt a type QSqrt2 = ExtensionField Q (Sqrt T2) sqrt2 :: QSqrt2 type QSqrt3 = ExtensionField Q (Sqrt T3) sqrt3 :: QSqrt3 type QSqrt5 = ExtensionField Q (Sqrt T5) sqrt5 :: QSqrt5 type QSqrt7 = ExtensionField Q (Sqrt T7) sqrt7 :: QSqrt7 type QSqrtMinus1 = ExtensionField Q (Sqrt TMinus1) i :: QSqrtMinus1 type QSqrtMinus2 = ExtensionField Q (Sqrt (M TMinus1 T2)) sqrtminus2 :: QSqrtMinus2 type QSqrtMinus3 = ExtensionField Q (Sqrt (M TMinus1 T3)) sqrtminus3 :: QSqrtMinus3 type QSqrtMinus5 = ExtensionField Q (Sqrt (M TMinus1 T5)) sqrtminus5 :: QSqrtMinus5 conjugate :: ExtensionField Q (Sqrt d) -> ExtensionField Q (Sqrt d) instance GHC.Classes.Ord k => GHC.Classes.Ord (Math.Algebra.Field.Extension.ExtensionField k poly) instance GHC.Classes.Eq k => GHC.Classes.Eq (Math.Algebra.Field.Extension.ExtensionField k poly) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Algebra.Field.Extension.UPoly a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Algebra.Field.Extension.UPoly a) instance Math.Common.IntegerAsType.IntegerAsType n => Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.Q (Math.Algebra.Field.Extension.Sqrt n) instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F2 Math.Algebra.Field.Extension.ConwayF32 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F3 Math.Algebra.Field.Extension.ConwayF27 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F5 Math.Algebra.Field.Extension.ConwayF25 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F2 Math.Algebra.Field.Extension.ConwayF16 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F3 Math.Algebra.Field.Extension.ConwayF9 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F2 Math.Algebra.Field.Extension.ConwayF8 instance Math.Algebra.Field.Extension.PolynomialAsType Math.Algebra.Field.Base.F2 Math.Algebra.Field.Extension.ConwayF4 instance (GHC.Classes.Eq k, GHC.Show.Show k, GHC.Num.Num k) => GHC.Show.Show (Math.Algebra.Field.Extension.ExtensionField k poly) instance (GHC.Classes.Eq k, GHC.Real.Fractional k, Math.Algebra.Field.Extension.PolynomialAsType k poly) => GHC.Num.Num (Math.Algebra.Field.Extension.ExtensionField k poly) instance (GHC.Classes.Eq k, GHC.Real.Fractional k, Math.Algebra.Field.Extension.PolynomialAsType k poly) => GHC.Real.Fractional (Math.Algebra.Field.Extension.ExtensionField k poly) instance (Math.Algebra.Field.Base.FiniteField k, Math.Algebra.Field.Extension.PolynomialAsType k poly) => Math.Algebra.Field.Base.FiniteField (Math.Algebra.Field.Extension.ExtensionField k poly) instance (Math.Core.Utils.FinSet fp, GHC.Classes.Eq fp, GHC.Num.Num fp, Math.Algebra.Field.Extension.PolynomialAsType fp poly) => Math.Core.Utils.FinSet (Math.Algebra.Field.Extension.ExtensionField fp poly) instance (GHC.Classes.Eq a, GHC.Show.Show a, GHC.Num.Num a) => GHC.Show.Show (Math.Algebra.Field.Extension.UPoly a) instance (GHC.Classes.Eq a, GHC.Num.Num a) => GHC.Num.Num (Math.Algebra.Field.Extension.UPoly a) -- | A module for constructing and working with combinatorial designs. -- -- Given integers t < k < v and lambda > 0, a t-design or -- t-(v,k,lambda) design is an incidence structure of points X and blocks -- B, where X is a set of v points, B is a collection of k-subsets of X, -- with the property that any t points are contained in exactly lambda -- blocks. If lambda = 1 and t >= 2, then a t-design is also called a -- Steiner system S(t,k,v). -- -- Many designs are highly symmetric structures, having large -- automorphism groups. In particular, the Mathieu groups, which were the -- first discovered sporadic finite simple groups, turn up as the -- automorphism groups of the Witt designs. module Math.Combinatorics.Design isSubset :: (Foldable t1, Foldable t2, Eq a) => t1 a -> t2 a -> Bool data Design a D :: [a] -> [[a]] -> Design a design :: Ord a => ([a], [[a]]) -> Design a toDesign :: Ord a => ([a], [[a]]) -> Design a isValid :: Ord a => Design a -> Bool points :: () => Design a -> [a] blocks :: () => Design a -> [[a]] noRepeatedBlocks :: Ord a => Design a -> Bool tDesignParams :: Eq a => Int -> Design a -> Maybe (Int, Int, Int) findvk :: () => Design a -> Maybe (Int, Int) findlambda :: Eq a => Int -> Design a -> Maybe Int designParams :: Eq a => Design a -> Maybe (Int, (Int, Int, Int)) isStructure :: Eq a => Int -> Design a -> Bool isDesign :: Ord a => Int -> Design a -> Bool is2Design :: Ord a => Design a -> Bool isSquare :: Ord a => Design a -> Bool -- | The incidence matrix of a design, with rows indexed by blocks and -- columns by points. (Note that in the literature, the opposite -- convention is sometimes used instead.) incidenceMatrix :: Eq t => Design t -> [[Int]] subsetDesign :: (Ord a, Num a, Enum a) => a -> Int -> Design a pairDesign :: Integral a => a -> Design a -- | The affine plane AG(2,Fq), a 2-(q^2,q,1) design or Steiner system -- S(2,q,q^2). ag2 :: (FiniteField k, Ord k) => [k] -> Design [k] -- | The projective plane PG(2,Fq), a square 2-(q^2+q+1,q+1,1) design or -- Steiner system S(2,q+1,q^2+q+1). For example, pg2 f2 is the -- Fano plane, a Steiner triple system S(2,3,7). pg2 :: (FiniteField k, Ord k) => [k] -> Design [k] flatsDesignPG :: (Ord a, FinSet a, Num a) => Int -> [a] -> Int -> Design [a] pg :: (Ord a, FinSet a, Num a) => Int -> [a] -> Design [a] flatsDesignAG :: (Num a, Ord a, FinSet a) => Int -> [a] -> Int -> Design [a] ag :: (Num a, Ord a, FinSet a) => Int -> [a] -> Design [a] to1n :: (Num a2, Enum a2, Ord a1) => Design a1 -> Design a2 paleyDesign :: (Ord a, Num a) => [a] -> Design a fanoPlane :: Design F7 -- | The dual of a design dual :: Ord t => Design t -> Design [t] derivedDesign :: Ord t => Design t -> t -> Design t pointResidual :: Ord t => Design t -> t -> Design t complementaryDesign :: Ord a => Design a -> Design a blockResidual :: Ord t => Design t -> [t] -> Design t isDesignAut :: Ord a => Design a -> Permutation a -> Bool -- | The incidence graph of a design incidenceGraph :: Ord a => Design a -> Graph (Either a [a]) -- | Find a strong generating set for the automorphism group of a design designAuts :: Ord t => Design t -> [Permutation t] designAuts1 :: Ord a => Design a -> [Permutation a] alphaL2_23 :: Permutation Integer betaL2_23 :: Permutation Integer gammaL2_23 :: Permutation Integer l2_23 :: [Permutation Integer] deltaM24 :: Permutation Integer -- | Generators for the Mathieu group M24, a finite simple group of order -- 244823040 m24 :: [Permutation Integer] -- | A strong generating set for the Mathieu group M24, a finite simple -- group of order 244823040 m24sgs :: [Permutation Integer] -- | A strong generating set for the Mathieu group M23, a finite simple -- group of order 10200960 m23sgs :: [Permutation Integer] -- | A strong generating set for the Mathieu group M22, a finite simple -- group of order 443520 m22sgs :: [Permutation Integer] octad :: [Integer] -- | The Steiner system S(5,8,24), with 759 blocks, whose automorphism -- group is M24 s_5_8_24 :: Design Integer -- | The Steiner system S(4,7,23), with 253 blocks, whose automorphism -- group is M23 s_4_7_23 :: Design Integer -- | The Steiner system S(3,6,22), with 77 blocks, whose automorphism group -- is M22 s_3_6_22 :: Design Integer s_5_8_24' :: Design Integer alphaL2_11 :: Permutation Integer betaL2_11 :: Permutation Integer gammaL2_11 :: Permutation Integer l2_11 :: [Permutation Integer] deltaM12 :: Permutation Integer hexad :: [Integer] -- | The Steiner system S(5,6,12), with 132 blocks, whose automorphism -- group is M12 s_5_6_12 :: Design Integer -- | The Steiner system S(4,5,11), with 66 blocks, whose automorphism group -- is M11 s_4_5_11 :: Design Integer -- | Generators for the Mathieu group M12, a finite simple group of order -- 95040 m12 :: [Permutation Integer] -- | A strong generating set for the Mathieu group M12, a finite simple -- group of order 95040 m12sgs :: [Permutation Integer] -- | A strong generating set for the Mathieu group M11, a finite simple -- group of order 7920 m11sgs :: [Permutation Integer] instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.Design.Design a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Combinatorics.Design.Design a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.Design.Design a) -- | A module defining various strongly regular graphs, including the -- Clebsch, Hoffman-Singleton, Higman-Sims, and McLaughlin graphs. -- -- A strongly regular graph with parameters (n,k,lambda,mu) is a (simple) -- graph with n vertices, in which the number of common neighbours of x -- and y is k, lambda or mu according as whether x and y are equal, -- adjacent, or non-adjacent. (In particular, it is a k-regular graph.) -- -- Strongly regular graphs are highly symmetric, and have large -- automorphism groups. module Math.Combinatorics.StronglyRegularGraph srgParams :: Ord a => Graph a -> Maybe (Int, Int, Int, Int) isSRG :: Ord a => Graph a -> Bool t' :: (Ord t, Ord a, Num t, Num a, Enum t, Enum a) => a -> Graph t t :: (Num a, Enum a, Ord a) => a -> Graph [a] l2' :: (Ord t, Ord b, Num t, Num b, Enum t, Enum b) => b -> Graph t l2 :: (Num b, Enum b, Ord b) => b -> Graph (b, b) paleyGraph :: (Ord t, Num t) => [t] -> Graph t clebsch' :: Graph Integer clebsch :: Graph [Integer] clebsch2 :: Graph DesignVertex triples :: [[Integer]] heptads :: [[[Integer]]] (+^) :: Ord a => [[a]] -> Permutation a -> [[a]] (+^^) :: Ord a => [[a]] -> [Permutation a] -> [[[a]]] hoffmanSingleton' :: Graph Integer hoffmanSingleton :: Graph (Either [[Integer]] [Integer]) inducedA7 :: Permutation Integer -> Permutation (Either [[Integer]] [Integer]) hsA7 :: [Permutation Integer] gewirtz' :: Graph Integer gewirtz :: Graph [Integer] data DesignVertex C :: DesignVertex P :: Integer -> DesignVertex B :: [Integer] -> DesignVertex higmanSimsGraph' :: Graph Integer higmanSimsGraph :: Graph DesignVertex inducedM22 :: Permutation Integer -> Permutation DesignVertex higmanSimsM22 :: [Permutation Integer] _HS2 :: [Permutation DesignVertex] _HS :: [Permutation DesignVertex] sp2 :: Int -> Graph [F2] sp :: Int -> Graph [F2] switch :: Ord t => Graph t -> [t] -> Graph t schlafli' :: Graph Integer schlafli :: Graph Integer mcLaughlin' :: Graph Integer mcLaughlin :: Graph DesignVertex _McL2 :: [Permutation DesignVertex] _McL :: [Permutation DesignVertex] instance GHC.Show.Show Math.Combinatorics.StronglyRegularGraph.DesignVertex instance GHC.Classes.Ord Math.Combinatorics.StronglyRegularGraph.DesignVertex instance GHC.Classes.Eq Math.Combinatorics.StronglyRegularGraph.DesignVertex module Math.Combinatorics.LatinSquares findLatinSqs :: Eq a => [a] -> [[[a]]] isLatinSq :: Ord a => [[a]] -> Bool isOneOfEach :: Ord a => [a] -> Bool incidenceGraphLS :: Ord c => [[c]] -> Graph (Int, Int, c) incidenceGraphLS' :: Eq a => [[a]] -> Graph (Int, Int) -- | Are the two latin squares orthogonal? isOrthogonal :: (Ord a, Ord b) => [[a]] -> [[b]] -> Bool findMOLS :: (Num t, Ord a, Eq t) => t -> [[[a]]] -> [[[[a]]]] -- | Are the latin squares mutually orthogonal (ie each pair is -- orthogonal)? isMOLS :: Ord a => [[[a]]] -> Bool -- | MOLS from a projective plane fromProjectivePlane :: (Ord k, Num k) => Design [k] -> [[[Int]]] isOA :: Ord b => (Int, Int) -> [[b]] -> Bool fromLS :: Foldable t => t [Int] -> [[Int]] fromMOLS :: Foldable t => [t [Int]] -> [[Int]] graphOA :: Ord a => [[a]] -> Graph [a] srgParamsOA :: Num d => (d, d) -> Maybe (d, d, d, d) -- | A module defining a type for hypergraphs. module Math.Combinatorics.Hypergraph data Hypergraph a H :: [a] -> [[a]] -> Hypergraph a hypergraph :: Ord a => [a] -> [[a]] -> Hypergraph a toHypergraph :: Ord a => [a] -> [[a]] -> Hypergraph a -- | Is this hypergraph uniform - meaning that all blocks are of the same -- size isUniform :: Ord a => Hypergraph a -> Bool same :: Eq a => [a] -> Bool fromGraph :: () => Graph a -> Hypergraph a fromDesign :: Ord a => Design a -> Hypergraph a incidenceGraph :: Ord a => Hypergraph a -> Graph (Either a [a]) incidenceMatrix :: (Eq a1, Num a2) => Hypergraph a1 -> [[a2]] fromIncidenceMatrix :: (Num a1, Enum a1, Ord a1, Num a2, Eq a2) => [[a2]] -> Hypergraph a1 isPartialLinearSpace :: Ord a => Hypergraph a -> Bool -- | Is this hypergraph a projective plane - meaning that any two lines -- meet in a unique point, and any two points lie on a unique line isProjectivePlane :: Ord a => Hypergraph a -> Bool -- | Is this hypergraph a projective plane with a triangle. This is a weak -- non-degeneracy condition, which eliminates all points on the same -- line, or all lines through the same point. isProjectivePlaneTri :: Ord a => Hypergraph a -> Bool -- | Is this hypergraph a projective plane with a quadrangle. This is a -- stronger non-degeneracy condition. isProjectivePlaneQuad :: Ord a => Hypergraph a -> Bool isGeneralizedQuadrangle :: Ord a => Hypergraph a -> Bool grid :: (Ord a, Ord b, Num a, Num b, Enum a, Enum b) => a -> b -> Hypergraph (a, b) dualGrid :: Integral a => a -> a -> Hypergraph a isGenQuadrangle' :: Ord a => Hypergraph a -> Bool -- | Is this hypergraph a (projective) configuration. isConfiguration :: Ord a => Hypergraph a -> Bool fanoPlane :: Hypergraph Integer -- | The Heawood graph is the incidence graph of the Fano plane heawoodGraph :: Graph (Either Integer [Integer]) desarguesConfiguration :: Hypergraph [Integer] desarguesGraph :: Graph (Either [Integer] [[Integer]]) pappusConfiguration :: Hypergraph Integer pappusGraph :: Graph (Either Integer [Integer]) coxeterGraph :: Graph [Integer] duads :: [[Integer]] synthemes :: [[[Integer]]] -- | The Tutte-Coxeter graph, also called the Tutte 8-cage tutteCoxeterGraph :: Graph (Either [Integer] [[Integer]]) intersectionGraph :: Ord a => Hypergraph a -> Graph [a] instance GHC.Show.Show a => GHC.Show.Show (Math.Combinatorics.Hypergraph.Hypergraph a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Math.Combinatorics.Hypergraph.Hypergraph a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Combinatorics.Hypergraph.Hypergraph a) -- | A module providing functions to test for primality, and find next and -- previous primes. module Math.NumberTheory.Prime -- | A (lazy) list of the primes primes :: [Integer] isTrialDivisionPrime :: Integer -> Bool isMillerRabinPrime :: (Integral a, Random a) => a -> Bool -- | Is this number prime? The algorithm consists of using trial division -- to test for very small factors, followed if necessary by the -- Miller-Rabin probabilistic test. isPrime :: Integer -> Bool notPrime :: Integer -> Bool -- | Given n, prevPrime n returns the greatest p, p < n, such -- that p is prime prevPrime :: Integer -> Integer -- | Given n, nextPrime n returns the least p, p > n, such that -- p is prime nextPrime :: Integer -> Integer -- | A module for finding prime factors. module Math.NumberTheory.Factor -- | List the prime factors of n (with multiplicity). For example: -- >>> pfactors 60 [2,2,3,5] -- -- This says that 60 = 2 * 2 * 3 * 5 -- -- The algorithm uses trial division to find small factors, followed if -- necessary by the elliptic curve method to find larger factors. The -- running time increases with the size of the second largest prime -- factor of n. It can find 10-digit prime factors in seconds, but can -- struggle with 20-digit prime factors. pfactors :: Integer -> [Integer] -- | List the prime power factors of n. For example: >>> ppfactors -- 60 [(2,2),(3,1),(5,1)] -- -- This says that 60 = 2^2 * 3^1 * 5^1 ppfactors :: Integer -> [(Integer, Int)] -- | Find the prime factors of all numbers up to n. Thus pfactorsTo -- n is equivalent to [(m, pfactors m) | m <- [1..n]], -- except that the results are not returned in order. For example: -- >>> pfactorsTo 10 -- [(8,[2,2,2]),(4,[2,2]),(6,[3,2]),(10,[5,2]),(2,[2]),(9,[3,3]),(3,[3]),(5,[5]),(7,[7]),(1,[])] -- -- pfactorsTo n is significantly faster than map pfactors -- [1..n] for larger n. pfactorsTo :: Integer -> [(Integer, [Integer])] -- | Find the prime power factors of all numbers up to n. Thus -- ppfactorsTo n is equivalent to [(m, ppfactors m) | m -- <- [1..n]], except that the results are not returned in order. -- For example: >>> ppfactorsTo 10 -- [(8,[(2,3)]),(4,[(2,2)]),(6,[(3,1),(2,1)]),(10,[(5,1),(2,1)]),(2,[(2,1)]),(9,[(3,2)]),(3,[(3,1)]),(5,[(5,1)]),(7,[(7,1)]),(1,[])] -- -- ppfactorsTo n is significantly faster than map ppfactors -- [1..n] for larger n. ppfactorsTo :: Integer -> [(Integer, [(Integer, Int)])] instance GHC.Show.Show Math.NumberTheory.Factor.EllipticCurvePt instance GHC.Classes.Eq Math.NumberTheory.Factor.EllipticCurvePt instance GHC.Show.Show Math.NumberTheory.Factor.EllipticCurve instance GHC.Classes.Eq Math.NumberTheory.Factor.EllipticCurve -- | A module for arithmetic in quadratic number fields. A quadratic number -- field is a field of the form Q(sqrt d), where d is a square-free -- integer. For example, we can perform the following calculation in -- Q(sqrt 2): -- --
-- (1 + sqrt 2) / (2 + sqrt 2) ---- -- It is also possible to mix different square roots in the same -- calculation. For example: -- --
-- (1 + sqrt 2) * (1 + sqrt 3) ---- -- Square roots of negative numbers are also permitted. For example: -- --
-- i * sqrt(-3) --module Math.NumberTheory.QuadraticField -- | A basis for quadratic number fields Q(sqrt d), where d is a -- square-free integer. data QNFBasis One :: QNFBasis Sqrt :: Integer -> QNFBasis -- | The type for elements of quadratic number fields type QNF = Vect Q QNFBasis -- | Although this has the same name as the Prelude.sqrt function, it -- should be thought of as more like a constructor for creating elements -- of quadratic fields. -- -- Note that for d positive, sqrt d means the positive square root, and -- sqrt (-d) should be interpreted as the square root with positive -- imaginary part, that is i * sqrt d. This has the consequence that for -- example, sqrt (-2) * sqrt (-3) = - sqrt 6. sqrt :: Integer -> QNF sqrt2 :: QNF sqrt3 :: QNF sqrt5 :: QNF sqrt6 :: QNF sqrt7 :: QNF i :: QNF newtype XVar X :: Int -> XVar instance GHC.Show.Show Math.NumberTheory.QuadraticField.XVar instance GHC.Classes.Ord Math.NumberTheory.QuadraticField.XVar instance GHC.Classes.Eq Math.NumberTheory.QuadraticField.XVar instance GHC.Classes.Ord Math.NumberTheory.QuadraticField.QNFBasis instance GHC.Classes.Eq Math.NumberTheory.QuadraticField.QNFBasis instance GHC.Real.Fractional Math.NumberTheory.QuadraticField.QNF instance GHC.Show.Show Math.NumberTheory.QuadraticField.QNFBasis instance (GHC.Classes.Eq k, GHC.Num.Num k) => Math.Algebras.Structures.Algebra k Math.NumberTheory.QuadraticField.QNFBasis module Math.Projects.ChevalleyGroup.Classical numPtsAG :: (Integral b, Num a) => b -> a -> a numPtsPG :: (Integral a, Integral b) => b -> a -> a -- | The special linear group SL(n,Fq), generated by elementary -- transvections, returned as matrices sl :: FiniteField k => Int -> [k] -> [[[k]]] elemTransvection :: (Enum b, Eq b, Num b, Num a) => b -> (b, b) -> a -> [[a]] -- | The projective special linear group PSL(n,Fq) == A(n,Fq) == -- SL(n,Fq)/Z, returned as permutations of the points of PG(n-1,Fq). This -- is a finite simple group provided n>2 or q>3. l :: (FiniteField k, Ord k) => Int -> [k] -> [Permutation [k]] orderL :: Integral a => a -> a -> a -- | The symplectic group Sp(2n,Fq), returned as matrices sp2 :: FiniteField k => Int -> [k] -> [[[k]]] -- | The projective symplectic group PSp(2n,Fq) == Cn(Fq) == Sp(2n,Fq)/Z, -- returned as permutations of the points of PG(2n-1,Fq). This is a -- finite simple group for n>1, except for PSp(4,F2). s2 :: (FiniteField k, Ord k) => Int -> [k] -> [Permutation [k]] s :: (FiniteField k, Ord k) => Int -> [k] -> [Permutation [k]] orderS2 :: (Integral a, Integral b) => b -> a -> a orderS :: (Integral b, Integral a) => b -> a -> a omegaeven :: FiniteField a => Int -> p -> [[[a]]] d :: (FiniteField a, Ord a) => Int -> [a] -> [Permutation [a]] omegaodd :: (Foldable t, FiniteField a1) => Int -> t a2 -> [[[a1]]] b :: (FiniteField a, Ord a) => Int -> [a] -> [Permutation [a]] o :: (FiniteField a, Ord a) => Int -> [a] -> [Permutation [a]] module Math.Projects.ChevalleyGroup.Exceptional newtype Octonion k O :: [(Int, k)] -> Octonion k i0 :: Octonion Q i1 :: Octonion Q i2 :: Octonion Q i3 :: Octonion Q i4 :: Octonion Q i5 :: Octonion Q i6 :: Octonion Q fromList :: (Eq k, Num k) => [k] -> Octonion k toList :: Num a => Octonion a -> [a] expose :: () => Octonion k -> [(Int, k)] nf :: (Num b, Ord a, Ord b) => [(a, b)] -> [(a, b)] m :: (Num a2, Integral a1) => (a1, a2) -> (a1, a2) -> (a1, a2) conj :: Num k => Octonion k -> Octonion k sqnorm :: Num a => Octonion a -> a isOrthogonal :: (Eq a, Num a) => Octonion a -> Octonion a -> Bool antiCommutes :: (Eq a, Num a) => a -> a -> Bool octonions :: (Eq k, Num k) => [k] -> [Octonion k] isUnit :: (Eq a, Num a) => Octonion a -> Bool unitImagOctonions :: (Eq a, Num a) => [a] -> [Octonion a] autFrom :: (Ord a, Num a) => Octonion a -> Octonion a -> Octonion a -> [[a]] (%^) :: (Eq k, Num k) => Octonion k -> [[k]] -> Octonion k alpha3 :: [[F3]] beta3 :: [[F3]] gamma3s :: [Octonion F3] gamma3 :: [[F3]] alpha3' :: Permutation (Octonion F3) beta3' :: Permutation (Octonion F3) gamma3' :: Permutation (Octonion F3) -- | Generators for G2(3), a finite simple group of order 4245696, as a -- permutation group on the 702 unit imaginary octonions over F3 g2_3 :: [Permutation (Octonion F3)] alpha4 :: [[F4]] beta4 :: [[F4]] gamma4s :: [Octonion F4] gamma4 :: [[F4]] alpha4' :: Permutation (Octonion F4) beta4' :: Permutation (Octonion F4) gamma4' :: Permutation (Octonion F4) instance GHC.Classes.Ord k => GHC.Classes.Ord (Math.Projects.ChevalleyGroup.Exceptional.Octonion k) instance GHC.Classes.Eq k => GHC.Classes.Eq (Math.Projects.ChevalleyGroup.Exceptional.Octonion k) instance GHC.Show.Show k => GHC.Show.Show (Math.Projects.ChevalleyGroup.Exceptional.Octonion k) instance (GHC.Classes.Ord k, GHC.Num.Num k) => GHC.Num.Num (Math.Projects.ChevalleyGroup.Exceptional.Octonion k) instance (GHC.Classes.Ord k, GHC.Num.Num k, GHC.Real.Fractional k) => GHC.Real.Fractional (Math.Projects.ChevalleyGroup.Exceptional.Octonion k) module Math.Projects.KnotTheory.LaurentMPoly newtype LaurentMonomial LM :: Map String Q -> LaurentMonomial degLM :: LaurentMonomial -> Q denominatorLM :: LaurentMonomial -> LaurentMonomial lcmLM :: LaurentMonomial -> LaurentMonomial -> LaurentMonomial divLM :: LaurentMonomial -> LaurentMonomial -> Maybe LaurentMonomial newtype LaurentMPoly r LP :: [(LaurentMonomial, r)] -> LaurentMPoly r cmpTerm :: Ord a => (a, b1) -> (a, b2) -> Ordering mergeTerms :: (Ord a, Eq b, Num b) => [(a, b)] -> [(a, b)] -> [(a, b)] collect :: (Num a1, Eq a2, Eq a1) => [(a2, a1)] -> [(a2, a1)] lm :: () => LaurentMPoly r -> LaurentMonomial lc :: () => LaurentMPoly r -> r lt :: () => LaurentMPoly r -> LaurentMPoly r quotRemLP :: (Eq r, Fractional r) => LaurentMPoly r -> LaurentMPoly r -> (LaurentMPoly r, LaurentMPoly r) reduceLP :: (Eq r, Fractional r) => LaurentMPoly r -> LaurentMPoly r -> LaurentMPoly r var :: Num r => String -> LaurentMPoly r t :: LaurentMPoly Q x :: LaurentMPoly Q y :: LaurentMPoly Q z :: LaurentMPoly Q denominatorLP :: Num r1 => LaurentMPoly r2 -> LaurentMPoly r1 inject :: (Eq r, Num r) => r -> LaurentMPoly r sqrtvar :: Num r => String -> LaurentMPoly r subst :: (Eq r, Fractional r, Show r) => [(LaurentMPoly r, LaurentMPoly r)] -> LaurentMPoly r -> LaurentMPoly r (^^^) :: (Eq a, Fractional a, Show a) => LaurentMPoly a -> Q -> LaurentMPoly a instance GHC.Classes.Ord r => GHC.Classes.Ord (Math.Projects.KnotTheory.LaurentMPoly.LaurentMPoly r) instance GHC.Classes.Eq r => GHC.Classes.Eq (Math.Projects.KnotTheory.LaurentMPoly.LaurentMPoly r) instance GHC.Classes.Eq Math.Projects.KnotTheory.LaurentMPoly.LaurentMonomial instance GHC.Show.Show r => GHC.Show.Show (Math.Projects.KnotTheory.LaurentMPoly.LaurentMPoly r) instance (GHC.Classes.Eq r, GHC.Num.Num r) => GHC.Num.Num (Math.Projects.KnotTheory.LaurentMPoly.LaurentMPoly r) instance (GHC.Classes.Eq r, GHC.Real.Fractional r) => GHC.Real.Fractional (Math.Projects.KnotTheory.LaurentMPoly.LaurentMPoly r) instance GHC.Classes.Ord Math.Projects.KnotTheory.LaurentMPoly.LaurentMonomial instance GHC.Show.Show Math.Projects.KnotTheory.LaurentMPoly.LaurentMonomial instance GHC.Num.Num Math.Projects.KnotTheory.LaurentMPoly.LaurentMonomial instance GHC.Real.Fractional Math.Projects.KnotTheory.LaurentMPoly.LaurentMonomial module Math.Projects.KnotTheory.Braid type LPQ = LaurentMPoly Q data BraidGens S :: Int -> BraidGens s_ :: Int -> NPoly LPQ BraidGens s1 :: NPoly LPQ BraidGens s2 :: NPoly LPQ BraidGens s3 :: NPoly LPQ BraidGens s4 :: NPoly LPQ BraidGens writhe :: () => NPoly r BraidGens -> Int k3_1 :: NPoly LPQ BraidGens k4_1 :: NPoly LPQ BraidGens k5_1 :: NPoly LPQ BraidGens k7_1 :: NPoly LPQ BraidGens instance GHC.Classes.Ord Math.Projects.KnotTheory.Braid.BraidGens instance GHC.Classes.Eq Math.Projects.KnotTheory.Braid.BraidGens instance GHC.Show.Show Math.Projects.KnotTheory.Braid.BraidGens instance Math.Algebra.NonCommutative.NCPoly.Invertible (Math.Algebra.NonCommutative.NCPoly.NPoly Math.Projects.KnotTheory.Braid.LPQ Math.Projects.KnotTheory.Braid.BraidGens) instance Math.Algebra.NonCommutative.NCPoly.Invertible Math.Projects.KnotTheory.Braid.LPQ module Math.Projects.KnotTheory.IwahoriHecke data IwahoriHeckeGens T :: Int -> IwahoriHeckeGens t_ :: Int -> NPoly LPQ IwahoriHeckeGens t1 :: NPoly LPQ IwahoriHeckeGens t2 :: NPoly LPQ IwahoriHeckeGens t3 :: NPoly LPQ IwahoriHeckeGens t4 :: NPoly LPQ IwahoriHeckeGens q :: LaurentMPoly Q z :: LaurentMPoly Q q' :: NPoly LPQ IwahoriHeckeGens z' :: NPoly LPQ IwahoriHeckeGens ihRelations :: Int -> [NPoly LPQ IwahoriHeckeGens] dimIH :: () => NPoly r IwahoriHeckeGens -> Int ihnf :: NPoly LPQ IwahoriHeckeGens -> NPoly LPQ IwahoriHeckeGens ihBasis :: Int -> [NPoly LPQ IwahoriHeckeGens] tau' :: Int -> (Monomial IwahoriHeckeGens, LPQ) -> LPQ tau :: Int -> NPoly LPQ IwahoriHeckeGens -> LPQ fromBraid :: NPoly LPQ BraidGens -> NPoly LPQ IwahoriHeckeGens homfly :: Int -> NPoly LPQ BraidGens -> LaurentMPoly Q i :: LPQ l :: LPQ m :: LPQ homfly' :: Int -> NPoly LPQ BraidGens -> LaurentMPoly Q homfly'' :: Int -> NPoly LPQ BraidGens -> LaurentMPoly (LaurentMPoly Q) coeffs :: (Eq r, Fractional r) => LaurentMPoly r -> LaurentMPoly r -> [LaurentMPoly r] jones' :: Int -> NPoly LPQ BraidGens -> LaurentMPoly Q instance GHC.Classes.Ord Math.Projects.KnotTheory.IwahoriHecke.IwahoriHeckeGens instance GHC.Classes.Eq Math.Projects.KnotTheory.IwahoriHecke.IwahoriHeckeGens instance GHC.Show.Show Math.Projects.KnotTheory.IwahoriHecke.IwahoriHeckeGens instance Math.Algebra.NonCommutative.NCPoly.Invertible (Math.Algebra.NonCommutative.NCPoly.NPoly Math.Projects.KnotTheory.Braid.LPQ Math.Projects.KnotTheory.IwahoriHecke.IwahoriHeckeGens) module Math.Projects.KnotTheory.TemperleyLieb data TemperleyLiebGens E :: Int -> TemperleyLiebGens e_ :: Int -> NPoly LPQ TemperleyLiebGens d :: LaurentMPoly Q d' :: NPoly LPQ TemperleyLiebGens e1 :: NPoly LPQ TemperleyLiebGens e2 :: NPoly LPQ TemperleyLiebGens e3 :: NPoly LPQ TemperleyLiebGens e4 :: NPoly LPQ TemperleyLiebGens tlRelations :: Int -> [NPoly LPQ TemperleyLiebGens] dimTL :: () => NPoly r TemperleyLiebGens -> Int tlnf :: NPoly LPQ TemperleyLiebGens -> NPoly LPQ TemperleyLiebGens tlBasis :: Int -> [NPoly LPQ TemperleyLiebGens] tr' :: Int -> Monomial TemperleyLiebGens -> LaurentMPoly Q tr :: Int -> NPoly (LaurentMPoly Q) TemperleyLiebGens -> LaurentMPoly Q a :: LaurentMPoly Q a' :: NPoly LPQ TemperleyLiebGens fromBraid :: NPoly LPQ BraidGens -> NPoly LPQ TemperleyLiebGens jones :: Int -> NPoly LPQ BraidGens -> LaurentMPoly Q instance GHC.Classes.Ord Math.Projects.KnotTheory.TemperleyLieb.TemperleyLiebGens instance GHC.Classes.Eq Math.Projects.KnotTheory.TemperleyLieb.TemperleyLiebGens instance GHC.Show.Show Math.Projects.KnotTheory.TemperleyLieb.TemperleyLiebGens module Math.Projects.MiniquaternionGeometry data F9 F9 :: F3 -> F3 -> F9 e :: F9 f9 :: [F9] w :: F9 conj :: F9 -> F9 norm :: F9 -> F3 data J9 J9 :: F9 -> J9 squaresF9 :: [F9] i :: J9 j :: J9 k :: J9 j9 :: [J9] autJ9 :: J9 -> Permutation J9 autA :: Permutation J9 autB :: Permutation J9 autC :: Permutation J9 autsJ9 :: [Permutation J9] conj' :: J9 -> J9 isAut :: (Eq a1, Num a1, Num a2) => [a2] -> (a2 -> a1) -> Bool isReal :: (Eq a, Num a) => a -> Bool isComplex :: J9 -> Bool ptsPG2 :: Num a => [a] -> [[a]] orthogonalLinesPG2 :: (Ord a, Num a) => [[a]] -> [[[a]]] rightLinesPG2 :: Num t => [t] -> [[[t]]] leftLinesPG2 :: Num t => [t] -> [[[t]]] phi :: Design [F9] phi' :: Design [F9] collineationsPhi :: [Permutation [F9]] liftToGraph :: Ord a => Design a -> Permutation a -> Permutation (Either a [a]) omega0 :: Design [J9] omega :: Design [J9] omega2 :: Design [J9] collineationsOmega :: [Permutation [J9]] omegaD :: Design [J9] omegaD1 :: Design Integer omegaD2 :: Design [J9] (<*) :: Num b => [b] -> b -> [b] psi :: Design [J9] psi2 :: Design [J9] collineationsPsi :: [Permutation [J9]] order :: () => Design a -> Int isProjectivePlane :: Eq a => Design a -> Bool collinear :: (Foldable t, Eq a) => Design a -> t a -> Bool isQuadrangle :: Eq a => Design a -> [a] -> Bool concurrent :: (Foldable t1, Foldable t2, Eq a) => Design a -> t1 (t2 a) -> Bool isQuadrilateral :: (Foldable t, Eq a) => Design a -> [t a] -> Bool isOval :: Eq a => Design a -> [a] -> Bool findOvals1 :: Eq a => Design a -> [[a]] findQuadrangles :: Eq a => Design a -> [[a]] findOvals :: Ord a => Design a -> [[a]] instance GHC.Classes.Ord Math.Projects.MiniquaternionGeometry.J9 instance GHC.Classes.Eq Math.Projects.MiniquaternionGeometry.J9 instance GHC.Classes.Ord Math.Projects.MiniquaternionGeometry.F9 instance GHC.Classes.Eq Math.Projects.MiniquaternionGeometry.F9 instance GHC.Show.Show Math.Projects.MiniquaternionGeometry.J9 instance GHC.Num.Num Math.Projects.MiniquaternionGeometry.J9 instance GHC.Real.Fractional Math.Projects.MiniquaternionGeometry.J9 instance Math.Algebra.Field.Base.FiniteField Math.Projects.MiniquaternionGeometry.J9 instance GHC.Show.Show Math.Projects.MiniquaternionGeometry.F9 instance GHC.Num.Num Math.Projects.MiniquaternionGeometry.F9 instance GHC.Real.Fractional Math.Projects.MiniquaternionGeometry.F9 instance Math.Algebra.Field.Base.FiniteField Math.Projects.MiniquaternionGeometry.F9 module Math.Projects.RootSystem data Type A :: Type B :: Type C :: Type D :: Type E :: Type F :: Type G :: Type basisElt :: Int -> Int -> [Q] simpleSystem :: Type -> Int -> [[Q]] w :: Fractional a => [a] -> [a] -> [a] closure :: (Ord a, Fractional a) => [[a]] -> [[a]] weylPerms :: Type -> Int -> [Permutation [Q]] weylMatrices :: Type -> Int -> [[[Q]]] wMx :: [Q] -> [[Q]] cartanMatrix :: Type -> Int -> [[Q]] setDiag :: () => a -> [[a]] -> [[a]] dynkinFromCartan :: Num a => [[a]] -> [[a]] dynkinDiagram :: Type -> Int -> [[Q]] coxeterFromDynkin :: (Eq a1, Num a2, Num a1) => [[a1]] -> [[a2]] coxeterMatrix :: Num a => Type -> Int -> [[a]] fromCoxeterMatrix :: () => [[Int]] -> ([SGen], [([SGen], [a])]) fromCoxeterMatrix2 :: [[Int]] -> ([SGen], [([SGen], [SGen])]) coxeterPresentation :: () => Type -> Int -> ([SGen], [([SGen], [a])]) eltsCoxeter :: Type -> Int -> [[SGen]] poincarePoly :: Type -> Int -> [Int] elemMx :: Int -> Int -> Int -> [[Q]] lieMult :: Num a => a -> a -> a (+|+) :: () => [[a]] -> [[a]] -> [[a]] (+-+) :: () => [a] -> [a] -> [a] form :: Num a => Type -> Int -> [[a]] rootSystem :: Type -> Int -> [[Q]] numRoots :: (Num a, Eq a) => Type -> a -> a orderWeyl :: Integral a => Type -> a -> Integer factorial :: Integral a => a -> Integer module Math.Projects.Rubik f :: Permutation Integer b :: Permutation Integer l :: Permutation Integer r :: Permutation Integer u :: Permutation Integer d :: Permutation Integer rubikCube :: [Permutation Integer] cornerFaces :: [Integer] kerCornerFaces :: [Permutation Integer] kerEdgeFaces :: [Permutation Integer] cornerBlocks :: [[Integer]] edgeBlocks :: [[Integer]] kerCornerBlocks :: [Permutation Integer] kerEdgeBlocks :: [Permutation Integer] _U :: Permutation Integer _u :: Permutation Integer _d :: Permutation Integer _D :: Permutation Integer bf :: Permutation Integer _R :: Permutation Integer _r :: Permutation Integer _l :: Permutation Integer _L :: Permutation Integer ud :: Permutation Integer _B :: Permutation Integer _b :: Permutation Integer _f :: Permutation Integer _F :: Permutation Integer -- | A module defining the quantum plane and its symmetries module Math.QuantumAlgebra.QuantumPlane qvar :: Monomial m => v -> Vect (LaurentPoly Q) (m v) a :: Monomial m => Vect (LaurentPoly Q) (m [Char]) b :: Monomial m => Vect (LaurentPoly Q) (m [Char]) c :: Monomial m => Vect (LaurentPoly Q) (m [Char]) d :: Monomial m => Vect (LaurentPoly Q) (m [Char]) detq :: (Ord (m [Char]), Show (m [Char]), Algebra (Vect Q LaurentMonomial) (m [Char]), Monomial m) => Vect (LaurentPoly Q) (m [Char]) x :: Monomial m => Vect (LaurentPoly Q) (m [Char]) y :: Monomial m => Vect (LaurentPoly Q) (m [Char]) u :: Monomial m => Vect (LaurentPoly Q) (m [Char]) v :: Monomial m => Vect (LaurentPoly Q) (m [Char]) aq20 :: (Ord (m [Char]), Show (m [Char]), Algebra (Vect Q LaurentMonomial) (m [Char]), Monomial m) => [Vect (LaurentPoly Q) (m [Char])] newtype Aq20 v Aq20 :: NonComMonomial v -> Aq20 v aq02 :: (Show (m [Char]), Algebra (Vect Q LaurentMonomial) (m [Char]), Monomial m, Ord (m [Char])) => [Vect (LaurentPoly Q) (m [Char])] newtype Aq02 v Aq02 :: NonComMonomial v -> Aq02 v m2q :: (Ord (m [Char]), Show (m [Char]), Algebra (Vect Q LaurentMonomial) (m [Char]), Monomial m) => [Vect (LaurentPoly Q) (m [Char])] newtype M2q v M2q :: NonComMonomial v -> M2q v sl2q :: (Ord (m [Char]), Show (m [Char]), Algebra (Vect Q LaurentMonomial) (m [Char]), Monomial m) => [Vect (LaurentPoly Q) (m [Char])] newtype SL2q v SL2q :: NonComMonomial v -> SL2q v yb :: (Ord b, Show b, Algebra (Vect Q LaurentMonomial) b) => Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.QuantumAlgebra.QuantumPlane.SL2q v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.QuantumAlgebra.QuantumPlane.SL2q v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.QuantumAlgebra.QuantumPlane.M2q v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.QuantumAlgebra.QuantumPlane.M2q v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.QuantumAlgebra.QuantumPlane.Aq02 v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.QuantumAlgebra.QuantumPlane.Aq02 v) instance GHC.Classes.Ord v => GHC.Classes.Ord (Math.QuantumAlgebra.QuantumPlane.Aq20 v) instance GHC.Classes.Eq v => GHC.Classes.Eq (Math.QuantumAlgebra.QuantumPlane.Aq20 v) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.QuantumAlgebra.QuantumPlane.SL2q v) instance Math.Algebras.NonCommutative.Monomial Math.QuantumAlgebra.QuantumPlane.SL2q instance Math.Algebras.Structures.Algebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.SL2q GHC.Base.String) instance Math.Algebras.Structures.Coalgebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.SL2q GHC.Base.String) instance Math.Algebras.Structures.Bialgebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.SL2q GHC.Base.String) instance Math.Algebras.Structures.HopfAlgebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.SL2q GHC.Base.String) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.QuantumAlgebra.QuantumPlane.M2q v) instance Math.Algebras.NonCommutative.Monomial Math.QuantumAlgebra.QuantumPlane.M2q instance Math.Algebras.Structures.Algebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.M2q GHC.Base.String) instance Math.Algebras.Structures.Coalgebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.M2q GHC.Base.String) instance Math.Algebras.Structures.Bialgebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.M2q GHC.Base.String) instance Math.Algebras.Structures.Comodule (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.M2q GHC.Base.String) (Math.QuantumAlgebra.QuantumPlane.Aq20 GHC.Base.String) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.QuantumAlgebra.QuantumPlane.Aq02 v) instance Math.Algebras.NonCommutative.Monomial Math.QuantumAlgebra.QuantumPlane.Aq02 instance Math.Algebras.Structures.Algebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.Aq02 GHC.Base.String) instance (GHC.Classes.Eq v, GHC.Show.Show v) => GHC.Show.Show (Math.QuantumAlgebra.QuantumPlane.Aq20 v) instance Math.Algebras.NonCommutative.Monomial Math.QuantumAlgebra.QuantumPlane.Aq20 instance Math.Algebras.Structures.Algebra (Math.Algebras.LaurentPoly.LaurentPoly Math.Algebra.Field.Base.Q) (Math.QuantumAlgebra.QuantumPlane.Aq20 GHC.Base.String) -- | A module defining classes and example instances of categories, -- monoidal categories and braided categories module Math.QuantumAlgebra.TensorCategory class MCategory c where { data family Ob c :: *; data family Ar c :: *; } id_ :: MCategory c => Ob c -> Ar c source :: MCategory c => Ar c -> Ob c target :: MCategory c => Ar c -> Ob c (>>>) :: MCategory c => Ar c -> Ar c -> Ar c class (MCategory a, MCategory b) => MFunctor a b fob :: MFunctor a b => Ob a -> Ob b far :: MFunctor a b => Ar a -> Ar b class MCategory c => Monoidal c tunit :: Monoidal c => Ob c tob :: Monoidal c => Ob c -> Ob c -> Ob c tar :: Monoidal c => Ar c -> Ar c -> Ar c class Monoidal c => StrictMonoidal c class Monoidal c => WeakMonoidal c assoc :: WeakMonoidal c => Ob c -> Ob c -> Ob c -> Ar c lunit :: WeakMonoidal c => Ob c -> Ar c runit :: WeakMonoidal c => Ob c -> Ar c class Monoidal c => Braided c twist :: Braided c => Ob c -> Ob c -> Ar c class Braided c => Symmetric c data FinOrd finOrdAr :: Int -> Int -> [Int] -> Ar FinOrd data FinCard finCardAr :: Int -> Int -> [Int] -> Ar FinCard finPerm :: [Int] -> Ar FinCard data Braid t :: Int -> Int -> Ar Braid t' :: Int -> Int -> Ar Braid data Vect k data Cob2 rewrite :: Ar Cob2 -> Ar Cob2 instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinOrd) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.FinCard) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Braid) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob (Math.QuantumAlgebra.TensorCategory.Vect k)) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Cob2) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Cob2) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.TensorCategory.Cob2) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Cob2) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Cob2) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.TensorCategory.Cob2) instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.TensorCategory.Cob2 instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.TensorCategory.Cob2 instance GHC.Num.Num k => Math.QuantumAlgebra.TensorCategory.MCategory (Math.QuantumAlgebra.TensorCategory.Vect k) instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.TensorCategory.Braid instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.TensorCategory.Braid instance Math.QuantumAlgebra.TensorCategory.Braided Math.QuantumAlgebra.TensorCategory.Braid instance Math.QuantumAlgebra.TensorCategory.MFunctor Math.QuantumAlgebra.TensorCategory.Braid Math.QuantumAlgebra.TensorCategory.FinCard instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.TensorCategory.FinCard instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.TensorCategory.FinCard instance Math.QuantumAlgebra.TensorCategory.MFunctor Math.QuantumAlgebra.TensorCategory.FinOrd Math.QuantumAlgebra.TensorCategory.FinCard instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.TensorCategory.FinOrd instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.TensorCategory.FinOrd -- | A module defining the category of tangles, and representations into -- the category of vector spaces (specifically, knot invariants). module Math.QuantumAlgebra.Tangle data Tangle data Oriented Plus :: Oriented Minus :: Oriented type TangleRep b = Vect (LaurentPoly Q) b cap :: [Oriented] -> TangleRep [Oriented] cup :: [Oriented] -> TangleRep [Oriented] over :: [Oriented] -> TangleRep [Oriented] under :: [Oriented] -> TangleRep [Oriented] loop :: Vect (LaurentPoly Q) [Oriented] kauffman :: Ar Tangle -> TangleRep [Oriented] -> TangleRep [Oriented] loopT :: Ar Tangle trefoilT :: Ar Tangle instance GHC.Show.Show Math.QuantumAlgebra.Tangle.Oriented instance GHC.Classes.Ord Math.QuantumAlgebra.Tangle.Oriented instance GHC.Classes.Eq Math.QuantumAlgebra.Tangle.Oriented instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.Tangle.Tangle) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.Tangle.Tangle) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.Tangle.Tangle) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.Tangle.Tangle) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.Tangle.Tangle) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.Tangle.Tangle) instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.Tangle.Tangle instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.Tangle.Tangle instance Math.Algebras.Structures.Mon [a] instance (GHC.Classes.Eq k, GHC.Num.Num k, GHC.Classes.Ord a) => Math.Algebras.Structures.Algebra k [a] module Math.QuantumAlgebra.OrientedTangle data Oriented Plus :: Oriented Minus :: Oriented data HorizDir ToL :: HorizDir ToR :: HorizDir data OrientedTangle idV :: () => a -> a idV' :: () => a -> a evalV :: (EBasis, EBasis) -> Vect (LaurentPoly Q) () evalV' :: (EBasis, EBasis) -> Vect (LaurentPoly Q) () coevalV :: (Eq k, Num k) => Int -> Vect k (Tensor EBasis EBasis) coevalV' :: (Eq k, Num k) => Int -> Vect k (Tensor EBasis EBasis) lambda :: Integral b => b -> LaurentPoly Q c :: Integral b => b -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) c' :: Integral b => b -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) testcc' :: Integral b => b -> Vect (LaurentPoly Q) (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) mu :: Integral b => b -> EBasis -> Vect (LaurentPoly Q) EBasis mu' :: Integral b => b -> EBasis -> Vect (LaurentPoly Q) EBasis capRL :: (Eq k, Num k) => Int -> Vect k (Tensor EBasis EBasis) capLR :: Int -> Vect (LaurentPoly Q) (EBasis, EBasis) cupRL :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) () cupLR :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) () xplus :: Integral b => b -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) xminus :: Integral b => b -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) yplus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) yminus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) tplus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) tminus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) zplus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) zminus :: Int -> (EBasis, EBasis) -> Vect (LaurentPoly Q) (EBasis, EBasis) oloop :: Int -> Vect (LaurentPoly Q) () otrefoil :: Int -> Vect (LaurentPoly Q) () otrefoil' :: Int -> Vect (LaurentPoly Q) () instance GHC.Show.Show Math.QuantumAlgebra.OrientedTangle.HorizDir instance GHC.Classes.Ord Math.QuantumAlgebra.OrientedTangle.HorizDir instance GHC.Classes.Eq Math.QuantumAlgebra.OrientedTangle.HorizDir instance GHC.Show.Show Math.QuantumAlgebra.OrientedTangle.Oriented instance GHC.Classes.Ord Math.QuantumAlgebra.OrientedTangle.Oriented instance GHC.Classes.Eq Math.QuantumAlgebra.OrientedTangle.Oriented instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ar Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance GHC.Show.Show (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance GHC.Classes.Ord (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance GHC.Classes.Eq (Math.QuantumAlgebra.TensorCategory.Ob Math.QuantumAlgebra.OrientedTangle.OrientedTangle) instance Math.QuantumAlgebra.TensorCategory.MCategory Math.QuantumAlgebra.OrientedTangle.OrientedTangle instance Math.QuantumAlgebra.TensorCategory.Monoidal Math.QuantumAlgebra.OrientedTangle.OrientedTangle