Necessary and Sufficient Conditions for Random Variables I've been reading 2 textbooks in parallel on Probability Theory and they have 2 separate definitions of random variables
$$
f:(\Omega, \mathcal{S})  \rightarrow (\mathbb{R}, \mathcal{B}) \iff \forall B \in \mathcal{B}, \quad f^{-1}(B) \in \mathcal{S} 
$$
and
$$
f:(\Omega, \mathcal{S})  \rightarrow (\mathbb{R}, \mathcal{B}) \iff \forall x \in \mathbb{R}, \quad f^{-1}((-\infty,x]) \in \mathcal{S} 
$$
The text giving the latter definition (A First Look at Rigorous Probability Theory) gives the following justification for its alternative definition:

Since complements and unions and intersections are preserved under
  inverse images, it follows from Exercise 2.4.5 that [the second
  definition] is equivalent to saying [the first definition].

Here, Exercise 2.4.5 states that if $\mathcal{A} = \{ (-\infty, x]: x \in \mathbb{R} \}$, then $\mathcal{B} = \sigma (\mathcal{A})$ where $\mathcal{B}$ are the Borel Sets for the real line.
Quite simply, I don't follow that logic.  Could someone explain to me how,
$$ 
\mathcal{A} \mbox{ generates } \mbox{B} \Rightarrow f^{-1}(\mathcal{A}) \mbox{ generates } f^{-1}(\sigma(\mathcal{A}))
$$
 A: Let $\mathcal A$ denote the collection of intervals $(-\infty,x]$ with $x\in\mathbb R$. You already know that $\sigma(\mathcal A)=\mathcal B$ and that $f^{-1}(\mathcal A)\subseteq\mathcal  S$, where $\mathcal B$ and $\mathcal S$ are two sigma-algebras, and you want to prove that $f^{-1}(\mathcal B)\subseteq\mathcal S$. 
In other words, you want to prove that $\mathcal C=\mathcal B$, where $\mathcal C$ is the class
$$
\mathcal C=\{B\in \mathcal B\mid f^{-1}(B)\in\mathcal S\}.
$$
The proof is in two steps. First step: since $\mathcal A\subseteq\mathcal C\subseteq\mathcal B$ and $\mathcal A$ generates $\mathcal B$, 
$$
\mathcal B=\sigma(\mathcal A)\subseteq\sigma(\mathcal C)\subseteq\sigma(\mathcal B)=\mathcal B,
$$ 
hence $\sigma(\mathcal C)=\mathcal B$. Second step: $\mathcal C$ is a sigma-algebra hence $\mathcal C=\sigma(\mathcal C)$ hence $\mathcal C=\mathcal B$.
Tell me what step (if any) causes you trouble and I will add some details.
Re your second formulation, the above proves that if $\sigma(\mathcal A)=\mathcal B$ then $f^{-1}(\mathcal B)\subseteq\sigma(f^{-1}(\mathcal A))$ (choose $\mathcal  S=\sigma(f^{-1}(\mathcal A))$). On the other hand, $f^{-1}(\mathcal A)\subseteq f^{-1}(\mathcal B)$ and $f^{-1}(\mathcal B)$ is a sigma-algebra hence $\sigma(f^{-1}(\mathcal A))\subseteq\sigma(f^{-1}(\mathcal B))=f^{-1}(\mathcal B)$. Finally, this proves that $f^{-1}(\mathcal B)=\sigma(f^{-1}(\mathcal A))$.
For other contexts where similar arguments are used, see some recent MSE questions here (which you might know) and here.
