Definition of stochastic integral, square integrable function Hello I have a question about Stochastic integral.
Let $X=(X_{t})_{t \geq0}$ be a Brownian motion started at $0$. I know the following fact:
Let $(\varphi(t))_{t\geq0}$ be a progressively measurable process such that
\begin{align*}
P\left[\int_{0}^{t}\varphi(s)^{2}\,ds<\infty \right]=1,\quad {}^{\forall}t\geq0.
\end{align*}
Then we can define the following stochastic integral 
\begin{align*}
\int_{0}^{t}\varphi(s)\,dX_{s}.
\end{align*}
Question
Let $b$ be a square integrable function on $\mathbb{R}$. Then can we define the stochastic integral $\int_{0}^{t}b(X_{s})\,dX_{s}$ ? 
If we want to define this integral, we have to check
\begin{align*}
P\left[\int_{0}^{t}b(X_{s})^{2}\,ds<\infty \right]=1\quad \mbox{or} \quad E\left[\int_{0}^{t}b(X_{s})^{2}\,ds\right]<\infty
\end{align*}
for all $t \geq 0$. But I don't know how to compute above quantities. If you know how to calculate, please let me know.
Thank you for your consideration.
 A: As you correctly write, the integral $\int_0^t b(X_s) dX_s$
is well defined (as an extended Itô integral) provided that $\int_0^t b(X_s)^2 ds<\infty$ almost surely.
So the question is: When is the integral $\int_0^t f(X_s) ds$ finite almost surely? 
The answer to the latter question is well known: this is the case if$^*$ $f\in L^1_{loc}(\mathbb{R})$. 
Therefore, the answer to your question is affirmative. Moreover, it is enough to assume that $b\in L^2_{loc}(\mathbb{R})$. 

Here is a sketch of the argument for $b\in L^2(\mathbb{R})$ (my answer here gives an alternative argument); the locally integrable case is done by localization.
Denote $f = b^2$. By the occupation density formula,
$$
\int_0^t f(X_s)ds = \int_{\mathbb{R}} l_t(x)f(x) dx,\tag{1}
$$
where $l_t(x)$ is the local time (occupation density) of $X$ at the point $x$ on the interval $[0,t]$. Since $l_t(x)\le C(\omega)$ (it is continuous in $x$ and vanishes on $\pm \infty$), 
$$
\left\lvert\int_0^t f(X_s)ds\right\rvert\le C(\omega)\int_{\mathbb{R}} |f(x)| dx<\infty,
$$
as required.

$^*$ This is also true for generalized functions $f$. Namely, if a measure $\nu$ has locally finite variation, then $\int_0^t \frac{d\nu}{dx}(X_s)ds$ is well-defined; it can be defined via the occupation density formula (1): 
$$
\int_0^t \frac{d\nu}{dx}(X_s)ds = \int_{\mathbb{R}} l_t(x) \nu(dx).
$$
