Exception for the proof of Cauchy's theorem Suppose a closed countour defined as:
$$
\begin{cases}
0 & y=1\mbox{, and,}0<x\leq1\\
1 & x=0\mbox{, and,}0\leq y\leq1\\
1 & x=1\mbox{, and,}0\leq y<1\\
x^{3}\sin(\frac{\pi}{x}) & y=0\mbox{, and,}0<x<1
\end{cases}
$$
Where $z=x+iy$.
This would look like:

Near the origin the countour varies infinite times.
Now, in many proofs of the Cauchy-Goursat theorem, we start with a triangle. We prove it for that case, then we generalize the theorem saying tha we can decompose any domain into triangles (intuitively, this is correct for most shapes). 
But I can't see how this is possible near the origin, because it's too curvy (no triangule will fit there.
Is this case not considered in the proof or my intuition is wrong?
 A: I don't know what proofs you have read, the ones I know proceed as follows:


*

*(Goursat) the integral over the boundary of each triangle (or rectangle) vanishes.

*From that follows that a holomorphic function defined on a convex domain (disk) has a primitive.

*(Cauchy's integral theorem for convex domains/disks), in a convex domain (disk), the integral of a holomorphic function over a closed path vanishes. That follows directly from the existence of a primitive and the fundamental theorem of calculus. Let $f$ be the holomorphic function, and $F$ its primitive. If we parameterize the path $\gamma \colon [a,b]\to \Omega$, and let $a = t_0 < t_1 < \dotsc < t_n = b$ be a partition such that $\gamma\lvert_{[t_{k-1},t_k]}$ is continuously differentiable for $1 \leqslant k \leqslant n$, then $$\begin{align}\int_\gamma f(z)\,dz &= \sum_{k=1}^n \int_{t_{k-1}}^{t_k} f(\gamma(t))\cdot \gamma'(t)\,dt\\ &= \sum_{k=1}^n \int_{t_{k-1}}^{t_k} (F\circ\gamma)'(t)\,dt\\ &= \sum_{k=1}^n F(\gamma(t_k)) - F(\gamma(t_{k-1}))\\ &= F(\gamma(b)) - F(\gamma(a)).\end{align}$$ If the path is closed, the last difference is $0$.

*Generalisation, all holomorphic functions have local primitives, and the integral of a holomorphic function over all null-homologous cycles vanishes.


At no point does one need to decompose a general contour into triangles, the existence of local primitives is the tool that yields all further results.
