What are the examples of some mathematicians coming very close to a very promising theory or a correct proof of a big conjecture but not making or missing the last step?

Freeman Dyson discusses a few examples of this in his article Missed Opportunities. One that I thought was particularly striking was that mathematicians could have discovered special relativity decades before Einstein just by staring at Maxwell's equations hard enough, and also on the basis that the representation theory of the Poincare group is simpler than the representation theory of the Galilean group. 


Emil L. Post was very close to proving Gödel's incompleteness theorem, and the existence of algorithmically unsolvable problems in the early 1920s. He realized that one could enumerate all algorithms, and hence obtain an unsolvable problem by diagonalization. Moreover, the "problem" can be viewed as a computable list of questions $Q_1,Q_2,Q_3,\ldots$ for which the sequence of answers (yes or no) is not computable. It follows that there cannot be any complete formal system that proves all true sentences of the form "The answer to $Q_i$ is yes" or "The answer to $Q_i$ is no," because this would solve the unsolvable problem. But then Post was stuck because he needed to formalize the notion of computation. He had in fact (an equivalent of) the right definition, but logicians were not ready for a definition of computation, and did not believe there was such a thing until the Turing machine concept came along in 1936. Gödel avoided this problem when he proved his theorem (1930) by proving incompleteness of a particular system (Principia Mathematica). 


In the book The Scientists by John Gribbin, he mentions that, in his search for the theory of general relativity, Einstein apparently wrote down a correct equation that would have led him to correctly discovering the rest of the equations for general relativity very quickly. But, he did not see the equation for what it was and ran down the wrong path for two entire years before coming back to the correct equation. Here's the quote from the book: "Einstein himself is often presented as the prime example of someone who did great things alone, without the need for a community. This myth was fostered, perhaps even deliberately, by those who have conspired to shape our memory of him. Many of us were told a story of a man who invented general relativity out of his own head, as an act of pure individual creation, serene in his contemplation of the absolute as the First World War raged around him. It is a wonderful story, and it has inspired generations of us to wander with unkempt hair and no socks around shrines like Princeton and Cambridge, imagining that if we focus our thoughts on the right question we could be the next great scientific icon. But this is far from what happened. Recently my partner and I were lucky enough to be shown pages from the actual notebook in which Einstein invented general relativity, while it was being prepared for publication by a group of historians working in Berlin. As working physicists it was clear to us right away what was happening: the man was confused and lost  very lost. But he was also a very good physicist (though not, of course, in the sense of the mythical saint who could perceive truth directly). In that notebook we could see a very good physicist exercising the same skills and strategies, the mastery of which made Richard Feynman such a great physicist. Einstein knew what to do when he was lost: open his notebook and attempt some calculation that might shed some light on the problem. So we turned the pages with anticipation. But still he gets nowhere. What does a good physicist do then? He talks with his friends. All of a sudden a name is scrawled on the page: 'Grossman!!!' It seems that his friend has told Einstein about something called the curvature tensor. This is the mathematical structure that Einstein had been seeking, and is now understood to be the key to relativity theory. Actually I was rather pleased to see that Einstein had not been able to invent the curvature tensor on his own. Some of the books from which I had learned relativity had seemed to imply that any competent student should be able to derive the curvature tensor given the principles Einstein was working with. At the time I had had my doubts, and it was reassuring to see that the only person who had ever actually faced the problem without being able to look up the answer had not been able to solve it. Einstein had to ask a friend who knew the right mathematics. The textbooks go on to say that once one understand the curvature tensor, one is very close to Einstein's theory of gravity. The questions Einstein is asking should lead him to invent the theory in half a page. There are only two steps to take, and one can see from this notebook that Einstein has all the ingredients. But could he do it? Apparently not. He starts out promisingly, then he makes a mistake. To explain why his mistake is not a mistake he invents a very clever argument. With falling hearts, we, reading the notebook, recognize his argument as one that was held up to us as an example of how not to think about the problem. As good students of the subject we know that the agument being used by Einstein is not only wrong but absurd, but no one told us it was Einstein himself who invented it. By the end of the notebook he has convinced himself of the truth of a theory that we, with more experience of this kind of stuff than he or anyone could have had at the time, can see is not even mathematically consistent. Still, he convinced himself and several others of its promise, and for the next two years they pursued this wrong theory. Actually the right equation was written down, almost accidentally, on one page of the notebook we looked at it. But Einstein failed to recognize it for what it was, and only after following a false trail for two years did he find his way back to it. When he did, it was questions his good friends asked him that finally made him see where he had gone wrong." 


Archimedes and the Integral calculus? 


In their attempts of justifying Euclid's fifth postulate, Girolamo Saccheri and Johann Heinrich Lambert proved many theorems of nonEuclidean geometry. However, they were so convinced that the fifth postulate must be true that they stopped short of actually discovering the new geometry. 


Fulkerson came extremely close to a proof of the Perfect Graph Conjecture eventually proved by Lovasz. He was stuck on one relatively easy lemma, which he had apparently become convinced was false. I don't know a reliable source for this, but I have heard that after learning that the conjecture was proven, Fulkerson went to his office and finished his own proof later that day. 


A famous example is that John Conway, who fathered the concept of a Skein relation, didn't discover the Jones (or HOMFLYPT) polynomials. By just searching for knot invariants defined via Skein relations, he would doubtlessly have found them, and the history of lowdimensional topology would have looked quite different. 


