# How to assume lexicographical ordering

Suppose I have functions which depends on the symbols $$c[I]$$, where $$I$$ is some subset of $$\{1,2,...,n\}$$. For example, $$f = c + c[1,2,3] + c[1,2],$$ $$g = c + c[2,1],$$

Code:

f = c + c[1, 2] + c[1, 2, 3];
g = c + c[2, 1];


and I want to find the maximum between f and g, assuming that the c's are positive and moreover monotonically decreasing with respect to the lexycographical order of their arguments:

so for example $$c > c > \dots,$$ $$c[1,2] > c[2,1] > c[2,2] > \dots$$

so that $$f - g = (c-c) + (c[1,2]-c[2,1]) + c[1,2,3] > 0.$$

How can I define in a clever way this assumption so that Max[{f, g}, assumption] does the job for me?

• People here generally like users to post code and examples as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful Oct 9, 2018 at 12:17

mymax[f_, g_] := With[{vars = Union@Cases[{f, g}, _c, Infinity]},