Safety and invariance