Gödel's incompleteness theorems came as a shock to the mathematical logic community in 1931. This was not just because it shows Russell's logicist programme had serious shortcomings (somthing I won't say much about here) but also because it shows that Hilbert's Programme for the foundation of mathematics cannot succeed either. I suspect this was a bit of a surprise even to Gödel who (it seems to me) set out to criticise Russell but was a supporter of Hilbert's position. The 1931 paper even ends with some suggestions (that do not really work) on how to ressurect Hilbert's position.
It is often stated that it is the first incompleteness theorem that kills Hilbert's Programme. In fact it is the second incompleteness theorem that is the blow. To explain, I will outline Hilbert's Programme (in rather anachronistic and modern terms) here.
Starting around 1900, Hilbert developed his Programme for the
Foundations of Mathematics over a number of years, up to 1930,
with much of the important work and papers published in the mid 1920s.
Although he did not use theories of arithmetic similar
to our , nor the notion of and
statements, he had related notions. In particular
he talked about
Finitistic Mathematics which included mathematics
that could be expressed in a way, and a little more
The starting point to Hilbert's Programme, is, as it has been elsewhere in this section, the idea that some theories such as are -complete, i.e. if is and true then it is provable in . Hilbert understood a version of this statement for his idea of finitistic mathematics, and he understood a sentence as expressing that there is a complete computation that verifies a finitistic statement is correct.
Hilbert also had a notion of statements. He called them real. He understood that statements are the negations of statements and vice versa. He proposed dividing mathematics into finitistic methods, real statements and the rest, which was called ideal and based on imaginary concepts, analogous to the theory of the complex numbers. Just as for complex numbers, where theories of can have important consequences for , a theory involving imaginary or ideal concepts can have many important real or consequences.
From now on, all theories considered here will be considered to include , either directly or via an interpretation. Hilbert observed that this means it suffices to concentrate on the consistency of theories. This is because if is such a theory and proves a real () statement then must be actually true, because if not, being would be provable in hence in , so would be inconsistent. Conversely, if is inconsistent then it will prove some false statement such as .
This means that mathematics involving high-powered and abstract concepts, such as those found in set theory, or involving new kinds of numbers, is OK provided the theories of these things are consistent and they can also express real statements too and extend a theory such as . In other words, the foundation of abstract mathematics is based on its predictions (or theorems) about real mathematics. If a theory as described above can be proved consistent then its real consequences would necessarily have to be correct, so the theory is well-founded.
As far as I can see, Hilbert never expected useful mathematical theories to be complete, in the sense that they decide all statements expressible in their language. (The first Gödel theorem says that -consistent recursively axiomatized theories cannot be complete.) But Hilbert did famously believe that we (as mathematicians) would eventually be able to decide the truth of all real statements. As he said, Wir müssen wissen; wir werden wissen! His suggestion was to look for a hierarchy of mathematical theories of ideal or abstract mathematics such as where is Hilbert's base theory of finitistic mathematics (similar to, but a bit stronger than ) and prove , , and so on. This way we establish in the theories their consistency. The beauty of this proposal is that, consistency being a notion is real, so that if it is provable in a consistent theory then it is actually true. In other words this will establish the actual truth of the the consistency of these theories and hence the truth of their real consequences. I don't think there ever was any expectation that the sequence of theories will have to be linearly ordered as just indicated. Mathematical progress might better go via a lattice of theories or a partially ordered set of theories. But the new theories should be justified by proving their consistency in the previously obtained theories.
The last sentence is the main point, and that is what Gödel's second incompleteness theorem says is impossible. A sufficiently strong theory such as or cannot, by Gödel's second incompleteness theorem, prove its own consistency, let alone the stronger statement of the consistency of a stonger theory.