Skip to main content
Package-X is no longer available
Source Link

Here's how I did it in earlier versions of Package-X, if I translate it to your notation:

rules = {ε4[idx1:PatternSequence[_, _, _, _]]* ε4[idx2:PatternSequence[_, _, _, _]]:> Det[Outer[g, {idx1}, {idx2}, 1, 1]], ε4[idx1:PatternSequence[_, _, _, _]]^2 :> Det[Outer[g, {idx1}, {idx1}, 1, 1]], g[a_, a_] :> 4, g[a_, b_] g[b_, c_] :> g[a, c], g[a_, b_]^2 :> 4 }; 

And then, so that the metric tensors sort their arguments, I also do:

SetAttributes[g, Orderless]; 

Now you can try something like

ε4[a, b, c, d] ε4[a, x, c, e] //. rules 
(* 2 g[b, x] g[d, e] - 2 g[b, e] g[d, x] *) 

Here's how I did it in earlier versions of Package-X, if I translate it to your notation:

rules = {ε4[idx1:PatternSequence[_, _, _, _]]* ε4[idx2:PatternSequence[_, _, _, _]]:> Det[Outer[g, {idx1}, {idx2}, 1, 1]], ε4[idx1:PatternSequence[_, _, _, _]]^2 :> Det[Outer[g, {idx1}, {idx1}, 1, 1]], g[a_, a_] :> 4, g[a_, b_] g[b_, c_] :> g[a, c], g[a_, b_]^2 :> 4 }; 

And then, so that the metric tensors sort their arguments, I also do:

SetAttributes[g, Orderless]; 

Now you can try something like

ε4[a, b, c, d] ε4[a, x, c, e] //. rules 
(* 2 g[b, x] g[d, e] - 2 g[b, e] g[d, x] *) 
rules = {ε4[idx1:PatternSequence[_, _, _, _]]* ε4[idx2:PatternSequence[_, _, _, _]]:> Det[Outer[g, {idx1}, {idx2}, 1, 1]], ε4[idx1:PatternSequence[_, _, _, _]]^2 :> Det[Outer[g, {idx1}, {idx1}, 1, 1]], g[a_, a_] :> 4, g[a_, b_] g[b_, c_] :> g[a, c], g[a_, b_]^2 :> 4 }; 

And then, so that the metric tensors sort their arguments, I also do:

SetAttributes[g, Orderless]; 

Now you can try something like

ε4[a, b, c, d] ε4[a, x, c, e] //. rules 
(* 2 g[b, x] g[d, e] - 2 g[b, e] g[d, x] *) 
Source Link

Here's how I did it in earlier versions of Package-X, if I translate it to your notation:

rules = {ε4[idx1:PatternSequence[_, _, _, _]]* ε4[idx2:PatternSequence[_, _, _, _]]:> Det[Outer[g, {idx1}, {idx2}, 1, 1]], ε4[idx1:PatternSequence[_, _, _, _]]^2 :> Det[Outer[g, {idx1}, {idx1}, 1, 1]], g[a_, a_] :> 4, g[a_, b_] g[b_, c_] :> g[a, c], g[a_, b_]^2 :> 4 }; 

And then, so that the metric tensors sort their arguments, I also do:

SetAttributes[g, Orderless]; 

Now you can try something like

ε4[a, b, c, d] ε4[a, x, c, e] //. rules 
(* 2 g[b, x] g[d, e] - 2 g[b, e] g[d, x] *)