# Getting around symbol favoritism of Simplify and FullSimplify [duplicate]

Simplify may or may not simplify depending on the symbols you use for its assumptions are good. For example, here is a case where Simplify is uncooperative

Simplify[b + c, b + c == a]
(* b + c *)


Here is a case where Simplify is happy with using the assumptions because it likes x, y and z.

Simplify[x + y, x + y == z]
(* z *)


Obviously Simplify is guilty of symbol favoritism. How do I formulate the assumptions in Simplify so that it will consistently simplify?

There is an old mathgroup discussion on this. The issue is that Simplify uses a Groebner basis and this is dependent on lexical order. The suggestion for getting around this was to use this code from Adam Strzebonski.

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
perm = Permutations[vars];
ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@
perm;
best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];


Then we have

VOISimplify[{a, b, c}, b + c, b + c == a]


a

However, checking all lexical orders could be expensive... I am no expert on this but just remember I had a similar problem in 2005. It is probably time to have further discussions on this issue.

• Nice find on the old mathgroup discussion. It's too bad you have to manually check for all permutations. Jul 28, 2018 at 16:54
• @QuantumDot Thanks for accepting. It might be worth asking a new question to see if there are alternative approaches to the one I found from 2005. This seems to be a very basic need in computer algebra and there should be a better method rather than looking at all permutations. I was hoping for a good discussion on the problem but no one seems to have responded to your attractively written question.
– Hugh
Jul 30, 2018 at 8:36

In this simple case, converting the equation to a Rule and using ReplaceAll works.

b + c /. Rule @@ (b + c == a)

(* a *)


or just

b + c /. b + c -> a


However, it would generally be better to restructure the Rule since replacement works better (more consistently) when the LHS of the Rule is as simple as possible.

b + c /. b -> a - c


Or

b + c /. c -> a - b

• The simple case is the result of isolating the issue in a bigger problem. The point of using Simplify with assumptions is to use transformations to make things simpler. Jul 26, 2018 at 19:29