Solution (source code)

= Solution

<Morera's theorem> states that a <continuous> function on an <open subset> of $\mathbb C$ is <holomorphic> if its <integral> around every triangular <contour>, with <triangle> and interior contained in that <open set>, is zero.

To prove this, work in any open disk $D$ whose closure lies in $U$, and fix $z_0\in D$. Define
$$
F(z)=\int_{[z_0,z]}f(w)\,dw,
$$
where the segment lies in $D$ by <convexity>. The zero <integral> on the <triangle> with vertices $z_0,z,z+h$ gives
$$
F(z+h)-F(z)=\int_{[z,z+h]}f(w)\,dw
=h\int_0^1f(z+th)\,dt.
$$
<Continuity> at $z$ implies that the last <integral> tends to $f(z)$ as $h\to0$: its difference from $f(z)$ is <bounded> by $\sup_{0\leq t\leq1}|f(z+th)-f(z)|$. Therefore $F'=f$ on $D$. The function $F$ is <holomorphic>, and the allowed theorem that a <holomorphic> <derivative> is <holomorphic> implies that $f=F'$ is <holomorphic> on $D$.

Every point of $U$ lies in such a disk, proving the result throughout $U$:
$$
\boxed{\text{continuity plus vanishing triangle integrals implies holomorphicity}.}
$$
The proof is local and does not require $U$ to be <simply connected>.