Foundations of mathematics is the study of the logical and philosophical basis of mathematics,[1] or, in a broader sense, the mathematical investigation of the consequences of what are at bottom philosophical theories concerning the nature of mathematics.[2] In this latter sense, the distinction between foundations of mathematics and philosophy of mathematics turns out to be quite vague. Foundations of mathematics can be conceived[citation needed] as the study of the basic mathematical concepts (number, geometrical figure, set, function...) and how they form hierarchies of more complex structures and concepts, especially the fundamentally important structures that form the language of mathematics (formulas, theories and their models giving a meaning to formulas, definitions, proofs, algorithms...) also called metamathematical concepts, with an eye to the philosophical aspects and the unity of mathematics. The search for foundations of mathematics is a central question of the philosophy of mathematics; the abstract nature of mathematical objects presents special philosophical challenges.

The foundations of mathematics as a whole does not aim to contain the foundations of every mathematical topic. Generally, the foundations of a field of study refers to a more-or-less systematic analysis of its most basic or fundamental concepts, its conceptual unity and its natural ordering or hierarchy of concepts, which may help to connect it with the rest of human knowledge. The development, emergence and clarification of the foundations can come late in the history of a field, and may not be viewed by everyone as its most interesting part.

Mathematics always played a special role in scientific thought, serving since ancient times as a model of truth and rigor for rational inquiry, and giving tools or even a foundation for other sciences (especially physics). Mathematics' many developments towards higher abstractions in the 19th century brought new challenges and paradoxes, urging for a deeper and more systematic examination of the nature and criteria of mathematical truth, as well as a unification of the diverse branches of mathematics into a coherent whole.

The systematic search for the foundations of mathematics started at the end of the 19th century[citation needed] and formed a new mathematical discipline called mathematical logic, with strong links to theoretical computer science. It went through a series of crises with paradoxical results, until the discoveries stabilized during the 20th century as a large and coherent body of mathematical knowledge with several aspects or components (set theory, model theory, proof theory...), whose detailed properties and possible variants are still an active research field. Its high level of technical sophistication inspired many philosophers to conjecture that it can serve as a model or pattern for the foundations of other sciences.

While the practice of mathematics had previously developed in other civilizations, special interest in its theoretical and foundational aspects was clearly evident in the work of the Ancient Greeks.

Early Greek philosophers disputed as to which is more basic, arithmetic or geometry. Zeno of Elea (490 BC – ca. 430 BC) produced four paradoxes that seem to show the impossibility of change.

The Pythagorean school of mathematics originally insisted that only natural and rational numbers exist. The discovery of the irrationality of √2, the ratio of the diagonal of a square to its side (around 5th century BC), was a shock to them which they only reluctantly accepted. The discrepancy between rationals and reals was finally resolved by Eudoxus of Cnidus (408–355 BC), a student of Plato, who reduced the comparison of irrational ratios to comparisons of multiples (rational ratios), thus anticipating the definition of real numbers by Richard Dedekind (1831-1916).

In the Posterior Analytics, Aristotle (384 BC – 322 BC) laid down the axiomatic method for organizing a field of knowledge logically by means of primitive concepts, axioms, postulates, definitions, and theorems. Aristotle took a majority of his examples for this from arithmetic and from geometry. This method reached its high point with Euclid's Elements (300 BC), a treatise on mathematics structured with very high standards of rigor: Euclid justifies each proposition by a demonstration in the form of chains of syllogisms (though they do not always conform strictly to Aristotelian templates). Aristotle's syllogistic logic, together with the axiomatic method exemplified by Euclid's Elements, are recognized as scientific achievements of ancient Greece.

Starting from the end of the 19th century, a Platonist view of mathematics became common among practicing mathematicians.

The concepts or, as Platonists would have it, the objects of mathematics are abstract and remote from everyday perceptual experience: geometrical figures are conceived as idealities to be distinguished from effective drawings and shapes of objects, and numbers are not confused with the counting of concrete objects. Their existence and nature present special philosophical challenges: How do mathematical objects differ from their concrete representation? Are they located in their representation, or in our minds, or somewhere else? How can we know them?

