Pensieve header: RVK and Z. Continues pensieve://Projects/SL2Portfolio2/.

RVK and Z

RVK, rot, Z from 2016-09/OneSmidgen.nb. See also in AP/Projects/SL2Invariant/.

Some details of the code below are at http://drorbn.net/bbs/show?shot=Dror-160920-151350.jpg.

RVK::usage="RVK[xs, rots] represents a Rotational Virtual Knot with a list of n Xp/Xm crossings xs and a length 2n list of rotation numbers rots. Crossing sites are indexed 1 through 2n, and rots[[k]] is the rotation between site k-1 and site k. RVK is also a casting operator converting to the RVK presentation from other knot presentations.";

RVK[pd_PD]:=(Subscript[PP, RVK])@Module[{n,xs,x,rots,front={0},k},
n=Length@pd;rots=Table[0,{2n}];
xs=Cases[pd,x_X:>(Piecewise[{{Xp[x[[4]],x[[1]]], PositiveQ@x}, {Xm[x[[2]],x[[1]]], True}}])];
For[k=0,k<2n,++k,If[k==0∨FreeQ[front,-k],
front=Flatten@Replace[front,k->(xs/.{
Xp[k+1,l_]|Xm[l_,k+1]:>{l,k+1,1-l},
Xp[l_,k+1]|Xm[k+1,l_]:>(++rots[[l]];{1-l,k+1,l}),
_Xp|_Xm:>{}
}), {1}],
Cases[front,k|-k]/.{k,-k}:>--rots[[k+1]];
]];
RVK[xs,rots] ];
RVK[K_]:=RVK[PD[K]];

rot[i_,0]:=(Subscript[dη, i]);
rot[i_,n_]:=rot[i,n,$k];
rot[i_,n_,k_]:=Module[{j},
rot[i,n,k]=If[n>0,rot[i,n-1](Subscript[kC, j]),rot[i,n+1](Subscript[(OverBar[kC]), j])]//(Subscript[km, i,j->i])];

Width[pd_PD]:=Max[Length/@FoldList[Complement[#1⋃#2,#1⋂#2]&, {}, List@@List@@@pd]]

ThinPosition[K_]:=Module[{todo,done,pd,c},
todo=List@@PD@K; done={}; pd=PD[];
While[todo=!={},
AppendTo[pd,c=RandomChoice@MaximalBy[todo, Length[done⋂List@@#]&]];
todo=DeleteCases[todo, c];
done=done⋃List@@c];
pd ];
ThinPosition[K_,n_] := First@MinimalBy[Table[ThinPosition[K], n], Width];

Z[K_] := Z[RVK@EchoFunction[Width]@ThinPosition[K,100]];
Z[rvk_RVK] := Monitor[ (Subscript[PP, "Z"])@Module[{ζ,done,st,c, χ,i,j,k},
ζ=1; done={}; st=Range[2Length[rvk[[1]]]]; $M={};
Do[AppendTo[$M,c];
{i,j}=List@@c;
χ=(c/.{_Xp:>(Subscript[kR, i,j])(Subscript[(OverBar[kKink]), 0]),_Xm:>(Subscript[(OverBar[kR]), i,j])(Subscript[kKink, 0])})//(Subscript[km, j,0->j]);
Do[χ=(rot[0,rvk[[2,k]]]χ)//(Subscript[km, 0,k->k]), {k,{i,j}}];
ζ*=χ;
Do[
If[MemberQ[done, k+1],ζ=ζ//(Subscript[km, k,k+1->k]); st=st/.k+1->k];
If[MemberQ[done, k-1],ζ=ζ//(Subscript[km, st[[k-1]],k->st[[k-1]]]); st=st/.k->st[[k-1]]],
{k,{i,j}}];
done=done⋃{i,j},
{c,rvk[[1]]}
];
CF/@ (ζ /. {(Subscript[x, 1])->x,(Subscript[y, 1])->y,(Subscript[a, 1])->a})
], {Length@$M,$M}]