module Math.Projects.KnotTheory.IwahoriHecke where
import Math.Algebra.Field.Base
import Math.Algebra.NonCommutative.NCPoly as NP hiding (x,y,z)
import Math.Algebra.NonCommutative.GSBasis
import Math.Projects.KnotTheory.LaurentMPoly as LP hiding (z)
import Math.Projects.KnotTheory.Braid
data IwahoriHeckeGens = T Int deriving (Eq,Ord)
instance Show IwahoriHeckeGens where
show (T i) = 't': show i
t_ i = NP [(M [T i], 1)] :: NPoly LPQ IwahoriHeckeGens
t1 = t_ 1
t2 = t_ 2
t3 = t_ 3
t4 = t_ 4
q = LP.var "q"
z = LP.var "z"
q' = NP.inject q :: NPoly LPQ IwahoriHeckeGens
z' = NP.inject z :: NPoly LPQ IwahoriHeckeGens
instance Invertible (NPoly LPQ IwahoriHeckeGens) where
inv (NP [(M [T i], 1)]) = (t_ i z') / q'
ihRelations n =
[t_ i * t_ j t_ j * t_ i | i <- [1..n1], j <- [i+2..n1] ] ++
[t_ i * t_ j * t_ i t_ j * t_ i * t_ j | i <- [1..n1], j <- [1..n1], abs (ij) == 1 ] ++
[(t_ i)^2 z' * t_ i q' | i <- [1..n1] ]
dimIH (NP ts) = 1 + maximum (0 : [i | (M bs,c) <- ts, T i <- bs])
ihnf f = f %% (gb $ ihRelations $ dimIH f)
ihBasis n = mbasisQA [t_ i | i <- [1..n1]] (gb $ ihRelations n)
tau' 1 (1,c) = c
tau' 2 (1,c) = c * (1q)/z
tau' 2 (m,c) = c
tau' n (m,c) = case m `divM` M [T (n1)] of
Just (l,r) -> tau (n1) $ NP [(l*r,c)]
Nothing -> tau' (n1) (m,c*(1q)/z)
tau n f | dimIH f <= n = let NP ts = ihnf f in sum [tau' n t | t <- ts]
fromBraid f = ihnf (NP.subst skeinRelations f) where
skeinRelations = concat [ [(s_ i, t_ i), (s_ (i), (t_ i z') / q')] | i <- [1..] ]
homfly n f = LP.subst [(q,1/x^2),(z,y/x)] $ tau n $ fromBraid f
i = LP.var "i" :: LPQ
l = LP.var "l" :: LPQ
m = LP.var "m" :: LPQ
homfly' n f =
let f' = LP.subst [(x,i^3*l),(y,i*m)] (homfly n f)
in reduceLP f' (i^2+1)
homfly'' n f = sum $ zipWith (*) (map LP.inject $ coeffs (m^2) (homfly' n f)) (iterate (*(m'^2)) 1)
where m' = LP.var "m" :: LaurentMPoly LPQ
coeffs v 0 = []
coeffs v f = let (f',c) = quotRemLP f v in c : coeffs v f'
jones' m f = let f' = homfly m f
n = d*f'
d = denominatorLP f'
subs = [(x,1/t),(y,t^^^(1/2)1/t^^^(1/2))]
n' = LP.subst subs n
d' = LP.subst subs d
nn = nd*n'
nd = denominatorLP n'
dn = dd*d'
dd = denominatorLP d'
(q,r) = quotRemLP nn dn
in if r == 0 then (dd/nd * q) else error ""