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

(*Using a pattern to make a pattern not a pattern!?*)lhsRule[RuleDelayed[lhs_,rhs_]]:=lhs/.HoldPattern[w_Pattern]:>w[[1]]
rhsRule[RuleDelayed[lhs_,rhs_]]:=Expand[rhs]

ruleToIdentity[expr_]:=lhsRule[expr]-rhsRule[expr]//Expand;

cr[{a_,b_,c_,d_}] := 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[]<>"wt5_rules_to_i311_i32_i5.m"];

ruleToIdentity[rule41to32]

ruleToIdentity[rule41to32]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule14to32]

ruleToIdentity[rule14to32]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule23to32]

ruleToIdentity[rule23to32]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule221to311]

ruleToIdentity[rule221to311]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule131to311]

ruleToIdentity[rule131to311]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule113to311]

ruleToIdentity[rule113to311]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule122to311]

ruleToIdentity[rule122to311]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

ruleToIdentity[rule212to311]

ruleToIdentity[rule212to311]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//sh//flatTensor//Expand

(* ------- *)

ruleToIdentity[rule311to32]

ruleToIdentity[rule311to32]/.{a->Inf,b->0,c->1,cri->cr,IIi->II}//CreateTensor//del//Expand