halg-core-0.6.0.0: Core types and functions of halg computational algebra suite.

Safe HaskellNone
LanguageHaskell2010

Algebra.Ring.Polynomial.Monomial

Contents

Synopsis

Documentation

type Monomial n = Sized' n Int Source #

N-ary Monomial. IntMap contains degrees for each x_i- type Monomial (n :: Nat) = Sized n Int

newtype OrderedMonomial ordering n Source #

A wrapper for monomials with a certain (monomial) order.

Constructors

OrderedMonomial 

Fields

Instances
Eq (Monomial n) => Eq (OrderedMonomial ordering n) Source # 
Instance details

Methods

(==) :: OrderedMonomial ordering n -> OrderedMonomial ordering n -> Bool #

(/=) :: OrderedMonomial ordering n -> OrderedMonomial ordering n -> Bool #

(Eq (Monomial n), IsOrder n name) => Ord (OrderedMonomial name n) Source #

Special ordering for ordered-monomials.

Instance details

Methods

compare :: OrderedMonomial name n -> OrderedMonomial name n -> Ordering #

(<) :: OrderedMonomial name n -> OrderedMonomial name n -> Bool #

(<=) :: OrderedMonomial name n -> OrderedMonomial name n -> Bool #

(>) :: OrderedMonomial name n -> OrderedMonomial name n -> Bool #

(>=) :: OrderedMonomial name n -> OrderedMonomial name n -> Bool #

max :: OrderedMonomial name n -> OrderedMonomial name n -> OrderedMonomial name n #

min :: OrderedMonomial name n -> OrderedMonomial name n -> OrderedMonomial name n #

KnownNat n => Show (OrderedMonomial ord n) Source # 
Instance details
KnownNat n => Unital (OrderedMonomial ord n) Source # 
Instance details

Methods

one :: OrderedMonomial ord n #

pow :: OrderedMonomial ord n -> Natural -> OrderedMonomial ord n #

productWith :: Foldable f => (a -> OrderedMonomial ord n) -> f a -> OrderedMonomial ord n #

KnownNat n => Division (OrderedMonomial ord n) Source # 
Instance details

Methods

recip :: OrderedMonomial ord n -> OrderedMonomial ord n #

(/) :: OrderedMonomial ord n -> OrderedMonomial ord n -> OrderedMonomial ord n #

(\\) :: OrderedMonomial ord n -> OrderedMonomial ord n -> OrderedMonomial ord n #

(^) :: Integral n0 => OrderedMonomial ord n -> n0 -> OrderedMonomial ord n

Multiplicative (OrderedMonomial ord n) Source # 
Instance details

Methods

(*) :: OrderedMonomial ord n -> OrderedMonomial ord n -> OrderedMonomial ord n #

pow1p :: OrderedMonomial ord n -> Natural -> OrderedMonomial ord n #

productWith1 :: Foldable1 f => (a -> OrderedMonomial ord n) -> f a -> OrderedMonomial ord n #

Hashable (Monomial n) => Hashable (OrderedMonomial ordering n) Source # 
Instance details

Methods

hashWithSalt :: Int -> OrderedMonomial ordering n -> Int #

hash :: OrderedMonomial ordering n -> Int #

NFData (OrderedMonomial ordering n) Source # 
Instance details

Methods

rnf :: OrderedMonomial ordering n -> () #

Wrapped (OrderedMonomial ordering n) Source # 
Instance details

Associated Types

type Unwrapped (OrderedMonomial ordering n) :: *

Methods

_Wrapped' :: Iso' (OrderedMonomial ordering n) (Unwrapped (OrderedMonomial ordering n))

OrderedMonomial ordering1 n1 ~ t => Rewrapped (OrderedMonomial ordering2 n2) t Source # 
Instance details
type Unwrapped (OrderedMonomial ordering n) Source # 
Instance details
type Unwrapped (OrderedMonomial ordering n) = Monomial n

class IsOrder (n :: Nat) (ordering :: Type) where Source #

