How do I automatically break the line before mathematical expression without using \\
Minimal example:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\begin{document}
text text text text text text text text text text text text text $f:A \to B; f(x) =
x^2 + x + 1$ text text text text text text text text text $p(x) = \{ a_0 + a_1 x +
a_2 x^2 + a_3 x^3 + \ldots + a_n x^n \}$ text text text text text text text text
text text
\end{document}
Result:

But, I need:

Remember: I need automatically, without \\.
