<<PolylogTools`

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}]]

cr[{a_,b_,c_,d_}]:=((a-c)/(a-d))/((b-c)/(b-d))
cr[{a_,b_,c_}]:=((a-c)/(b-c))

cr[{Inf,b_,c_,d_}]:=cr[{d,c,b}]
cr[{a_,Inf,c_,d_}]:=cr[{c,d,a}]
cr[{a_,b_,Inf,d_}]:=cr[{b,a,d}]
cr[{a_,b_,c_,Inf}]:=cr[{a,b,c}]

i4 = 5 IIi[{4},{cri[{a,b,d}]}]-4 IIi[{4},{cri[{a,b,e}]}]+2 IIi[{4},{cri[{a,c,d}]}]+2 IIi[{4},{cri[{a,c,e}]}]+2 IIi[{4},{cri[{a,d,e}]}]+IIi[{4},{cri[{a,e,d}]}]+2 IIi[{4},{cri[{b,a,c}]}]+2 IIi[{4},{cri[{b,d,a}]}]-4 IIi[{4},{cri[{b,e,a}]}]-2 IIi[{4},{cri[{c,a,b}]}]+4 IIi[{4},{cri[{c,d,a}]}]+3 IIi[{4},{cri[{c,e,a}]}]+IIi[{4},{cri[{d,a,b}]}]+8 IIi[{4},{cri[{d,a,c}]}]-3 IIi[{4},{cri[{e,a,b}]}]+2 IIi[{4},{cri[{e,a,c}]}]+IIi[{4},{cri[{a,b,c,e}]}]+4 IIi[{4},{cri[{a,c,b,d}]}]-2 IIi[{4},{cri[{a,c,b,e}]}]-2 IIi[{4},{cri[{a,d,c,e}]}]+2 IIi[{4},{cri[{a,e,c,d}]}];

i31 = 2 IIi[{3,1},{cri[{a,b,d}],cri[{a,c,d}]}]-2 IIi[{3,1},{cri[{a,b,d}],cri[{a,e,d}]}]-IIi[{3,1},{cri[{a,b,d}],cri[{e,b,d}]}]+IIi[{3,1},{cri[{a,b,e}],cri[{a,c,e}]}]-2 IIi[{3,1},{cri[{a,c,d}],cri[{b,c,d}]}]+IIi[{3,1},{cri[{a,c,e}],cri[{b,c,e}]}]-IIi[{3,1},{cri[{a,c,e}],cri[{d,c,e}]}]-IIi[{3,1},{cri[{a,d,e}],cri[{a,b,e}]}]+IIi[{3,1},{cri[{a,d,e}],cri[{b,d,e}]}]-IIi[{3,1},{cri[{a,d,e}],cri[{c,d,e}]}]-IIi[{3,1},{cri[{a,e,d}],cri[{b,e,d}]}]-2 IIi[{3,1},{cri[{b,a,c}],cri[{b,d,c}]}]+IIi[{3,1},{cri[{b,a,c}],cri[{d,a,c}]}]-IIi[{3,1},{cri[{b,d,a}],cri[{b,d,c}]}]+IIi[{3,1},{cri[{b,d,a}],cri[{a,c,b,d}]}]-IIi[{3,1},{cri[{b,d,a}],cri[{a,e,b,d}]}]+IIi[{3,1},{cri[{b,e,a}],cri[{b,e,c}]}]+IIi[{3,1},{cri[{b,e,a}],cri[{a,c,b,e}]}]-IIi[{3,1},{cri[{c,a,b}],cri[{c,d,b}]}]+IIi[{3,1},{cri[{c,a,b}],cri[{c,e,b}]}]-IIi[{3,1},{cri[{c,d,a}],cri[{c,d,e}]}]-IIi[{3,1},{cri[{c,d,a}],cri[{a,e,c,d}]}]-IIi[{3,1},{cri[{c,e,a}],cri[{c,e,b}]}]+IIi[{3,1},{cri[{c,e,a}],cri[{c,e,d}]}]+2 IIi[{3,1},{cri[{d,a,b}],cri[{c,a,b}]}]+IIi[{3,1},{cri[{d,a,b}],cri[{d,c,b}]}]-2 IIi[{3,1},{cri[{d,a,b}],cri[{e,a,b}]}]-IIi[{3,1},{cri[{d,a,c}],cri[{d,b,c}]}]-IIi[{3,1},{cri[{d,a,c}],cri[{d,e,c}]}]-IIi[{3,1},{cri[{d,a,c}],cri[{e,a,c}]}]+IIi[{3,1},{cri[{e,a,b}],cri[{e,c,b}]}]-2 IIi[{3,1},{cri[{e,a,c}],cri[{e,d,c}]}]-IIi[{3,1},{cri[{a,b,c,d}],cri[{d,c,b}]}]+IIi[{3,1},{cri[{a,b,c,d}],cri[{a,e,c,d}]}]+IIi[{3,1},{cri[{a,b,c,e}],cri[{c,e,a}]}]-IIi[{3,1},{cri[{a,b,c,e}],cri[{e,c,b}]}]+IIi[{3,1},{cri[{a,b,c,e}],cri[{b,d,e,c}]}]-IIi[{3,1},{cri[{a,c,b,d}],cri[{d,b,c}]}]+IIi[{3,1},{cri[{a,c,b,e}],cri[{e,b,c}]}]+IIi[{3,1},{cri[{a,d,b,e}],cri[{e,b,d}]}]-IIi[{3,1},{cri[{a,d,b,e}],cri[{a,c,b,e}]}]-IIi[{3,1},{cri[{a,d,c,e}],cri[{c,e,a}]}]-IIi[{3,1},{cri[{a,d,c,e}],cri[{e,c,d}]}]-IIi[{3,1},{cri[{a,e,b,d}],cri[{b,d,c,e}]}]-IIi[{3,1},{cri[{a,e,c,d}],cri[{d,c,e}]}];

i1111 = IIi[{1,1,1,1},{cri[{b,f,a}],cri[{c,f,a}],cri[{d,f,a}],cri[{e,f,a}]}];

phi = (1/2)*(i4 + i31);

phidiff = phi - (phi/.{a->f});

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