(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



SetDirectory["C:\\drorbn\\AcademicPensieve\\2016-02"]


DQ[is___] := (Sort[{is}]===Union[{is}]);
OQ[is___] := OrderedQ[{is}]; (* tests for non-strict ordering. Also true when {is} is {i,i}. *)
Subscript[K\[Delta], is__]:=KroneckerDelta[1,Length[Union[{is}]]];


Simp[expr_] := Expand[expr];
S[expr_] := expr /. (\[Lambda]_\[Beta]|\[Lambda]_a|\[Lambda]_\[Delta]\[Beta]|\[Lambda]_\[Delta]a|\[Lambda]_c|\[Lambda]_ca|\[Lambda]_\[Delta]aa) :> MapAt[Simp, \[Lambda], 1];


AutoCollecting[\[Lambda]_] := (
\[Lambda] /: \[Lambda][0,___] = 0;
\[Lambda] /: \[Lambda][f_, r___] + \[Lambda][g_, r___] := \[Lambda][Simp[f+g], r];
\[Lambda] /: g_*\[Lambda][f_, r___] := \[Lambda][Simp[g f], r];
);
AutoCollecting /@ {\[Beta], a, \[Delta]\[Beta], c, \[Delta]a, ca, \[Delta]aa};
UU /: UU[x_]+UU[y_] := UU[x+y];
UU /: a_*UU[x_] := UU[Expand[a x]];


\[Gamma][f_, j_,k_] := \[Delta]a[f,j,k]-c[Subscript[\[Epsilon], 48] Subscript[b, j]f,k];
\[Gamma]a[f_, j_,k_,l_,m_] := \[Delta]aa[f,j,k,l,m]-ca[Subscript[\[Epsilon], 48] Subscript[b, j]f,k,l,m];


UUBasis[T_List, H_List, f_] := Module[
{ff,n=0,h,t,h1,h2},
ff:=
\!\(\*SubscriptBox[\(f\), \(++n\)]\)@@Table[Subscript[b, t], {t,T}];
UU /@ Flatten@{
\[Beta][ff],
Table[{a[ff, t,h],\[Delta]a[ff,t,h]}, {t,T}, {h,H}],
\[Delta]\[Beta][ff],
Table[c[ff, h], {h,H}],
Table[ca[ff, h1,t,h2], {h1,H}, {t,T}, {h2,H}],
Table[\[Delta]aa[ff, T[[i]],H[[j]],T[[k]],H[[l]]], {k,Length@T},{i,k}, {l,Length@H},{j,l}]
} /. Subscript[1, _][___] -> 1
];
UUBasis[S_List,f_] := UUBasis[S,S,f];
UUBasis[n_Integer,m_Integer,f_] := UUBasis[Range@n,Range@m,f];
UUBasis[n_Integer, f_] := UUBasis[Range@n, f];


UU[expr_] // S := UU[S[expr //. {
\[Delta]aa[f_,i_,j_,k_,l_] /; !OQ[j,l] :> \[Delta]aa[f,k,l,i,j],
\[Delta]aa[f_,i_,j_,k_,l_] /; !OQ[i,k]\[And]DQ[j,l]\[And]OQ[j,l] :> \[Delta]aa[f,i,l,k,j] + ca[Subscript[\[Epsilon], 4] Subscript[b, k]f,l,i,j] + ca[-Subscript[\[Epsilon], 4] Subscript[b, i]f,l,k,j] + ca[-Subscript[\[Epsilon], 4] Subscript[b, k]f,j,i,l] + ca[Subscript[\[Epsilon], 4] Subscript[b, i]f,j,k,l],
\[Delta]aa[f_,i_,k_,j_,k_] /; !OQ[i,j] :> \[Delta]aa[f,j,k,i,k] + \[Delta]a[-Subscript[\[Epsilon], 2] Subscript[b, i]f,j,k] + \[Delta]a[Subscript[\[Epsilon], 2] Subscript[b, j]f,i,k]
}]];


UU[expr_] // tm[x_,y_,z_] := S[UU[Expand[expr /. {
a[f_,x,j_] :> a[f,z,j]+Subscript[\[Epsilon], 13]\[Gamma][\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(y\)]]f\),z,j],
a[f_,y,j_] :> a[f,z,j],
\[Delta]a[f_,x|y,j_] :> \[Delta]a[f,z,j],
ca[f_,i_,x|y,j_] :> ca[f,i,z,j],
\[Delta]aa[f_,i_,j_,k_,l_] :> \[Delta]aa[f,i//Replace[x|y->z], j, k//Replace[x|y->z], l]
} /. Subscript[b, x|y]->Subscript[b, z]]]];


UU[expr_] // hm[x_,y_,z_] := S[UU[Expand[expr /. {
a[f_,i_,x|y] :> a[f,i,z],
c[f_,x|y] :> c[f,z],
\[Delta]a[f_,i_,x|y] :> \[Delta]a[f,i,z],
ca[f_,y,j_, x] :> ca[f,z,j,z] + Subscript[\[Epsilon], 12]\[Gamma][f,j,z],
ca[f_,i_,j_,k_] :> ca[f,i//Replace[x|y->z],j,k//Replace[x|y->z]],
\[Delta]aa[f_,i_,y,k_,x] :> \[Delta]aa[f,k,z,i,z],
\[Delta]aa[f_,i_,j_,k_,l_] :> \[Delta]aa[f,i,j//Replace[x|y->z], k, l//Replace[x|y->z]]
}]]];


UU[expr_] // hts[y_,x_] := S[UU[Expand[expr /. {
a[f_,i_,j_] :> a[f,i,j] - Subscript[\[Epsilon], 11] Subscript[K\[Delta], j,y]\[Gamma][\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),i,y] - Subscript[K\[Delta], i,x] Subscript[K\[Delta], j,y](Subscript[\[Epsilon], 5]\[Beta][f Subscript[b, x]]+Subscript[\[Epsilon], 6]c[f,y]-Subscript[\[Epsilon], 7]\[Delta]\[Beta][Subscript[b, x]\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\)]),
\[Delta]a[f_,x,y] :> \[Delta]a[f,x,y] - Subscript[\[Epsilon], 8]\[Delta]\[Beta][f Subscript[b, x]],
ca[f_,i_,j_,k_] :> ca[f,i,j,k] + Subscript[\[Epsilon], 10] Subscript[K\[Delta], i,y] Subscript[K\[Delta], j,x]\[Gamma][f,x,k] + Subscript[K\[Delta], j,x] Subscript[K\[Delta], k,y]c[-Subscript[\[Epsilon], 9]f Subscript[b, x],i],
\[Delta]aa[f_,i_,j_,k_,l_] :> \[Delta]aa[f,i,j,k,l] + Subscript[\[Epsilon], 14] Subscript[K\[Delta], i,x] Subscript[K\[Delta], j,y]\[Delta]a[-Subscript[b, x]f,k,l] + Subscript[\[Epsilon], 3] Subscript[K\[Delta], i,x] Subscript[K\[Delta], l,y](-\[Delta]a[Subscript[b, k]f,x,j]+\[Delta]a[Subscript[b, x]f,k,j]) + Subscript[\[Epsilon], 1] Subscript[K\[Delta], k,x] Subscript[K\[Delta], j,y](\[Delta]a[Subscript[b, i]f,x,l]-\[Delta]a[Subscript[b, x]f,i,l]) + Subscript[\[Epsilon], 15] Subscript[K\[Delta], k,x] Subscript[K\[Delta], l,y]\[Delta]a[-Subscript[b, x]f,i,j] + Subscript[\[Epsilon], 16] Subscript[K\[Delta], i,x] Subscript[K\[Delta], j,l,y]\[Delta]\[Beta][Subscript[b, i] Subscript[b, k]f]
}]]];


dm[x_,y_,z_][expr_] := expr // hts[x,y] // tm[x,y,z] // hm[x,y,z]


