Pasting Lemma/Counterexample of Infinite Union of Closed Sets

Theorem
Let $T = \struct {X, \tau}$ and $S = \struct {Y, \sigma}$ be topological spaces.

Let $I$ be an Definition:Infinite index set.

For all $i \in I$, let $C_i$ be closed in $T$.

Let $f: X \to Y$ be a mapping such that the restriction $f \restriction_{C_i}$ is continuous for all $i$.

Then:
 * $f$ need not be continuous on $C = \ds \bigcup_{i \mathop \in I}C_i$, that is, $f \restriction_C$ need not be continuous.

Proof
Let $f : \R \to \R$ be the function on the closed interval $\closedint {-1} 1$ defined by:
 * $\map f x = \begin{cases}

1 & : x \ge 0 \\ -1 & : x < 0 \end{cases}$

The function $f$ is discontinuous at $0$.

The function $f$ restricted to the closed intervals:
 * $\closedint {-1} {-\dfrac 1 2, }, \closedint {-1} {-\dfrac 1 3}, \ldots, \closedint {-1} {-\dfrac 1 n}, \ldots, \closedint 0 1$

are constant functions.

From Constant Function is Continuous, the function $f$ restricted to the closed intervals:
 * $\closedint {-1} {-\dfrac 1 2, }, \closedint {-1} {-\dfrac 1 3}, \ldots, \closedint {-1} {-\dfrac 1 n}, \ldots, \closedint 0 1$

are continuous

We have:
 * $\closedint {-1} 1 = \paren{\ds \bigcup_{n \in \N_{>1}} \closedint {-1} {- \dfrac 1 n}} \cup \closedint 0 1$

The result follows.