Dirichlet Function Pointwise Convergence We say that a function $f$ is Baire Class $1$ if there is a sequence of functions $f_i \to f$ pointwise where each $f_i$ is continuous.
The set of discontinuities of a Baire Class $1$ function $f$ must be a first-category (meagre) set of points.
The Dirichlet function $f(x) = \begin{cases} 1 & x \in \mathbb Q \\ 0 & x \notin \mathbb Q \end{cases}$ is not Baire class $1$ since it is discontinuous everywhere.
But can't we write the function as $f_i(x) = \lim_{i\to\infty} \cos(i!\pi x)^{2i}$, each of which is a continuous function that converges pointwise to the Dirichlet function?  What is wrong with this?
 A: Let $0\le n_1<n_2<...<n_k<\dots$ and define $$x=2\sum_{j=1}^\infty \frac{1}{n_j!}$$
Basically, we will pick $\{n_i\}$ to grow "fast enough" so that $\limsup_i \left(\cos n_i!\pi x\right)^{2n_i}>0$
Now $n_i!x = 2K + 2\sum_{j>i} \frac{n_i!}{n_j!}$ for some integer $K$.  And:$$
\begin{align} 
0&\leq 2\sum_{j>i} \frac{n_i!}{n_j!} \\&< \frac{2}{n_i+1}\left(1+\frac{1}{n_i+1}+\frac{1}{(n_i+1)^2}+\cdots\right) \\&= \frac{2}{n_i}
\end{align} 
$$
So $n_i!x\pi = 2K\pi + z_i$ where $0\leq z_i < \frac{2\pi}{n_i}.$
Then, since $\cos z=1+o(z)$ near zero, you get:
$$\cos(z_i)=1+o\left(\frac1{n_i}\right)$$ and thus, by the Lemma here, $$\cos(z_i)^{2n_i}\to 1.$$
In particular then, $\left(\cos j!\pi x\right)^{2j}$ does not converge to zero for uncountably many real numbers $x$ between $0$ and $e.$
A: I think there may be some confusion here. The sequence of functions you've proposed don't actually depend on the index (and, as people have pointed out, the limit doesn't converge everywhere.)
Do you instead mean to write $$f_k(x) = \lim_{i \to \infty} \cos(k!\pi x)^{2i}$$
If this is what you mean, then certainly, $\forall x \in \mathbb{R}$, $$f(x) = \lim_{k \to \infty} f_k(x) = \lim_{k \to \infty} \lim_{i \to \infty} \cos(k!\pi x)^{2i} $$
but the individual $f_k(x)$ are not continuous.
Added to elaborate:
What's continuous here are each $\cos(k! \pi x)$. This makes each $f_k(x)$ above of Baire class 1, but not continuous themselves: each $f_k(x)$ is $0$ on all the irrationals and rationals with sufficiently large denominators, and $1$ on the others (where "sufficiently large denominators" depends on $k$; as $k \to \infty$, we 'sweep out' all the rationals.) So what you have here is a sequence $f_k(x)$ of Baire class 1 functions converging pointwise to the Dirichlet function, where each of those $f_k(x)$ are themselves pointwise limits of a sequence of continuous functions.
A: The set of discontinuities of a Baire Class 1 function f must be a first-category (meagre) set of points. Hence Dirichlet is not Baire 1
$f(x)=\lim_{i\to\infty} \lim_{j\to\infty} (\cos(i!πx)^{2j})$. This proves Dirichlet function is Baire 2 function. 
