I wiil refine it again!
I changed "farg".
inverse_additive(e,f) :=
subst("+" =
lambda([[l]],
block([listarith : true, q : 0, lx, r:0,farg : 0],
for lx in l do (
if not mapatom(lx) and op(lx)=f then (farg : ++1,lx : args(lx),q : q +lx) else (r:r+lx,farg : farg)
),
if farg>0 then funmake(f, inverse_additive(q,f))+r else q+r
)
),
e)$
s1:3*f(f(f(x))) + 7*f(f(y)) + 5*f(z)+42;
s2:inverse_outative(s1,f);
inverse_additive(s2,f); f([5*z+7*y+f(3*x)])+42 -->f(5*z+f(7*y+f(3*x)))+42 Part Marty