{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
module Math.Projects.KnotTheory.Braid where
import Data.List ( (\\) )
import Math.Algebra.Field.Base
import Math.Algebra.NonCommutative.NCPoly
import Math.Projects.KnotTheory.LaurentMPoly
type LPQ = LaurentMPoly Q
instance Invertible LPQ where
inv = recip
data BraidGens = S Int deriving (Eq,Ord)
instance Show BraidGens where
show (S i) | i > 0 = 's': show i
| i < 0 = 's': show (-i) ++ "'"
s_ i = NP [(M [S i], 1)] :: NPoly LPQ BraidGens
s1 = s_ 1
s2 = s_ 2
s3 = s_ 3
s4 = s_ 4
instance Invertible (NPoly LPQ BraidGens) where
inv (NP [(M [S i], 1)]) = s_ (-i)
writhe (NP [(M xs,c)]) = sum [signum i | S i <- xs]
k3_1 = s1^-3
k4_1 = s2^-1 * s1 * s2^-1 * s1
k5_1 = s1^-5
k7_1 = s1^-7