Q:

Simplifying If statements

How can I get Mathematica to simplify the true and false clauses for If[] statements?  
For example:
bar[a_] := a
FullSimplify[If[a > b, bar[a], bar[b]]]

If[a > b, bar[a], bar[b]]

I was hoping for at least If[a>b, a, b].  I thought that it might be hesitating to simplify bar[] because of possible side effects in the function, but I noticed this:
FullSimplify[If[a + a + a > b + b + b, a + a + a, b + b + b]]

If[a > b, a + a + a, b + b + b]

Note that the conditional clause was simplified, but nothing else was.  But if the form is slightly different, it will simplify:
FullSimplify[If[a > b, a - a + a, b - b + b]]

{a  a > b
  {b  True

How can I get simplified expressions within If statements?  I feel like I'm missing something very basic.

A:

If is primarily a programming function.  It tells the computer what to do.  It's not the best idea to use it to represent a mathematical function (as opposed to an algorithm).
To represent mathematical functions, use Piecewise,
Piecewise[{{bar[a], a > b}, {bar[b], True}}]

Mathematica tries to unify various uses to be easier to use for users, but it's good to be aware that numerical, symbolical, or "algorithmic" functions are really different use cases (another example would be UnitStep vs HeavisideTheta vs If[something>0, ...].  UnitStep is excellent for fast numerical calculations.  HeavisideTheta is knows that it should be undefined for 0.  And If is usable for (conditional) evaluation control while programming, i.e. one can use it to build programs/algorithms.

A:

Try this:
bar[a_] := a
If[a > b, Evaluate[bar[a]], Evaluate[bar[b]]]

