<<PolylogTools`

(* -------- *)

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

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

I311[x_,y_,z_] := G[z, y, 0, 0, x, 1];
I32[x_,y_] := G[0, y, 0, 0, x, 1];
L5[x_] := -G[0, 0, 0, 0, 1/x, 1];

I41[x_,y_] := G[y, 0, 0, 0, x, 1];
N5[x_] := G[0, 0, 0, 1, 1, x];

N5old[x_] := I41[1,x];

tocr[expr_] := expr/.{I311[a_,b_,c_,d_,e_,f_] :> I311@@cr[a,b,c,d,e,f], I32[a_,b_,c_,d_,e_] :> I32@@cr[a,b,c,d,e],L5[a_,b_,c_,d_]:>L5[cr[a,b,c,d]],N5[a_,b_,c_,d_]:>N5[cr[a,b,c,d]],N5old[a_,b_,c_,d_]:>N5old[cr[a,b,c,d]]}

i311id4step1[a_,b_,c_,d_,e_,f_]:=I311[a,b,c,d,e,f]-I311[d,e,f,a,b,c];
i311id4str[a_,b_,c_,d_,e_,f_]:=i311id4step1[a,b,c,d,e,f]+i311id4step1[a,c,b,d,f,e];
i311id4str[x,y,z] := i311id4str[Inf,0,1,x,y,z];

i311id4bstep1[a_,b_,c_,d_,e_,f_]:=I311[a,b,c,d,e,f]-I311[f,c,b,d,e,a];
i311id4bstr[a_,b_,c_,d_,e_,f_]:=i311id4bstep1[a,b,c,d,e,f]+i311id4bstep1[a,b,c,e,d,f];
i311id4bstr[x,y,z] := i311id4bstr[Inf, 0, 1, x, y, z];

id1 = (1/3) (-3 (I311[a,b,c,d,e,f]+I311[a,c,b,d,f,e]-I311[d,e,f,a,b,c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