diff --git a/Algebra/Algorithms/Groebner.hs b/Algebra/Algorithms/Groebner.hs
--- a/Algebra/Algorithms/Groebner.hs
+++ b/Algebra/Algorithms/Groebner.hs
@@ -18,7 +18,7 @@
        , NormalStrategy(..), SugarStrategy(..), GradedStrategy(..)
        -- * Ideal operations
        , isIdealMember, intersection, thEliminationIdeal, thEliminationIdealWith
-       , unsafeThEliminationIdealWith
+       , unsafeThEliminationIdealWith, eliminatePadding
        , quotIdeal, quotByPrincipalIdeal
        , saturationIdeal, saturationByPrincipalIdeal
        -- * Resultant
diff --git a/Algebra/Field/AlgebraicReal.hs b/Algebra/Field/AlgebraicReal.hs
--- a/Algebra/Field/AlgebraicReal.hs
+++ b/Algebra/Field/AlgebraicReal.hs
@@ -150,6 +150,8 @@
 instance Multiplicative Algebraic where
   (*) = multA
   {-# INLINE (*) #-}
+  pow1p a = powA a . succ
+  {-# INLINE pow1p #-}
 
 instance LeftModule (Scalar (Fraction Integer)) Algebraic where
   (.*) = multA . Rational . runScalar
@@ -308,10 +310,6 @@
   minusA (plusA x y) x = y
 "plusminus/left" [~1] forall x (y :: Algebraic) .
   plusA x (minusA y x) = y
-"plus-zero-left" [~1] forall x.
-  plusA 0 x = x
-"plus-zero-right" [~1] forall x.
-  plusA x 0 = x
   #-}
 
 plusA :: Algebraic -> Algebraic -> Algebraic
@@ -368,11 +366,6 @@
 normalize :: (Eq r, Euclidean r, Division r) => Unipol r -> Unipol r
 normalize = monoize . sqFreePart
 
-shiftP :: (Domain r, Division r, Eq r, Euclidean r)
-       => Unipol r -> Unipol r
-shiftP f | isZero (coeff one f) = f `quot` var 0
-         | otherwise = f
-
 stabilize :: Algebraic -> Algebraic
 stabilize r@Rational{} = r
 stabilize ar@(Algebraic f ss int)
@@ -525,10 +518,6 @@
       int = catcher multInt fg (stabilize a) (stabilize b)
   in fromJust $ algebraic fg int
 
-defEqn :: Algebraic -> Unipol Rational
-defEqn (Rational a) = var 0 - injectCoeff a
-defEqn a@Algebraic{} = eqn a
-
 improveNonzero :: Algebraic -> Interval Rational
 improveNonzero (Algebraic _ ss int0) = go int0
   where
@@ -636,10 +625,6 @@
          | n == 0    = Rational 1
          | otherwise = r ^ P.fromIntegral n
 {-# INLINE powA #-}
-
-iterateImprove :: Rational -> Unipol Rational -> Interval Rational -> Interval Rational
-iterateImprove eps f =
-  iterateImproveStrum eps (strum f)
 
 iterateImproveStrum :: Rational -> [Unipol Rational] -> Interval Rational -> Interval Rational
 iterateImproveStrum eps ss int0 =
diff --git a/Algebra/Field/Galois/Internal.hs b/Algebra/Field/Galois/Internal.hs
--- a/Algebra/Field/Galois/Internal.hs
+++ b/Algebra/Field/Galois/Internal.hs
@@ -6,13 +6,13 @@
        (ConwayPolynomial(..),
         Conway,
         buildInstance,
-        parseLine) where
+        parseLine
+       ) where
 import           Algebra.Field.Finite
 import           Algebra.Prelude.Core               hiding (lex, lift)
 import           Algebra.Ring.Polynomial.Univariate (Unipol)
 import           Data.Char                          (isDigit)
 import           Data.Char                          (digitToInt)
-import qualified Data.Map                           as M
 import           Data.Reflection
 import qualified GHC.TypeLits                       as TL
 import           Language.Haskell.TH
diff --git a/Algebra/Internal.hs b/Algebra/Internal.hs
--- a/Algebra/Internal.hs
+++ b/Algebra/Internal.hs
@@ -3,7 +3,7 @@
 {-# LANGUAGE MultiParamTypeClasses, PatternSynonyms, PolyKinds, RankNTypes #-}
 {-# LANGUAGE ScopedTypeVariables, StandaloneDeriving, TypeFamilies         #-}
 {-# LANGUAGE TypeOperators                                                 #-}
-{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
+{-# OPTIONS_GHC -Wincomplete-patterns -Wno-orphans #-}
 module Algebra.Internal
        (  (:~:)(..), withRefl,
           module Data.Proxy,
@@ -41,6 +41,7 @@
 import           Data.Type.Natural.Class      as Algebra.Internal
 import qualified Data.Type.Ordinal            as O
 import qualified Data.Vector                  as DV
+import          Data.ListLike (ListLike)
 import           GHC.TypeLits                 as Algebra.Internal
 import           Proof.Equational             (coerce, withRefl)
 import           Proof.Equational             as Algebra.Internal (because,
@@ -64,7 +65,8 @@
 
 type SNat (n :: Nat) = Sing n
 
-sizedLength f = (S.sLength f)
+sizedLength :: ListLike (f a) a => S.Sized f n a -> Sing n
+sizedLength f = S.sLength f
 
 padVecs :: forall a n m. a -> Sized' n a -> Sized' m a
         -> (SNat (Max n m), Sized' (Max n m) a, Sized' (Max n m) a)
diff --git a/Algebra/LinkedMatrix.hs b/Algebra/LinkedMatrix.hs
--- a/Algebra/LinkedMatrix.hs
+++ b/Algebra/LinkedMatrix.hs
@@ -19,7 +19,7 @@
                              scaleCol, clearRow, clearCol, index, (!),
                              nonZeroEntries, rankLM, splitIndependentDirs,
                              structuredGauss, multWithVector, solveWiedemann,
-                             henselLift, solveHensel, structuredGauss') where
+                             henselLift, solveHensel, structuredGauss', intDet) where
 import Algebra.Algorithms.ChineseRemainder
 import Algebra.Field.Finite
 import Algebra.Instances                   ()
@@ -587,31 +587,6 @@
 nonZeroEntries :: Matrix a -> Vector ((Int, Int), a)
 nonZeroEntries mat = V.map (view idx &&& view value) $ mat ^. coefficients
 
-matListView :: (Show a, Monoidal a) => Matrix a -> String
-matListView = unlines . map (('\t':).show) . toLists
-
-prettyMat :: Show a => Matrix a -> String
-prettyMat mat =
-  unlines [ "row start: " <> starter Row
-          , "col start: " <> starter Column
-          , "[" <> (intercalate ", " $ V.toList $ V.imap (\i e -> "(#" <> show i <> ") " <> prettyEntry e) $ mat^.coefficients) <> "]"
-          ]
-  where
-    starter dir = intercalate ", " (map (\(a,b) -> show a ++ " -> " ++ show b) (mat^.startL dir.to IM.toList))
-
-prettyEntry :: Show a => Entry a -> String
-prettyEntry ent =
-  concat [ show $ ent^.value, " "
-         , show $ ent^.idx
-         , "->("
-         ,showMaybe (ent^.nextL Row)
-         , ", "
-         ,showMaybe (ent^.nextL Column)
-         , ")"
-         ]
-  where
-    showMaybe = maybe "_" show
-
 multWithVector :: (Multiplicative a, Monoidal a)
                => Matrix a -> Vector a -> Vector a
 multWithVector mat v =
@@ -627,6 +602,7 @@
 nonZeroCols :: Matrix r -> [Int]
 nonZeroCols = nonZeroDirs Column
 
+{-
 testCase :: Matrix (Fraction Integer)
 testCase = fromLists [[0,0,0,0,0,0,2,-3,-1,0]
                       ,[0,0,0,2,-3,-1,0,0,0,0]
@@ -635,6 +611,7 @@
                       ,[2,-3,0,-1,0,0,0,0,0,0]
                       ,[1,0,1,0,0,1,0,0,0,-1]
                       ,[1,0,1,0,0,1,-2,0,0,0]]
+-}
 
 newtype Square n r = Square { runSquare :: Matrix r
                             } deriving (Show, Eq, Additive, Multiplicative)
@@ -838,16 +815,6 @@
             case mns of
               ((l,m):mn) | i == l -> build (m : ans) (i-1) mn vecs
               _ -> build (V.empty : ans) (i-1) mns vecs
-
-(.!) :: (a -> b) -> (t -> a) -> t -> b
-(f .! g) x = f $! g x
-
-infixr 9 .!
-
-clearDenom :: Euclidean a => Matrix (Fraction a) -> (a, Matrix a)
-clearDenom mat =
-  let g = V.foldr' (lcm' . denominator . snd) one $ nonZeroEntries mat
-  in (g, cmap (numerator . (* (g % one))) mat)
 
 lcm' :: Euclidean r => r -> r -> r
 lcm' n m = n * m `quot` gcd n m
diff --git a/Algebra/Prelude/Core.hs b/Algebra/Prelude/Core.hs
--- a/Algebra/Prelude/Core.hs
+++ b/Algebra/Prelude/Core.hs
@@ -23,8 +23,6 @@
 n % m = injectCoeff (n / m)
 infixl 7 %
 
-type Rational = Fraction Integer
-
 logBase2 :: Int -> Int
 logBase2 x = finiteBitSize x - 1 - countLeadingZeros x
 {-# INLINE logBase2 #-}
diff --git a/Algebra/Ring/Ideal.hs b/Algebra/Ring/Ideal.hs
--- a/Algebra/Ring/Ideal.hs
+++ b/Algebra/Ring/Ideal.hs
@@ -50,7 +50,6 @@
 mapIdeal :: (r -> r') -> Ideal r -> Ideal r'
 mapIdeal fun (Ideal xs) = Ideal $ S.map fun xs
 {-# INLINE [1] mapIdeal #-}
-{-# RULES "mapIdeal/id" [~1] forall x. mapIdeal id x = x #-}
 
 instance NFData r => NFData (Ideal r) where
   rnf (Ideal is) = rnf is
diff --git a/Algebra/Ring/Polynomial/Class.hs b/Algebra/Ring/Polynomial/Class.hs
--- a/Algebra/Ring/Polynomial/Class.hs
+++ b/Algebra/Ring/Polynomial/Class.hs
@@ -201,7 +201,6 @@
 
 {-# RULES
 "liftMap/identity"   liftMap (\ x -> x) = (P.id :: poly -> poly)
-"liftMap/identity-2" liftMap P.id = (P.id :: poly -> poly)
   #-}
 
 -- | Class to lookup ordering from its (type-level) name.
diff --git a/Algebra/Ring/Polynomial/Internal.hs b/Algebra/Ring/Polynomial/Internal.hs
--- a/Algebra/Ring/Polynomial/Internal.hs
+++ b/Algebra/Ring/Polynomial/Internal.hs
@@ -33,7 +33,6 @@
 import           Control.DeepSeq                       (NFData)
 import           Control.Lens                          hiding (assign)
 import qualified Data.Coerce                           as C
-import qualified Data.Foldable                         as F
 import qualified Data.HashSet                          as HS
 import           Data.Map                              (Map)
 import qualified Data.Map.Strict                       as M
@@ -93,9 +92,6 @@
       extractPower = runMult . ifoldMap (\ o -> Mult . pow (mor o) . fromIntegral) . getMonomial
   {-# INLINE liftMap #-}
 
-ordVec :: forall n. KnownNat n => Sized n (Ordinal n)
-ordVec = unsafeFromList' $ enumOrdinal (sing :: SNat n)
-
 instance (KnownNat n, CoeffRing r, IsMonomialOrder n ord)
       => IsOrderedPolynomial (OrderedPolynomial r ord n) where
   -- | coefficient for a degree.
@@ -170,7 +166,7 @@
 -- -- | By Hilbert's finite basis theorem, a polynomial ring over a noetherian ring is also a noetherian ring.
 instance (IsMonomialOrder n order, CoeffRing r, KnownNat n) => Ring (OrderedPolynomial r order n) where
   fromInteger 0 = Polynomial M.empty
-  fromInteger n = Polynomial $ M.singleton one (fromInteger' n)
+  fromInteger n = Polynomial $ M.singleton one (NA.fromInteger n)
   {-# INLINE fromInteger #-}
 
 decZero :: DecidableZero r => r -> Maybe r
@@ -239,41 +235,17 @@
        => Show (OrderedPolynomial r order n) where
   showsPrec = showsPolynomialWith $ generate sing (\i -> "X_" ++ show (fromEnum i))
 
-showPolynomialWithVars :: (CoeffRing a, Show a, KnownNat n, IsMonomialOrder n ordering)
-                       => [(Int, String)] -> OrderedPolynomial a ordering n -> String
-showPolynomialWithVars dic p0@(Polynomial d)
-    | isZero p0 = "0"
-    | otherwise = intercalate " + " $ mapMaybe showTerm $ M.toDescList d
-    where
-      showTerm (getMonomial -> deg, c)
-          | isZero c = Nothing
-          | otherwise =
-              let cstr = if (not (isZero $ c - one) || isConstantMonomial deg)
-                         then show c ++ " "
-                         else if isZero (c - one) then ""
-                              else if isZero (c + one)
-                              then if any (not . isZero) (F.toList deg) then "-" else "-1"
-                              else  ""
-              in Just $ cstr ++ unwords (mapMaybe showDeg (zip [0..] $ F.toList deg))
-      showDeg (n, p) | p == 0    = Nothing
-                     | p == 1    = Just $ showVar n
-                     | otherwise = Just $ showVar n ++ "^" ++ show p
-      showVar n = fromMaybe ("X_" ++ show n) $ lookup n dic
-
-isConstantMonomial :: Monomial n -> Bool
-isConstantMonomial v = all (== 0) $ F.toList v
-
 -- | We provide Num instance to use trivial injection R into R[X].
 --   Do not use signum or abs.
 instance (IsMonomialOrder n order, CoeffRing r, KnownNat n)
       => P.Num (OrderedPolynomial r order n) where
-  (+) = (+)
+  (+) = (NA.+)
   {-# INLINE (+) #-}
 
-  (*) = (*)
+  (*) = (NA.*)
   {-# INLINE (*) #-}
 
-  fromInteger = normalize . injectCoeff . fromInteger'
+  fromInteger = NA.fromInteger
   {-# INLINE fromInteger #-}
 
   signum f = if isZero f then zero else injectCoeff one
@@ -506,6 +478,8 @@
        => RightModule (Scalar r) (PadPolyL n ord poly) where
   PadPolyL f *. r = PadPolyL $ mapCoeff' (*. r) f
   {-# INLINE (*.) #-}
+deriving instance (KnownNat n, IsMonomialOrder n ord, IsPolynomial poly)
+               => Num (PadPolyL n ord poly)
 
 instance (KnownNat n, IsMonomialOrder n ord, IsPolynomial poly)
      =>  IsPolynomial (PadPolyL n ord poly) where
@@ -547,3 +521,8 @@
 padLeftPoly :: (IsMonomialOrder n ord, IsPolynomial poly)
             => Sing n -> ord -> poly -> PadPolyL n ord poly
 padLeftPoly n _ = withKnownNat n $ PadPolyL . injectCoeff
+
+instance (r ~ Coefficient poly, IsPolynomial poly,
+          KnownNat n, CoeffRing r, IsMonomialOrder n order, PrettyCoeff r)
+       => Show (PadPolyL n order poly) where
+  showsPrec = showsPolynomialWith $ generate sing (\i -> "X_" ++ show (fromEnum i))
diff --git a/Algebra/Ring/Polynomial/Labeled.hs b/Algebra/Ring/Polynomial/Labeled.hs
--- a/Algebra/Ring/Polynomial/Labeled.hs
+++ b/Algebra/Ring/Polynomial/Labeled.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE CPP, ConstraintKinds, DataKinds, EmptyCase, FlexibleContexts  #-}
 {-# LANGUAGE FlexibleInstances, GADTs, GeneralizedNewtypeDeriving          #-}
+{-# LANGUAGE TypeApplications #-}
 {-# LANGUAGE IncoherentInstances, KindSignatures, MultiParamTypeClasses    #-}
 {-# LANGUAGE OverloadedLabels, PolyKinds, RankNTypes, ScopedTypeVariables  #-}
 {-# LANGUAGE StandaloneDeriving, TemplateHaskell, TypeFamilies, TypeInType #-}
@@ -29,7 +30,11 @@
 import           GHC.OverloadedLabels         (IsLabel (..))
 import qualified Numeric.Algebra              as NA
 import qualified Prelude                      as P
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 802
+import qualified Data.Text as T
+#endif
 
+
 type family UniqueList' (x :: Symbol) (xs :: [Symbol]) :: Constraint where
   UniqueList' x '[] = ()
   UniqueList' x (x ': xs) = TypeError ('Text "The variable " ':<>: 'ShowType x ':<>: 'Text " occurs more than once!")
@@ -49,10 +54,17 @@
           IsPolynomial poly,
           Wraps vars poly,
           Elem symb vars ~ 'True) => IsLabel symb (LabPolynomial poly vars) where
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 802
+  fromLabel =
+    let vs = map T.unpack $ fromSing (sing :: Sing vars)
+        v  = symbolVal @symb Proxy
+    in maybe (error "impossible!") (var . toEnum) $ L.elemIndex v vs
+#else
   fromLabel k =
     let vs = fromSing (sing :: Sing vars)
         v    = symbolVal' k
     in maybe (error "impossible!") (var . toEnum) $ L.elemIndex v vs
+#endif
 
 data LabPolynomial poly (vars :: [Symbol]) where
   LabelPolynomial :: (IsUniqueList vars, Length vars ~ Arity poly)
@@ -74,7 +86,12 @@
       => Show (LabPolynomial poly vars) where
   showsPrec d (LabelPolynomial f) =
     let svs   = sing :: Sing vars
-        vs    = fromSing svs
+        vs    =
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 802
+          map T.unpack $ 
+#endif
+
+          fromSing svs
         vsVec = generate sing $ \i -> vs !! fromEnum i
     in showsPolynomialWith vsVec d f
 
diff --git a/Algebra/Ring/Polynomial/Monomial.hs b/Algebra/Ring/Polynomial/Monomial.hs
--- a/Algebra/Ring/Polynomial/Monomial.hs
+++ b/Algebra/Ring/Polynomial/Monomial.hs
@@ -24,29 +24,27 @@
        ) where
 import Algebra.Internal
 
-import           AlgebraicPrelude                hiding (lex)
-import           Control.DeepSeq                 (NFData (..))
-import           Control.Lens                    (Ixed (..), alaf, imap,
-                                                  makeLenses, makeWrapped, (%~),
-                                                  (&), (.~), _Wrapped)
-import           Data.Constraint                 ((:=>) (..), Dict (..))
-import qualified Data.Constraint                 as C
+import           AlgebraicPrelude             hiding (lex)
+import           Control.DeepSeq              (NFData (..))
+import           Control.Lens                 (Ixed (..), imap, makeLenses,
+                                               makeWrapped, (%~), (&), (.~),
+                                               _Wrapped)
+import           Data.Constraint              ((:=>) (..), Dict (..))
+import qualified Data.Constraint              as C
 import           Data.Constraint.Forall
-import qualified Data.Foldable                   as F
-import           Data.Hashable                   (Hashable (..))
-import           Data.Kind                       (Type)
-import           Data.Maybe                      (catMaybes)
-import           Data.Monoid                     (Dual (..))
-import           Data.Monoid                     ((<>))
-import qualified Data.MonoTraversable.Unprefixed as MT
-import           Data.Ord                        (comparing)
-import           Data.Singletons.Prelude         (POrd (..), SList, Sing ())
-import           Data.Singletons.Prelude         (SingKind (..))
-import           Data.Singletons.Prelude.List    (Length, Replicate, sReplicate)
-import           Data.Singletons.TypeLits        (withKnownNat)
-import qualified Data.Sized.Builtin              as V
-import           Data.Type.Natural.Class         (IsPeano (..), PeanoOrder (..))
-import           Data.Type.Ordinal               (Ordinal (..), ordToInt)
+import qualified Data.Foldable                as F
+import           Data.Hashable                (Hashable (..))
+import           Data.Kind                    (Type)
+import           Data.Maybe                   (catMaybes)
+import           Data.Monoid                  ((<>))
+import           Data.Ord                     (comparing)
+import           Data.Singletons.Prelude      (POrd (..), SList, Sing ())
+import           Data.Singletons.Prelude      (SingKind (..))
+import           Data.Singletons.Prelude.List (Length, Replicate, sReplicate)
+import           Data.Singletons.TypeLits     (withKnownNat)
+import qualified Data.Sized.Builtin           as V
+import           Data.Type.Natural.Class      (IsPeano (..), PeanoOrder (..))
+import           Data.Type.Ordinal            (Ordinal (..), ordToInt)
 -- import           Prelude                         hiding (Fractional (..),
 --                                                   Integral (..), Num (..),
 --                                                   Real (..), lex, product, sum)
@@ -133,20 +131,6 @@
 -- | Class to lookup ordering from its (type-level) name.
 class IsOrder (n :: Nat) (ordering :: *) where
   cmpMonomial :: Proxy ordering -> MonomialOrder n
-
-head' :: (0 :< n) ~ 'True => Sized' n a -> a
-head' = V.head
-{-# INLINE head' #-}
-
--- We know that Monomial ordering coincides on lex ordering
--- on univariate monomials.
-{-# RULES
-"cmpMonomial/unary" [~1]
-              forall (pxy :: IsMonomialOrder 1 (o :: *) => Proxy o)
-                     (xs :: Sized' 1 Int)
-                     (ys :: Sized' 1 Int).
-  cmpMonomial pxy xs ys = comparing head' xs ys
- #-}
 
 -- * Names for orderings.
 --   We didn't choose to define one single type for ordering names for the extensibility.
diff --git a/Algebra/Ring/Polynomial/Univariate.hs b/Algebra/Ring/Polynomial/Univariate.hs
--- a/Algebra/Ring/Polynomial/Univariate.hs
+++ b/Algebra/Ring/Polynomial/Univariate.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE BangPatterns, ConstraintKinds, DataKinds, FlexibleContexts #-}
+{-# LANGUAGE BangPatterns, CPP, ConstraintKinds, DataKinds, FlexibleContexts #-}
 {-# LANGUAGE GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses   #-}
 {-# LANGUAGE NoImplicitPrelude, ScopedTypeVariables, StandaloneDeriving #-}
 {-# LANGUAGE TypeApplications, TypeFamilies, UndecidableSuperClasses    #-}
@@ -28,7 +28,7 @@
 import qualified Numeric.Algebra                       as NA
 import           Numeric.Decidable.Zero                (DecidableZero (..))
 import qualified Prelude as P
-import GHC.OverloadedLabels
+
 -- | Univariate polynomial.
 --   It uses @'IM.IntMap'@ as its internal representation;
 --   so if you want to treat the power greater than @maxBound :: Int@,
@@ -42,10 +42,11 @@
 -- | By this instance, you can use @#x@ for
 --   the unique variable of @'Unipol' r@.
 instance Unital r => IsLabel "x" (Unipol r) where
+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 802
+  fromLabel   = Unipol $ IM.singleton 1 one
+#else
   fromLabel _ = Unipol $ IM.singleton 1 one
-
-normaliseUP :: DecidableZero r => Unipol r -> Unipol r
-normaliseUP (Unipol r) = Unipol $ IM.filter (not . isZero) r
+#endif
 
 divModUnipol :: (CoeffRing r, Field r) => Unipol r -> Unipol r -> (Unipol r, Unipol r)
 divModUnipol f g =
@@ -143,9 +144,6 @@
     then zero
     else one
 
-(%!!) :: Sized (n :: Nat) a -> SV.Ordinal (n :: Nat) -> a
-(%!!) = (SV.%!!)
-
 {-# RULES
 "var x^n" forall (x :: SV.Ordinal 1) n.
   pow (varUnipol x) n = Unipol (IM.singleton (fromEnum n) one)
@@ -154,11 +152,6 @@
 {-# RULES
 "pow1p x n" forall (x :: SV.Ordinal 1) n.
   NA.pow1p (varUnipol x) n = Unipol (IM.singleton (fromEnum n + 1) one)
-  #-}
-
-{-# RULES
-"x ^ n" forall (x :: SV.Ordinal 1) n.
-  (varUnipol x) ^ n = Unipol (IM.singleton (fromEnum n) one)
   #-}
 
 varUnipol :: Unital r => SV.Ordinal 1 -> Unipol r
diff --git a/Algebra/Scalar.hs b/Algebra/Scalar.hs
--- a/Algebra/Scalar.hs
+++ b/Algebra/Scalar.hs
@@ -3,9 +3,7 @@
 {-# LANGUAGE StandaloneDeriving                                #-}
 module Algebra.Scalar (Scalar(..), (.*.)) where
 import           AlgebraicPrelude
-import qualified Data.Coerce as C
 import Algebra.Normed
-import Control.Lens
 import qualified Prelude          as P
 
 -- | @'Scalar' r@ provides almost the same type-instances as @r@,
diff --git a/computational-algebra.cabal b/computational-algebra.cabal
--- a/computational-algebra.cabal
+++ b/computational-algebra.cabal
@@ -1,881 +1,854 @@
 name: computational-algebra
-version: 0.5.0.0
-cabal-version: >=1.10
-build-type: Simple
-license: BSD3
-license-file: LICENSE
-copyright: (C) Hiromi ISHII 2017
-maintainer: konn.jinro_at_gmail.com
-homepage: https://github.com/konn/computational-algebra
-synopsis: Well-kinded computational algebra library, currently supporting Groebner basis.
-description:
-    Dependently-typed computational algebra library for Groebner basis.
-category: Math
-author: Hiromi ISHII
-tested-with: GHC ==8.0.1
-extra-source-files:
-    README.md
-    examples/*.hs
-    tests/*.hs
-    bench/*.hs
-    share/*.hs
-    data/conway.txt
-
-source-repository head
-    type: git
-    location: git://github.com/konn/computational-algebra.git
-
-flag examples
-    default: False
-
-library
-    exposed-modules:
-        Algebra.Algorithms.ChineseRemainder
-        Algebra.Algorithms.Groebner
-        Algebra.Algorithms.PrimeTest
-        Algebra.Algorithms.ZeroDim
-        Algebra.Field.AlgebraicReal
-        Algebra.Field.Finite
-        Algebra.Field.Galois
-        Algebra.Instances
-        Algebra.Internal
-        Algebra.LinkedMatrix
-        Algebra.Matrix
-        Algebra.Normed
-        Algebra.Prelude
-        Algebra.Prelude.Core
-        Algebra.Ring.Ideal
-        Algebra.Ring.Polynomial
-        Algebra.Ring.Polynomial.Class
-        Algebra.Ring.Polynomial.Factorise
-        Algebra.Ring.Polynomial.Labeled
-        Algebra.Ring.Polynomial.Monomial
-        Algebra.Ring.Polynomial.Quotient
-        Algebra.Ring.Polynomial.Univariate
-        Algebra.Scalar
-    build-depends:
-        template-haskell >=2.11.0.0 && <2.12,
-        MonadRandom >=0.1 && <0.5,
-        algebraic-prelude ==0.1.*,
-        algebra >=4.1 && <4.4,
-        base >=4 && <4.10,
-        semigroups >=0.15 && <0.19,
-        containers ==0.5.*,
-        convertible ==1.1.*,
-        constraints >=0.3 && <0.9,
-        deepseq >=1.3 && <1.5,
-        equational-reasoning >=0.4.1.1 && <0.5,
-        hashable >=1.1 && <1.3,
-        heaps ==0.3.*,
-        hmatrix >=0.16 && <0.18,
-        matrix ==0.3.*,
-        entropy >=0.3.7 && <0.4,
-        lens >=4.13 && <4.15,
-        monad-loops ==0.4.*,
-        dlist >=0.8.0.2 && <0.9,
-        monomorphic >=0.0.3 && <0.1,
-        mtl >=2.1 && <2.3,
-        reflection >=2 && <2.2,
-        sized ==0.2.*,
-        tagged >=0.7 && <0.9,
-        hybrid-vectors >=0.1 && <0.3,
-        text >=0.11 && <1.3,
-        type-natural >=0.7.1 && <0.8,
-        unamb ==0.2.*,
-        unordered-containers ==0.2.*,
-        vector >=0.10 && <0.12,
-        parallel ==3.2.*,
-        mono-traversable >=0.10 && <1.1,
-        control-monad-loop ==0.1.*,
-        primes >=0.2.1 && <0.3,
-        singletons ==2.2.*,
-        arithmoi >=0.4.3.0 && <0.5,
-        ghc-typelits-knownnat >=0.2.2 && <0.3
-    default-language: Haskell2010
-    default-extensions: CPP DataKinds PolyKinds GADTs
-                        MultiParamTypeClasses TypeFamilies FlexibleContexts
-                        FlexibleInstances UndecidableInstances NoImplicitPrelude
-    other-modules:
-        Algebra.Algorithms.FGLM
-        Algebra.Field.Galois.Conway
-        Algebra.Field.Galois.Internal
-        Algebra.Ring.Polynomial.Internal
-    ghc-options: -O2 -Wall -Wno-unused-top-binds -fplugin GHC.TypeLits.KnownNat.Solver
-
-executable groebner-prof
-    main-is: groebner-prof.hs
-    buildable: False
-    build-depends:
-        base >=4.9.0.0 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        deepseq >=1.4.2.0 && <1.5
-    default-language: Haskell2010
-    extensions: NoImplicitPrelude
-    hs-source-dirs: share examples
-    ghc-options: -Wall -prof -fprof-auto -threaded -O2
-
-executable solve
-    main-is: solve.hs
-    buildable: False
-    build-depends:
-        semigroups >=0.15.2 && <0.19,
-        constraints >=0.3 && <0.9,
-        algebra >=4.1 && <4.4,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        computational-algebra >=0.5.0.0 && <0.6,
-        random >=1.0 && <1.2,
-        hmatrix >=0.17.0.2 && <0.18,
-        matrix ==0.3.*,
-        sized >=0.2.1.0 && <0.3,
-        vector >=0.10 && <0.12,
-        convertible ==1.1.*,
-        lens >=3.9 && <4.15,
-        MonadRandom >=0.1 && <0.5
-    hs-source-dirs: share examples
-    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded
-
-executable algebraic
-    main-is: algebraic.hs
-    buildable: False
-    build-depends:
-        base >=4.9.0.0 && <4.10,
-        algebraic-prelude >=0.1.0.1 && <0.2,
-        computational-algebra >=0.5.0.0 && <0.6
-    default-language: Haskell2010
-    hs-source-dirs: examples
-    ghc-options: -Wall -O2 -threaded
-
-executable ipsolve
-    main-is: ipsolve.hs
-    buildable: False
-    build-depends:
-        semigroups >=0.15.2 && <0.19,
-        parallel ==3.2.*,
-        constraints >=0.3 && <0.9,
-        algebra >=4.1 && <4.4,
-        equational-reasoning >=0.2 && <0.5,
-        reflection >=1.4 && <2.2,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        computational-algebra >=0.5.0.0 && <0.6,
-        random >=1.0 && <1.2,
-        hmatrix >=0.17.0.2 && <0.18,
-        matrix ==0.3.*,
-        sized >=0.2.1.0 && <0.3,
-        vector >=0.10 && <0.12,
-        convertible ==1.1.*,
-        lens >=3.9 && <4.15,
-        MonadRandom >=0.1 && <0.5,
-        singletons ==2.2.*
-    hs-source-dirs: share examples
-    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded
-
-executable faugere-prof
-    main-is: faugere-prof.hs
-    buildable: False
-    build-depends:
-        criterion >=0.8.1.0 && <1.2,
-        semigroups >=0.15.2 && <0.19,
-        constraints >=0.3 && <0.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        computational-algebra >=0.5.0.0 && <0.6,
-        random >=1.0 && <1.2,
-        hmatrix >=0.17.0.2 && <0.18,
-        matrix ==0.3.*,
-        sized >=0.2.1.0 && <0.3,
-        vector >=0.10 && <0.12,
-        convertible ==1.1.*,
-        lens >=3.9 && <4.15,
-        deepseq >=1.3 && <1.5,
-        MonadRandom >=0.1 && <0.5
-    hs-source-dirs: share examples
-    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded
-
-executable hensel-prof
-    main-is: hensel-prof.hs
-    buildable: False
-    build-depends:
-        criterion >=0.8.1.0 && <1.2,
-        semigroups >=0.15.2 && <0.19,
-        constraints >=0.3 && <0.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        computational-algebra >=0.5.0.0 && <0.6,
-        random >=1.0 && <1.2,
-        hmatrix >=0.17.0.2 && <0.18,
-        matrix ==0.3.*,
-        sized >=0.2.1.0 && <0.3,
-        vector >=0.10 && <0.12,
-        convertible ==1.1.*,
-        lens >=3.9 && <4.15,
-        deepseq >=1.3 && <1.5,
-        MonadRandom >=0.1 && <0.5
-    hs-source-dirs: share examples
-    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded -eventlog
-
-executable sandpit-poly
-    main-is: sandpit-poly.hs
-    buildable: False
-    build-depends:
-        semigroups >=0.15.2 && <0.19,
-        constraints >=0.3 && <0.9,
-        computational-algebra >=0.5.0.0 && <0.6,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        algebra ==4.3.*,
-        sized >=0.2.1.0 && <0.3
-    hs-source-dirs: share examples
-
-executable quotient
-    main-is: quotient.hs
-    buildable: False
-    build-depends:
-        semigroups >=0.15.2 && <0.19,
-        constraints >=0.3 && <0.9,
-        computational-algebra >=0.5.0.0 && <0.6,
-        base >=4 && <4.10,
-        type-natural >=0.7.1.2 && <0.8,
-        algebra ==4.3.*,
-        sized >=0.2.1.0 && <0.3,
-        reflection >=2.1.2 && <2.2
-    hs-source-dirs: share examples
-
-test-suite test-multi-table
-    type: exitcode-stdio-1.0
-    main-is: multi-table.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.2.5.2 && <1.4,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        hspec >=1.9.5 && <2.3,
-        lazysmallcheck ==0.6.*,
-        lens >=3.9 && <4.15,
-        quickcheck-instances >=0.3.8 && <0.4,
-        reflection >=1.4 && <2.2,
-        sized >=0.2.1.0 && <0.3,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.0.3 && <0.9,
-        test-framework-hunit >=0.3.0.1 && <0.4,
-        transformers >=0.3 && <0.6,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-    ghc-options: -Wall -threaded
-test-suite singular-test
-    type: exitcode-stdio-1.0
-    main-is: SingularTest.hs
-    buildable: False
-    build-depends:
-        algebra ==4.3.*,
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        monomorphic >=0.0.3 && <0.1,
-        smallcheck >=1.1.1 && <1.2,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        quickcheck-instances >=0.3.8 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        sized >=0.2.1.0 && <0.3,
-        reflection >=2.1.2 && <2.2,
-        tagged >=0.8.5 && <0.9,
-        lens ==4.14.*,
-        matrix >=0.3.5.0 && <0.4,
-        text >=1.2.2.1 && <1.3,
-        singletons ==2.2.*
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-        SingularBridge
-    ghc-options: -Wall -threaded
-test-suite monomial-order-test
-    type: exitcode-stdio-1.0
-    main-is: monomials.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        monomorphic >=0.0.3 && <0.1,
-        smallcheck >=1.1.1 && <1.2,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        sized >=0.2.1.0 && <0.3
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-    ghc-options: -Wall -threaded
-test-suite linear-test
-    type: exitcode-stdio-1.0
-    main-is: linear.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        sized >=0.2.1.0 && <0.3,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-    ghc-options: -Wall -threaded
-test-suite matrix-test
-    type: exitcode-stdio-1.0
-    main-is: matrix.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        sized >=0.2.1.0 && <0.3,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*,
-        equational-reasoning >=0.2 && <0.5
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-    ghc-options: -Wall -threaded
-test-suite specs
-    type: exitcode-stdio-1.0
-    main-is: Spec.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        sized >=0.2.1.0 && <0.3,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        convertible >=1.1.1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        process >=1.1 && <1.5,
-        text >=0.11 && <1.3,
-        singletons ==2.2.*,
-        matrix ==0.3.*
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-        UnivariateSpec
-        GroebnerSpec
-        ZeroDimSpec
-        QuotientSpec
-        PolynomialSpec
-        SingularBridge
-    ghc-options: -Wall -threaded
-test-suite new-div-test
-    type: exitcode-stdio-1.0
-    main-is: division.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: tests share
-    other-modules:
-        Utils
-    ghc-options: -Wall -threaded
-
-benchmark unipol-bench
-    type: exitcode-stdio-1.0
-    main-is: unipol-bench.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        singletons ==2.2.*,
-        sized >=0.2.1.0 && <0.3,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    ghc-options: -O2 -threaded -rtsopts
-benchmark normal-bench
-    type: exitcode-stdio-1.0
-    main-is: bench.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        singletons ==2.2.*,
-        sized >=0.2.1.0 && <0.3,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        SingularBench
-    ghc-options: -O2 -threaded -rtsopts
-benchmark elimination-bench
-    type: exitcode-stdio-1.0
-    main-is: elimination-bench.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        singletons ==2.2.*,
-        sized >=0.2.1.0 && <0.3,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        SingularBench
-    ghc-options: -O2 -threaded -rtsopts
-benchmark quotient-bench-randomized
-    type: exitcode-stdio-1.0
-    main-is: quotient-bench-randomized.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        lens >=3.9 && <4.15,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        singletons ==2.2.*,
-        smallcheck >=1.1.1 && <1.2,
-        sized >=0.2.1.0 && <0.3,
-        tagged >=0.7 && <0.9,
-        transformers >=0.3 && <0.6,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*,
-        equational-reasoning >=0.2 && <0.5,
-        monomorphic >=0.0.3 && <0.1
-    hs-source-dirs: bench share
-    other-modules:
-        SingularBench
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark monomial-order-bench
-    type: exitcode-stdio-1.0
-    main-is: monomials.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        random >=1.0 && <1.2,
-        reflection >=1.4 && <2.2,
-        singletons ==2.2.*,
-        sized >=0.2.1.0 && <0.3,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        transformers >=0.3 && <0.6,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        SingularBench
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark linear-bench
-    type: exitcode-stdio-1.0
-    main-is: linear.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        sized >=0.2.1.0 && <0.3,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*,
-        monomorphic >=0.0.3 && <0.1
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark division-bench
-    type: exitcode-stdio-1.0
-    main-is: division.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        sized >=0.2.1.0 && <0.3,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*,
-        monomorphic >=0.0.3 && <0.1
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark sugar-paper-bench
-    type: exitcode-stdio-1.0
-    main-is: sugar-paper.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*,
-        monomorphic >=0.0.3 && <0.1
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark solve-bench
-    type: exitcode-stdio-1.0
-    main-is: solve.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        random >=1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -O2 -threaded -rtsopts
-benchmark coercion-bench
-    type: exitcode-stdio-1.0
-    main-is: coercion.hs
-    buildable: False
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        MonadRandom >=0.1 && <0.5,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        random >=1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -Wall -O2 -threaded -rtsopts
-benchmark faugere4-bench
-    type: exitcode-stdio-1.0
-    main-is: faugere4.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        random >=1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -Wall -O2 -threaded -rtsopts
-benchmark unipol-mult-bench
-    type: exitcode-stdio-1.0
-    main-is: unipol-mult.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        random >=1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -Wall -O2 -threaded -rtsopts
-benchmark unipol-div-bench
-    type: exitcode-stdio-1.0
-    main-is: unipol-div.hs
-    build-depends:
-        constraints >=0.3 && <0.9,
-        HUnit >=1.3.1.2 && <1.4,
-        sized >=0.2.1.0 && <0.3,
-        QuickCheck >=2.6 && <2.9,
-        algebra ==4.3.*,
-        base >=4 && <4.10,
-        computational-algebra >=0.5.0.0 && <0.6,
-        containers ==0.5.*,
-        criterion >=0.8.1.0 && <1.2,
-        deepseq >=1.3 && <1.5,
-        hspec >=2.2.4 && <2.3,
-        lens >=3.9 && <4.15,
-        monomorphic >=0.0.3 && <0.1,
-        parallel ==3.2.*,
-        process >=1.1 && <1.5,
-        quickcheck-instances >=0.3.12 && <0.4,
-        reflection >=1.4 && <2.2,
-        smallcheck >=1.1.1 && <1.2,
-        tagged >=0.7 && <0.9,
-        test-framework >=0.8.1.1 && <0.9,
-        test-framework-hunit >=0.3.0.2 && <0.4,
-        type-natural >=0.7.1.2 && <0.8,
-        vector >=0.10 && <0.12,
-        random >=1.0 && <1.2,
-        equational-reasoning >=0.2 && <0.5,
-        matrix ==0.3.*
-    hs-source-dirs: bench share
-    other-modules:
-        Utils
-    ghc-options: -Wall -O2 -threaded -rtsopts
+version: 0.5.1.0
+cabal-version: >=1.10
+build-type: Simple
+license: BSD3
+license-file: LICENSE
+copyright: (C) Hiromi ISHII 2013
+maintainer: konn.jinro_at_gmail.com
+homepage: https://konn.github.com/computational-algebra
+synopsis: Well-kinded computational algebra library, currently supporting Groebner basis.
+description: Dependently-typed computational algebra library for Groebner basis.
+category: Math
+author: Hiromi ISHII
+data-dir: ""
+tested-with:        GHC == 8.0.2, GHC == 8.2.2
+extra-source-files: README.md examples/*.hs tests/*.hs bench/*.hs
+                    share/*.hs data/conway.txt
+
+source-repository head
+    type: git
+    location: git://github.com/konn/computational-algebra.git
+ 
+flag examples
+    default: False
+    manual:  True
+
+flag profile
+    manual:  True
+    default: False
+ 
+library
+    build-depends: ListLike ==4.5.*,
+                   MonadRandom >=0.1 && <0.6,
+                   algebra >=4.1 && <4.4,
+                   algebraic-prelude >=0.1.1.0 && <0.2,
+                   arithmoi >=0.5 && <0.7,
+                   base >=4 && <4.11,
+                   constraints >=0.3 && <0.10,
+                   containers ==0.5.*,
+                   control-monad-loop ==0.1.*,
+                   convertible ==1.1.*,
+                   deepseq >=1.3 && <1.5,
+                   dlist >=0.8.0.3 && <0.9,
+                   entropy >=0.3.8 && <0.4,
+                   equational-reasoning >=0.4.1.1 && <0.6,
+                   ghc-typelits-knownnat >=0.3.1 && <0.4,
+                   ghc-typelits-natnormalise >=0.5.7 && <0.6,
+                   ghc-typelits-presburger >=0.1.1.1 && <0.2,
+                   hashable >=1.1 && <1.3,
+                   heaps ==0.3.*,
+                   hmatrix >=0.16 && <0.19,
+                   hybrid-vectors >=0.1 && <0.3,
+                   hybrid-vectors >=0.1 && <0.3,
+                   integer-logarithms ==1.0.*,
+                   lens >=4.13 && <4.16,
+                   matrix ==0.3.*,
+                   monad-loops ==0.4.*,
+                   mono-traversable >=0.10 && <1.1,
+                   monomorphic >=0.0.3 && <0.1,
+                   mtl >=2.1 && <2.3,
+                   parallel ==3.2.*,
+                   primes >=0.2.1 && <0.3,
+                   reflection >=2 && <2.2,
+                   semigroups >=0.15 && <0.19,
+                   singletons >=2.2 && <2.4,
+                   sized ==0.2.*,
+                   tagged >=0.7 && <0.9,
+                   template-haskell >=2.12.0.0 && <2.13,
+                   text >=0.11 && <1.3,
+                   type-natural >=0.7.1 && <0.8,
+                   unamb ==0.2.*,
+                   unordered-containers ==0.2.*,
+                   vector >=0.10 && <0.13,
+                   vector-algorithms >=0.7.0.1 && <0.8
+    exposed-modules:   Algebra.Algorithms.ChineseRemainder
+                       Algebra.Algorithms.Groebner
+                       Algebra.Algorithms.PrimeTest
+                       Algebra.Algorithms.ZeroDim
+                       Algebra.Field.AlgebraicReal
+                       Algebra.Field.Finite
+                       Algebra.Field.Galois
+                       Algebra.Instances
+                       Algebra.Internal
+                       Algebra.LinkedMatrix
+                       Algebra.Matrix
+                       Algebra.Normed
+                       Algebra.Prelude
+                       Algebra.Prelude.Core
+                       Algebra.Ring.Ideal
+                       Algebra.Ring.Polynomial
+                       Algebra.Ring.Polynomial.Class
+                       Algebra.Ring.Polynomial.Factorise
+                       Algebra.Ring.Polynomial.Labeled
+                       Algebra.Ring.Polynomial.Monomial
+                       Algebra.Ring.Polynomial.Quotient
+                       Algebra.Ring.Polynomial.Univariate
+                       Algebra.Scalar
+    exposed:           True
+    other-modules:     Algebra.Algorithms.FGLM
+                       Algebra.Field.Galois.Conway
+                       Algebra.Field.Galois.Internal
+                       Algebra.Ring.Polynomial.Internal
+    ghc-options:      -O2 -Wall -Wno-unused-top-binds
+                      -fplugin GHC.TypeLits.KnownNat.Solver
+    default-language:   Haskell2010
+    default-extensions: CPP
+                      , DataKinds
+                      , FlexibleContexts
+                      , FlexibleInstances
+                      , GADTs
+                      , MultiParamTypeClasses
+                      , NoImplicitPrelude
+                      , OverloadedLabels
+                      , PolyKinds
+                      , TypeFamilies
+                      , UndecidableInstances
+ 
+executable groebner-prof
+  hs-source-dirs:      share examples
+  Main-is:             groebner-prof.hs
+  build-depends:       base
+                     , computational-algebra
+                     , deepseq
+  default-language:    Haskell2010
+  ghc-options:         -Wall -threaded -O2
+  default-extensions:  NoImplicitPrelude
+
+  if flag(profile)
+      ghc-options:       -prof -fprof-auto-exported
+  else
+      Buildable: False
+
+executable solve
+    build-depends: MonadRandom
+                 , algebra
+                 , base
+                 , type-natural
+                 , computational-algebra
+                 , constraints
+                 , convertible
+                 , hmatrix
+                 , lens
+                 , matrix
+                 , random >=1.0 && <1.2
+                 , semigroups
+                 , sized
+                 , vector
+     
+    main-is: solve.hs
+    hs-source-dirs: share examples
+    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded
+    default-language:   Haskell2010
+
+    if !flag(examples)
+        buildable: False
+
+executable algebraic
+  Main-is:             algebraic.hs
+  hs-source-dirs:      examples
+  build-depends:       algebraic-prelude
+                     , base
+                     , computational-algebra
+  default-language:    Haskell2010
+  ghc-options:         -Wall -O2 -threaded
+
+  if !flag(examples)
+      buildable: False
+
+
+executable ipsolve
+    build-depends: MonadRandom
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , convertible
+                 , equational-reasoning
+                 , hmatrix
+                 , lens
+                 , matrix
+                 , parallel
+                 , random >=1.0 && <1.2
+                 , reflection
+                 , semigroups
+                 , singletons
+                 , sized
+                 , type-natural
+                 , vector
+     
+    main-is: ipsolve.hs
+    hs-source-dirs: share examples
+    ghc-options: -caf-all -auto-all -rtsopts -O2 -threaded
+    default-language:   Haskell2010
+
+    if !flag(examples)
+        buildable: False
+ 
+executable hensel-prof
+    build-depends: MonadRandom
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , convertible
+                 , criterion >=0.8.1.0 && <1.3
+                 , deepseq
+                 , hmatrix
+                 , lens
+                 , matrix
+                 , random >=1.0 && <1.2
+                 , semigroups
+                 , sized
+                 , type-natural
+                 , vector
+    if flag(profile)
+        ghc-options: -caf-all -auto-all -rtsopts -eventlog
+    else
+        buildable: False
+    main-is: hensel-prof.hs
+    hs-source-dirs: share examples
+    ghc-options: -O2 -threaded
+    default-language:   Haskell2010
+
+executable sandpit-poly
+    build-depends: algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , semigroups
+                 , sized
+                 , type-natural
+     
+    if !flag(examples)
+        buildable: False
+    main-is: sandpit-poly.hs
+    hs-source-dirs: share examples
+    default-language:   Haskell2010
+
+executable quotient
+    build-depends: algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , reflection
+                 , semigroups
+                 , sized
+                 , type-natural
+     
+    if !flag(examples)
+        buildable: False
+    main-is: quotient.hs
+    hs-source-dirs: share examples
+    default-language:   Haskell2010
+ 
+test-suite test-multi-table
+    build-depends: HUnit >=1.2.5.2 && <1.7
+                 , QuickCheck >=2.6 && <2.11
+                 , algebra
+                 , base
+                 , computational-algebra -any
+                 , constraints
+                 , containers
+                 , equational-reasoning
+                 , hspec >=1.9.5 && <2.5
+                 , lazysmallcheck ==0.6.*
+                 , lens
+                 , quickcheck-instances >=0.3.8 && <0.4
+                 , reflection
+                 , sized
+                 , smallcheck >=1.1.1 && <1.2
+                 , tagged
+                 , test-framework >=0.8.0.3 && <0.9
+                 , test-framework-hunit >=0.3.0.1 && <0.4
+                 , transformers
+                 , type-natural
+                 , vector
+
+    type: exitcode-stdio-1.0
+    main-is: multi-table.hs
+    buildable: False
+    hs-source-dirs: tests share
+    other-modules: Utils
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+test-suite singular-test
+    main-is: SingularTest.hs
+    type: exitcode-stdio-1.0
+    buildable: False
+    hs-source-dirs: tests share
+    other-modules: Utils SingularBridge
+    ghc-options: -Wall -threaded
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , quickcheck-instances
+                 , reflection
+                 , singletons
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , text
+                 , type-natural
+                 , vector
+    default-language:   Haskell2010
+
+test-suite monomial-order-test
+    build-depends: HUnit -any
+                 , MonadRandom
+                 , QuickCheck
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , monomorphic
+                 , sized
+                 , smallcheck
+                 , test-framework
+                 , test-framework-hunit
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: monomials.hs
+    buildable: False
+    hs-source-dirs: tests share
+    other-modules: Utils
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+test-suite linear-test
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base >=4
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , quickcheck-instances
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: linear.hs
+    buildable: True
+    hs-source-dirs: tests share
+    other-modules: Utils
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+test-suite matrix-test
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , quickcheck-instances
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: matrix.hs
+    buildable: False
+    hs-source-dirs: tests share
+    other-modules: Utils
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+test-suite specs
+    build-depends: HUnit -any
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , convertible
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , process >=1.1 && <1.7
+                 , quickcheck-instances
+                 , reflection
+                 , singletons
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , text
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: Spec.hs
+    buildable: True
+    hs-source-dirs: tests share
+    other-modules: QuotientSpec PolynomialSpec SingularBridge
+                   Utils UnivariateSpec GroebnerSpec ZeroDimSpec
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+test-suite new-div-test
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , quickcheck-instances
+                 , reflection
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: division.hs
+    buildable: False
+    hs-source-dirs: tests share
+    other-modules: Utils
+    ghc-options: -Wall -threaded
+    default-language:   Haskell2010
+
+benchmark unipol-bench
+    build-depends: algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , matrix
+                 , parallel
+                 , process
+                 , singletons
+                 , sized
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: unipol-bench.hs
+    hs-source-dirs: bench share
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark normal-bench
+    build-depends: algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , matrix
+                 , parallel
+                 , process
+                 , singletons
+                 , sized
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: bench.hs
+    -- buildable: False
+    hs-source-dirs: bench share
+    other-modules: SingularBench
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark elimination-bench
+    build-depends: algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers 
+                 , criterion
+                 , deepseq
+                 , matrix
+                 , parallel
+                 , process
+                 , singletons
+                 , sized
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: elimination-bench.hs
+    buildable: False
+    hs-source-dirs: bench share
+    other-modules: SingularBench
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark quotient-bench-randomized
+    build-depends: QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , reflection
+                 , singletons
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , transformers
+                 , type-natural
+                 , vector
+                 , constraints
+    type: exitcode-stdio-1.0
+    main-is: quotient-bench-randomized.hs
+    buildable: True
+    hs-source-dirs: bench share
+    other-modules: SingularBench Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark monomial-order-bench
+    build-depends: QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraint
+                 , containers
+                 , criterion
+                 , deepseq
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , random
+                 , reflection
+                 , singletons
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , transformers
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: monomials.hs
+    buildable: False
+    hs-source-dirs: bench share
+    other-modules: SingularBench Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark linear-bench
+    build-depends: HUnit -any
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: linear.hs
+    buildable: False
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark division-bench
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: division.hs
+    buildable: False
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark sugar-paper-bench
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: sugar-paper.hs
+    buildable: True
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark solve-bench
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , random
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: solve.hs
+    buildable: True
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark coercion-bench
+    build-depends: HUnit
+                 , MonadRandom
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , random
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: coercion.hs
+    buildable: False
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -Wall -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark unipol-mult-bench
+    build-depends: HUnit
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , constraints
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , random
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+    type: exitcode-stdio-1.0
+    main-is: unipol-mult.hs
+    buildable: True
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -Wall -O2 -threaded -rtsopts
+    default-language:   Haskell2010
+
+benchmark unipol-div-bench
+    build-depends: HUnit
+                 , QuickCheck
+                 , algebra
+                 , base
+                 , computational-algebra
+                 , containers
+                 , criterion
+                 , deepseq
+                 , equational-reasoning
+                 , hspec
+                 , lens
+                 , matrix
+                 , monomorphic
+                 , parallel
+                 , process
+                 , quickcheck-instances
+                 , random
+                 , reflection
+                 , sized
+                 , smallcheck
+                 , tagged
+                 , test-framework
+                 , test-framework-hunit
+                 , type-natural
+                 , vector
+                , constraints
+    type: exitcode-stdio-1.0
+    main-is: unipol-div.hs
+    buildable: True
+    hs-source-dirs: bench share
+    other-modules: Utils
+    ghc-options: -Wall -O2 -threaded -rtsopts
+    default-language:   Haskell2010
diff --git a/examples/hensel-prof.hs b/examples/hensel-prof.hs
--- a/examples/hensel-prof.hs
+++ b/examples/hensel-prof.hs
@@ -1,21 +1,11 @@
-{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DataKinds, NoImplicitPrelude, OverloadedLabels #-}
 module Main where
-import Algebra.Algorithms.Faugere4
 import Algebra.LinkedMatrix
 import Algebra.Prelude
-import Control.Exception           (evaluate)
+import Algebra.Ring.Polynomial.Factorise
+import Control.DeepSeq
+import Control.Exception                 (evaluate)
 
 main :: IO ()
 main = do
-  _ <- evaluate $ faugere4Modular optimalStrategy (cyclic (sing :: SNat 4))
-  return ()
-
-testCase :: Matrix (Fraction Integer)
-testCase = fromLists [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0]
-                    ,[0,0,0,0,0,0,1,1,1,0,0,1,0,0,0,1,0,0,0]
-                    ,[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0]
-                    ,[0,0,0,0,0,1,0,0,0,0,1,-1,0,-1,1,0,-1,0,0]
-                    ,[0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,0]
-                    ,[1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0]
-                    ,[1,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0]
-                    ]
+  print =<< factorHensel (#x ^5)
diff --git a/examples/sandpit-poly.hs b/examples/sandpit-poly.hs
--- a/examples/sandpit-poly.hs
+++ b/examples/sandpit-poly.hs
@@ -54,9 +54,13 @@
        | isZero f -> Just zero
        | otherwise -> Nothing
 
-
-
-
-
+sPolLex :: OrderedPolynomial Rational Lex 2
+sPolLex =
+  let [x,y] = vars
+  in sPolynomial (x ^3 * y ^2 + x ^2 * y ^3) (3 * x ^4 * y + y ^2)
 
+sPolGrevlex :: OrderedPolynomial Rational Grevlex 2
+sPolGrevlex =
+  let [x,y] = vars
+  in sPolynomial (x ^3 * y ^2 + x ^2 * y ^3) (3 * x ^4 * y + y ^2)
 
