I guess that a good syntax might be
\prob{a=1} % no subscript, standard size
\prob[\big]{a=1} % no subscript, \big size
\prob*{a=\frac{1}{2}} % no subscript, automatic sizing
\prob_{b}{a=1} % subscript, standard size
\prob_{b}[\big]{a=1} % subscript, \big size
\prob_{b}*{a=\frac{1}{2}} % subscript, automatic sizing
because this is the order in which the various elements naturally appear.
It is not necessary to specify all arguments, because \prob
can test for the subscript and then pass control to another command that typesets the rest grabbing its argument using \DeclarePairedDelimiter
.
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\probargument}{[}{]}
\NewDocumentCommand{\prob}{e{_}}{%
\mathsf{P}\IfValueT{#1}{_{#1}}\probargument
}
\begin{document}
\begin{gather}
\prob{a=1} \\ % no subscript, standard size
\prob[\big]{a=1} \\ % no subscript, \big size
\prob*{a=\frac{1}{2}} \\ % no subscript, automatic sizing
\prob_{b}{a=1} \\ % subscript, standard size
\prob_{b}[\big]{a=1} \\ % subscript, \big size
\prob_{b}*{a=\frac{1}{2}} % subscript, automatic sizing
\end{gather}
\end{document}

With some more xparse
trickery, you can have an argument like {a=1|b=1}
to denote conditional probability. Spaces around |
are ignored.
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiterX{\probargument}[1]{[}{]}{\probargumentA{#1}}
\NewDocumentCommand{\prob}{e{_}}{%
\mathsf{P}\IfValueT{#1}{_{#1}}\probargument
}
\NewDocumentCommand{\probargumentA}{>{\SplitArgument{1}{|}}m}{%
\probargumentB#1%
}
\NewDocumentCommand{\probargumentB}{mm}{%
\IfNoValueTF{#2}{% not conditional
#1%
}{% conditional
#1\;\delimsize|\;#2%
}%
}
\begin{document}
\begin{gather}
\prob{a=1} \\ % no subscript, standard size
\prob[\big]{a=1} \\ % no subscript, \big size
\prob*{a=\frac{1}{2}} \\ % no subscript, automatic sizing
\prob_{b}{a=1} \\ % subscript, standard size
\prob_{b}[\big]{a=1} \\ % subscript, \big size
\prob_{b}*{a=\frac{1}{2}} \\ % subscript, automatic sizing
\prob{a=1|b=1} \\ % no subscript, standard size
\prob[\big]{a=1|b=1} \\ % no subscript, \big size
\prob*{a=\frac{1}{2}|b=1} \\ % no subscript, automatic sizing
\prob_{b}{a=1|b=1} \\ % subscript, standard size
\prob_{b}[\big]{a=1|b=1} \\ % subscript, \big size
\prob_{b}*{a=\frac{1}{2}|b=1} % subscript, automatic sizing
\end{gather}
\end{document}

semantex
(disclaimer: I am the author) was created more or less to support syntax like this.