Class to lookup ordering from its (type-level) name.

Minimal complete definition

cmpMonomial

Methods

cmpMonomial :: Proxy ordering -> MonomialOrder n Source #

Instances
IsOrder n Grlex Source # 
Instance details
IsOrder n Lex Source # 
Instance details
IsOrder n Revlex Source # 
Instance details
IsOrder n Grevlex Source # 
Instance details
IsOrder n ord => IsOrder n (Graded ord) Source # 
Instance details
(KnownNat n, IsOrder n ord, SingI ws) => IsOrder n (WeightOrder ws ord) Source # 
Instance details
(IsOrder n ord, IsOrder m ord', KnownNat m, KnownNat n, k ~ (n + m)) => IsOrder k (ProductOrder n m ord ord') Source # 
Instance details

Methods

cmpMonomial :: Proxy (ProductOrder n m ord ord') -> MonomialOrder k Source #

class IsOrder n name => IsMonomialOrder n name Source #

Class for Monomial orders.

Instances
IsMonomialOrder n Lex Source # 
Instance details
IsMonomialOrder n Grevlex Source # 
Instance details
IsMonomialOrder n Grlex Source # 
Instance details
IsMonomialOrder n ord => IsMonomialOrder n (Graded ord) Source # 
Instance details
(KnownNat k, SingI ws, IsMonomialOrder k ord) => IsMonomialOrder k (WeightOrder ws ord) Source # 
Instance details
(KnownNat n, KnownNat m, IsMonomialOrder n o, IsMonomialOrder m o', k ~ (n + m)) => IsMonomialOrder k (ProductOrder n m o o') Source # 
Instance details

type MonomialOrder n = Monomial n -> Monomial n -> Ordering Source #

Monomial order (of degree n). This should satisfy following laws: (1) Totality: forall a, b (a < b || a == b || b < a) (2) Additivity: a b == a + c <= b + c (3) Non-negative: forall a, 0 <= a

type IsStrongMonomialOrder ord = Forall (IsMonomialOrder' ord) Source #

Monomial ordering which can do with monomials of arbitrary large arity.

data ProductOrder (n :: Nat) (m :: Nat) (a :: Type) (b :: Type) where Source #

Constructors

ProductOrder :: Sing n -> Sing m -> ord -> ord' -> ProductOrder n m ord ord' 
Instances
(KnownNat n, KnownNat m, IsMonomialOrder n ord, IsMonomialOrder m ord', k ~ (n + m), KnownNat k) => EliminationType k (n :: Nat) (ProductOrder n m ord ord') Source # 
Instance details
(KnownNat n, KnownNat m, IsMonomialOrder n o, IsMonomialOrder m o', k ~ (n + m)) => IsMonomialOrder k (ProductOrder n m o o') Source # 
Instance details
(IsOrder n ord, IsOrder m ord', KnownNat m, KnownNat n, k ~ (n + m)) => IsOrder k (ProductOrder n m ord ord') Source # 
Instance details

Methods

cmpMonomial :: Proxy (ProductOrder n m ord ord') -> MonomialOrder k Source #

productOrder :: forall ord ord' n m. (IsOrder n ord, IsOrder m ord', KnownNat n, KnownNat m) => Proxy (ProductOrder n m ord ord') -> MonomialOrder (n + m) Source #

productOrder' :: forall n ord ord' m. (IsOrder n ord, IsOrder m ord') => SNat n -> SNat m -> ord -> ord' -> MonomialOrder (n + m) Source #

type WeightProxy (v :: [Nat]) = SList v Source #

data WeightOrder (v :: [Nat]) (ord :: Type) where Source #

Constructors

WeightOrder :: SList (v :: [Nat]) -> Proxy ord -> WeightOrder v ord 
Instances
(IsMonomialOrder k ord, ones ~ Replicate n 1, SingI ones, (Length ones <= k) ~ True, KnownNat k) => EliminationType k (n :: Nat) (WeightOrder ones ord) Source # 
Instance details
(KnownNat k, SingI ws, IsMonomialOrder k ord) => IsMonomialOrder k (WeightOrder ws ord) Source # 
Instance details
(KnownNat n, IsOrder n ord, SingI ws) => IsOrder n (WeightOrder ws ord) Source # 
Instance details

tryDiv :: Field r => (r, OrderedMonomial ord n) -> (r, OrderedMonomial ord n) -> (r, OrderedMonomial ord n) Source #

data Lex Source #

Lexicographical order

Constructors

Lex 
Instances
Eq Lex Source # 
Instance details

Methods

(==) :: Lex -> Lex -> Bool #

(/=) :: Lex -> Lex -> Bool #

Ord Lex Source # 
Instance details

Methods

compare :: Lex -> Lex -> Ordering #

(<) :: Lex -> Lex -> Bool #

(<=) :: Lex -> Lex -> Bool #

(>) :: Lex -> Lex -> Bool #

(>=) :: Lex -> Lex -> Bool #

max :: Lex -> Lex -> Lex #

min :: Lex -> Lex -> Lex #

Show Lex Source # 
Instance details

Methods

showsPrec :: Int -> Lex -> ShowS #

show :: Lex -> String #

showList :: [Lex] -> ShowS #

IsMonomialOrder n Lex Source # 
Instance details
IsOrder n Lex Source # 
Instance details
KnownNat n => EliminationType n (m :: k) Lex Source # 
Instance details

class (IsMonomialOrder n ord, KnownNat n) => EliminationType n m ord Source #

Monomial order which can be use to calculate n-th elimination ideal of m-ary polynomial. This should judge monomial to be bigger if it contains variables to eliminate.

Instances
KnownNat n => EliminationType n (m :: k) Lex Source # 
Instance details
(IsMonomialOrder k ord, ones ~ Replicate n 1, SingI ones, (Length ones <= k) ~ True, KnownNat k) => EliminationType k (n :: Nat) (WeightOrder ones ord) Source # 
Instance details
(KnownNat n, KnownNat m, IsMonomialOrder n ord, IsMonomialOrder m ord', k ~ (n + m), KnownNat k) => EliminationType k (n :: Nat) (ProductOrder n m ord ord') Source # 
Instance details

type WeightedEliminationOrder (n :: Nat) (ord :: Type) = WeightOrder (Replicate n 1) ord Source #

lex :: MonomialOrder n Source #

Lexicographical order. This *is* a monomial order.

revlex :: MonomialOrder n Source #

Reversed lexicographical order. This is *not* a monomial order.

graded :: MonomialOrder n -> MonomialOrder n Source #

Convert ordering into graded one.

grlex :: MonomialOrder n Source #

Graded lexicographical order. This *is* a monomial order.

grevlex :: MonomialOrder n Source #

Graded reversed lexicographical order. This *is* a monomial order.

weightOrder :: forall n ns ord. (KnownNat n, IsOrder n ord, SingI ns) => Proxy (WeightOrder ns ord) -> MonomialOrder n Source #

data Grevlex Source #

Graded reversed lexicographical order. Same as Graded Revlex.

Constructors

Grevlex 
Instances
Eq Grevlex Source # 
Instance details

Methods

(==) :: Grevlex -> Grevlex -> Bool #

(/=) :: Grevlex -> Grevlex -> Bool #

Ord Grevlex Source # 
Instance details
Show Grevlex Source # 
Instance details
IsMonomialOrder n Grevlex Source # 
Instance details
IsOrder n Grevlex Source # 
Instance details

fromList :: SNat n -> [Int] -> Monomial n Source #

convert NAry list into Monomial.

data Revlex Source #

Reversed lexicographical order

Constructors

Revlex 
Instances
Eq Revlex Source # 
Instance details

Methods

(==) :: Revlex -> Revlex -> Bool #

(/=) :: Revlex -> Revlex -> Bool #

Ord Revlex Source # 
Instance details
Show Revlex Source # 
Instance details
IsOrder n Revlex Source # 
Instance details

data Grlex Source #

Graded lexicographical order. Same as Graded Lex.

Constructors

Grlex 
Instances
Eq Grlex Source # 
Instance details

Methods

(==) :: Grlex -> Grlex -> Bool #

(/=) :: Grlex -> Grlex -> Bool #

Ord Grlex Source # 
Instance details

Methods

compare :: Grlex -> Grlex -> Ordering #

(<) :: Grlex -> Grlex -> Bool #

(<=) :: Grlex -> Grlex -> Bool #

(>) :: Grlex -> Grlex -> Bool #

(>=) :: Grlex -> Grlex -> Bool #

max :: Grlex -> Grlex -> Grlex #

min :: Grlex -> Grlex -> Grlex #

Show Grlex Source # 
Instance details

Methods

showsPrec :: Int -> Grlex -> ShowS #

show :: Grlex -> String #

showList :: [Grlex] -> ShowS #

IsMonomialOrder n Grlex Source # 
Instance details
IsOrder n Grlex Source # 
Instance details

newtype Graded ord Source #

Graded order from another monomial order.

Constructors

Graded ord 
Instances
IsMonomialOrder n ord => IsMonomialOrder n (Graded ord) Source # 
Instance details
IsOrder n ord => IsOrder n (Graded ord) Source # 
Instance details
Eq ord => Eq (Graded ord) Source # 
Instance details

Methods

(==) :: Graded ord -> Graded ord -> Bool #

(/=) :: Graded ord -> Graded ord -> Bool #

Ord ord => Ord (Graded ord) Source # 
Instance details

Methods

compare :: Graded ord -> Graded ord -> Ordering #

(<) :: Graded ord -> Graded ord -> Bool #

(<=) :: Graded ord -> Graded ord -> Bool #

(>) :: Graded ord -> Graded ord -> Bool #

(>=) :: Graded ord -> Graded ord -> Bool #

max :: Graded ord -> Graded ord -> Graded ord #

min :: Graded ord -> Graded ord -> Graded ord #

Read ord => Read (Graded ord) Source # 
Instance details
Show ord => Show (Graded ord) Source # 
Instance details

Methods

showsPrec :: Int -> Graded ord -> ShowS #

show :: Graded ord -> String #

showList :: [Graded ord] -> ShowS #

varMonom :: SNat n -> Ordinal n -> Monomial n Source #

sOnes :: Sing n -> Sing (Replicate n 1) Source #

withStrongMonomialOrder :: forall ord n r proxy (proxy' :: Nat -> Type). IsStrongMonomialOrder ord => proxy ord -> proxy' n -> (IsMonomialOrder n ord => r) -> r Source #

cmpAnyMonomial :: IsStrongMonomialOrder ord => Proxy ord -> Monomial n -> Monomial m -> Ordering Source #

Comparing monomials with different arity, padding with 0 at bottom of the shorter monomial to make the length equal.

orderMonomial :: proxy ord -> Monomial n -> OrderedMonomial ord n Source #

Orphan instances

Ord (Monomial n) Source #

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

Instance details

Methods

compare :: Monomial n -> Monomial n -> Ordering #

(<) :: Monomial n -> Monomial n -> Bool #

(<=) :: Monomial n -> Monomial n -> Bool #

(>) :: Monomial n -> Monomial n -> Bool #

(>=) :: Monomial n -> Monomial n -> Bool #

max :: Monomial n -> Monomial n -> Monomial n #

min :: Monomial n -> Monomial n -> Monomial n #

KnownNat n => Unital (Monomial n) Source # 
Instance details

Methods

one :: Monomial n #

pow :: Monomial n -> Natural -> Monomial n #

productWith :: Foldable f => (a -> Monomial n) -> f a -> Monomial n #

Multiplicative (Monomial n) Source # 
Instance details

Methods

(*) :: Monomial n -> Monomial n -> Monomial n #

pow1p :: Monomial n -> Natural -> Monomial n #

productWith1 :: Foldable1 f => (a -> Monomial n) -> f a -> Monomial n #