computational-algebra-0.0.2.0: Well-kinded computational algebra library, currently supporting Groebner basis.

Safe HaskellSafe-Infered

Algebra.Internal

Synopsis

Documentation

toProxy :: a -> Proxy a

data SNat n where

Constructors

SZ :: SNat Z 
SS :: SNat n -> SNat (S n) 

Instances

data Vector a n where

Constructors

Nil :: Vector a Z 
:- :: a -> Vector a n -> Vector a (S n) 

Instances

Monomorphicable Nat (Vector a) 
Eq (Monomial n) => Ord (Monomial n)

For simplicity, we choose grevlex for the default monomial ordering (for the sake of efficiency).

Wrapped (Monomial n) (Monomial m) (OrderedMonomial o n) (OrderedMonomial o' m) 
Eq a => Eq (Vector a n) 
Show a => Show (Vector a n) 

class Sing n where

Methods

sing :: SNat n

Instances

Sing Z 
Sing n => Sing (S n) 

data SingInstance a where

Constructors

SingInstance :: Sing a => SingInstance a 

toInt :: SNat n -> Int

type family Min n m :: Nat

type family Max n m :: Nat

sMin :: SNat n -> SNat m -> SNat (Min n m)

sMax :: SNat n -> SNat m -> SNat (Max n m)

sZ :: SNat Z

The smart constructor for SZ.

sS :: SNat n -> SNat (S n)

The smart constructor for SS n.

type family n :+: m :: Nat

(%+) :: SNat n -> SNat m -> SNat (n :+: m)

type family n :-: m :: Nat

(%-) :: (m :<<= n) ~ True => SNat n -> SNat m -> SNat (n :-: m)

type Zero = Z

type One = S Z

type Two = S (S Z)

type Three = S (S (S Z))

type SZero = SNat Zero

type SOne = SNat One

type STwo = SNat Two

lengthV :: Vector a n -> Int

sLengthV :: Vector a n -> SNat n

takeV :: (n :<<= m) ~ True => SNat n -> Vector a m -> Vector a n

dropV :: (n :<<= m) ~ True => SNat n -> Vector a m -> Vector a (m :-: n)

splitAtV :: (n :<<= m) ~ True => SNat n -> Vector a m -> (Vector a n, Vector a (m :-: n))

appendV :: Vector a n -> Vector a m -> Vector a (n :+: m)

foldrV :: (a -> b -> b) -> b -> Vector a n -> b

foldlV :: (a -> b -> a) -> a -> Vector b n -> a

singletonV :: a -> Vector a (S Z)

zipWithV :: (a -> b -> c) -> Vector a n -> Vector b n -> Vector c n

toList :: Vector a n -> [a]

allV :: (a -> Bool) -> Vector a n -> Bool

mapV :: (a -> b) -> Vector a n -> Vector b n

headV :: Vector a (S n) -> a

tailV :: Vector a (S n) -> Vector a n

data Leq n m where

Comparison witness via GADTs.

Constructors

ZeroLeq :: SNat m -> Leq Zero m 
SuccLeqSucc :: Leq n m -> Leq (S n) (S m) 

type family n :<<= m :: Bool

Comparison function

class n :<= m

Instances

Zero :<= n 
:<= n m => (S n) :<= (S m) 

data LeqInstance n m where

Constructors

LeqInstance :: n :<= m => LeqInstance n m 

data LeqTrueInstance a b where

Constructors

LeqTrueInstance :: (a :<<= b) ~ True => LeqTrueInstance a b 

boolToPropLeq :: (n :<<= m) ~ True => SNat n -> SNat m -> Leq n m

boolToClassLeq :: (n :<<= m) ~ True => SNat n -> SNat m -> LeqInstance n m

leqRefl :: SNat n -> Leq n n

leqSucc :: SNat n -> Leq n (S n)

data Eql a b where

Constructors

Eql :: Eql a a 

eqlRefl :: SNat a -> Eql a a

eqlSymm :: Eql a b -> Eql b a

eqlTrans :: Eql a b -> Eql b c -> Eql a c

plusZR :: SNat n -> Eql (n :+: Z) n

plusZL :: SNat n -> Eql (Z :+: n) n

eqPreservesS :: Eql n m -> Eql (S n) (S m)

plusAssociative :: SNat n -> SNat m -> SNat l -> Eql (n :+: (m :+: l)) ((n :+: m) :+: l)

sAndPlusOne :: SNat n -> Eql (S n) (n :+: One)

plusCommutative :: SNat n -> SNat m -> Eql (n :+: m) (m :+: n)

minusCongEq :: Eql n m -> SNat l -> Eql (n :-: l) (m :-: l)

eqSuccMinus :: (m :<<= n) ~ True => SNat n -> SNat m -> Eql (S n :-: m) (S (n :-: m))

plusMinusEqL :: SNat n -> SNat m -> Eql ((n :+: m) :-: m) n

plusMinusEqR :: SNat n -> SNat m -> Eql ((m :+: n) :-: m) n

plusLeqL :: SNat n -> SNat m -> Leq n (n :+: m)

plusLeqR :: SNat n -> SNat m -> Leq m (n :+: m)

zAbsorbsMinR :: SNat n -> Eql (Min n Z) Z

zAbsorbsMinL :: SNat n -> Eql (Min Z n) Z

minLeqL :: SNat n -> SNat m -> Leq (Min n m) n

minLeqR :: SNat n -> SNat m -> Leq (Min n m) m

leqRhs :: Leq n m -> SNat m

leqLhs :: Leq n m -> SNat n

leqTrans :: Leq n m -> Leq m l -> Leq n l

minComm :: SNat n -> SNat m -> Eql (Min n m) (Min m n)

leqAnitsymmetric :: Leq n m -> Leq m n -> Eql n m

maxZL :: SNat n -> Eql (Max Z n) n

maxComm :: SNat n -> SNat m -> Eql (Max n m) (Max m n)

maxZR :: SNat n -> Eql (Max n Z) n

maxLeqL :: SNat n -> SNat m -> Leq n (Max n m)

maxLeqR :: SNat n -> SNat m -> Leq m (Max n m)

data Monomorphic k

A wrapper type for polymophic types.

Constructors

forall a . Monomorphic (k a) 

Instances

class Monomorphicable k where

A types which have the monomorphic representation.

Associated Types

type MonomorphicRep k :: *

Monomorphic representation

Methods

promote :: MonomorphicRep k -> Monomorphic k

Promote the monomorphic value to the polymophic one.

demote :: Monomorphic k -> MonomorphicRep k

Demote the polymorphic value to the monomorphic representation.

demote' :: Monomorphicable k => k a -> MonomorphicRep k

Convinience function to demote polymorphic types into monomorphic one directly.

demoteComposed :: Monomorphicable (f :.: g) => f (g a) -> MonomorphicRep (f :.: g)

Demote polymorphic nested types directly into monomorphic representation.

monomorphicCompose :: f (g a) -> Monomorphic (f :.: g)

withPolymorhic :: Monomorphicable k => MonomorphicRep k -> (forall a. k a -> b) -> b

Apply dependently-typed function to the monomorphic representation.

liftPoly :: Monomorphicable k => (forall a. k a -> b) -> MonomorphicRep k -> b

Flipped version of withPolymorhic.

viaPoly :: (Monomorphicable k, Monomorphicable k') => (forall x y. k x -> k' y) -> MonomorphicRep k -> MonomorphicRep k'

Demote the function between polymorphic types into the one between monomorphic one.

newtype (f :.: g) a

Constructors

Comp (f (g a))