PsychonautQQ said:
Nope, it's not homework, just doing a self-study in topology
Good for you. Self-study is brilliant way to spend one's spare time.
Here's my proof. I suspect it can be streamlined a bit, as a few steps get repeated, but I thought I'd just post it as is, just to get it out there.
The proof works mostly in terms of limit points rather than open sets, as the open-set approach was getting too confusing by generating so many open sets. We use the notion that if two sets are 'connected' they share a limit point. Since X is connected and X-Y isn't, and A is disconnected from B, every component of A must be connected to Y.
IIRC the first part of the proof mirrors yours.
Here goes:
------------------------------------------------------------------------------------------------------------------------
We will use three lemmas, shown after the end of this proof. One is from Munkres.
Assume there is a separation ##C,D## of ##Y\cup A##.
Let ##\mathscr S## be the collection of components of ##A##. Then ##Y## must have a non-empty intersection with at least one of ##C,D##. Assume wlog it is ##C##. Then ##Y\subseteq C## because if not, ##(Y\cap C),(Y\cap D)## is a separation of ##Y##, which cannot exist because ##Y## is connected.
Consider a component ##A'\in\mathscr S##
Then ##A'## must have a non-empty intersection with at least one of ##C,D##. Assume it is ##C##. Then ##A'\subseteq C## because if not, ##(A'\cap C),(A'\cap D)## is a separation of ##A'##, which cannot exist because ##A'## is connected. Similarly, if ##A'\cap D\neq\emptyset## then ##A'\subseteq D##.
So every component of ##A## lies entirely in either ##C## or ##D##, and we can write
$$C=Y\cup\bigcup_{\substack{A'\in\mathscr S\\A'\subseteq C}} A'
\quad\quad \quad\quad
D=\bigcup_{\substack{A'\in\mathscr S\\A'\subseteq D}} A'$$
Hence ##D\subseteq A##.
Since ##C,D## is a separation of ##Y\cup A##, by Lemma 1.1 neither of ##C## or ##D## contains a limit point of the other, in the topology of ##Y\cup A##. Using Lemma 3, we conclude that neither of ##C## or ##D## contains a limit point of the other in the topology of ##X##.
We also know ##A,B## is a separation of ##X-Y## so, by Lemma 1.1, neither contains a limit point of the other in the topology of ##X-Y##. Hence, since ##D## is a subset of ##A##, it cannot contain any limit points of ##B## in the ##X-Y## topology. And since the set of limit points of ##D## is a subset of the set of limit points of ##A##, and ##B## contains no limit points of ##A##, ##B## also contains no limit points of ##D##. So neither of ##D## and ##B## contains a limit point of the other in the topology of ##X-Y## and, by Lemma 3, neither contains a limit point of the other in the topology of ##X##.
Since neither ##B## nor ##C## contains any limit points of ##D##, it follows that ##B\cup C## contains no limit points of ##D##.
Also ##D## contains no limit points of either ##B## or ##C##. We now claim that ##D## contains no limit points of ##B\cup C##. To prove that, assume the contrary , that ##D## contains a limit point ##x## of ##B\cup C##. That cannot be a limit point of ##B## or ##C## so there must be open sets ##U_B,U_C##, both containing ##x##, such that ##U_B\cap B= U_C\cap C= \emptyset##. But then ##U_B\cap U_C## is an open set containing ##x##, which intersects neither ##B## nor ##C## and hence does not intersect ##B\cup C##. So ##x## is not a limit point of ##B\cup C## and we have a contradiction. Hence ##D## contains no limit points of ##B\cup C##.
So neither of ##D## and ##B\cup C## contains a limit point of the other. So both contain all their limit points. So both are closed in ##X## and, since each is the complement of the other, both are open. Hence ##D,B\cup C## is a separation of ##X##, which contradicts the connectedness of ##X##.
Hence the assumption that there was a separation ##C,D## of ##Y\cup A## must be false. ##Y\cup A## is connected.
-------------------------------------------------------
Munkres Lemma 1.1
If ##V,W## form a separation of ##S## then neither of ##V,W## contains any limit points of the other.
Lemma 2
If ##V,W## are subspaces of ##S## and ##V## contains a limit point of ##W## in the ##S## topology then ##V## contains a limit point of ##W## in the ##V\cup W## subspace topology.
Proof: Let ##x## be such a limit point. Then for every open set ##H## open in ##S## that contains ##x##, there exists ##y\in W\cap H,\ y\neq x##. Consider an arbitrary set ##H'## that is open in ##V\cup W## and contains ##x##. This is ##H\cap (V\cup W)## for some ##H## open in ##S##. Then there exists ##y\in W\cap H,\ y\neq x##. But since ##H'=H\cap (V\cup W)=(H\cap V)\cup(H\cap W)##, we have ##y\in H'\cap W##. QED (for Lemma).
Lemma 3
If ##V,W## are subspaces of ##S##, and ##V## contains no limit points of ##W## in the ##V\cup W## subspace topology then ##V## contains no limit points of ##W## in the ##S## topology.
This is simply the contrapositive of Lemma 2.