symmetric functions with restricted number of variables
I'd like to restrict computations with symmetric functions to just a given number of variables.
For example,
m = SymmetricFunctions(QQ).m()
(1 + m[1])^5
produces
m[] + 5*m[1] + 20*m[1, 1] + 60*m[1, 1, 1] + 120*m[1, 1, 1, 1] + 120*m[1, 1, 1, 1, 1] + 10*m[2] + 30*m[2, 1] + 60*m[2, 1, 1] + 60*m[2, 1, 1, 1] + 30*m[2, 2] + 30*m[2, 2, 1] + 10*m[3] + 20*m[3, 1] + 20*m[3, 1, 1] + 10*m[3, 2] + 5*m[4] + 5*m[4, 1] + m[5]
However, if it's known that there are just 3 variables, the above result should be truncated to:
m[] + 5*m[1] + 20*m[1, 1] + 60*m[1, 1, 1] + 10*m[2] + 30*m[2, 1] + 60*m[2, 1, 1] + 30*m[2, 2] + 30*m[2, 2, 1] + 10*m[3] + 20*m[3, 1] + 20*m[3, 1, 1] + 10*m[3, 2] + 5*m[4] + 5*m[4, 1] + m[5]
I can surely truncate a particular expression myself, but I need an automated way to do so for all intermediate results in lengthy computation.
I guess I need somehow to define a custom ring of symmetric functions, where result of multiplication is truncated to a given (fixed) number of variables.