A measure-theoretic approach to Bayesian hypothesis testing and inversion with geophysical data