Is there a set $A \subset [0,1]$ such that $\int_{A \times A^\text{c}} \frac{\mathrm{d} x \, \mathrm{d} y}{\lvert x - y\vert}=\infty$? The above question came up when I was trying to find a counterexample related to this problem. Clearly, the integral of $(x,y) \mapsto \lvert x-y \rvert^{-1}$ over $[0,1]^2$ is divergent. When integrating over a subset of the form $A \times A^\text{c}$ with Lebesgue measurable $A \subset [0,1]$ (and $A^\text{c} = [0,1] \setminus A$), however, the result is generally finite. I would like to know whether this is true for every $A$.
My thoughts so far:


*

*For the simple interval $A = [0,1/2]$ the integral has the finite value $\log(2)$. The integrand is only singular near the point $(1/2,1/2)$, which is not enough to make the two-dimensional integral diverge. The same is true if $A$ is a union of finitely many intervals. Therefore, in order to make the integral large we need 'a lot' of points $(x,y) \in A \times A^\text{c}$ for which $\lvert x - y \rvert$ is small.

*This can be achieved by choosing $A = [0,1] \cap \mathbb{Q}$, but of course the integral is simply zero  in this case because $A \times A^\text{c}$ is a Lebesgue null set. Thus we also need to ensure that both $A$ and $A^\text{c}$ have positive measure.

*We can let $A$ be the fat Cantor set to fulfil both requirements: $A$ and $A^\text{c}$ have Lebesgue measure $\frac{1}{2}$ each and there is an infinite number of points on the diagonal of $[0,1]^2$ near which the integrand diverges. I have tried to show that the integral is finite/infinite using the sequence of simpler sets defined in the iterative construction of $A$, but the corresponding integrals become complicated rather fast and it seems like I am stuck at this point.


Question:

Can we prove that $\int \limits_{A \times A^\text{c}} \frac{\mathrm{d} x \, \mathrm{d} y}{\lvert x - y\vert} < \infty$ holds for every Lebesgue measurable $A \subset [0,1]$ or find a counterexample?

 A: An alternating sequence of $2n$ strips in a width $w$ provides around $w\log n$ to the sum.  Set aside $1/n/(\log n)^2$ width for each $n$.  They have a finite total width but infinite total contribution.
