A DP transition dp[i] = minj(mj·x + bj) is a query against the lower envelope. Watch the deque add lines, pop the now-useless "bad middle" lines, and answer a query at x.
(b3-b1)*(m1-m2) ≤ (b2-b1)*(m1-m3). See junior.md and professional.md for the correctness proof.