Bayesian brains and cognitive mechanisms