BAYESIAN ANALYSIS OF TWO STELLAR POPULATIONS IN GALACTIC GLOBULAR CLUSTERS. I. STATISTICAL AND COMPUTATIONAL METHODS