Set between Connected Set and Closure is Connected/Proof 1

Proof
Let $D$ be the discrete space $\left\{{0, 1}\right\}$.

Let $f: K \to D$ be any continuous mapping.

From Continuity of Composite with Inclusion, the restriction $f \restriction_H$ is continuous.

Since $H$ is connected and $f \restriction_H$ is continuous, $f \left({H}\right) = \left\{{0}\right\}$ or $f \left({H}\right) = \left\{{1}\right\}$ by definition of connectedness.

Suppose WLOG that $f \left({H}\right) = \left\{{0}\right\}$.

Suppose, with a view to getting a contradiction, that $\exists k \in K: f \left({k}\right) = 1$.

Since $\left\{{1}\right\}$ is open in $D$, $f^{-1} \left({\left\{{1}\right\}}\right)$ is open in $K$.

Since $K$ has the subspace topology, $f^{-1} \left({\left\{{1}\right\}}\right) = K \cap U$ for some $U$ open in $T$.

Now $k \in f^{-1} \left({\left\{{1}\right\}}\right) \subseteq U$ and $k \in \operatorname{cl}\left({H}\right)$.

So by definition of topology, $\exists x \in H \cap U$.

Then since $x \in H$, we have that $f \left({x}\right) = 0$.

But also $f \left({x}\right) = 1$ since $x \in H \cap U \subseteq K \cap U = f^{-1} \left({\left\{{1}\right\}}\right)$.

This contradiction shows that $f$ can not be onto $D$.

Thus $K$ is connected.