A Functionalist Theory of Sacrifice