Edit:
If $a\lt b\le c\lt d$ then $$\int_a^b dx\int_c^d dy\frac1{y-x}=\\(d-a)\log(d-a)-(d-b)\log(d-b)-(c-a)\log(c-a)+(c-b)\log(c-b)$$
and the last term vanishes if $b=c$.
Start with an interval $[0,2n]$, alternating strips of length 1.  There are $n^2$ contributions to the integral.  In  $2n-1$ cases, the strips are adjacent, contributing $(2n-1)(2\log2-2\log1+0$ .
In $2n-3$ cases there is a gap of two strips, contributing $(2n-3)(4\log4-6\log3+2\log2)$.
In $2n-2k-1$ cases there is a gap of $2k$ strips, contributing 
$$(2n-2k-1)((2k+2)\log(2k+2)-(4k+2)\log(2k+1)+2k\log(2k))\\ \gt(2n-2k-1)/(2k+1)$$
If $k\lt n/2$ this is more than $n/(2k+1)$ so the total is at least $n\log n/2$.
Reduce the width by a factor $2n$ so it fits a total width of $1$, and it contributes at least $(\log n)/4$. Also, if shrunk to a total width $w$, it contributes $w(\log n)/4$. 
For each $n$, set aside $$w_n=\frac1{n(\log n)^2}$$  This has a finite sum by the integral test.  The total contribution to the integral is at least $\sum 1/(4n\log n)$ which has an infinite sum by the integral test.  
Let $b_n=\sum_{k=3}^{n-1} w_k$.  Then
$$A=\cup_{n=3}^\infty\cup_{k=0}^{n-1}\{b_n+\frac{w_n}{2n}[2k,2k+1)\}$$
A: This is just to show why/how a construction simpler than the one used by @Empy2 does not work.
For $n \geq 1$ , consider the intervals
$$
X_n = [ 1/\log(n+1) , 1/\log(n+1/2)) \qquad Y_n = [1/\log(n+1/2) , 1/\log(n))
$$
The intervals are all disjoint. Define $A = X_0 \cup X_1 \cup X_2... $ for an opportune $X_0$, so that $A^c = Y_0 \cup Y_1 \cup Y_2... $ for an opportune $Y_0$. We are not interested in $Y_0$ and $X_0$, only to the asymptotic behavior of the integral over the domain $X_n \times Y_n$ for large $n>0$.
Define $i_n = \int_{X_n \times Y_n} \frac{dx \, dy}{|x-y|}$. The exact result can be calculated for every $n>0$, but the expression is long and not interesting. The interesting thing is that for large $n$ it can be proven that 
$$
i_n \sim 1/(n \log(n)^2)
$$
Therefore the series of the $i_n $ converges and so the integral over $A \times A^c$. You can try to consider 
$$
X_n = [ 1/\log(\log(n+1)) , 1/\log(\log(n+1/2)) \qquad Y_n = [1/\log(\log(n+1/2)) , 1/\log(\log(n)) )
$$
which makes the convergence of $\sum i_n$ even slower: in this case you have 
$$
i_n \sim 1/(n \log(n) \log(\log(n))^2)
$$
that still gives a (very slowly) converging series. You can add other log to the definition of the intervals, but this makes the convergence slower and slower, never divergent. So the point is to seek for constructions where the ``number of disjoint intervals is bigger''.
A: An alternative counterexample based on my initial misinterpretation of Empy2's answer:
Let $w_m = \frac{1}{m \log^2(m)}$ for $m \in \mathbb{N} \setminus \{1\}$ and $a_n = \sum_{m=2}^n w_m$ for $n \in \mathbb{N} \cup \{\infty\}$ . Define
$$ A = \bigcup \limits_{k=1}^\infty \left[\frac{a_{2k-1}}{a_\infty}, \frac{a_{2k}}{a_\infty}\right) ,$$
so that
$$ A^\text{c} = [0,1] \setminus A =  \{1\} \cup \bigcup \limits_{l=1}^\infty \left[\frac{a_{2l}}{a_\infty}, \frac{a_{2l+1}}{a_\infty}\right) . $$
Then
\begin{align}
\int \limits_{A \times A^\text{c}} \frac{\mathrm{d} x \, \mathrm{d} y}{\lvert x - y\vert} &= \sum \limits_{k,l = 1}^\infty ~ \int \limits_{\frac{a_{2k-1}}{a_\infty}}^{\frac{a_{2k}}{a_\infty}} \int \limits_{\frac{a_{2l}}{a_\infty}}^{\frac{a_{2l+1}}{a_\infty}} \frac{\mathrm{d} y \, \mathrm{d} x}{\lvert x - y\vert} \stackrel{(u,v) = a_\infty (x,y)}{=} \frac{1}{a_\infty} \sum \limits_{k,l = 1}^\infty ~ \int \limits_{a_{2k-1}}^{a_{2k}} \int \limits_{a_{2l}}^{a_{2l+1}} \frac{\mathrm{d} v \, \mathrm{d} u}{\lvert u - v\vert} \\
&= \frac{1}{a_\infty} \sum \limits_{k = 1}^\infty \left[\sum \limits_{l=1}^{k-1} ~ \int \limits_{a_{2k-1}}^{a_{2k}} \int \limits_{a_{2l}}^{a_{2l+1}} \frac{\mathrm{d} v \, \mathrm{d} u}{u - v} + \sum \limits_{l=k}^\infty ~ \int \limits_{a_{2k-1}}^{a_{2k}} \int \limits_{a_{2l}}^{a_{2l+1}} \frac{\mathrm{d} v \, \mathrm{d} u}{v-u} \right] \\
&\geq \frac{1}{a_\infty} \sum \limits_{k = 1}^\infty \left[\sum \limits_{l=1}^{k-1} \frac{(a_{2k} - a_{2k-1})(a_{2l+1} - a_{2l})}{a_{2k} - a_{2l}} + \sum \limits_{l=k}^\infty \frac{(a_{2k} - a_{2k-1})(a_{2l+1} - a_{2l})}{a_{2l+1} - a_{2k-1}} \right] \\
&\geq \frac{1}{a_\infty} \sum \limits_{k = 1}^\infty \left[\sum \limits_{l=1}^{k-1} \frac{w_{2k} w_{2l+1}}{2(k-l) w_{2l+1}} + \sum \limits_{l=k}^\infty \frac{w_{2k} w_{2l+1}}{2(l-k+1) w_{2k}} \right] \\
&= \frac{1}{2 a_\infty} \left[\sum \limits_{k = 1}^\infty w_{2k} \sum \limits_{l=1}^{k-1} \frac{1}{k-l} + \sum \limits_{l=1}^\infty w_{2l+1} \sum \limits_{k=1}^l \frac{1}{l-k+1} \right] \\
&= \frac{1}{2 a_\infty} \left[\sum \limits_{k = 1}^\infty w_{2k} H_{k-1} + \sum \limits_{l=1}^\infty w_{2l+1} H_l \right] = \frac{1}{2 a_\infty} \sum \limits_{n=2}^\infty \frac{H_{\left \lfloor (n-1)/2 \right \rfloor}}{n \log^2(n)} = \infty \, ,
\end{align}
since the harmonic numbers satisfy $H_{\left \lfloor (n-1)/2 \right \rfloor} \sim \log(n)$ as $n \to \infty$ .