One of the important conjectures in set theory in the 60s was that strongly inaccessible cardinals are measurable. This was disproved by Tarski in 1960. Soon after this Erdős and Hajnal realized that they were very close to Tarski's result in their paper "On the structure of set mappings" which appeared in 1958. Another miss was in the paper of Erdős, Hajnal, and Milner ("On sets of almost disjoint subsets of a set") from 1968 where they went pretty close to discovering Silver's famous theorem on GCH at singular cardinals of uncountable cofinality. 


As mentioned in Categories for the Working Mathematician, Bourbaki nearly had the right definition of an adjunction 1015 years before the proper definition was formulated by Dan Kan. In fact, Bourbaki actually proved the Special Adjoint functor theorem (cf. Categories for the Working Mathematician  notes at the end of the chapter on Adjunctions) Edit: To explain a little more (from Mac Lane), Bourbaki had figured out most of these notions, but since they had not formulated the general adjoint functor theorem, only the special adjoint functor theorem, they restricted their definition of a "universal construction" to those adjunctions for which the SAFT holds. I find it pretty impressive that they were able to do all of this without the benefit of a formal framework for category theory. 


Leibniz was extremely close to 'discovering' modal logic. He definitely understood the difference between intension and extension, and knew about valuations as functions from possible worlds. And I don't mean that one can "extract" this from his writings by reading hard between the lines  it is quite explicit, and in many manuscripts. He did not, of course, have the formal tools in hand needed to formalize these ideas, but then again no one did until the work of Frege after 1880 and Russell after 1900. That's a 200 year gap! 


Schubert came extremely close to discovering the JSJdecomposition of 3manifolds in his paper "Knoten und Vollringe" (1953). With a little more work, one could turn Schubert's paper into something equivalent to the JSJdecomposition applied to knot and link complements in $S^3$. That would have allowed people to conjecture the JSJdecomposition for 3manifolds, around 20 years earlier than it was. It's interesting to speculate whether or not the connection between 3manifold theory and hyperbolic geometry would have been made much earlier, as some of the ingredients were already in place  SeifertWeber space, and the Gieseking manifold, but I do not think people knew finitevolume hyperbolic manifolds to be atoroidal until much later. 


In his final scientific work, the Two New Sciences, Galileo almost discovered Cantor's theory of infinite cardinalities ... 


Issac Barrow very nearly had the fundamental theorum of calculus a generation before Newton and Liebniz,but he failed to see the relationship between the quadrature problem and the fluxion problem,despite making huge contributions to the development of the theory of limits in both. 


In The Sand Reckoner, Archimedes comes extremely close to discovering (inventing?) both the positional number system and some form of scientific notation: he uses the geometric sequence of powers of $10$ to express very large numbers and formulates and proves the fact that $10^m \times 10^n = 10^{m+n}$ (except that since he counts from $1$, it's a bit more messy). 


When I took a course in set theory, I was told that in the early 1920's, Thoralf Skolem essentially proved what is now Gödel's Completeness Theorem, but was unaware of its significance because the concept of completeness was not understood fully at the time. 


The history of good models for spectra might be an example of missed discoveries. To briefly sketch this history: Spectra (in the sense of topology) were introced by Lima in a dissertation under the direction of George Whitehead in 1958; in the year 1964, Boardman gave a definition of the (homotopy) category of spectra and he also defined the smash product of spectra. But in his language, one could only formalize ring spectra up to homotopy. Peter May gave in his 1977 book $E_\infty$ring spaces and $E_\infty$ring spectra the first definition of an $E_\infty$ring spectrum, i.e. a ring spectrum whose multiplication is associate and commutative in a homotopy coherent way. It was only in the 90s that people found models of spectra, where one can define $E_\infty$ring spectra just as commutative monoids in a suitable category of spectra: Elmendorf, Kriz, Mandell and May came first with their $S$modules and shortly after Jeff Smith defined symmetric spectra; shortly after that, Mandell, May, Schwede and Shipley defined the closely related model of orthogonal spectra. Compared to $S$modules and the earlier formalizations of $E_\infty$ring spectra, symmetric and orthogonal spectra are rather easy to define and produce a theory that is much easier to digest than the older ones. The interesting thing is: Peter May already defined commutative orthogonal spectra in his 1977 book under the name $\mathcal{J}_*$prefunctors. He did not realize at this point though that they are the commutative monoids in a symmetric monoidal category of orthogonal spectra (and that this category has a homotopy theory that is equivalent to that of spectra)  reasons might be that the Day convolution product wasn't really known then to topologists and also that the language of model categories wasn't widespread. It seems that May viewed these $\mathcal{J}_*$prefunctors only as a convenient technical input to construct examples of spectra in his language. In the 80s, Gunnarson (1982) and Bökstedt (1985) considered symmetric ring spectra without calling them this way or again without realizing fully their significance. Schwede's unfinished book project has history sections, which give more information about this. It is certainly fair to say that the history of stable homotopy theory and algebraic Ktheory would have been less convoluted if people had found symmetric or orthogonal spectra earlier  but this history should also highlight that realizing that these definitions were so significant, was a highly nontrivial insight by Jeff Smith. 

