    -- Copyright (c) 2010, David Amos. All rights reserved.

    {-# LANGUAGE TypeSynonymInstances, FlexibleInstances, FlexibleContexts, MultiParamTypeClasses, NoMonomorphismRestriction #-}

    -- |A module defining the quantum plane and its symmetries
    module Math.QuantumAlgebra.QuantumPlane where

    -- Refs:
    -- Kassel, Quantum Groups
    -- Street, Quantum Groups

    import Math.Algebra.Field.Base hiding (powers)

    import Math.Algebras.VectorSpace
    import Math.Algebras.TensorProduct
    import Math.Algebras.Structures
    import Math.Algebras.LaurentPoly
    import Math.Algebras.NonCommutative
    import qualified Data.List as L

    qvar :: v -> Vect (LaurentPoly Q) (m v)
    qvar v :: v
    v = let V [(m :: m v
    m,1)] = v -> Vect Q (m v)
    forall (m :: * -> *) v. Monomial m => v -> Vect Q (m v)
    var v
    v in [(m v, LaurentPoly Q)] -> Vect (LaurentPoly Q) (m v)
    forall k b. [(b, k)] -> Vect k b
    V [(m v
    forall (m :: * -> *). Monomial m => m v
    m,1 :: LaurentPoly Q)]

    a :: Vect (LaurentPoly Q) (m [Char])
    a = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "a"
    b :: Vect (LaurentPoly Q) (m [Char])
    b = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "b"
    c :: Vect (LaurentPoly Q) (m [Char])
    c = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "c"
    d :: Vect (LaurentPoly Q) (m [Char])
    d = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "d"

    detq :: Vect (LaurentPoly Q) (m [Char])
    detq = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c

    x :: Vect (LaurentPoly Q) (m [Char])
    x = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "x"
    y :: Vect (LaurentPoly Q) (m [Char])
    y = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "y"
    -- z = qvar "z"

    u :: Vect (LaurentPoly Q) (m [Char])
    u = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "u"
    v :: Vect (LaurentPoly Q) (m [Char])
    v = [Char] -> Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *) v.
    Monomial m =>
    v -> Vect (LaurentPoly Q) (m v)
    qvar "v"

    -- Quantum plane Aq20

    aq20 :: [Vect (LaurentPoly Q) (m [Char])]
    aq20 = [Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    yVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    xVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    qVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    xVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    y]
    -- Kassel p72, Street p10

    newtype Aq20 v = Aq20 (NonComMonomial v) deriving (Aq20 v -> Aq20 v -> Bool
    (Aq20 v -> Aq20 v -> Bool)
    -> (Aq20 v -> Aq20 v -> Bool) -> Eq (Aq20 v)
    forall v. Eq v => Aq20 v -> Aq20 v -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: Aq20 v -> Aq20 v -> Bool
    $c/= :: forall v. Eq v => Aq20 v -> Aq20 v -> Bool
    == :: Aq20 v -> Aq20 v -> Bool
    $c== :: forall v. Eq v => Aq20 v -> Aq20 v -> Bool
    Eq,Eq (Aq20 v)
    Eq (Aq20 v) =>
    (Aq20 v -> Aq20 v -> Ordering)
    -> (Aq20 v -> Aq20 v -> Bool)
    -> (Aq20 v -> Aq20 v -> Bool)
    -> (Aq20 v -> Aq20 v -> Bool)
    -> (Aq20 v -> Aq20 v -> Bool)
    -> (Aq20 v -> Aq20 v -> Aq20 v)
    -> (Aq20 v -> Aq20 v -> Aq20 v)
    -> Ord (Aq20 v)
    Aq20 v -> Aq20 v -> Bool
    Aq20 v -> Aq20 v -> Ordering
    Aq20 v -> Aq20 v -> Aq20 v
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    forall v. Ord v => Eq (Aq20 v)
    forall v. Ord v => Aq20 v -> Aq20 v -> Bool
    forall v. Ord v => Aq20 v -> Aq20 v -> Ordering
    forall v. Ord v => Aq20 v -> Aq20 v -> Aq20 v
    min :: Aq20 v -> Aq20 v -> Aq20 v
    $cmin :: forall v. Ord v => Aq20 v -> Aq20 v -> Aq20 v
    max :: Aq20 v -> Aq20 v -> Aq20 v
    $cmax :: forall v. Ord v => Aq20 v -> Aq20 v -> Aq20 v
    >= :: Aq20 v -> Aq20 v -> Bool
    $c>= :: forall v. Ord v => Aq20 v -> Aq20 v -> Bool
    > :: Aq20 v -> Aq20 v -> Bool
    $c> :: forall v. Ord v => Aq20 v -> Aq20 v -> Bool
    <= :: Aq20 v -> Aq20 v -> Bool
    $c<= :: forall v. Ord v => Aq20 v -> Aq20 v -> Bool
    < :: Aq20 v -> Aq20 v -> Bool
    $c< :: forall v. Ord v => Aq20 v -> Aq20 v -> Bool
    compare :: Aq20 v -> Aq20 v -> Ordering
    $ccompare :: forall v. Ord v => Aq20 v -> Aq20 v -> Ordering
    $cp1Ord :: forall v. Ord v => Eq (Aq20 v)
    Ord)

    instance (Eq v, Show v) => Show (Aq20 v) where show :: Aq20 v -> [Char]
    show (Aq20 m :: NonComMonomial v
    m) = NonComMonomial v -> [Char]
    forall a. Show a => a -> [Char]
    show NonComMonomial v
    m

    instance Monomial Aq20 where
        var :: v -> Vect Q (Aq20 v)
    var v :: v
    v = [(Aq20 v, Q)] -> Vect Q (Aq20 v)
    forall k b. [(b, k)] -> Vect k b
    V [(NonComMonomial v -> Aq20 v
    forall v. NonComMonomial v -> Aq20 v
    Aq20 (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 1 [v
    v]),1)]
        powers :: Aq20 v -> [(v, Int)]
    powers (Aq20 m :: NonComMonomial v
    m) = NonComMonomial v -> [(v, Int)]
    forall (m :: * -> *) v. (Monomial m, Eq v) => m v -> [(v, Int)]
    powers NonComMonomial v
    m

    instance Algebra (LaurentPoly Q) (Aq20 String) where
        unit :: LaurentPoly Q -> Vect (LaurentPoly Q) (Aq20 [Char])
    unit 0 = Vect (LaurentPoly Q) (Aq20 [Char])
    forall k b. Vect k b
    zerov -- V []
        unit x :: LaurentPoly Q
    x = [(Aq20 [Char], LaurentPoly Q)]
    -> Vect (LaurentPoly Q) (Aq20 [Char])
    forall k b. [(b, k)] -> Vect k b
    V [(Aq20 [Char]
    forall v. Aq20 v
    munit,LaurentPoly Q
    x)] where munit :: Aq20 v
    munit = NonComMonomial v -> Aq20 v
    forall v. NonComMonomial v -> Aq20 v
    Aq20 (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 0 [])
        mult :: Vect (LaurentPoly Q) (Tensor (Aq20 [Char]) (Aq20 [Char]))
    -> Vect (LaurentPoly Q) (Aq20 [Char])
    mult x :: Vect (LaurentPoly Q) (Tensor (Aq20 [Char]) (Aq20 [Char]))
    x = Vect (LaurentPoly Q) (Aq20 [Char])
    x''' where
            x' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' = Vect
      (LaurentPoly Q)
      (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall k b. Algebra k b => Vect k (Tensor b b) -> Vect k b
    mult (Vect
       (LaurentPoly Q)
       (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
     -> Vect (LaurentPoly Q) (NonComMonomial [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall a b. (a -> b) -> a -> b
    $ (Tensor (Aq20 [Char]) (Aq20 [Char])
     -> Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (Tensor (Aq20 [Char]) (Aq20 [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ( \(Aq20 a :: NonComMonomial [Char]
    a, Aq20 b :: NonComMonomial [Char]
    b) -> (NonComMonomial [Char]
    a,NonComMonomial [Char]
    b) ) Vect (LaurentPoly Q) (Tensor (Aq20 [Char]) (Aq20 [Char]))
    x -- unwrap and multiply
            x'' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' = Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall m k.
    (DivisionBasis m, Fractional k, Ord m, Show m, Algebra k m,
     Eq k) =>
    Vect k m -> [Vect k m] -> Vect k m
    %% [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    forall (m :: * -> *).
    (Ord (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m) =>
    [Vect (LaurentPoly Q) (m [Char])]
    aq20 -- quotient by m2q relations while unwrapped
            x''' :: Vect (LaurentPoly Q) (Aq20 [Char])
    x''' = (NonComMonomial [Char] -> Aq20 [Char])
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> Vect (LaurentPoly Q) (Aq20 [Char])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap NonComMonomial [Char] -> Aq20 [Char]
    forall v. NonComMonomial v -> Aq20 v
    Aq20 Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' -- wrap the monomials up as Aq20 again

    -- Quantum superplane Aq02

    aq02 :: [Vect (LaurentPoly Q) (m [Char])]
    aq02 = [Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    uVect (LaurentPoly Q) (m [Char])
    -> Integer -> Vect (LaurentPoly Q) (m [Char])
    forall a b. (Num a, Integral b) => a -> b -> a
    ^2, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    vVect (LaurentPoly Q) (m [Char])
    -> Integer -> Vect (LaurentPoly Q) (m [Char])
    forall a b. (Num a, Integral b) => a -> b -> a
    ^2, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    uVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    vVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    +LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    qVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    vVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    u]
    -- Street p10

    newtype Aq02 v = Aq02 (NonComMonomial v) deriving (Aq02 v -> Aq02 v -> Bool
    (Aq02 v -> Aq02 v -> Bool)
    -> (Aq02 v -> Aq02 v -> Bool) -> Eq (Aq02 v)
    forall v. Eq v => Aq02 v -> Aq02 v -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: Aq02 v -> Aq02 v -> Bool
    $c/= :: forall v. Eq v => Aq02 v -> Aq02 v -> Bool
    == :: Aq02 v -> Aq02 v -> Bool
    $c== :: forall v. Eq v => Aq02 v -> Aq02 v -> Bool
    Eq,Eq (Aq02 v)
    Eq (Aq02 v) =>
    (Aq02 v -> Aq02 v -> Ordering)
    -> (Aq02 v -> Aq02 v -> Bool)
    -> (Aq02 v -> Aq02 v -> Bool)
    -> (Aq02 v -> Aq02 v -> Bool)
    -> (Aq02 v -> Aq02 v -> Bool)
    -> (Aq02 v -> Aq02 v -> Aq02 v)
    -> (Aq02 v -> Aq02 v -> Aq02 v)
    -> Ord (Aq02 v)
    Aq02 v -> Aq02 v -> Bool
    Aq02 v -> Aq02 v -> Ordering
    Aq02 v -> Aq02 v -> Aq02 v
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    forall v. Ord v => Eq (Aq02 v)
    forall v. Ord v => Aq02 v -> Aq02 v -> Bool
    forall v. Ord v => Aq02 v -> Aq02 v -> Ordering
    forall v. Ord v => Aq02 v -> Aq02 v -> Aq02 v
    min :: Aq02 v -> Aq02 v -> Aq02 v
    $cmin :: forall v. Ord v => Aq02 v -> Aq02 v -> Aq02 v
    max :: Aq02 v -> Aq02 v -> Aq02 v
    $cmax :: forall v. Ord v => Aq02 v -> Aq02 v -> Aq02 v
    >= :: Aq02 v -> Aq02 v -> Bool
    $c>= :: forall v. Ord v => Aq02 v -> Aq02 v -> Bool
    > :: Aq02 v -> Aq02 v -> Bool
    $c> :: forall v. Ord v => Aq02 v -> Aq02 v -> Bool
    <= :: Aq02 v -> Aq02 v -> Bool
    $c<= :: forall v. Ord v => Aq02 v -> Aq02 v -> Bool
    < :: Aq02 v -> Aq02 v -> Bool
    $c< :: forall v. Ord v => Aq02 v -> Aq02 v -> Bool
    compare :: Aq02 v -> Aq02 v -> Ordering
    $ccompare :: forall v. Ord v => Aq02 v -> Aq02 v -> Ordering
    $cp1Ord :: forall v. Ord v => Eq (Aq02 v)
    Ord)

    instance (Eq v, Show v) => Show (Aq02 v) where show :: Aq02 v -> [Char]
    show (Aq02 m :: NonComMonomial v
    m) = NonComMonomial v -> [Char]
    forall a. Show a => a -> [Char]
    show NonComMonomial v
    m

    instance Monomial Aq02 where
        var :: v -> Vect Q (Aq02 v)
    var v :: v
    v = [(Aq02 v, Q)] -> Vect Q (Aq02 v)
    forall k b. [(b, k)] -> Vect k b
    V [(NonComMonomial v -> Aq02 v
    forall v. NonComMonomial v -> Aq02 v
    Aq02 (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 1 [v
    v]),1)]
        powers :: Aq02 v -> [(v, Int)]
    powers (Aq02 m :: NonComMonomial v
    m) = NonComMonomial v -> [(v, Int)]
    forall (m :: * -> *) v. (Monomial m, Eq v) => m v -> [(v, Int)]
    powers NonComMonomial v
    m

    instance Algebra (LaurentPoly Q) (Aq02 String) where
        unit :: LaurentPoly Q -> Vect (LaurentPoly Q) (Aq02 [Char])
    unit 0 = Vect (LaurentPoly Q) (Aq02 [Char])
    forall k b. Vect k b
    zerov -- V []
        unit x :: LaurentPoly Q
    x = [(Aq02 [Char], LaurentPoly Q)]
    -> Vect (LaurentPoly Q) (Aq02 [Char])
    forall k b. [(b, k)] -> Vect k b
    V [(Aq02 [Char]
    forall v. Aq02 v
    munit,LaurentPoly Q
    x)] where munit :: Aq02 v
    munit = NonComMonomial v -> Aq02 v
    forall v. NonComMonomial v -> Aq02 v
    Aq02 (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 0 [])
        mult :: Vect (LaurentPoly Q) (Tensor (Aq02 [Char]) (Aq02 [Char]))
    -> Vect (LaurentPoly Q) (Aq02 [Char])
    mult x :: Vect (LaurentPoly Q) (Tensor (Aq02 [Char]) (Aq02 [Char]))
    x = Vect (LaurentPoly Q) (Aq02 [Char])
    x''' where
            x' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' = Vect
      (LaurentPoly Q)
      (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall k b. Algebra k b => Vect k (Tensor b b) -> Vect k b
    mult (Vect
       (LaurentPoly Q)
       (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
     -> Vect (LaurentPoly Q) (NonComMonomial [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall a b. (a -> b) -> a -> b
    $ (Tensor (Aq02 [Char]) (Aq02 [Char])
     -> Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (Tensor (Aq02 [Char]) (Aq02 [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ( \(Aq02 a :: NonComMonomial [Char]
    a, Aq02 b :: NonComMonomial [Char]
    b) -> (NonComMonomial [Char]
    a,NonComMonomial [Char]
    b) ) Vect (LaurentPoly Q) (Tensor (Aq02 [Char]) (Aq02 [Char]))
    x -- unwrap and multiply
            x'' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' = Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall m k.
    (DivisionBasis m, Fractional k, Ord m, Show m, Algebra k m,
     Eq k) =>
    Vect k m -> [Vect k m] -> Vect k m
    %% [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    forall (m :: * -> *).
    (Show (m [Char]), Algebra (LaurentPoly Q) (m [Char]), Monomial m,
     Ord (m [Char])) =>
    [Vect (LaurentPoly Q) (m [Char])]
    aq02 -- quotient by m2q relations while unwrapped
            x''' :: Vect (LaurentPoly Q) (Aq02 [Char])
    x''' = (NonComMonomial [Char] -> Aq02 [Char])
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> Vect (LaurentPoly Q) (Aq02 [Char])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap NonComMonomial [Char] -> Aq02 [Char]
    forall v. NonComMonomial v -> Aq02 v
    Aq02 Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' -- wrap the monomials up as Aq02 again

    -- M2q

    m2q :: [Vect (LaurentPoly Q) (m [Char])]
    m2q = [Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b,
           Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit (LaurentPoly Q
    q'LaurentPoly Q -> LaurentPoly Q -> LaurentPoly Q
    forall a. Num a => a -> a -> a
    -LaurentPoly Q
    q)Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c]
    -- Kassel p78, Street p9
    -- I think this is already a Groebner basis

    newtype M2q v = M2q (NonComMonomial v) deriving (M2q v -> M2q v -> Bool
    (M2q v -> M2q v -> Bool) -> (M2q v -> M2q v -> Bool) -> Eq (M2q v)
    forall v. Eq v => M2q v -> M2q v -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: M2q v -> M2q v -> Bool
    $c/= :: forall v. Eq v => M2q v -> M2q v -> Bool
    == :: M2q v -> M2q v -> Bool
    $c== :: forall v. Eq v => M2q v -> M2q v -> Bool
    Eq,Eq (M2q v)
    Eq (M2q v) =>
    (M2q v -> M2q v -> Ordering)
    -> (M2q v -> M2q v -> Bool)
    -> (M2q v -> M2q v -> Bool)
    -> (M2q v -> M2q v -> Bool)
    -> (M2q v -> M2q v -> Bool)
    -> (M2q v -> M2q v -> M2q v)
    -> (M2q v -> M2q v -> M2q v)
    -> Ord (M2q v)
    M2q v -> M2q v -> Bool
    M2q v -> M2q v -> Ordering
    M2q v -> M2q v -> M2q v
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    forall v. Ord v => Eq (M2q v)
    forall v. Ord v => M2q v -> M2q v -> Bool
    forall v. Ord v => M2q v -> M2q v -> Ordering
    forall v. Ord v => M2q v -> M2q v -> M2q v
    min :: M2q v -> M2q v -> M2q v
    $cmin :: forall v. Ord v => M2q v -> M2q v -> M2q v
    max :: M2q v -> M2q v -> M2q v
    $cmax :: forall v. Ord v => M2q v -> M2q v -> M2q v
    >= :: M2q v -> M2q v -> Bool
    $c>= :: forall v. Ord v => M2q v -> M2q v -> Bool
    > :: M2q v -> M2q v -> Bool
    $c> :: forall v. Ord v => M2q v -> M2q v -> Bool
    <= :: M2q v -> M2q v -> Bool
    $c<= :: forall v. Ord v => M2q v -> M2q v -> Bool
    < :: M2q v -> M2q v -> Bool
    $c< :: forall v. Ord v => M2q v -> M2q v -> Bool
    compare :: M2q v -> M2q v -> Ordering
    $ccompare :: forall v. Ord v => M2q v -> M2q v -> Ordering
    $cp1Ord :: forall v. Ord v => Eq (M2q v)
    Ord)

    instance (Eq v, Show v) => Show (M2q v) where show :: M2q v -> [Char]
    show (M2q m :: NonComMonomial v
    m) = NonComMonomial v -> [Char]
    forall a. Show a => a -> [Char]
    show NonComMonomial v
    m

    instance Monomial M2q where
        var :: v -> Vect Q (M2q v)
    var v :: v
    v = [(M2q v, Q)] -> Vect Q (M2q v)
    forall k b. [(b, k)] -> Vect k b
    V [(NonComMonomial v -> M2q v
    forall v. NonComMonomial v -> M2q v
    M2q (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 1 [v
    v]),1)]
        powers :: M2q v -> [(v, Int)]
    powers (M2q m :: NonComMonomial v
    m) = NonComMonomial v -> [(v, Int)]
    forall (m :: * -> *) v. (Monomial m, Eq v) => m v -> [(v, Int)]
    powers NonComMonomial v
    m

    instance Algebra (LaurentPoly Q) (M2q String) where
        unit :: LaurentPoly Q -> Vect (LaurentPoly Q) (M2q [Char])
    unit 0 = Vect (LaurentPoly Q) (M2q [Char])
    forall k b. Vect k b
    zerov -- V []
        unit x :: LaurentPoly Q
    x = [(M2q [Char], LaurentPoly Q)] -> Vect (LaurentPoly Q) (M2q [Char])
    forall k b. [(b, k)] -> Vect k b
    V [(M2q [Char]
    forall v. M2q v
    munit,LaurentPoly Q
    x)] where munit :: M2q v
    munit = NonComMonomial v -> M2q v
    forall v. NonComMonomial v -> M2q v
    M2q (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 0 [])
        mult :: Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    -> Vect (LaurentPoly Q) (M2q [Char])
    mult x :: Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    x = Vect (LaurentPoly Q) (M2q [Char])
    x''' where
            x' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' = Vect
      (LaurentPoly Q)
      (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall k b. Algebra k b => Vect k (Tensor b b) -> Vect k b
    mult (Vect
       (LaurentPoly Q)
       (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
     -> Vect (LaurentPoly Q) (NonComMonomial [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall a b. (a -> b) -> a -> b
    $ (Tensor (M2q [Char]) (M2q [Char])
     -> Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ( \(M2q a :: NonComMonomial [Char]
    a, M2q b :: NonComMonomial [Char]
    b) -> (NonComMonomial [Char]
    a,NonComMonomial [Char]
    b) ) Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    x -- unwrap and multiply
            x'' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' = Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall m k.
    (DivisionBasis m, Fractional k, Ord m, Show m, Algebra k m,
     Eq k) =>
    Vect k m -> [Vect k m] -> Vect k m
    %% [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    forall (m :: * -> *).
    (Ord (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m) =>
    [Vect (LaurentPoly Q) (m [Char])]
    m2q -- quotient by m2q relations while unwrapped
            x''' :: Vect (LaurentPoly Q) (M2q [Char])
    x''' = (NonComMonomial [Char] -> M2q [Char])
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> Vect (LaurentPoly Q) (M2q [Char])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap NonComMonomial [Char] -> M2q [Char]
    forall v. NonComMonomial v -> M2q v
    M2q Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' -- wrap the monomials up as M2q again

    -- Kassel p82-3
    instance Coalgebra (LaurentPoly Q) (M2q String) where
        counit :: Vect (LaurentPoly Q) (M2q [Char]) -> LaurentPoly Q
    counit x :: Vect (LaurentPoly Q) (M2q [Char])
    x = case Vect (LaurentPoly Q) (M2q [Char])
    x Vect (LaurentPoly Q) (M2q [Char])
    -> ([Char] -> Vect (LaurentPoly Q) (M2q [Char]))
    -> Vect (LaurentPoly Q) (M2q [Char])
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (M2q [Char])
    cu of
                   V [] -> 0
                   V [(M2q (NCM 0 []), c :: LaurentPoly Q
    c)] -> LaurentPoly Q
    c
            where cu :: [Char] -> Vect (LaurentPoly Q) (M2q [Char])
    cu "a" = 1 :: Vect (LaurentPoly Q) (M2q String)
                  cu "b" = 0
                  cu "c" = 0
                  cu "d" = 1
        comult :: Vect (LaurentPoly Q) (M2q [Char])
    -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    comult x :: Vect (LaurentPoly Q) (M2q [Char])
    x = Vect (LaurentPoly Q) (M2q [Char])
    x Vect (LaurentPoly Q) (M2q [Char])
    -> ([Char]
        -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char])))
    -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (M2q [Char]))
    forall (m :: * -> *) (m :: * -> *).
    (Ord (m [Char]), Ord (m [Char]), Show (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m, Monomial m) =>
    [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    cm
            where cm :: [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    cm "a" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c
                  cm "b" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d
                  cm "c" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c
                  cm "d" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d

    instance Bialgebra (LaurentPoly Q) (M2q String) where {}

    {-
    -- The following shows that the M2q relations are *sufficient*
    -- for M2q to be symmetries of Aq20 and Aq02

    > let x' = a*x+b*y :: Vect (LaurentPoly Q) (NonComMonomial String)
    > let y' = c*x+d*y :: Vect (LaurentPoly Q) (NonComMonomial String)
    > (y'*x'-unit q*x'*y') %% (m2q ++ aq20 ++ [s*t-t*s | s <- [a,b,c,d], t <- [x,y]])
    0

    > let u' = a*u+b*v :: Vect (LaurentPoly Q) (NonComMonomial String)
    > let v' = c*u+d*v :: Vect (LaurentPoly Q) (NonComMonomial String)
    > (u'^2) %% (m2q ++ aq02 ++ [s*t-t*s | s <- [a,b,c,d], t <- [u,v]])
    0
    > (v'^2) %% (m2q ++ aq02 ++ [s*t-t*s | s <- [a,b,c,d], t <- [u,v]])
    0
    > (u'*v'+unit q*v'*u') %% (m2q ++ aq02 ++ [s*t-t*s | s <- [a,b,c,d], t <- [u,v]])
    0

    -- To show that the M2q relations are necessary,
    -- set the coefficients of x^2, yx, y^2, and vu == 0 in all of the following
    > (y'*x'-unit q*x'*y') %% (aq20 ++ [p*q-q*p | p <- [a,b,c,d], q <- [x,y]])
    -qx^2ac+x^2ca-yxad-qyxbc+q^-1yxcb+yxda-qy^2bd+y^2db
    > (u'^2) %% (aq02 ++ [p*q-q*p | p <- [a,b,c,d], q <- [u,v]])
    -qvuab+vuba
    > (v'^2) %% (aq02 ++ [p*q-q*p | p <- [a,b,c,d], q <- [u,v]])
    -qvucd+vudc
    > (u'*v'+unit q*v'*u') %% (aq02 ++ [p*q-q*p | p <- [a,b,c,d], q <- [u,v]])
    -qvuad+vubc-q^2vucb+qvuda

    -- yx => -ad-qbc+q^-1cb+da == 0
    -- vu => -qad+bc-q^2cb+qda == 0
    -- qyx-vu => -q^2bc+cb-bc+q^2cb == 0 => bc == cb
    -- Now substitute back into yx

    -- We could probably have got gb to do this for us
    -}

    -- Kassel p85
    instance Comodule (LaurentPoly Q) (M2q String) (Aq20 String) where
        coaction :: Vect (LaurentPoly Q) (Aq20 [Char])
    -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (Aq20 [Char]))
    coaction xy :: Vect (LaurentPoly Q) (Aq20 [Char])
    xy = Vect (LaurentPoly Q) (Aq20 [Char])
    xy Vect (LaurentPoly Q) (Aq20 [Char])
    -> ([Char]
        -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (Aq20 [Char])))
    -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (Aq20 [Char]))
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (Tensor (M2q [Char]) (Aq20 [Char]))
    forall (m :: * -> *) (m :: * -> *).
    (Ord (m [Char]), Ord (m [Char]), Show (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m, Monomial m) =>
    [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    ca where
            ca :: [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    ca "x" = (Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    x) Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + (Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    y) -- we can use (+) instead of add since Aq20 is an algebra
            ca "y" = (Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    x) Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + (Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    y)
    -- coaction (x) = (a b) `te` (x)
    --          (y)   (c d)      (y)

    -- SL2q

    sl2q :: [Vect (LaurentPoly Q) (m [Char])]
    sl2q = [Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q'Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b,
            Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b, Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    aVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit (LaurentPoly Q
    q'LaurentPoly Q -> LaurentPoly Q -> LaurentPoly Q
    forall a. Num a => a -> a -> a
    -LaurentPoly Q
    q)Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    bVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c,
            -LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    qVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    cVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    dVect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    *Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    - 1] -- det q, but reduced
    --        a*d-unit q'*b*c-1] -- det_q
    -- We have to hand-reduce detq, or else call gb

    newtype SL2q v = SL2q (NonComMonomial v) deriving (SL2q v -> SL2q v -> Bool
    (SL2q v -> SL2q v -> Bool)
    -> (SL2q v -> SL2q v -> Bool) -> Eq (SL2q v)
    forall v. Eq v => SL2q v -> SL2q v -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: SL2q v -> SL2q v -> Bool
    $c/= :: forall v. Eq v => SL2q v -> SL2q v -> Bool
    == :: SL2q v -> SL2q v -> Bool
    $c== :: forall v. Eq v => SL2q v -> SL2q v -> Bool
    Eq,Eq (SL2q v)
    Eq (SL2q v) =>
    (SL2q v -> SL2q v -> Ordering)
    -> (SL2q v -> SL2q v -> Bool)
    -> (SL2q v -> SL2q v -> Bool)
    -> (SL2q v -> SL2q v -> Bool)
    -> (SL2q v -> SL2q v -> Bool)
    -> (SL2q v -> SL2q v -> SL2q v)
    -> (SL2q v -> SL2q v -> SL2q v)
    -> Ord (SL2q v)
    SL2q v -> SL2q v -> Bool
    SL2q v -> SL2q v -> Ordering
    SL2q v -> SL2q v -> SL2q v
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    forall v. Ord v => Eq (SL2q v)
    forall v. Ord v => SL2q v -> SL2q v -> Bool
    forall v. Ord v => SL2q v -> SL2q v -> Ordering
    forall v. Ord v => SL2q v -> SL2q v -> SL2q v
    min :: SL2q v -> SL2q v -> SL2q v
    $cmin :: forall v. Ord v => SL2q v -> SL2q v -> SL2q v
    max :: SL2q v -> SL2q v -> SL2q v
    $cmax :: forall v. Ord v => SL2q v -> SL2q v -> SL2q v
    >= :: SL2q v -> SL2q v -> Bool
    $c>= :: forall v. Ord v => SL2q v -> SL2q v -> Bool
    > :: SL2q v -> SL2q v -> Bool
    $c> :: forall v. Ord v => SL2q v -> SL2q v -> Bool
    <= :: SL2q v -> SL2q v -> Bool
    $c<= :: forall v. Ord v => SL2q v -> SL2q v -> Bool
    < :: SL2q v -> SL2q v -> Bool
    $c< :: forall v. Ord v => SL2q v -> SL2q v -> Bool
    compare :: SL2q v -> SL2q v -> Ordering
    $ccompare :: forall v. Ord v => SL2q v -> SL2q v -> Ordering
    $cp1Ord :: forall v. Ord v => Eq (SL2q v)
    Ord)

    instance (Eq v, Show v) => Show (SL2q v) where show :: SL2q v -> [Char]
    show (SL2q m :: NonComMonomial v
    m) = NonComMonomial v -> [Char]
    forall a. Show a => a -> [Char]
    show NonComMonomial v
    m

    instance Monomial SL2q where
        var :: v -> Vect Q (SL2q v)
    var v :: v
    v = [(SL2q v, Q)] -> Vect Q (SL2q v)
    forall k b. [(b, k)] -> Vect k b
    V [(NonComMonomial v -> SL2q v
    forall v. NonComMonomial v -> SL2q v
    SL2q (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 1 [v
    v]),1)]
        powers :: SL2q v -> [(v, Int)]
    powers (SL2q m :: NonComMonomial v
    m) = NonComMonomial v -> [(v, Int)]
    forall (m :: * -> *) v. (Monomial m, Eq v) => m v -> [(v, Int)]
    powers NonComMonomial v
    m

    instance Algebra (LaurentPoly Q) (SL2q String) where
        unit :: LaurentPoly Q -> Vect (LaurentPoly Q) (SL2q [Char])
    unit 0 = Vect (LaurentPoly Q) (SL2q [Char])
    forall k b. Vect k b
    zerov -- V []
        unit x :: LaurentPoly Q
    x = [(SL2q [Char], LaurentPoly Q)]
    -> Vect (LaurentPoly Q) (SL2q [Char])
    forall k b. [(b, k)] -> Vect k b
    V [(SL2q [Char]
    forall v. SL2q v
    munit,LaurentPoly Q
    x)] where munit :: SL2q v
    munit = NonComMonomial v -> SL2q v
    forall v. NonComMonomial v -> SL2q v
    SL2q (Int -> [v] -> NonComMonomial v
    forall v. Int -> [v] -> NonComMonomial v
    NCM 0 [])
        mult :: Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    -> Vect (LaurentPoly Q) (SL2q [Char])
    mult x :: Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    x = Vect (LaurentPoly Q) (SL2q [Char])
    x''' where
            x' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' = Vect
      (LaurentPoly Q)
      (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall k b. Algebra k b => Vect k (Tensor b b) -> Vect k b
    mult (Vect
       (LaurentPoly Q)
       (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
     -> Vect (LaurentPoly Q) (NonComMonomial [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall a b. (a -> b) -> a -> b
    $ (Tensor (SL2q [Char]) (SL2q [Char])
     -> Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    -> Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    -> Vect
         (LaurentPoly Q)
         (Tensor (NonComMonomial [Char]) (NonComMonomial [Char]))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ( \(SL2q a :: NonComMonomial [Char]
    a, SL2q b :: NonComMonomial [Char]
    b) -> (NonComMonomial [Char]
    a,NonComMonomial [Char]
    b) ) Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    x -- unwrap and multiply
            x'' :: Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' = Vect (LaurentPoly Q) (NonComMonomial [Char])
    x' Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    forall m k.
    (DivisionBasis m, Fractional k, Ord m, Show m, Algebra k m,
     Eq k) =>
    Vect k m -> [Vect k m] -> Vect k m
    %% [Vect (LaurentPoly Q) (NonComMonomial [Char])]
    forall (m :: * -> *).
    (Ord (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m) =>
    [Vect (LaurentPoly Q) (m [Char])]
    sl2q -- quotient by sl2q relations while unwrapped
            x''' :: Vect (LaurentPoly Q) (SL2q [Char])
    x''' = (NonComMonomial [Char] -> SL2q [Char])
    -> Vect (LaurentPoly Q) (NonComMonomial [Char])
    -> Vect (LaurentPoly Q) (SL2q [Char])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap NonComMonomial [Char] -> SL2q [Char]
    forall v. NonComMonomial v -> SL2q v
    SL2q Vect (LaurentPoly Q) (NonComMonomial [Char])
    x'' -- wrap the monomials up as SL2q again

    instance Coalgebra (LaurentPoly Q) (SL2q String) where
        counit :: Vect (LaurentPoly Q) (SL2q [Char]) -> LaurentPoly Q
    counit x :: Vect (LaurentPoly Q) (SL2q [Char])
    x = case Vect (LaurentPoly Q) (SL2q [Char])
    x Vect (LaurentPoly Q) (SL2q [Char])
    -> ([Char] -> Vect (LaurentPoly Q) (SL2q [Char]))
    -> Vect (LaurentPoly Q) (SL2q [Char])
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (SL2q [Char])
    cu of
                   V [] -> 0
                   V [(SL2q (NCM 0 []), c :: LaurentPoly Q
    c)] -> LaurentPoly Q
    c
            where cu :: [Char] -> Vect (LaurentPoly Q) (SL2q [Char])
    cu "a" = 1 :: Vect (LaurentPoly Q) (SL2q String)
                  cu "b" = 0
                  cu "c" = 0
                  cu "d" = 1
        comult :: Vect (LaurentPoly Q) (SL2q [Char])
    -> Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    comult x :: Vect (LaurentPoly Q) (SL2q [Char])
    x = Vect (LaurentPoly Q) (SL2q [Char])
    x Vect (LaurentPoly Q) (SL2q [Char])
    -> ([Char]
        -> Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char])))
    -> Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (Tensor (SL2q [Char]) (SL2q [Char]))
    forall (m :: * -> *) (m :: * -> *).
    (Ord (m [Char]), Ord (m [Char]), Show (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]),
     Algebra (LaurentPoly Q) (m [Char]), Monomial m, Monomial m) =>
    [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    cm
            where cm :: [Char] -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    cm "a" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c
                  cm "b" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d
                  cm "c" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c
                  cm "d" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall a. Num a => a -> a -> a
    + Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (Tensor (m [Char]) (m [Char]))
    forall k a b. Num k => Vect k a -> Vect k b -> Vect k (Tensor a b)
    `te` Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d

    instance Bialgebra (LaurentPoly Q) (SL2q String) where {}

    -- Kassel p84
    instance HopfAlgebra (LaurentPoly Q) (SL2q String) where
        antipode :: Vect (LaurentPoly Q) (SL2q [Char])
    -> Vect (LaurentPoly Q) (SL2q [Char])
    antipode x :: Vect (LaurentPoly Q) (SL2q [Char])
    x = Vect (LaurentPoly Q) (SL2q [Char])
    x Vect (LaurentPoly Q) (SL2q [Char])
    -> ([Char] -> Vect (LaurentPoly Q) (SL2q [Char]))
    -> Vect (LaurentPoly Q) (SL2q [Char])
    forall k b (m :: * -> *) t.
    (Num k, Ord b, Show b, Algebra k b, Monomial m, Eq k, Eq t) =>
    Vect k (m t) -> (t -> Vect k b) -> Vect k b
    `bind` [Char] -> Vect (LaurentPoly Q) (SL2q [Char])
    forall (m :: * -> *).
    (Monomial m, Ord (m [Char]), Show (m [Char]),
     Algebra (LaurentPoly Q) (m [Char])) =>
    [Char] -> Vect (LaurentPoly Q) (m [Char])
    antipode'
            where antipode' :: [Char] -> Vect (LaurentPoly Q) (m [Char])
    antipode' "a" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    d
                  antipode' "b" = - LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    * Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    b
                  antipode' "c" = - LaurentPoly Q -> Vect (LaurentPoly Q) (m [Char])
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q' Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    -> Vect (LaurentPoly Q) (m [Char])
    forall a. Num a => a -> a -> a
    * Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    c
                  antipode' "d" = Vect (LaurentPoly Q) (m [Char])
    forall (m :: * -> *). Monomial m => Vect (LaurentPoly Q) (m [Char])
    a
    -- in the GL2q case we would need 1/detq factor as well

    -- !! The following probably needs to be rehoused in separate module at some point
    -- YANG-BAXTER OPERATOR

    -- This is a Yang-Baxter operator, but not the only possible such
    -- Street, p93
    yb :: Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    yb x :: Vect (LaurentPoly Q) (b, b)
    x = Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall k b. (Eq k, Num k, Ord b) => Vect k b -> Vect k b
    nf (Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b))
    -> Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall a b. (a -> b) -> a -> b
    $ Vect (LaurentPoly Q) (b, b)
    x Vect (LaurentPoly Q) (b, b)
    -> ((b, b) -> Vect (LaurentPoly Q) (b, b))
    -> Vect (LaurentPoly Q) (b, b)
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall b.
    (Ord b, Show b, Algebra (LaurentPoly Q) b) =>
    (b, b) -> Vect (LaurentPoly Q) (b, b)
    yb' where
        yb' :: (b, b) -> Vect (LaurentPoly Q) (b, b)
    yb' (a :: b
    a,b :: b
    b) = case b -> b -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare b
    a b
    b of
                     GT -> (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (b
    b,b
    a)
                     LT -> (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (b
    b,b
    a) Vect (LaurentPoly Q) (b, b)
    -> Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall a. Num a => a -> a -> a
    + LaurentPoly Q -> Vect (LaurentPoly Q) (b, b)
    forall k b. Algebra k b => k -> Vect k b
    unit (LaurentPoly Q
    qLaurentPoly Q -> LaurentPoly Q -> LaurentPoly Q
    forall a. Num a => a -> a -> a
    -LaurentPoly Q
    q') Vect (LaurentPoly Q) (b, b)
    -> Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall a. Num a => a -> a -> a
    * (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (b
    a,b
    b)
                     EQ -> LaurentPoly Q -> Vect (LaurentPoly Q) (b, b)
    forall k b. Algebra k b => k -> Vect k b
    unit LaurentPoly Q
    q Vect (LaurentPoly Q) (b, b)
    -> Vect (LaurentPoly Q) (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall a. Num a => a -> a -> a
    * (b, b) -> Vect (LaurentPoly Q) (b, b)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (b
    a,b
    a)