<<PolyLogTools`

Get[NotebookDirectory[]<>"PolyLogToolsLite.m"];

cr[{a_,b_,c_,d_}] := Factor[Limit[(a - c)/(a - d) / ((b - c)/(b-d)), Inf->Infinity]];
cr[l_List] := Sequence@@(cr[Join[l[[1;;3]], {#}]]&/@l[[4;;All]]);

II[indices_List,arguments_List]/;Length[indices]==Length[arguments]&&VectorQ[indices,IntegerQ[#]&&#≥1&]:=G@@Flatten[Join[Table[Join[Table[0,{indices[[j]]-1}],{arguments[[j]]}],{j,Length[indices],1,-1}],{1}]]

Get[NotebookDirectory[]<>"wt4_dan_precomputed.m"];

wt4DanAllNPrecomputed/.{cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

wt4DanAllNas31and4Precomputed/.{cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

(* Compute and check the structred reduction *)

cycleList[l_List] := NestWhileList[RotateLeft, l, True&, 1, Length[l]-1]

Gcyc[a_,b_,c_,d_,e_] := Total[G0@@@cycleList[{a,b,c,d,e}]];
G0[a_,b_,c_,d_,e_] := IIi[{3,1},{cri[{a,b,c,d,e}]}] - IIi[{3,1},{cri[{e,d,c,b,a}]}] - 3 IIi[{3,1},{cri[{a,b,d,c,e}]}] + 3 IIi[{3,1},{cri[{e,d,b,c,a}]}];

Hcyc[a_,b_,c_,d_,e_] := Total[H0@@@cycleList[{a,b,c,d,e}]];
H0[a_,b_,c_,d_,e_] := IIi[{4},{cri[{c,a,b,Inf}]}] - IIi[{4},{cri[{b,d,a,Inf}]}] + IIi[{4},{cri[{a,d,b,Inf}]}] - IIi[{4},{cri[{b,a,d,Inf}]}];

(* see Gangl's notion of a split *)
spl[l_List, x_] := Table[Join[l[[1;;i-1]], {x}, l[[i+1;;All]]], {i, 1, Length[l]}];

F[a_,b_,c_,d_,e_] := 1/20 * (
Gcyc[a,b,c,d,e] - Total[Gcyc@@@spl[{a,b,c,d,e}, Inf]] + 10 Hcyc[a,b,c,d,e]
);

wt4danStructuredLower = F[a,b,c,d,e]//Expand;

wt4danStructuredLowerPrecomputed == wt4danStructuredLower

wt4danStructured = IIi[{1,1,1,1},{cri[{Inf, a,f, b,c,d,e}]}] - (wt4danStructuredLower - (wt4danStructuredLower/.a->f))//Expand;

wt4DanStructuredPrecomputed == wt4danStructured

wt4danStructured/.{a->0,f->1}/.{cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand