(* ::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.                                                         *)
(************************************************************************)



DQ[is___] := (Sort[{is}]===Union[{is}]);


LSimp[\[Gamma][f_,j_,k_,k_]] = 0;
LSimp[\[Gamma][f_,j_,k_,l_]] /; OrderedQ[{l,k}]\[And]DQ[k,l] := \[Gamma][-f, j, l, k] // LSimp;
LSimp[\[Gamma]a[f_, i_,j_,i_,k_]] /; OrderedQ[{k,j}]\[And]DQ[k,j] := \[Gamma][Subscript[b, i]f, i,j,k] + \[Gamma]a[f, i,k,i,j] // LSimp;
LSimp[\[Beta][f_]] := \[Beta][Expand[f]];
LSimp[a[i_,j_]] := a[i,j];
LSimp[a[f_, i_,j_]] := a[Expand[f], i,j];
LSimp[\[Gamma][f_, is__]] := \[Gamma][Expand[f], is];
LSimp[\[Gamma]a[f_, is__]] := \[Gamma]a[Expand[f], is];
LSimp[expr_] := expr /. (t_\[Beta]|t_a|t_\[Gamma]|t_\[Gamma]a) :> LSimp[t];


\[Beta][0] :=0;
\[Beta] /: \[Beta][f_] + \[Beta][g_] := \[Beta][f+g];
\[Beta] /: -\[Beta][f_] := \[Beta][-f] // LSimp;
a[0,__] := 0;
a /: a[f_,i_,j_] + a[g_, i_,j_] := a[f+g, i,j];
a /: -a[f_, is__] := a[-f, is] // LSimp;
\[Gamma][0,__] :=0;
\[Gamma] /: \[Gamma][f_,is__] + \[Gamma][g_, is__] := \[Gamma][f+g, is];
\[Gamma] /: -\[Gamma][f_, is__] := \[Gamma][-f, is] // LSimp;
\[Gamma]a[0,__] :=0;
\[Gamma]a /: \[Gamma]a[f_,is__] + \[Gamma]a[g_, is__] := \[Gamma]a[f+g, is];
\[Gamma]a /: -\[Gamma]a[f_, is__] := \[Gamma]a[-f, is] // LSimp;


B[0,_] =0; B[_, 0] = 0;
B[x_,x_] = 0;
B[x_Plus, y_] := B[#,y]& /@ x;
B[x_, y_Plus] := B[x,#]& /@ y;


B[a[f_, j_,k_], a[g_, l_,m_]] := Plus[
B[a[j,k], a[l,m]] /. {a[h_,is__] :> a[f g h, is], \[Gamma][h_,is__] :> \[Gamma][f g h, is]},
\[Gamma]a[f(\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(j\)]]g\)-\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(k\)]]g\)), j,k,l,m] + \[Gamma]a[g(\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(m\)]]f\)-\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(l\)]]f\)), l,m,j,k]
] // LSimp;
(* tt *) B[a[j_,k_], a[j_,l_]] /; DQ[j,k,l] := \[Gamma][1,j,k,l] // LSimp;
(* hh *) B[a[j_,k_], a[i_,k_]] /; DQ[i,j,k] := a[Subscript[b, i], j,k] - a[Subscript[b, j], i,k] // LSimp;
(* th *) B[a[j_,k_], a[i_,j_]] /; DQ[i,j,k] := a[Subscript[b, j], i,k] - a[Subscript[b, i], j,k] + \[Gamma][1, i,j,k] // LSimp;
(* ht *) B[a[j_,k_], a[k_,l_]] /; DQ[j,k,l] := -B[a[k,l], a[j,k]];
(* loc *) B[a[j_,k_], a[l_,m_]] /; DQ[j,k,l,m] := 0;


B[a[f_, j_,k_], \[Beta][g_]] := \[Gamma][f(\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(j\)]]g\)-\!\(
\*SubscriptBox[\(\[PartialD]\), 
SubscriptBox[\(b\), \(k\)]]g\)), j,k] // LSimp;


(* tt\[Gamma] *) B[a[f_, j_,k_], \[Gamma][g_, j_,l_]] /; DQ[j,k,l] := 0;
(* hh\[Gamma] *) B[a[f_, j_,k_], \[Gamma][g_, i_,k_]] /; DQ[i,j,k] := - \[Gamma][Subscript[b, j]f g, i,k] // LSimp;
(* th\[Gamma] *) B[a[f_, j_,k_], \[Gamma][g_, i_,j_]] /; DQ[i,j,k] := \[Gamma][Subscript[b, j]f g, i,k] // LSimp;
(* ht\[Gamma] *) B[a[f_, j_,k_], \[Gamma][g_, k_,l_]] /; DQ[j,k,l] := \[Gamma][Subscript[b, j]f g, k,l] - \[Gamma][Subscript[b, k]f g, j,l] // LSimp;
(* loc\[Gamma] *) B[a[f_, j_,k_], \[Gamma][g_, l_,m_]] /; DQ[j,k,l,m] := 0;
B[a[f_, j_,k_], \[Gamma][g_, j_,k_]] :=  \[Gamma][-Subscript[b, j]f g, j,k] // LSimp;


