Robust pattern matching functions obeying quadratic constraints

2018-01-24 07:03:32

I have a function, br, that takes multiple integer arguments (which for syntactic ease I collect in a list) and is

Antisymmetric in any two arguments:

br[l_List] :> Signature[l] br[Sort[l]]

Obeys an algebraic relation:

br[{i_,j_,m___}]br[{k_,l_,m___}] -

br[{i_,k_,m___}]br[{j_,l_,m___}] -

br[{i_,l_,m___}]br[{j_,k_,m___}] :> 0

Perhaps abusively, I call this a "quadratic" constraint since each term is two "powers" of br (with different arguments).

Is there a good way to implement this second condition?

A sample expression that should reduce after two iterations of the second rule:

samp = (1/(br[{3, 6, 7}] br[{4, 6, 7}]))*

(

br[{2, 6, 7}] br[{3, 6, 7}] br[{4, 5, 6}] +

br[{2, 6, 7}] br[{3, 4, 6}] br[{5, 6, 7}] +

br[{2, 3, 6}] br[{4, 6, 7}] br[{5, 6, 7}]

);

The first condition is straightforward, but I have to by-hand define the second:

cleanBR =

{

br[l_List] :> Signature[l] br[Sort[l]]

,

br[{3, 6, 7}] br[{4, 5, 6}] :>

br[{3, 6, 4}] br[{7, 5, 6}] + br[{3, 6,