Brst Formulation of Partition Function Constraints