  We generalize the celebrated isoperimetric inequality of Khot, Minzer, and
Safra~(SICOMP 2018) for Boolean functions to the case of real-valued functions
$f \colon \{0,1\}^d\to\mathbb{R}$. Our main tool in the proof of the
generalized inequality is a new Boolean decomposition that represents every
real-valued function $f$ over an arbitrary partially ordered domain as a
collection of Boolean functions over the same domain, roughly capturing the
distance of $f$ to monotonicity and the structure of violations of $f$ to
monotonicity.
  We apply our generalized isoperimetric inequality to improve algorithms for
testing monotonicity and approximating the distance to monotonicity for
real-valued functions. Our tester for monotonicity has query complexity
$\widetilde{O}(\min(r \sqrt{d},d))$, where $r$ is the size of the image of the
input function. (The best previously known tester, by Chakrabarty and Seshadhri
(STOC 2013), makes $O(d)$ queries.) Our tester is nonadaptive and has 1-sided
error. We show a matching lower bound for nonadaptive, 1-sided error testers
for monotonicity. We also show that the distance to monotonicity of real-valued
functions that are $\alpha$-far from monotone can be approximated nonadaptively
within a factor of $O(\sqrt{d\log d})$ with query complexity polynomial in
$1/\alpha$ and the dimension $d$. This query complexity is known to be nearly
optimal for nonadaptive algorithms even for the special case of Boolean
functions. (The best previously known distance approximation algorithm for
real-valued functions, by Fattal and Ron (TALG 2010) achieves $O(d\log
r)$-approximation.)
