Debugging 2
September-17-08
11:16 AM
RelationsIn[gc_GC, red_] := ReplaceList[
  red*(Times @@ Select[gc, (Intersection[List @@ #, List @@ red] =!= {}) &]), {
   (* Short red arrows are central: *)
   RedAr[i_, i_]*_. /; i > 0 :> -red + RedAr[i - 1, i - 1],
   (* Tails commute for RedAr: *)
   RedAr[i_, j_] Ar[i_, _, _]*_. :> -red + RedAr[i - 1, j] + If[i - 1 == j, -x RedW[], 0],
   (* Commuting a RedAr tail across an Ar head *)
   RedAr[i_, j_] Ar[k_, i_, s_]*_. :> -red + RedAr[i - 1, j] + (X^s - 1)/x RedY[k, i, j] + If[i - 1 == j, -x RedW[], 0],
   (* Commuting the head of a RedAr with the head of an Ar *)
   (* RedAr[i_,j_]Ar[k_, j_, s_]*_. :> -red + RedAr[i,j-1]+(X^s-1)/x RedY[k,i,j]+If[i==j, -x RedW[], 0], *)
   (* The anti-symmetry of RedY: *)
   RedY[i_, j_, k_] * _. :> red + RedY[j, i, k],
   (* Tails commute for RedY: *)
   RedY[i_, j_, k_] Ar[i_, _, _]*_. :> -red + RedY[i - 1, j, k] + If[i - 1 == k, x^2 RedW[], 0],
   RedY[i_, j_, k_] Ar[j_, _, _]*_. :> -red + RedY[i, j - 1, k] + If[j - 1 == k, -x^2 RedW[], 0],
   (* Commuting a RedY tail across an Ar head *)
   RedY[i_, j_, k_] Ar[l_, j_, s_]*_. :> -red + RedY[i, j - 1, k] - (X^s - 1) RedY[l, j, k] + If[j - 1 == k, -x^2 RedW[], 0]
   }
  ]