The UK Supreme Court has ruled the legal definition of a woman excludes trans women.