The equation of state for stellar envelopes. I - an occupation probability formalism for the truncation of internal partition functions | Synapse