A rigorous definition of mass in special relativity