The trouble is that philosophers these days tend to recognise more than one form of necessity, as follows:
(1) Logical necessityThe Humean and logical positivist view is that all necessity is de dicto necessity, but modern analytic philosophers following the metaphysical revolution of Kripke deny this.
Logical necessity is a property of a proposition, and means that the idea expressed by the proposition could not have been false: its negation is a self-contradiction.
Logical necessity is found in (1) analytic a priori propositions where it is grounded in consistent use of language or (2) the conclusion of valid and sound deductive argument (the only possible though still debatable exception is a highly qualified version of Descartes’ cogito argument).
In this sense, logical necessity is an epistemological/epistemic concept and a property attached to propositions. It can be called de dicto necessity.
In short, as an epistemological concept, we can know with apodictic truth that a proper analytic a priori proposition is necessarily true.
The opposite of logical necessity is contingency: a contingent proposition is one whose negation is possible, and not a self-contradiction. Again, the concept is epistemological/epistemic.
(2) Metaphysical necessity
There is a second type of necessity that is ontological, not epistemological/epistemic.
For something to have metaphysical necessity is for it to be necessarily true in all possible worlds: a necessity that obtains in all logically possible worlds. This is a type of modal de re necessity.
(3) Physical/natural necessity
Again, this is a type of necessity that is ontological, not epistemological/epistemic.
The necessity is grounded it what is assumed to exist in nature. A physical/natural necessity is one that is ontologically necessary in our universe or any possible universe with the same laws of nature (considered with respect to that particular universe).
In addition, nomic necessity or nomological necessity is a type of ontological necessity that is a property of things guaranteed by laws of nature in our universe.
The laws of nature are clearly not logically necessary because they are not analytic (that is, true by virtue of definition of terms) nor are they formally logically necessary (Ellis 2002: 109).
But some modern philosophers, adopting an epistemological category taken from Saul Kripke, think that the laws of nature are necessary a posteriori, in the sense that even though they are known empirically (or a posteriori) they are ontologically or physically necessary in our universe (Ellis 2002: 109).
There is also a sense – and this is where it gets complicated! – in which the specific laws of nature in our universe could be metaphysically contingent (in that they could be different in other possible universes) but at the same time physically necessary when considered with respect to things within our universe: they have metaphysical contingency but physical necessity.
But the necessity here is not epistemic, but ontological or de re necessity.
So Hume’s problem of induction and the problems with necessary laws of nature can be recast or indeed properly interpreted as a fundamental epistemological issue: can we know that laws of nature are physically necessary in our universe? All the arguments adduced for the ontologically necessary a posteriori status of laws of nature are still based on empirical evidence and inductive argument, and so are fallible given that induction does not yield certainty. It may be that laws of nature are physically necessary, but, epistemologically speaking, we cannot be certain that they are.
Paradoxically, the proposition “that laws of nature are physically necessary in our universe” remains a synthetic a posteriori statement whose truth is highly probable at best, because the concept of necessity used here is ontological, not epistemic.
“David Hume,” Stanford Encyclopedia of Philosophy, 2001 [rev. 2009]
Fieser, James. “David Hume (1711–1776),” Internet Encyclopedia of Philosophy
“Laws of Nature,” Stanford Encyclopedia of Philosophy, 2003 [rev. 2010].
Swartz, Norman. “Laws of Nature,” Internet Encyclopedia of Philosophy
Ellis, Brian David. 2002. The Philosophy of Nature: A Guide to the New Essentialism. Acumen, Chesham.