Foundations for an algebraic theory of conditioning