t\[Sigma][x_List,y_List][expr_] := Module[{rule=Thread[x->y]},
expr /. Subscript[b, i_]:>Subscript[b, i /. rule] /. {
a[f_,i_,j_] :> a[f,i/.rule,j],
\[Delta]a[f_,i_,j_] :> \[Delta]a[f,i/.rule,j],
ca[f_,i_,j_,k_] :> ca[f,i,j/.rule,k],
\[Delta]aa[f_,i_,j_,k_,l_] :> \[Delta]aa[f,i/.rule,j,k/.rule,l]
}
];
t\[Sigma][x_,y_][expr_] := t\[Sigma][{x},{y}][expr];
h\[Sigma][x_List,y_List][expr_] := Module[{rule=Thread[x->y]},
S[expr /. {
a[f_,i_,j_] :> a[f,i,j/.rule],
c[f_,i_] :> c[f,i/.rule],
\[Delta]a[f_,i_,j_] :> \[Delta]a[f,i,j/.rule],
ca[f_,i_,j_,k_] :> ca[f,i/.rule,j,k/.rule],
\[Delta]aa[f_,i_,j_,k_,l_] :> \[Delta]aa[f,i,j/.rule,k,l/.rule]
}]
];
h\[Sigma][x_,y_][expr_] := h\[Sigma][{x},{y}][expr];
d\[Sigma][x_,y_][expr_] := expr // t\[Sigma][x,y] // h\[Sigma][x,y];


tb[x_][UU[L_],UU[R_]] := Module[{p},S[UU[Expand[Distribute[p[L,R]] /. {
p[0,_] -> 0, p[_,0] -> 0,
p[_\[Beta]|_\[Delta]\[Beta]|_c|_\[Delta]a|_ca|_\[Delta]aa, _\[Beta]|_\[Delta]\[Beta]|_c|_\[Delta]a|_ca|_\[Delta]aa] -> 0,
p[u_\[Beta]|u_\[Delta]\[Beta]|u_c|u_\[Delta]a|u_ca|u_\[Delta]aa, v_a] :> -p[v,u]
} /. {
p[a[f_,x,j_], u_] :> (u /. {
\[Beta][g_] :> Subscript[\[Epsilon], 39]\[Gamma][f \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]g\),x,j],
a[g_,k_,l_] :> Subscript[\[Epsilon], 40]\[Gamma]a[f \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]g\),x,j,k,l] +Subscript[K\[Delta], x,k](-\[Gamma]a[Subscript[\[Epsilon], 41]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(k\)]]f\),k,l,x,j] + ca[Subscript[\[Epsilon], 17]f g,l,x,j]-ca[Subscript[\[Epsilon], 17]f g,j,k,l]),
_ -> 0
}),
p[a[f_,j_,k_], a[g_,x,l_]] :> -\[Gamma]a[Subscript[\[Epsilon], 42]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),x,l,j,k],
p[_,_] -> 0
}]]]];


hb[y_][UU[L_],UU[R_]] := Module[{p},S[UU[Expand[Distribute[p[L,R]] /. {
p[0,_] -> 0, p[_,0] -> 0,
p[_\[Beta]|_\[Delta]\[Beta],_] -> 0,
p[_, _\[Beta]|_\[Delta]\[Beta]] -> 0,
p[_c|_\[Delta]a|_ca|_\[Delta]aa, _c|_\[Delta]a|_ca|_\[Delta]aa] -> 0,
p[u_c|u_\[Delta]a|u_ca|u_\[Delta]aa, v_a] :> -p[v,u]
} /. {
p[a[f_,i_,y], u_] :> (u /. {
a[g_,j_,k_] :> Subscript[\[Epsilon], 18] Subscript[K\[Delta], y,k](a[Subscript[b, j]f g,i,y]-a[Subscript[b, i]f g,j,k]),
c[g_, j_] :> Subscript[\[Epsilon], 19] Subscript[K\[Delta], y,j]\[Gamma][f g,i,j],
\[Delta]a[g_,j_,k_] :> Subscript[\[Epsilon], 20] Subscript[K\[Delta], y,k](\[Delta]a[Subscript[b, j]f g,i,y]-\[Delta]a[Subscript[b, i]f g,j,k]),
ca[g_,j_,k_,l_] :> Subscript[K\[Delta], y,j]\[Gamma]a[Subscript[\[Epsilon], 21]f g,i,j,k,l] + Subscript[K\[Delta], y,l](ca[Subscript[\[Epsilon], 22] Subscript[b, k]f g,j,i,y]-ca[Subscript[\[Epsilon], 22] Subscript[b, i]f g,j,k,l]),
\[Delta]aa[g_,j_,k_,l_,m_] :> Subscript[\[Epsilon], 23] Subscript[K\[Delta], y,k](\[Delta]aa[Subscript[b, j]f g,i,y,l,m]-\[Delta]aa[Subscript[b, i]f g,j,k,l,m]) + Subscript[\[Epsilon], 24] Subscript[K\[Delta], y,m](\[Delta]aa[Subscript[b, l]f g,j,k,i,y]-\[Delta]aa[Subscript[b, i]f g,j,k,l,m])
}),
_p -> 0
}]]]];


