Mathematics is, at its purest level, an abstract system of thought that can be developed without any reference to the natural world. You might consider a "space of all possible ideas", and mathematics would be a subset of this space. Mathematics as we know it (or will ever know it) is a discovery made by explorers of that space.
Mind you, if you believe that the space of ideas is a real thing, then nothing at all is ever invented. The steam engine, the telephone and the computer all existed in this timeless space of ideas long before humans thought of them. (Source)