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})) $$