\right subformula is treated as an Inner atom and this adds some space before and after the subformula, in certain circumstances. One can get the desired behavior by
so the spacing inserted will disappear (TeX doesn't insert space between an opening atom and an inner one, nor between an inner atom and a closing one).
It's better to define "P" with
\operatorname than with
As Philippe Goutet remarks, if superscripts or subscripts need to be attached to the closing parenthesis, the definition should be