Why does the principle of path independence require that the function being integrated is analytic in a simply-connected domain I'm confused why the principle of path independence requires that the function being integrated is analytic in a simply-connected domain containing both contours used as the endpoints.
Intuitively, I'm thinking that since the domain contains the contours and continuity is a prerequisite for analyticity, then a function that was not continuous on D would not be continuous on the path of integration. So I guess, my question becomes, can we integrate on a path where the the function is not defined defined at each point on the contour. My thinking is probably not, hence this theorem.
Please let me know if my thinking is correct, and maybe provide a bit more in-depth of an explanation as to why my intuition makes sense or not by whatever means possible.
Thank you
 A: Generally speaking, path-independence is derived from Cauchy's integral theorem. The proof of Cauchy's theorem takes an integral over a closed curve, approximates that curve with finer and finer polygons, and triangulates those polygons. Because you go over all the inner edges once in each direction, you can then write the integral as a sum over the triangulation.
Then, you split that triangle up into smaller and smaller sets of four half triangles by connecting the midpoints of the edges again and again, and you bound the largest value of the integral as $4^n$ times the value over the triangle on which the function is largest.
This all works whether or not the function is complex differentiable everywhere in a simply connected domain. The punchline is to show that the contour integral of a linear function over a triangle is 0, and then to use the definition of complex differentiability to show that the difference between the integral of the function over one of the small triangles and its linear approximation there is small, and with more and more triangles the absolute value of the whole integral can be bounded as close to $0$ as you like, so must be 0.
That's the key, to prove Cauchy's theorem, you need to reduce the problem to a large appropriate multiple of the function on some small triangle, one which one can bound the integral with complex differentiability. If the function isn't complex differentiable everywhere in the interior, like $f(z) = 1/z$ near $0$, then you can't bound the integral over the triangle by its linear approximation, so a path integral around a circle containing the origin needn't be 0, and in fact it can be seen isn't zero. And since Cauchy's integral theorem gives rise to path-independence, if the function isn't complex differentiable on some simply connected domain, the bounding procedure that usually gives rise to path-independence fails, and as it turns out so does path independence (taking the integral of $1/z$ on different halves of the unit circle, as @saulspatz suggests).
