Proof (vanishing complex derivative implies constant)

Since $f'\equiv 0$, if we let $f = u+iv$ where $u,v$ are real-valued, then $u_x = u_y = v_x = v_y = 0$ by the Cauchy-Riemann equations.

Fix some $z_0\in U$. For any $z\in U$, there exists a path $γ$ consisting on finitely many horizontal and vertical line segments from $z_0$ to $z$. $f$ is constant on each of these segments by the real mean value theorem, so $f(z) = f(z_0)$, i.e. $f$ is constant on $U$.