There are no rules, mathematics or otherwise, which govern the laws of physics. Rather the empirical nature of the
laws of physics govern the mathematical models. The models are designed to describe what nature
actually does, which we then use to estimate predictions about what nature will do, or has done, under various circumstances.
The knowledge comes from actual measurement, observations, or experimental testing. The mathematical models represent
our best understanding, so far, about nature. My confidence in a particular hypothesis grows with careful logical
deduction or inductive testing, measuring, or observation. And when a mathematical model is refined to account for all
anomalies and conditions, and accurately predicts for every case, of many many cases, after all prior anomaly & condition
corrections, we debate calling it a theory or a law.
Both math realism and anti-realism, are ideas chosen in an attempt to impose order on the idea of math. Math is
real in the sense of an activity which minds engage in. But if you want to talk about something physical, one needs physical
units like, "apples."
Consider the question, does "I have 12," mean anything?, "I have 12 apples," may mean I won't go hungry
or I have something to trade. But, "I have 12," has meaning only in pure philosophy or as a claim about process of reasoning.
Math is pure philosophy, except with a special constraint of universal consistency. For example, in some sense the mathematical
philosophy on equations of lines in 2-dimensions is required by this math philosophy, to be consistent with
the math philosophy of matrix algebra in 3-dimsensions. This special requirement of math philosophy need not necessarily apply
to nature, physics, or any other philosophy.
If math is invented, the only invention was that of a universally consistent philosophy about numerical quantities. All
new contributions to math are discoveries of the mere logical consequences of the original idea, proposing or creating the
philosophy of math, as a human activity in exploring the logical consequences of the original conditions of the philosophy.