The ancient Greek philosophers took such questions very seriously. Indeed, many of their general philosophical discussions were carried on with extensive reference to geometry and arithmetic. Plato (424/423 BC – 348/347 BC) insisted that mathematical objects, like other platonic Ideas (forms or essences), must be perfectly abstract and have a separate, non-material kind of existence, in a world of mathematical objects independent of humans. He believed that the truths about these objects also exist independently of the human mind, but is discovered by humans. In the Meno Plato's teacher Socrates asserts that it is possible to come to know this truth by a process akin to memory retrieval.

Above the gateway to Plato's academy appeared a famous inscription: "Let no one who is ignorant of geometry enter here". In this way Plato indicated his high opinion of geometry. He regarded geometry as ``the first essential in the training of philosophers", because of its abstract character.

This philosophy of Platonist mathematical realism, is shared by many mathematicians. It can be argued that Platonism somehow comes as a necessary assumption underlying any mathematical work.[3]

In this view, the laws of nature and the laws of mathematics have a similar status, and the effectiveness ceases to be unreasonable. Not our axioms, but the very real world of mathematical objects forms the foundation.

Aristotle dissected and rejected this view in his Metaphysics. These questions provide much fuel for philosophical analysis and debate.

For over 2,000 years, Euclid's Elements stood as a perfectly solid foundation for mathematics, as its methodology of rational exploration guided mathematicians, philosophers, and scientists well into the 19th century.

The Middle Ages saw a dispute over the ontological status of the universals (platonic Ideas): Realism asserted their existence independently of perception; conceptualism asserted their existence within the mind only; nominalism, denied either, only seeing universals as names of collections of individual objects (following older speculations that they are words, "logos").

René Descartes published La Géométrie (1637), aimed at reducing geometry to algebra by means of coordinate systems, giving algebra a more foundational role (while the Greeks embedded arithmetic into geometry by identifying whole numbers with evenly spaced points on a line). Descartes' book became famous after 1649 and paved the way to infinitesimal calculus.

Isaac Newton (1642 – 1727) in England and Leibniz (1646 – 1716) in Germany independently developed the infinitesimal calculus based on heuristic methods greatly efficient, but direly lacking rigorous justifications. Leibniz even went on to explicitly describe infinitesimals as actual infinitely small numbers (close to zero). Leibniz also worked on formal logic but most of his writings on it remained unpublished until 1903.

The Protestant philosopher George Berkeley (1685–1753), in his campaign against the religious implications of Newtonian mechanics, wrote a pamphlet on the lack of rational justifications of infinitesimal calculus:[4] "They are neither finite quantities, nor quantities infinitely small, nor yet nothing. May we not call them the ghosts of departed quantities?"

Then mathematics developed very rapidly and successfully in physical applications, but with little attention to logical foundations.

The modern (ε, δ)-definition of limit and continuous functions was first developed by Bolzano in 1817, but remained relatively unknown. It gives a rigorous foundation of infinitesimal calculus based on the set of real numbers, arguably resolving the Zeno paradoxes and Berkeley's arguments.

Mathematicians such as Karl Weierstrass (1815 – 1897) discovered pathological functions such as continuous, nowhere-differentiable functions. Previous conceptions of a function as a rule for computation, or a smooth graph, were no longer adequate. Weierstrass began to advocate the arithmetization of analysis, to axiomatize analysis using properties of the natural numbers. In 1858, Dedekind proposed a definition of the real numbers as cuts of rational numbers. This reduction of real numbers and continuous functions in terms of rational numbers and thus of natural numbers, was later integrated by Cantor in his set theory, and axiomatized in terms of second order arithmetic by Hilbert and Bernays.

Abel and Galois's works opened the way for the developments of group theory (which would later be used to study symmetry in physics and other fields), and abstract algebra. Concepts of vector spaces emerged from the conception of barycentric coordinates by Möbius in 1827, to the modern definition of vector spaces and linear maps by Peano in 1888. Geometry was no more limited to 3 dimensions. These concepts did not generalize numbers but combined notions of functions and sets which were not yet formalized, breaking away from familiar mathematical objects.

In the mid-nineteenth century there was an acrimonious controversy between the proponents of synthetic and analytic methods in projective geometry, the two sides accusing each other of mixing projective and metric concepts. Indeed the basic concept that is applied in the synthetic presentation of projective geometry, the cross-ratio of four points of a line, was introduced through consideration of the lengths of intervals.

