I am trying to prove the following:
Assume that $f$ is analytic on a neighbourhood of a compact set $K$. Prove that if $| f |$ is constant on the boundary of $K$ and that $f$ has no zeroes in $K$, then $f$ is constant.
Assuming also that $K$ is connected, I think I have proved that $f$ is constant on $K$: since $K$ is closed and bounded, $K = Kº \cup \partial K$. As $f$ has no zeros in $K$, both $|f|$ and $1/|f|$ are continuous on K, and must attain maxima (by Extreme Value Theorem). By the Maximum Modulus principle, assuming connectedness, they cannot attain local maxima on $Kº$, so they must attain a maximum on $\partial K$. Hence, we have that $|f|$ is constant on $K$ by the Open Mapping Theorem (as $f(Kº)$ maps to a circle, which isn't open, so $f$ is constant on $Kº$, hence also on $K$ by continuity). Then $f$ is constant on any neighbourhood of $K$ by the Identity Theorem, as all accumulation points of $K$ lie in $K$ (since $K$ is closed).
Most of the the other questions I have found are about domains, which are connected by assumption, e.g. Compact set - A non-constant holomorphic function - Maximum modulus principle, Analytic $f$ with $|f|$ constant on $∂D$, I need to show that it has at least one 0 inside $D$, and Proving $|f(z)|$ is constant on the boundary of a domain implies $f$ is a constant function
Can I drop the assumption of connectedness of $K$? I think it is necessary to apply the Maximum Modulus Principle and the Identity Theorem, as they are stated for domains.
Thanks in advance!