thb[x_,y_][UU[L_],UU[R_]] := Module[{p},S[UU[Expand[Distribute[p[L,R]] /. {
p[0,_] -> 0, p[_,0] -> 0,
p[_\[Beta]|_\[Delta]\[Beta]|_c|_\[Delta]a|_ca|_\[Delta]aa, _\[Beta]|_\[Delta]\[Beta]|_c|_\[Delta]a|_ca|_\[Delta]aa] -> 0,
p[_a,_\[Beta]|_\[Delta]\[Beta]] -> 0,
p[\[Beta][f_], a[g_,i_,j_]] :> Subscript[K\[Delta], y,j]\[Gamma][Subscript[\[Epsilon], 43]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\), i,y],
p[a[f_,i_,j_], a[g_,k_,l_]] :> Subscript[K\[Delta], y,l](
\[Gamma]a[Subscript[\[Epsilon], 44]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),k,l,i,j]+Subscript[K\[Delta], x,i](
\[Gamma][-Subscript[\[Epsilon], 45] Subscript[b, k]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),i,j]+\[Delta]a[Subscript[\[Epsilon], 46] Subscript[b, k]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),i,j]-\[Delta]a[Subscript[\[Epsilon], 47] Subscript[b, i]g \!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(x\)]]f\),k,j]-a[Subscript[\[Epsilon], 25] Subscript[b, k]f g,i,j]+a[Subscript[\[Epsilon], 25] Subscript[b, i]f g,k,j]+ca[Subscript[\[Epsilon], 26]f g, j,k,l]-ca[Subscript[\[Epsilon], 26]f g,l,k,j]
)
),
p[a[f_,i_,j_], c[g_,k_]] :> -Subscript[\[Epsilon], 27] Subscript[K\[Delta], i,x] Subscript[K\[Delta], k,y]\[Gamma][f g,i,j],
p[a[f_,i_,j_], \[Delta]a[g_,k_,l_]] :> Subscript[\[Epsilon], 28] Subscript[K\[Delta], x,i] Subscript[K\[Delta], y,l](-\[Delta]a[Subscript[b, k]f g,i,j]+\[Delta]a[Subscript[b, i]f g,k,j]),
p[a[f_,i_,j_], ca[g_,k_,l_,m_]] :> Subscript[K\[Delta], x,i](
-Subscript[\[Epsilon], 29] Subscript[K\[Delta], y,k]\[Gamma]a[f g,i,j,l,m]+Subscript[\[Epsilon], 30] Subscript[K\[Delta], y,m](-ca[Subscript[b, l]f g,k,i,j]+ca[Subscript[b, i]f g,k,l,j])-Subscript[\[Epsilon], 31] Subscript[K\[Delta], y,k,m]\[Gamma][Subscript[b, l]f g,x,j]
),
p[a[f_,i_,j_], \[Delta]aa[g_,k_,l_,m_,n_]] :> Subscript[K\[Delta], x,i](
Subscript[\[Epsilon], 32] Subscript[K\[Delta], y,l](-\[Delta]aa[Subscript[b, k]f g,i,j,m,n]+\[Delta]aa[Subscript[b, i]f g,k,j,m,n]) + Subscript[\[Epsilon], 33] Subscript[K\[Delta], y,n](-\[Delta]aa[Subscript[b, m]f g,k,l,i,j]+\[Delta]aa[Subscript[b, i]f g,k,l,m,j])+Subscript[\[Epsilon], 34] Subscript[K\[Delta], y,l,n](\[Delta]a[Subscript[b, x] Subscript[b, m]f g,k,j]-\[Delta]a[Subscript[b, k] Subscript[b, m]f g,x,j])
),
p[_\[Delta]\[Beta]|_c,_a] -> 0,
p[\[Delta]a[f_,i_,j_], a[g_,k_,l_]] :> Subscript[\[Epsilon], 35] Subscript[K\[Delta], x,i] Subscript[K\[Delta], y,l](-\[Delta]a[Subscript[b, k]f g,i,j]+\[Delta]a[Subscript[b, i]f g,k,j]),
p[ca[f_,m_,i_,j_], a[g_,k_,l_]] :> Subscript[\[Epsilon], 36] Subscript[K\[Delta], x,i] Subscript[K\[Delta], y,l](-ca[Subscript[b, k]f g,m,i,j]+ca[Subscript[b, i]f g,m,k,j]),
p[\[Delta]aa[f_,i_,j_,m_,n_], a[g_,k_,l_]] :> Subscript[\[Epsilon], 37] Subscript[K\[Delta], x,i] Subscript[K\[Delta], y,l](-\[Delta]aa[Subscript[b, k]f g,i,j,m,n]+\[Delta]aa[Subscript[b, i]f g,k,j,m,n]) + Subscript[\[Epsilon], 38] Subscript[K\[Delta], x,m] Subscript[K\[Delta], y,l](-\[Delta]aa[Subscript[b, k]f g,i,j,m,n]+\[Delta]aa[Subscript[b, m]f g,i,j,k,n])
}]]]];
htb[x_,y_][L_UU,R_UU] := -thb[y,x][R,L];