(* tt\[Gamma]3 *) B[a[f_, j_,k_], \[Gamma][g_, j_,l_,m_]] /; DQ[j,k,l,m] := 0;
(* th\[Gamma]3-1 *) B[a[f_, j_,k_], \[Gamma][g_, i_,j_,l_]] /; DQ[i,j,k,l] := \[Gamma][Subscript[b, j]f g,i,k,l] + \[Gamma]a[f g,i,l,j,k] // LSimp;
(* th\[Gamma]3-2 *) B[a[f_, l_,k_], \[Gamma][g_, i_,j_,l_]] /; DQ[i,j,k,l] := \[Gamma][-Subscript[b, l]f g,i,k,j] + \[Gamma]a[-f g,i,j,l,k] // LSimp;
(* ht\[Gamma]3 *) B[a[f_, j_,k_], \[Gamma][g_, k_,l_,m_]] /; DQ[j,k,l,m] := \[Gamma][-Subscript[b, k]f g,j,l,m] + \[Gamma][Subscript[b, j]f g,k,l,m] // LSimp;
(* hh\[Gamma]3-1 *) B[a[f_, j_,k_], \[Gamma][g_, n_,i_,k_]] /; DQ[n,i,j,k] := \[Gamma][-Subscript[b, j]f g, n,i,k] + \[Gamma]a[f g, n,i,j,k] // LSimp;
(* hh\[Gamma]3-2 *) B[a[f_, j_,i_], \[Gamma][g_, n_,i_,k_]] /; DQ[n,i,j,k] := \[Gamma][Subscript[b, j]f g, n,k,i] + \[Gamma]a[-f g, n,k,j,i] // LSimp;
(* a-th-1 *) B[a[f_, j_,k_], \[Gamma][g_, j_,k_,l_]] /; DQ[j,k,l] := \[Gamma]a[-f g,j,k,j,l] // LSimp;
(* a-th-2 *) B[a[f_, j_,l_], \[Gamma][g_, j_,k_,l_]] /; DQ[j,k,l] := \[Gamma]a[f g,j,l,j,k] // LSimp;
(* a-hh-1 *) B[a[f_, j_,k_], \[Gamma][g_, i_,j_,k_]] /; DQ[i,j,k] := \[Gamma][-Subscript[b, j]f g, i,j,k] + \[Gamma]a[f g, i,j,j,k] + \[Gamma]a[f g, i,k,j,k] // LSimp;
(* a-hh-2 *) B[a[f_, k_,j_], \[Gamma][g_, i_,j_,k_]] /; DQ[i,j,k] := \[Gamma][Subscript[b, k]f g, i,k,j] + \[Gamma]a[-f g, i,k,k,j] + \[Gamma]a[-f g, i,j,k,j] // LSimp;
(* loc\[Gamma] *) B[a[f_, i_,j_], \[Gamma][g_, k_,l_,m_]] /; DQ[i,j,k,l,m] := 0;


B[x_a, \[Gamma]a[f_, i_,j_,m_,n_]] := Plus[
B[x, \[Gamma][f, i,j]] /. \[Gamma][g_, k_,l_] :> \[Gamma]a[g, k,l,m,n],
B[x, a[1, m,n]] /. {a[g_, k_,l_] :> \[Gamma]a[f g, i,j,k,l], _\[Gamma]|_\[Gamma]a:>0}
] // LSimp


B[x_\[Beta]|x_\[Gamma]|x_\[Gamma]a, y_a] := -B[y,x];
B[_\[Beta]|_\[Gamma]|_\[Gamma]a, _\[Beta]|_\[Gamma]|_\[Gamma]a] := 0;


\[Beta]c[0,_] :=0;
\[Beta]c /: \[Beta]c[f_,i_] + \[Beta]c[g_, i_] := \[Beta]c[f+g, i];
\[Beta]c /: -\[Beta]c[f_, i_] := \[Beta]c[Expand[-f], i];
\[Delta]a[0,__] :=0;
\[Delta]a /: \[Delta]a[f_,is__] + \[Delta]a[g_, is__] := \[Delta]a[f+g, is];
\[Delta]a /: -\[Delta]a[f_, is__] := \[Delta]a[Expand[-f], is];
B[a[f_,j_,k_], c[l_]] /; DQ[j,k,l]:= 0;
B[a[f_,j_,k_], c[j_]] := \[Gamma][-f,j,k];
B[a[f_,j_,k_], c[k_]] := \[Gamma][f,j,k];
B[x_, \[Beta]c[f_, i_]] := B[x, c[i]] /. \[Gamma][g_,l_,m_] :> \[Gamma][f g, l,m];
(*B[x_, ca[f_, i_,j_,k_]] := Plus[
B[x, c[i]] /. \[Gamma][g_,l_,m_] \[RuleDelayed] \[Gamma]a[f g, l,m,j,k],
B[x, a[f,j,k]] /. {a[g_,l_,m_] \[RuleDelayed] ca[g, i,l,m], _\[Gamma] \[Rule] 0, _\[Gamma]a \[Rule] 0}
];*)
(*\[Delta]aa[f_, i_,j_,k_,l_] /; OrderedQ[{l,j}]\[And]DQ[i,j,k,l] := \[Delta]aa[f, k,l,i,j];
\[Delta]aa[f_, i_,j_,i_,l_] /; OrderedQ[{l,j}]\[And]DQ[j,l]:= \[Delta]aa[f,i,l,i,j];*)
B[x_,\[Delta]a[f_,i_,j_]] := B[x, a[f,i,j]] /. {a->\[Delta]a, _\[Gamma]:>0};
E\[Gamma]2 = {
\[Gamma][f_,j_,k_] :> \[Delta]a[f, j,k]+\[Beta]c[Expand[-f Subscript[b, j]], k]
};
Check2[y_\[Gamma]] := {t1=B[a[f,j,k], y] /. E\[Gamma]2, t2=B[a[f,j,k], y /. E\[Gamma]2] /. E\[Gamma]2, t1==t2 // Simplify}



