  Let $(\Omega,\Sigma,\mu)$ be a measure space, and $1\leq p\leq \infty$. A
subspace $E\subseteq L_p(\mu)$ is said to do stable phase retrieval (SPR) if
there exists a constant $C\geq 1$ such that for any $f,g\in E$ we have $$
  \inf_{|\lambda|=1} \|f-\lambda g\|\leq C\||f|-|g|\|. $$
  In this case, if $|f|$ is known, then $f$ is uniquely determined up to an
unavoidable global phase factor $\lambda$; moreover, the phase recovery map is
$C$-Lipschitz. Phase retrieval appears in several applied circumstances,
ranging from crystallography to quantum mechanics.
  In this article, we construct various subspaces doing stable phase retrieval,
and make connections with $\Lambda(p)$-set theory. Moreover, we set the
foundations for an analysis of stable phase retrieval in general function
spaces. This, in particular, allows us to show that H\"older stable phase
retrieval implies stable phase retrieval, improving the stability bounds in a
recent article of M. Christ and the third and fourth authors. We also
characterize those compact Hausdorff spaces $K$ such that $C(K)$ contains an
infinite dimensional SPR subspace.