db[x_][u_UU,v_UU] := Module[{t,h}, Plus[
htb[x,x][u//t\[Sigma][x,t],v//h\[Sigma][x,h]] // tm[t,x,x] // hm[x,h,x],
tb[x][u,v//h\[Sigma][x,h]] // hm[x,h,x],
hb[x][u,v//t\[Sigma][x,t]] // tm[t,x,x],
thb[x,x][u//h\[Sigma][x,h],v//t\[Sigma][x,t]] // tm[t,x,x] // hm[x,h,x]
]];


bb[S_List] := Module[{w,bar,t,n=0},
bar[x_] := -x;
w=#2//d\[Sigma][S,bar/@S];
Sum[
t=db[S[[k]]][#1,w // d\[Sigma][bar[S[[k]]], S[[k]]]];
Do[t=t//dm[bar[S[[i]]], S[[i]], S[[i]]], {i,1,k-1}];
Do[t=t//dm[S[[i]], bar[S[[i]]], S[[i]]], {i,k+1,Length@S}];
t,
{k,Length@S}
]
]&
bb[S___] := bb[{S}]


ct::usage="ct[L,R,{h,t}] contracts the head h in L with the tail t in R. ct[L,R] assumes that both h and t are 0. When ambiguous, L is placeed below R.";
ct[L_,R_] := ct[L,R,{0,0}];
ct[UU[L_],UU[R_], {h_,t_}] := Module[{p}, S[UU[Distribute[p[L,R]] /. {
p[_\[Beta]|_\[Delta]\[Beta],_] -> 0,
p[a[f_,i_,h], \[Beta][g_]] :> \[Beta][f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0)],
p[a[f_,i_,h], a[g_,t,j_]] :> a[f(g/.Subscript[b, t]->0), i,j],
p[a[f_,i_,h], a[g_,j_,k_]] :> a[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k],
p[a[f_,i_,h], c[g_,j_]] :> c[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j],
p[a[f_,i_,h], \[Delta]a[g_,t,j_]] :> \[Delta]a[f(g/.Subscript[b, t]->0), i,j],
p[a[f_,i_,h], \[Delta]a[g_,j_,k_]] :> \[Delta]a[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k],
p[a[f_,i_,h], ca[g_,k_,t,j_]] :> ca[f(g/.Subscript[b, t]->0), k,i,j],
p[a[f_,i_,h], ca[g_,l_,j_,k_]] :> ca[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), l,j,k],
p[a[f_,i_,h], \[Delta]aa[g_,t,j_,t,k_]]  -> 0,
p[a[f_,i_,h], \[Delta]aa[g_,t,j_,k_,l_]] :> \[Delta]aa[f(g/.Subscript[b, t]->0), i,j,k,l],
p[a[f_,i_,h], \[Delta]aa[g_,j_,k_,t,l_]] :> \[Delta]aa[f(g/.Subscript[b, t]->0), j,k,i,l],
p[a[f_,i_,h], \[Delta]aa[g_,j_,k_,l_,m_]] :> \[Delta]aa[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k,l,m],
p[a[__], _] -> 0,
p[c[f_,h], \[Beta][g_]] :> \[Delta]\[Beta][f ((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0)],
p[_c,_\[Beta]]->0,
p[c[f_,h], a[g_,t,j_]] :> c[f(g/.Subscript[b, t]->0), j],
p[c[f_,h], a[g_,j_,k_]] :> \[Delta]a[f((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k],
p[_c,_a]->0,
p[_c|_\[Delta]a|_ca|_\[Delta]aa, _\[Delta]\[Beta]|_c|_\[Delta]a|_ca|_\[Delta]aa] -> 0,
p[\[Delta]a[f_,i_,h], \[Beta][g_]] :> \[Delta]\[Beta][f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0)],
p[\[Delta]a[f_,i_,h], a[g_,t,j_]] :> \[Delta]a[f(g/.Subscript[b, t]->0),i,j],
p[\[Delta]a[f_,i_,h], a[g_,j_,k_]] :> \[Delta]a[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k],
p[_\[Delta]a,_] -> 0,
p[ca[_,h,_,h], _] -> 0,
p[ca[f_,h,i_,j_], \[Beta][g_]] :> \[Delta]a[f((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i,j],
p[ca[f_,i_,j_,h], \[Beta][g_]] :> c[f Subscript[b, j]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i],
p[ca[f_,h,i_,j_], a[g_,t,k_]] :> ca[f (g/.Subscript[b, t]->0), k,i,j],
p[ca[f_,h,i_,j_], a[g_,k_,l_]] :> \[Delta]aa[f((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i,j,k,l],
p[ca[f_,i_,j_,h], a[g_,t,k_]] :> ca[f (g/.Subscript[b, t]->0),i,j,k],
p[ca[f_,i_,j_,h], a[g_,k_,l_]] :> ca[f Subscript[b, j]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i,k,l],
p[_ca,_] -> 0,
p[\[Delta]aa[_,_,h,_,h], _] -> 0,
p[\[Delta]aa[f_,i_,h,j_,k_], \[Beta][g_]] :> \[Delta]a[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0),j,k],
p[\[Delta]aa[f_,i_,h,j_,k_], a[g_,t,l_]] :> \[Delta]aa[f (g/.Subscript[b, t]->0),i,l,j,k],
p[\[Delta]aa[f_,i_,h,j_,k_], a[g_,l_,m_]] :> \[Delta]aa[f Subscript[b, i]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), j,k,l,m],
p[\[Delta]aa[f_,i_,j_,k_,h], \[Beta][g_]] :> \[Delta]a[f Subscript[b, k]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i,j],
p[\[Delta]aa[f_,i_,j_,k_,h], a[g_,t,l_]] :> \[Delta]aa[f (g/.Subscript[b, t]->0),i,j,k,l],
p[\[Delta]aa[f_,i_,j_,k_,h], a[g_,l_,m_]] :> \[Delta]aa[f Subscript[b, k]((\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(t\)]]g\)) /. Subscript[b, t]->0), i,j,l,m],
p[_\[Delta]aa, _] -> 0
}]]];