The purely geometric approach of von Staudt was based on the complete quadrilateral to express the relation of projective harmonic conjugates. Then he created a means of expressing the familiar numeric properties with his Algebra of Throws. English language versions of this process of deducing the properties of a field can be found in either the book by Oswald Veblen and John Young, Projective Geometry (1938), or more recently in John Stillwell's Four Pillars of Geometry (2005). Stillwell writes on page 120

...projective geometry is simpler than algebra in a certain sense, because we use only five geometric axioms to derive the nine field axioms.

The algebra of throws is commonly seen as a feature of cross-ratios since students ordinarily rely upon numbers without worry about their basis. However, cross-ratio calculations use metric features of geometry, features not admitted by purists. For instance, in 1961 Coxeter wrote Introduction to Geometry without mention of cross-ratio.

Attempts of formal treatment of mathematics had started with Leibniz and Lambert (1728 – 1777), and continued with works by algebraists such as George Peacock (1791 – 1858). Systematic mathematical treatments of logic came with the British mathematician George Boole (1847) who devised an algebra that soon evolved into what is now called Boolean algebra, in which the only numbers were 0 and 1 and logical combinations (conjunction, disjunction, implication and negation) are operations similar to the addition and multiplication of integers. Also De Morgan publishes his laws (1847). Logic becomes a branch of mathematics. Boolean algebra is the starting point of mathematical logic and has important applications in computer science.

Charles Sanders Peirce built upon the work of Boole to develop a logical system for relations and quantifiers, which he published in several papers from 1870 to 1885.

The German mathematician Gottlob Frege (1848–1925) presented an independent development of logic with quantifiers in his Begriffsschrift (formula language) published in 1879, a work generally considered as marking a turning point in the history of logic. He exposed deficiencies in Aristotle's Logic, and pointed out the 3 expected properties of a mathematical theory

Completeness: any statement is either provable or refutable (i.e. its negation is provable).

Decidability: there is a decision procedure to test any statement in the theory.

He then showed in Grundgesetze der Arithmetik (Basic Laws of Arithmetic) how arithmetic could be formalised in his new logic.

Frege's work was popularized by Bertrand Russell near the turn of the century. But Frege's two-dimensional notation had no success. Popular notations were (x) for universal and (∃x) for existential quantifiers, coming from Giuseppe Peano and William Ernest Johnson until the ∀ symbol was introduced by Gentzen in 1935 and became canonical in the 1960s.

From 1890 to 1905, Ernst Schröder published Vorlesungen über die Algebra der Logik in three volumes. This work summarized and extended the work of Boole, De Morgan, and Peirce, and was a comprehensive reference to symbolic logic as it was understood at the end of the 19th century.

The formalization of arithmetic (the theory of natural numbers) as an axiomatic theory started with Peirce in 1881 and continued with Richard Dedekind and Giuseppe Peano in 1888. This was still a second-order axiomatization (expressing induction in terms of arbitrary subsets, thus with an implicit use of set theory) as concerns for expressing theories in first-order logic were not yet understood. In Dedekind's work, this approach appears as completely characterizing natural numbers and providing recursive definitions of addition and multiplication from the successor function and mathematical induction.

The foundational crisis of mathematics (in German, Grundlagenkrise der Mathematik) was the early 20th century's term for the search for proper foundations of mathematics.

