Mathematica does not seem to treat variables as a unit. Consider the following:
rule = a -> Function[{x}, OverBar[a][x]]
test = a[x] /. rule;
test /. rule
It seems to apply the rule again on the last line, which of course is not what I want (in the sense that a and OverBar[a] are supposed to be different things). I tried to use the Notation package but was rather unsuccessful. Is there a way to make this work?