Rigorous derivation of the anelastic approximation