This is a question about pattern matching and list transformation rules.
(I may have the notation a bit wrong). Basically I'm thinking of rules which transform a set of balls with a letter on them, and the rules say what you must replace that letter with. So if you swap two letters on two balls then this doesn't count as no-transformation. Since we can line up the balls in any order to start with, so if 2 letters are swapped we would notice it. But the ordering you start with shouldn't matter. So in the following it might be better to think of them as lists in which we can randomize the order at the start.
The rules cannot refer to the position of the element in the list since the ordering can be randomized at the start.
Given a list of lists of characters of equal size. I want to enumerate all the possible list transformation rules.
For example, a set of rules could be:
$$\{A \rightarrow B, C \rightarrow D, E \rightarrow B, EverythingElse \rightarrow F\}$$
So that, for example, it transforms the lists:
$\{A,C,E,G\} \rightarrow \{B,D,B,F\}$ and $\{H,C,E,A\}\rightarrow \{F,D,B,B\}$
So I've managed to think up 5 cases so far:
CASE 1 - Replace the remainders
Normal rules for most elements, and then all other elements (which could be any number) which don't have a rule transform to a certain letter:
$$\{A_1 \rightarrow B_1, A_2 \rightarrow B_2, ..., AllOtherElements(\neq A_n) \rightarrow C\}$$
In other words it matches on the symbols from the first rules and then uses the last rule on everything it doesn't match. Because the lists are unordered it can only do the same thing to all of them (except in a special case).
e.g. $\{A_2,F,G,A_1\} \rightarrow \{B_2,C,C,B_1\}$
CASE 2 - The "swap"
Normal rules for most elements, and then swap the final two left over elements whatever they may be:
$$\{A_1 \rightarrow B_1, A_2 \rightarrow B_2, ..., OtherX \rightarrow OtherY, OtherY\rightarrow OtherX\}$$
e.g. $\{A_1,A_2,A_3,C,D\}\rightarrow\{B_1,B_2,B_3,D,C\}$ and $\{E,F,A_2,A_3,A_1\}\rightarrow\{F,E,B_2,B_3,B_1\}$
CASE 3 - Use the remainder to transform other letters.
Normal rules for most elements, and then the other element (X) goes to a certain letter. And Some other letters go to the other element (X). (The OtherElementX can be a different letter in each list.)
$$\{A_1 \rightarrow B_1, A_2 \rightarrow B_2, ..., OtherElementX(\neq A_n,D_n) \rightarrow C, D_1\rightarrow OtherElementX, D_2\rightarrow OtherElementX,...\}$$
e.g. $\{A_1,A_2,D_1,D_2,F\}\rightarrow \{B_1,B_2,F,F,C\}$
CASE 4 - Use the remainder to transform other letters but leave remainder unchanged.
Same as case 3 except we don't transform the remainder.
$$\{A_1 \rightarrow B_1, A_2 \rightarrow B_2, ..., OtherElementX(\neq A_n,D_n) \rightarrow OtherElementX, D_1\rightarrow OtherElementX, D_2\rightarrow OtherElementX,...\}$$
e.g. $\{A_1,A_2,D_1,D_2,F\}\rightarrow \{B_1,B_2,F,F,F\}$
CASE 5 - Leave the rest alone
Normal rules for most elements, and then just leave the remaining elements how they are:
$$\{A_1 \rightarrow B_1, A_2 \rightarrow B_2, ..., OtherX \rightarrow OtherX, OtherY\rightarrow OtherY,...\}$$
e.g. $\{C,D,A_1,A_2\}\rightarrow \{C,D,B_1,B_2\}$
I think this is all the cases since something involving permutations of 3 or more left-over elements would involve pattern matching on 3 elements of the list and this can be done in two many ways.
The question is:
Are these the only possible rules on lists? (Can it be proved?) Is there a better notation for this?
Background
The background for this question is from IQ tests where you are given a list of lists and asked to find a transformation rule. So I think all transformation rules must be from one of these 3 cases.