Mathematics is the study of quantity and structure. Reasoning about how to mutate some state, defined as a set of values, according to some domain-specific logic, constrained by the execution environment and invariants, is most assuredly mathematics.
Indeed. Whether the likes of Sarah Mei agree or not, the Curry-Howard correspondence holds regardless: producing a computer program that meets some specification is theorem proving at a fundamental level...