Mistaken Understanding

I think that one of most important goals of philosophy is the idea of understanding (of the world, our being in the world, or in general relations between things of which we are aware). To be an understanding it needs to carry necessity – to remove a “why?” questions. The knowledge alone doesn’t produce understanding, and while one can learn things from experience about some relation, the question of “why this state of affairs is true in reality and not some other?” is left unanswered.

However, I want to point to two interesting situations that arise:

  1. We can check experience in order to confirm our understanding, and
  2. We may in some cases come to understand something after we have learned it from experience.

But isn’t there something wrong with (1) and (2)?
While we might feel that there is something strange, I think if we think of some examples they appear very normal…

A mathematician can check his theorem by checking if it works on concrete examples.
Or she might first learn about some regularity by just playing with some mathematical entities, and only then understand the nature of that regularity (why the given relation holds).
Programmers (hopefully) understand how the code they write will implement the intended behavior. But they test those programs.  And really often find bugs. So, the bugs are the sign that there was something wrong with their understanding. They maybe overlooked something, or had wrong assumptions somewhere. And (hopefully) they will understand why the bug appeared, and with this new (richer) understanding, they can fix the code.
Also often in understanding the bug, programmer will try a bunch of concrete cases, in order to shrink the number of the possible causes of the bug, and only after that get to reading the relevant parts of the code.

So, while I think that those relations between understanding and learning from experience as in (1) and (2) are normal, we need a way to resolve two problems here:

    a) the apparent contradiction between the understanding carrying necessity and yet also there being possibility to turn out wrong.
    b) the value of understanding once we already have knowledge from experience.

Any thoughts?

UPDATE:Changed the title, because it was kind of silly. (It was ‘Can A Priori Knowledge be False’)