Several schools of the philosophy of mathematics ran into difficulties one after the other in the 20th century, as the assumption that mathematics had any foundation that could be consistently stated within mathematics itself was heavily challenged by the discovery of various paradoxes (such as Russell's paradox).

The name "paradox" should not be confused with contradiction. A contradiction in a formal theory is a formal proof of an absurdity inside the theory (such as 2 + 2 = 5), showing that this theory is inconsistent and must be rejected. But a paradox may either refer to a surprising but true result in a given formal theory, or to an informal argument leading to a contradiction, so that a candidate theory, if it is to be formalized, must disallow at least one of its steps; in this case the problem is to find a satisfying theory without contradiction. Both meanings may apply if the formalized version of the argument forms the proof of a surprising truth. For instance, Russell's paradox may be expressed as "there is no set of all sets" (except in some marginal axiomatic set theories).

Various schools of thought on the right approach to the foundations of mathematics were fiercely opposing each other. The leading school was that of the formalist approach, of which David Hilbert was the foremost proponent, culminating in what is known as Hilbert's program, which thought to ground mathematics on a small basis of a logical system proved sound by metamathematicalfinitistic means. The main opponent was the intuitionist school, led by L. E. J. Brouwer, which resolutely discarded formalism as a meaningless game with symbols (van Dalen, 2008). The fight was acrimonious. In 1920 Hilbert succeeded in having Brouwer, whom he considered a threat to mathematics, removed from the editorial board of Mathematische Annalen, the leading mathematical journal of the time.

It has been claimed that formalists, such as David Hilbert (1862–1943), hold that mathematics is only a language and a series of games. Indeed he used the words "formula game" in his 1927 response to L. E. J. Brouwer's criticisms:

"And to what has the formula game thus made possible been successful? This formula game enables us to express the entire thought-content of the science of mathematics in a uniform manner and develop it in such a way that, at the same time, the interconnections between the individual propositions and facts become clear . . . The formula game that Brouwer so deprecates has, besides its mathematical value, an important general philosophical significance. For this formula game is carried out according to certain definite rules, in which the technique of our thinking is expressed. These rules form a closed system that can be discovered and definitively stated."[5]

Thus Hilbert is insisting that mathematics is not an arbitrary game with arbitrary rules; rather it must agree with how our thinking, and then our speaking and writing, proceeds.[5]

"We are not speaking here of arbitrariness in any sense. Mathematics is not like a game whose tasks are determined by arbitrarily stipulated rules. Rather, it is a conceptual system possessing internal necessity that can only be so and by no means otherwise."[6]

The foundational philosophy of formalism, as exemplified by David Hilbert, is a response to the paradoxes of set theory, and is based on formal logic. Virtually all mathematical theorems today can be formulated as theorems of set theory. The truth of a mathematical statement, in this view, is represented by the fact that the statement can be derived from the axioms of set theory using the rules of formal logic.

Merely the use of formalism alone does not explain several issues: why we should use the axioms we do and not some others, why we should employ the logical rules we do and not some others, why do "true" mathematical statements (e.g., the laws of arithmetic) appear to be true, and so on. Hermann Weyl would ask these very questions of Hilbert:

"What "truth" or objectivity can be ascribed to this theoretic construction of the world, which presses far beyond the given, is a profound philosophical problem. It is closely connected with the further question: what impels us to take as a basis precisely the particular axiom system developed by Hilbert? Consistency is indeed a necessary but not a sufficient condition. For the time being we probably cannot answer this question…"[7]

Intuitionists, such as L. E. J. Brouwer (1882–1966), hold that mathematics is a creation of the human mind. Numbers, like fairy tale characters, are merely mental entities, which would not exist if there were never any human minds to think about them.

The foundational philosophy of intuitionism or constructivism, as exemplified in the extreme by Brouwer and more coherently by Stephen Kleene, requires proofs to be "constructive" in nature – the existence of an object must be demonstrated rather than inferred from a demonstration of the impossibility of its non-existence. For example, as a consequence of this the form of proof known as reductio ad absurdum is suspect.

Some modern theories in the philosophy of mathematics deny the existence of foundations in the original sense. Some theories tend to focus on mathematical practice, and aim to describe and analyze the actual working of mathematicians as a social group. Others try to create a cognitive science of mathematics, focusing on human cognition as the origin of the reliability of mathematics when applied to the real world. These theories would propose to find foundations only in human thought, not in any objective outside construct. The matter remains controversial.

Logicism is one of the schools of thought in the philosophy of mathematics, putting forth the theory that mathematics is an extension of logic and therefore some or all mathematics is reducible to logic. Bertrand Russell and Alfred North Whitehead championed this theory fathered by Gottlob Frege.

Many researchers in axiomatic set theory have subscribed to what is known as set-theoretical Platonism, exemplified by mathematician Kurt Gödel.

Several set theorists followed this approach and actively searched for possible axioms that may be considered as true for heuristic reasons and that would decide the continuum hypothesis. Many large cardinal axioms were studied but the continuum hypothesis remained independent from them. Other types of axioms were considered, but none of them has as yet reached consensus as a solution to the continuum problem.

quantification over mathematical entities is indispensable for science...; therefore we should accept such quantification; but this commits us to accepting the existence of the mathematical entities in question.

Few mathematicians are typically concerned on a daily, working basis over logicism, formalism or any other philosophical position. Instead, their primary concern is that the mathematical enterprise as a whole always remains productive. Typically, they see this as insured by remaining open-minded, practical and busy; as potentially threatened by becoming overly-ideological, fanatically reductionistic or lazy. Such a view was expressed by the Physics Nobel Prize laureate Richard Feynman

People say to me, "Are you looking for the ultimate laws of physics?" No, I'm not… If it turns out there is a simple ultimate law which explains everything, so be it — that would be very nice to discover. If it turns out it's like an onion with millions of layers… then that's the way it is. But either way there's Nature and she's going to come out the way She is. So therefore when we go to investigate we shouldn't predecide what it is we're looking for only to find out more about it. Now you ask: "Why do you try to find out more about it?" If you began your investigation to get an answer to some deep philosophical question, you may be wrong. It may be that you can't get an answer to that particular question just by finding out more about the character of Nature. But that's not my interest in science; my interest in science is to simply find out about the world and the more I find out the better it is, I like to find out…[8]

Philosophers, incidentally, say a great deal about what is absolutely necessary for science, and it is always, so far as one can see, rather naive, and probably wrong[9]

The insights of philosophers have occasionally benefited physicists, but generally in a negative fashion—by protecting them from the preconceptions of other philosophers.(...) without some guidance from our preconceptions one could do nothing at all. It is just that philosophical principles have not generally provided us with the right preconceptions.

Physicists do of course carry around with them a working philosophy. For most of us, it is a rough-and-ready realism, a belief in the objective reality of the ingredients of our scientific theories. But this has been learned through the experience of scientific research and rarely from the teachings of philosophers. (...) we should not expect [the philosophy of science] to provide today's scientists with any useful guidance about how to go about their work or about what they are likely to find. (...)

After a few years' infatuation with philosophy as an undergraduate I became disenchanted. The insights of the philosophers I studied seemed murky and inconsequential compared with the dazzling successes of physics and mathematics. From time to time since then I have tried to read current work on the philosophy of science. Some of it I found to be written in a jargon so impenetrable that I can only think that it aimed at impressing those who confound obscurity with profundity. (...) But only rarely did it seem to me to have anything to do with the work of science as I knew it. (...)

I am not alone in this; I know of no one who has participated actively in the advance of physics in the postwar period whose research has been significantly helped by the work of philosophers. I raised in the previous chapter the problem of what Wigner calls the "unreasonable effectiveness" of mathematics; here I want to take up another equally puzzling phenomenon, the unreasonable ineffectiveness of philosophy.

Even where philosophical doctrines have in the past been useful to scientists, they have generally lingered on too long, becoming of more harm than ever they were of use.

He believed that any undecidability in mathematics, such as the continuum hypothesis, could be potentially resolved despite the incompleteness theorem, by finding suitable further axioms to add to set theory.

The Completeness theorem establishes an equivalence in first-order logic between the formal provability of a formula and its truth in all possible models. Precisely, for any consistent first-order theory it gives an "explicit construction" of a model described by the theory; this model will be countable if the language of the theory is countable. However this "explicit construction" is not algorithmic. It is based on an iterative process of completion of the theory, where each step of the iteration consists in adding a formula to the axioms if it keeps the theory consistent; but this consistency question is only semi-decidable (an algorithm is available to find any contradiction but if there is none this consistency fact can remain unprovable).

This can be seen as a giving a sort of justification to the Platonist view that the objects of our mathematical theories are real. More precisely, it shows that the mere assumption of the existence of the set of natural numbers as a totality (an actual infinity) suffices to imply the existence of a model (a world of objects) of any consistent theory. However several difficulties remain:

For any consistent theory this usually does not give just one world of objects, but an infinity of possible worlds that the theory might equally describe, with a possible diversity of truths between them.

In the case of set theory, none of the models obtained by this construction resemble the intended model, as they are countable while set theory intends to describe uncountable infinities. Similar remarks can be made in many other cases. For example, with theories that include arithmetic, such constructions generally give models that include non-standard numbers, unless the construction method was specifically designed to avoid them.

As it gives models to all consistent theories without distinction, it gives no reason to accept or reject any axiom as long as the theory remains consistent, but regards all consistent axiomatic theories as referring to equally existing worlds. It gives no indication on which axiomatic system should be preferred as a foundation of mathematics.

As claims of consistency are usually unprovable, they remain a matter of belief or non-rigorous kinds of justifications. Hence the existence of models as given by the completeness theorem needs in fact 2 philosophical assumptions: the actual infinity of natural numbers and the consistency of the theory.

Another consequence of the completeness theorem is that it justifies the conception of infinitesimals as actual infinitely small nonzero quantities, based on the existence of non-standard models as equally legitimate to standard ones. This idea was formalized by Abraham Robinson into the theory of nonstandard analysis.

1931: Publication of Gödel's incompleteness theorems, showing that essential aspects of Hilbert's program could not be attained. It showed how to construct, for any sufficiently powerful and consistent recursively axiomatizable system – such as necessary to axiomatize the elementary theory of arithmetic on the (infinite) set of natural numbers – a statement that formally expresses its own unprovability, which he then proved equivalent to the claim of consistency of the theory; so that (assuming the consistency as true), the system is not powerful enough for proving its own consistency, let alone that a simpler system could do the job. It thus became clear that the notion of mathematical truth can not be completely determined and reduced to a purely formal system as envisaged in Hilbert's program. This dealt a final blow to the heart of Hilbert's program, the hope that consistency could be established by finitistic means (it was never made clear exactly what axioms were the "finitistic" ones, but whatever axiomatic system was being referred to, it was a 'weaker' system than the system whose consistency it was supposed to prove).

1955: Pyotr Novikov showed that there exists a finitely presented group G such that the word problem for G is undecidable.

1963: Paul Cohen showed that the Continuum Hypothesis is unprovable from ZFC. Cohen's proof developed the method of forcing, which is now an important tool for establishing independence results in set theory.

Starting in 1935, the Bourbaki group of French mathematicians started publishing a series of books to formalize many areas of mathematics on the new foundation of set theory.

The intuitionistic school did not attract many adherents among working mathematicians, due to difficulties of constructive mathematics.

We may consider that Hilbert's program has been partially completed, so that the crisis is essentially resolved, satisfying ourselves with lower requirements than Hibert's original ambitions. His ambitions were expressed in a time when nothing was clear: we did not know if mathematics could have a rigorous foundation at all. Now we can say that mathematics has a clear and satisfying foundation made of set theory and model theory. Set theory and model theory are clearly defined and the right foundation for each other.

There are many possible variants of set theory which differ in consistency strength, where stronger versions (postulating higher types of infinities) contain formal proofs of the consistency of weaker versions, but none contains a formal proof of its own consistency. Thus the only thing we don't have is a formal proof of consistency of whatever version of set theory we may prefer, such as ZF.

In practice, most mathematicians either do not work from axiomatic systems, or if they do, do not doubt the consistency of ZFC, generally their preferred axiomatic system. In most of mathematics as it is practiced, the incompleteness and paradoxes of the underlying formal theories never played a role anyway, and in those branches in which they do or whose formalization attempts would run the risk of forming inconsistent theories (such as logic and category theory), they may be treated carefully.

^Weyl 1927 Comments on Hilbert's second lecture on the foundations of mathematics in van Heijenoort 1967:484. Although Weyl the intuitionist believed that "Hilbert's view" would ultimately prevail, this would come with a significant loss to philosophy: "I see in this a decisive defeat of the philosophical attitude of pure phenomenology, which thus proves to be insufficient for the understanding of creative science even in the area of cognition that is most primal and most readily open to evidence – mathematics" (ibid).

In Chapter III A Critique of Mathematic Reasoning, §11. The paradoxes, Kleene discusses Intuitionism and Formalism in depth. Throughout the rest of the book he treats, and compares, both Formalist (classical) and Intuitionist logics with an emphasis on the former. Extraordinary writing by an extraordinary mathematician.