PERMUTATION INVARIANCE a function of a set, not a list — the order of the inputs does not matter
When the input is really a set, the output must not depend on the order it was written in: f(π·x) = f(x) for any permutation π. Sum, product, max, min, count are all permutation-invariant — scramble the arguments, the answer holds. The deep result (Deep Sets) is that every permutation-invariant function has the form ρ(∑ φ(xi)) — embed each element, sum (the invariant step), then decode. It is the symmetry of aggregation: how you build a function whose input has no inherent order, from a molecule's atoms to a graph's neighbours.
THE TECHNIQUE f(π·x) = f(x) — symmetric in its arguments (a set, not a list)
The demo sums two permutations of the same multiset — the totals match, so sum is permutation-invariant: live demo
HISTORY & CREDIT symmetric functions · Deep Sets 2017
“A function reads its inputs in order.” — a set-function must not; sum/max/count give the same answer however you shuffle the arguments. Order-freedom is a design constraint. cited
the relation · invariance under the symmetric group Sn — a function of a multiset. examples · sum, product, max, min, count, mean. 2017 · Zaheer et al. (Deep Sets) — every such function is ρ(∑φ(xi)): embed, sum, decode.
Shuffle the arguments, the answer holds — a function of a set, not a list. The symmetry of aggregation. Deep Sets 2017
RECOMMEND FOR I-13 the order-free sum, on the compiler
On the canonical compiler, sum([3,1,2]) = sum([1,2,3]) = 6 — permutation-invariant:
$ i13 run sy_permutationinvariance.i13 # sum is order-free
RUN OK · 141 step(s) · peak stack 5 · call depth 4
sum_a = 6 sum_b = 6
perm_invariant = 1 -- same multiset, any order, same total
Recommend: permutation-invariance is the symmetry of sets — the output blind to order — and i13 confirms sum is order-free. Not a keeper (invariance under a group is the B38 case, witnessed; every correct set-function has it, coextensive with “is a function of a set”). The dart that shows aggregation's symmetry, and the Deep Sets form (embed–sum–decode) beneath every function whose input is a bag of things.