I know intuitively what units are and I understand how to DO dimensional analysis fine, but it occurred to me recently that I've never really considered what units or dimensions actually ARE, that is, what properties an unit must necessarily have and what properties a dimension (in the context of dimensional analysis) must have. Specifically, I was reading several threads on the topic of how many base units are actually necessary in physics, over on the physics SE last week (didn't save the links unfortunately) and the general impression I got was that the number of base units in a unit system is analogous to the number of basis vectors in a vector space which makes the dimensions in dimensional analysis analogous to the dimensions of a vector space. That makes intuitive sense as an analogy, but unit systems in general can't actually be vector spaces since they don't satisfy the addition axioms, as addition between units of different dimensions is generally undefined (e.g. we can't add meters and kilograms). Is there some other, more general mathematical structure that unit systems are an example of, and that have a property analogous to the dimensions of a vector space that the dimensions of dimensional analysis would be an example of? If not, have any mathematicians attempted to formalize things and come up with proper definitions?
I did Google this question and found stuff on the Buckingham Pi theorem; however, looking at the Wikipedia page, if I'm understanding correctly, the theorem states that, for a unit system of n linearly independent base units, there will be an equivalent system of n dimensionless parameters. That makes it seem very much like base units are just independent variables/degrees of freedom. That sort of makes sense, except that addition between different base units is undefined and that would seem to imply that this set of dimensionless parameters that are, presumably, isometric to the original unit system, can't be either real or complex-valued, because real and complex numbers can all be added together. But if these parameters can't have real or complex values, then what type of values can they have?
And, further, it's unclear to me to what "dimensionless" even means in this context because it's unclear what "dimension" means, mathematically speaking. Even if I relate it back to the intuition I have from physics, it's still not entirely clear because different unit systems have different numbers of base units and different quantities that are used as bases. For example, in SI units, you can't add space time together without using c as a conversion factor on one of them. But if, as is actually common in some branches of physics, we simply declare that c=1, we end up with space and time having the same unit, as well as with the electric and magnetic fields having the same units, and energy, mass, and momentum all having the same unit. That presumably just means that the SI base units aren't really all linearly independent of each other and so the Buckingham Pi theorem wouldn't apply. But that brings up the question of what linear independence even means when we're not dealing with a vector space, as it doesn't seem like linear combinations are possible.