This page seeks to correct two misconceptions:
There have been various proposals for how to define gender or sex. In some situations they disagree with each other.
However, many jurisdictions allow modifications to be made to a birth certificate in at least some narrow cases. (e.g. intersex folks with ambiguous genitalia) This is an acknowledgment that the initial sex assignment by the birth doctor is (if only rarely) not definitive.
Because legislatures have been reluctant to define "man" and "woman", case law has been forced to address the issue several times.