It is not by prior knowledge alone, but by intuition.
For example, on how I know about the “Where is my Train app.”
I do not know of it because I’ve been told there is such an app, I simply intuited it’s existence from knowing that the train’s position can be tracked, and there is a way for such an app to exist.
That is, not all knowledge is discovered by random occurrences and documented from there.
That is, what the mind intuits is meaningful, and that’s not just because everything that happens does so due to material phenomena, and the intellect too is such a material phenomena. That all things are material is also affirmed by Hindu theology, but what’s material comes from the efficient and material cause that is Brahman.
That is why when you identify something, you feel good. It is not just because that’s evolutionary good, because people who are ascetic or less inclined to activities that are reproductionarily or evolutionarily beneficiary still have these qualities. Well, they are evolutionarily benefeciary in the mental sense, not of the material world. That is because the goalless material world has no will to govern itself towards evolution.