Do these two definitions of Disconnectedness coincide? Here are 2 different versions of the definition of Disconnectedness that I know of, one is taught in class, and the other one is the version in Gouvêa's $p$-adic numbers - An Introduction. But I just don't seem to be able to connect the 2 definitions.
The set $D$ is called disconnected iff
First version
There exist 2 open sets $O_1, O_2$ such that:


*

*$D \cap O_1 \cap O_2 = \emptyset$

*$D \cap O_1 \neq \emptyset \wedge D \cap O_2 \neq \emptyset$

*$D \subset (D \cap O_1) \cup (D \cap O_2)$


Second version (Gouvêa)
There exists 2 open sets $O_1; O_2$ such that:


*

*$\color{red}{O_1 \cap O_2 = \emptyset}$

*$D \cap O_1 \neq \emptyset \wedge D \cap O_2 \neq \emptyset$

*$D = (D \cap O_1) \cup (D \cap O_2)$


The second version is no doubt stronger than the first one. The way I understand it, the open sets $O_1; O_2$ in the second version can be obtained from the first by some kind of shrinking. But given the first version, how can we find such a way to 'shrink' both $O_1, O_2$, so that they become disjoint?
And here's a problem from Gouvêa's book that I'm having troubles with. I can prove it one way using the first version, but I can just prove 1 way using the second definition.

Problem

Prove that a set $S$ is disconnected iff we can write it as a union $S = A \cup B$, for some arbitrary sets $A, B$, and moreover $\overline{A} \cap B = \emptyset$, $A \cap \overline{B} = \emptyset$.

How can I prove the part that: Given $S = A \cup B$, and $\overline{A} \cap B = \emptyset$, $A \cap \overline{B} = \emptyset$, then $S$ is disconnected? How can I find $O_1; O_2$, such that they are disjoint?
 A: @DonAntonio: I concur with your answer. The curious thing is how few books state the definition of the sum $S= X_1 \sqcup X_2$ of topological spaces, and the  universal property of the two injections $i_1: X_1 \to S, i_2:X_2 \to S$ that a continuous function $f: S \to Z$ is entirely determined by two continuous functions $f_i:X_i \to Z$ such that $fi_1=f_1, fi_2=f_2$. I think the reason is that the emphasis is usually, or often,  on the spaces rather than on the category of topological spaces and continuous functions. The latter emphasis allows a "dual" analogy between sum and product of spaces, and also analogies between this construction and the free product of groups, the sum of vector spaces, and so on. 
Intuitively, if one says a space is disconnected if it falls into two pieces, then one might first say how a new space can be formed from two separate pieces. The paradigmatic example of a space with two pieces is $\{0,1\}$ with the discrete topology, and this relates to the notion of characteristic map for a subset. 
A: HINT: To show that the first definition implies the second, suppose that $U$ and $V$ are open, $U\cap V\cap D=\varnothing$, $U\cap D\ne\varnothing\ne V\cap D$, and $D\subseteq U\cup V$. Let $W=X\setminus\operatorname{cl}U$; clearly $U\cap W=\varnothing$. Show that $W\cap D=V\cap D$, and conclude that $U\cap D\ne\varnothing\ne W\cap D$, and $D\subseteq U\cup W$. 
For the other problem, you don’t need to find disjoint $O_1$ and $O_2$: you just need to be sure that $O_1\cap O_2\cap S=\varnothing$, as in the first definition of disconnectedness. What if you use $X\setminus\operatorname{cl}A$ and $X\setminus\operatorname{cl}B$?
A: Hint: Try prove the following equivalent
Definition: A topological space $\,S\,$ is disconnected iff there exists a continuous surjective function
$$f:S\to\{0\,,\,1\}\;,\;\;\text{with}\;\;\{0\,,\,1\}\;\;\text{endowed with the discrete topology}$$
which is the same as the one inherited from the euclidean space $\,\Bbb R\,$.
