fu[x_, rules_, expr_] := Module[Block[{rout = Thread[x -> #] & /@ rules, out{expr}, new}, out = {expr}; While[new = Complement[Flatten[x /. rComplement[Flatten[rules /. Thread[x -> #] & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] fu[x_, rules_, expr_] := Module[{r = Thread[x -> #] & /@ rules, out, new}, out = {expr}; While[new = Complement[Flatten[x /. r /. Thread[x -> #] & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] fu[x_, rules_, expr_] := Block[{out = {expr}, new}, While[new = Complement[Flatten[rules /. Thread[x -> #] & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] fu[x_, rules_, expr_] := Module[{r = Thread[x -> #] & /@ rules, out, new}, out = {expr}; While[new = Complement[ Flatten[((xComplement[Flatten[x /. # & /@ r) /. Thread[x -> #]) & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] fu[x_, rules_, expr_] := Module[{r = Thread[x -> #] & /@ rules, out, new}, out = {expr}; While[new = Complement[ Flatten[((x /. # & /@ r) /. Thread[x -> #]) & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] fu[x_, rules_, expr_] := Module[{r = Thread[x -> #] & /@ rules, out, new}, out = {expr}; While[new = Complement[Flatten[x /. r /. Thread[x -> #] & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] The first argument is identity permutation. The second argument is list of rules/permutations and the third argument is an expression on which the function is applied.
fu[x_, rules_, expr_] := Module[{r = Thread[x -> #] & /@ rules, out, new}, out = {expr}; While[new = Complement[ Flatten[((x /. # & /@ r) /. Thread[x -> #]) & /@ out, 1], out]; out = Join[out, new]; new != {}]; out ] So for the three examples we have:
rules = {{-a, b, c, -d, e, f}, {a, c, b, d, f, e}, {b, a, c, e, d, f}, {b, c, a, e, f, d}, {c, a, b, f, d, e}, {c, b, a, f, e, d}, {d, e, f, a, b, c}}; fu[{a, b, c, d, e, f}, rules, {-1, -1, -1, -1, -1, -1}] Length[%] fu[{a, b, c, d, e, f}, rules, {0, 0, 0, 0, 0, 0}] Length[%] fu[{a, b, c, d, e, f}, rules, {-1, -1, -1, -1, -1, 0}] Length[%] {{-1, -1, -1, -1, -1, -1}, {1, -1, -1, 1, -1, -1}, {-1, -1, 1, -1, -1, 1}, {-1, 1, -1, -1, 1, -1}, {1, -1, 1, 1, -1, 1}, {1, 1, -1, 1, 1, -1}, {-1, 1, 1, -1, 1, 1}, {1, 1, 1, 1, 1, 1}} 8 {{0, 0, 0, 0, 0, 0}} 1 {{-1, -1, -1, -1, -1, 0}, {-1, -1, -1, -1, 0, -1}, {-1, -1, -1, 0, -1, -1}, {-1, -1, 0, -1, -1, -1}, {1, -1, -1, 1, -1, 0}, {-1, -1, 1, -1, 0, 1}, {-1, -1, 1, 0, -1, 1}, {-1, 0, -1, -1, -1, -1}, {-1, 1, -1, -1, 1, 0}, {-1, 1, -1, 0, 1, -1}, {0, -1, -1, -1, -1, -1}, {1, -1, -1, 0, -1, -1}, {1, -1, -1, 1, 0, -1}, {1, -1, 0, 1, -1, -1}, {-1, -1, 1, -1, -1, 0}, {-1, 0, 1, -1, -1, 1}, {-1, 1, -1, -1, 0, -1}, {-1, 1, 0, -1, 1, -1}, {0, -1, -1, 1, -1, -1}, {0, -1, 1, -1, -1, 1}, {0, 1, -1, -1, 1, -1}, {1, -1, 1, 0, -1, 1}, {1, -1, 1, 1, 0, 1}, {1, 0, -1, 1, -1, -1}, {1, 1, -1, 0, 1, -1}, {1, 1, -1, 1, 1, 0}, {-1, -1, 0, -1, -1, 1}, {-1, 0, -1, -1, 1, -1}, {-1, 1, 1, -1, 0, 1}, {-1, 1, 1, -1, 1, 0}, {-1, 1, 1, 0, 1, 1}, {0, -1, 1, 1, -1, 1}, {0, 1, -1, 1, 1, -1}, {1, -1, 1, 1, -1, 0}, {1, 0, 1, 1, -1, 1}, {1, 1, -1, 1, 0, -1}, {1, 1, 0, 1, 1, -1}, {-1, 0, 1, -1, 1, 1}, {-1, 1, 0, -1, 1, 1}, {0, 1, 1, -1, 1, 1}, {1, -1, 0, 1, -1, 1}, {1, 0, -1, 1, 1, -1}, {1, 1, 1, 0, 1, 1}, {1, 1, 1, 1, 0, 1}, {1, 1, 1, 1, 1, 0}, {0, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1}} 48 lang-mma