# How does Simplify resolve LeafCount ties? [closed]

The documentation for ComplexityFunction says

With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount, with corrections to treat integers with more digits as more complex.

and

LeafCount[-a - b] == LeafCount[-(a + b)] == 7
>> True


so I would expect that Simplify would not change either expression. But

Simplify[-a - b]
>> -a - b

Simplify[-(a + b)]
>> -a - b


seems to imply that Mathematica considers the expression -a - b to be strictly simpler than -(a + b). Why is it doing so, since the two expressions seem to have the same complexity as measured by LeafCount? I'm not sure whether to interpret the quoted sentence in the documentation as saying that the integer-digit correction to LeafCount is the only correction, or if it is just giving the integer-digit correction as one example of multiple corrections.

• The automatic ComplexityFunction is SimplifyCount in ComplexityFunction >> Properties and Relations – kglr Aug 7 '17 at 7:33
• tparker it is in the last section in the linked page. It also gives the same value for both expressions because both functions are seen as Plus[Times[-1, a], Times[-1, b]]. – kglr Aug 7 '17 at 7:40
• @kglr, tparker: Forgive me, but both LeafCount and SimplifyCount yield ties. I don't see how the question (how ties are resolved) has been answered yet. – Michael E2 Aug 7 '17 at 11:04
• Note that -(a + b) evaluates to -a - b, so Simplify is irrelevant. – ilian Aug 7 '17 at 13:33
• @MichaelE2 Good point. kglr's comment answers both the explicit question "explain this particular behavior" and the implicit question "clarify the LeafCount documentation" in the body of the OP, so I accepted their posted answer (although ironically, as written it only answers the implicit question). I've spun the question off in the title as a separate question at mathematica.stackexchange.com/questions/153273/…. – tparker Aug 7 '17 at 17:42