{-# LANGUAGE FlexibleInstances #-}
module Math.Projects.KnotTheory.TemperleyLieb where
import Data.List ( (\\) )
import Math.Algebra.Field.Base
import Math.Algebra.NonCommutative.NCPoly as NP
import Math.Algebra.NonCommutative.GSBasis
import Math.Projects.KnotTheory.LaurentMPoly as LP
import Math.Projects.KnotTheory.Braid
data TemperleyLiebGens = E Int deriving (Eq,Ord)
instance Show TemperleyLiebGens where
show (E i) = 'e': show i
e_ i = NP [(M [E i], 1)] :: NPoly LPQ TemperleyLiebGens
d = LP.var "d"
d' = NP.inject d :: NPoly LPQ TemperleyLiebGens
e1 = e_ 1
e2 = e_ 2
e3 = e_ 3
e4 = e_ 4
tlRelations n =
[e_ i * e_ j - e_ j * e_ i | i <- [1..n-1], j <- [i+2..n-1] ] ++
[e_ i * e_ j * e_ i - e_ i | i <- [1..n-1], j <- [1..n-1], abs (i-j) == 1 ] ++
[(e_ i)^2 - d' * e_ i | i <- [1..n-1] ]
dimTL (NP ts) = 1 + maximum (0 : [i | (M bs,c) <- ts, E i <- bs])
tlnf f = f %% (gb $ tlRelations $ dimTL f)
tlBasis n = mbasisQA [e_ i | i <- [1..n-1]] (gb $ tlRelations n)
tr' n (M g) = d ^ ( -1 + length (orbits g [1..n]) ) where
image i [] = i
image i (E j : es) | i == j = image (i+1) es
| i == j+1 = image (i-1) es
| otherwise = image i es
orbits g [] = []
orbits g (i:is) = let i' = orbit i [] in i' : orbits g ((i:is) \\ i')
orbit j js = let j' = image j g in if j' `elem` (j:js) then reverse (j:js) else orbit j' (j:js)
tr n f@(NP ts) = sum [c * tr' n m | (m,c) <- ts]
a = LP.var "a"
a' = NP.inject a :: NPoly LPQ TemperleyLiebGens
fromBraid f = tlnf (NP.subst skeinRelations f) where
skeinRelations = concat [ [(s_ i, 1/a' * e_ i + a'), (s_ (-i), a' * e_ i + 1/a')] | i <- [1..] ]
jones n f = let kauffman = LP.subst [(d, - a^2 - 1/a^2)] $ tr n (fromBraid f)
j = (-a)^^(-3 * writhe f) * kauffman
in LP.subst [(a,1/t^^^(1/4))] j