Could not include topos theory - contents
In logic, double negation is the operation that takes $P$ to $\neg{\neg{P}}$, where $\neg$ is negation. In other words, double negation is the composite of negation with itself. This is a closure operator/modality and as such a special case of a continuation monad.
In classical logic, the double negation of any truth value or proposition is itself. More abstractly, double negation is the identity function on any boolean algebra.
In intuitionistic logic, double negation is weaker than the identity. That is, we have $P \Rightarrow \neg{\neg{P}}$ but not conversely. In paraconsistent logic, it is the other way around. More abstractly, this holds in any Heyting algebra (intuitionistic) or its dual (paraconsistent).
In linear logic, double negation is the identity again, although linear logic also has notions of intuitionistic negation and paraconsistent negation which act as above.
Even in classical mathematics, a frame is a Heyting algebra but not a boolean algebra. Accordingly, double negation is usually not the identity on a frame. However, the operation of double negation is a nucleus on any frame.
Thus, every locale $L$ has a sublocale given by that nucleus, called the double negation sublocale and denoted $L_{\neg\neg}$. This sublocale is dense, and in fact it is the smallest dense sublocale of $L$, the intersection of all dense sublocales.
Classically, we have $L = L_{\neg\neg}$ if and only if $L$ is the discrete locale on some set $S$ of points. In constructive mathematics, $S$ must also have decidable equality.
Let $\mathcal{O}_X$ be the sheaf of continuous (or smooth, or holomorphic, or regular?) functions on a topological space (or smooth manifold, or complex manifold, or reduced scheme) $X$. Then the pushforward of the pullback of $\mathcal{O}_X$ to the smallest dense sublocale of $X$ is the sheaf of meromorphic functions on $X$ (i.e. sections over an open subset $U$ are given by sections of $\mathcal{O}_X$ defined on some dense open subset $V \subseteq U$).
The notion of double negation sublocale may be categorified from locales to toposes.
If $E$ is a topos with subobject classifier $\Omega$, there is a negation operator $\neg \colon \Omega \to \Omega$, defined by virtue of the fact that $\Omega$ is an internal Heyting algebra.
The double negation morphism
constitutes a Lawvere-Tierney topology on $\mathcal{E}$.
This is called the double negation topology.
The topology axioms can be formulated in purely equational form, i.e., as equations between operations of the form $\Omega^n \to \Omega$. By the Yoneda lemma, it suffices to verify the corresponding equations between transformations $Hom(-, \Omega)^n \to Hom(-, \Omega)$, which boils the problem down to checking the equations for ordinary Heyting algebras in $Set$. For ordinary Heyting algebras, proofs may be found here.
The sheaf topos $\mathcal{E}_{\not \not} \hookrightarrow \mathcal{E}$ corresponding to the double negation topology is a Boolean topos.
This appears for sheaf toposes as (MacLaneMoerdijk, theorem VI 3), and in the general case as a special case of (Johnstone, Lemma 4.5.21).
$\mathcal{E}_{\not \not} \hookrightarrow \mathcal{E}$ is the smallest dense subtopos.
(Johnstone, below Corollary 4.5.20)
$\not\not$ is the unique largest topology in $\mathcal{E}$ for which $0\rightarrowtail 1$ is closed.
For a proof see (Johnstone (1977), p.140).
Both of the preceeding results imply in particular that $0$ is always a $\not\not$-sheaf, i.e. $\mathcal{E}_{\not\not}$ is always a dense subtopos. In fact, we have:
$\not\not$ is the unique topology $j$ such that (1) $j$ is dense, i.e. $j(0)=0$, and (2) the sheaf topos $\mathcal{E}_j$ is Boolean.
It remains to show that (1) and (2) imply that $j=\not\not$. First note that the dense monos corresponding to $j$ are classified by the subobject classifier $\Omega_j$ of $\mathcal{E}_j$. Since (2) implies that $\Omega_j$ is an internal Boolean algebra, it follows that the dense subobjects of any object $X$ form a Boolean algebra.
This Boolean algebra is a reflective sub-poset of the Heyting algebra of all subobjects of $X$, whose reflector is lex, i.e. preserves finite meets. Thus, it will suffice to show that if $B$ is a Boolean algebra that is a lex-reflective sub-poset of a Heyting algebra $H$ and if $0\in B$, then $B = \{ U | U = \neg\neg U \}$.
To show this, first note that the Boolean negation in $B$ is the restriction of the Heyting negation in $H$. Thus, Booleanness of $B$ implies $U=\neg\neg U$ for all $U\in B$. Thus, it remains to show that if $U=\neg\neg U$ then $U\in B$. But since $0\in B$ and $B$ is an exponential ideal, by the definition $\neg U = (U\Rightarrow 0)$ it follows that $\neg\neg U\in B$ for any $U$. Thus, if $U=\neg\neg U$ then $U\in B$ as well.
Remark. As the Aufhebung $\mathcal{E}_j$ of $0\vdash 1$ is necessarily dense it follows that $\mathcal{E}_{\neg\neg}\subseteq \mathcal{E}_j$ in general and $\mathcal{E}_{\neg\neg}=\mathcal{E}_j$ in case the former is an essential subtopos (For further details cf. Aufhebung).
The next two propositions consider the important special case of $\neg\neg$ on presheaf toposes:
For every presheaf topos $[C^{op}, Set]$ the double negation topology coincides with the dense topology?.
This appears as MacLaneMoerdijk, corollary VI 5.
Let $C$ be a poset. Then the double negation sheaf topos $Sh_{\not \not}(C) \hookrightarrow [C^{op}, Set]$ satisfies the axiom of choice.
This appears as MacLaneMoerdijk, corollary VI 9. Essentially because of this fact, double-negation sheaves on posets are the basic context for forcing in set theory (since set theorists generally want the axiom of choice to be preserved in forcing models.)
Classically the double negation modality is equivalent to the n-truncation modality for $n = -1$ (the bracket type). In general, it's still true that double negation takes any type (object in the higher topos) to a $(-1)$-type, but the bracket type ${\|A\|_{-1}}$ only entails the double negation $\neg(\neg{A})$:
there is a canonical function
and this is a 1-epimorphism precisely if the law of excluded middle holds.
In topos theory:
Peter Johnstone, Topos Theory , Academic Press 1977 (Dover reprint 2014). (pp.139-140)
Peter Johnstone, Sketches of an Elephant I, Oxford UP 2002. (pp.211,219-220)
Saunders Mac Lane, Ieke Moerdijk, Sheaves in Geometry and Logic , Springer Heidelberg 1994. (chap. VI, in particular sec.VI.1)