The a i are the activities, which we defined when discussing the chemical potential analogous to the fugacities for gases. Fugacities , in turn, were introduced to take care of non-ideal behavior of gases. Lets now switch to an absolute quantity. We take the number of mols of gas i. If this looks a bit like magic, you are encouraged to go through the motions in fiddling around the products and the sums yourself.
Lets try it.