Solution (source code)

= Solution

The steady-state output is $q=\bar a\bar c+bc+\bar cd$. Its <Karnaugh map>, with rows $ab$ and columns $cd$ in <Gray code> order, is
$$
\begin{array}{c|cccc}
ab\backslash cd&00&01&11&10\\\hline
00&1&1&0&0\\01&1&1&1&1\\11&0&1&1&1\\10&0&1&0&0
\end{array}.
$$
The existing <prime implicants> cover adjacent ones except for some transitions in $c$. The <consensus theorem> supplies the two missing bridging implicants \b[$\bar ab$ and $bd$], giving
$$
\boxed{q_{\mathrm{safe}}=\bar a\bar c+bc+\bar cd+\bar ab+bd.}
$$
Both are needed in a hazard-free <sum of products> retaining the original terms. At $a=0,b=1,d=0$, the two values of $c$ require a common implicant, necessarily covered by $\bar ab$; at $a=1,b=1,d=1$, the corresponding transition requires $bd$. Neither bridge covers the other's critical edge. All other adjacent-one pairs already share a term. Thus two is the least number of additional <prime implicants>. This addresses single-input static hazards; simultaneous input changes require separate analysis.