\documentclass[JEP,XML,SOM,Unicode,NoEqCountersInSection,NoFloatCountersInSection]{cedram}
\datereceived{2016-09-13}
\dateaccepted{2017-12-04}
\dateepreuves{2017-12-08}

\usepackage{tikz}
\usepackage{mathrsfs}
\let\mathcal\mathscr

\newenvironment{enumeratei}
{\bgroup\def\theenumi{\roman{enumi}}\def\theenumii{\arabic{enumii}}\begin{enumerate}}
{\end{enumerate}\egroup}

\multlinegap0pt
\let\sep\mid
\newcommand{\implique}{\mathchoice{\Longrightarrow}{\Rightarrow}{\Rightarrow}{\Rightarrow}}
\newcommand{\spfrac}[2]{\sfrac{#1}{(#2)}}
\newcommand{\RedefinitSymbole}[1]{%
\expandafter\let\csname old\string#1\endcsname=#1
\let#1=\relax
\newcommand{#1}{\csname old\string#1\endcsname\,}%
}
\RedefinitSymbole{\forall} \RedefinitSymbole{\exists}

\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\newtheorem{lem}{Lemma}

\theoremstyle{definition}
\newtheorem{rem}{Remark}

\newcommand\subsetsim{\mathrel{%
\ooalign{\raise0.2ex\hbox{$\subset$}\cr\hidewidth\raise-0.9ex\hbox{\scalebox{0.9}{$\sim$}}\hidewidth\cr}}}

\newcommand{\NN}{{\mathbb N}}
\newcommand{\ZZ}{{\mathbb Z}}
\newcommand{\RR}{{\mathbb R}}
\newcommand{\Tor}{{\mathbb T}}

\DeclareMathOperator\diam{diam}

\begin{document}
\frontmatter
\title[Small sumsets in $\mathbb{R}$]{Small sumsets in $\mathbb{R}$: \\full continuous $3k-4$ theorem, critical sets}

\author[\initial{A.} \lastname{de Roton}]{\firstname{Anne} \lastname{de Roton}}
\address{Université de Lorraine, CNRS, Institut Elie Cartan de Lorraine, UMR 7502\\
B.P. 70239, 54506 Vandoeuvre-lès-Nancy Cedex, France}
\email{anne.de-roton@univ-lorraine.fr}
\urladdr{http://www.iecl.univ-lorraine.fr/~Anne.de-Roton/}
\thanks{Soutien de l'ANR C\ae sar, ANR12-BS01-0011}

\begin{abstract}
We prove a full continuous Freiman's $3k-4$ theorem for small sumsets in $\mathbb{R}$ by using some ideas from Ruzsa's work on measure of sumsets in $\mathbb{R}$ as well as some graphic representation of density functions of sets. We thereby get some structural properties of $A$, $B$ and $A+B$ when $\lambda(A+B)<\lambda(A)+2\lambda(B)$ and either $\lambda(A)\geq\lambda(B)$ or $A$ has larger diameter than $B$. We also give some structural information for sets of large density according to the size of their sumset, a result so far unknown in the discrete and the continuous setting. Finally, we characterise the critical sets for which equality holds in the lower bounds for $\lambda(A+B)$.
\end{abstract}

\keywords{Sumsets, critical sets, Lebesgue measure, inverse theorems in additive combinatorics}

\subjclass{28A75, 11B13, 05B10}

\alttitle{Ensembles de réels de petite somme: une version continue du théorème 3k-4, structure des ensembles critiques}

\altkeywords{Ensembles sommes, ensembles critiques, mesure de Lebesgue, théorèmes inverses en combinatoire additive}

\begin{altabstract}
Nous démontrons un théorème $3k-4$, dans sa version la plus complète, pour les ensembles de réels en utilisant des idées issues du travail de Ruzsa sur les mesures des sommes d'ensembles de réels et une représentation graphique liée à la densité des ensembles. Nous obtenons ainsi des informations sur les structures des ensembles $A$, $B$ et $A+B$ lorsque $\lambda(A+B)<\lambda(A)+2\lambda(B)$ et soit la mesure de $A$ est supérieure à celle de $B$, soit le diamètre de $A$ est supérieur à celui de~$B$. Nous obtenons aussi des informations sur la structure des ensembles de grande densité en fonction de la taille de leur somme, ce qui représente un résultat n'ayant pas d'analogue discret. Nous caractérisons enfin les ensembles de réels critiques pour lesquels la mesure de l'ensemble somme atteint le minorant que nous avons obtenu.\end{altabstract}
\maketitle
\tableofcontents
\mainmatter

\section{Introduction}
Inverse problems for small sumsets study the structural properties of sets $A$ and~$B$ when their sumset $A+B=\{a+b,\, a\in A, \, b\in B\}$ is small (see \cite{Tao-Vu} or \cite{Nathanson} for an overview on this subject).
In 1959, Freiman \cite{Freiman1959} proved that a set $A$ of integers such that $|A+A|\leq 3|A|-4$, where $|A|$ denotes the number of elements in~$A$, is contained in an arithmetic progression of length $|A+A|-|A|+1$. This result is usually referred to as Freiman's $(3k-4)$ theorem. It has been refined in many ways and generalised to finite sets in other groups or semi-groups. The most complete version of this theorem for integers can be found in \cite{Gr}, chapter 7. We shall call this theorem the full Freiman's $(3k-4)$ theorem.

In this paper, we consider the addition of two bounded sets $A$ and $B$ of real numbers. We establish a continuous analogue of the full Freiman's $(3k-4)$ theorem and study the structures of the critical sets for which the lower bounds are attained. We also prove some results on sets of real numbers so far unknown for sets of integers. Our first main result can be read as follows ($\lambda$ is the inner Lebesgue measure on $\RR$ and $\diam(A)=\sup(A)-\inf(A)$ is the diameter of $A$).
\begin{thm}\label{intro_3k-4}
Let $A$ and $B$ be bounded subsets of $\mathbb{R}$ such that $\lambda(A),\lambda(B)\not=0$.
If
\begin{enumeratei}
\item
either $\lambda(A+B)< \lambda(A)+\lambda(B)+\min(\lambda(A),\lambda(B))$,
\item
or $\diam(B)\leq \diam(A)$ and $\lambda(A+B)< \lambda(A)+2\lambda(B)$,
\end{enumeratei}
\noindent
then
\begin{enumerate}
\item $\diam(A)\leq \lambda(A+B)-\lambda(B)$,
\item $\diam(B)\leq \lambda(A+B)-\lambda(A)$,
\item there exists an interval $I$ of length at least $\lambda(A)+\lambda(B)$ included in $A+B$.
\end{enumerate}
\end{thm}
\begin{rem}

As a consequence of our proof, for $A$ and $B$ subsets of $\mathbb{R}$ such that $0=\inf{A}=\inf{B}$ and $D_A=\diam(A)$, $D_B=\diam(B)$ bounded, we can derive, as in the discrete case, that the interval $I$ included in $A+B$ we found has lower bound $b:=\sup\{x\in [0,D_A], x\not\in A+B\}$ and upper bound
\[
c:=\inf\{x\sep x\in[D_A,D_A+D_B],\, x\not\in A+B\}.
\]
Furthermore we get that
\[
\lambda(A\cap[0,x])+\lambda(B\cap[0,x])> x
\]
for $x>b$ and
\[
\lambda(A\cap[0,x+D_A-D_B])+\lambda(B\cap[0,x])< x+\lambda(A)+\lambda(B)-D_B
\]
for $x<c-D_A$.
\end{rem}

Beyond the result themselves, what is noticeable is that the proof in the continuous setting is much easier to understand than in the discrete setting. The first two statements under hypothesis (i) are a straightforward application of Ruzsa's results in \cite{Ruz}. This nice paper of Ruzsa seems to have been overlooked whereas his ideas may lead to further results in the continuous setting that may even yield some improvements in the discrete one. This part of the theorem has already partially been proved by M. Christ in \cite{Cr} (for $A=B$).

A much stronger and very nice result in the continuous setting was proved by Bilu in \cite{Bilu}. Bilu's $\alpha+2\beta$ theorem in $\Tor^r=(\mathbb{R}/\mathbb{Z})^r$ gives a description of subsets $A$ and~$B$ of $\Tor^r$ such that $\mu(A+B)<\mu(A)+\mu(B)+\min(\mu(A),\mu(B))$ where $\mu$ is the inner Haar measure on $\Tor^r$. More precisely, Bilu conjectured that if $A,B$ are subsets of $\Tor^r$ such that $\mu(A)\geq \mu(B)$ and $\mu(A+B)<\min(1,\mu(A)+2\mu(B))$, then there exist a non zero character $\chi:\Tor^r\to\Tor$ and closed intervals $I,J\subset \Tor$ such that $\chi(A)\subset I$, $\chi(B)\subset J$, $I$ and $J$ have length at most $\mu(A+B)-\mu(B)$ and $\mu(A+B)-\mu(A)$ correspondingly. He proved this conjecture when $\mu(A)$ is small and close to $\mu(B)$. Working in the torus is actually much more demanding than working in $\RR$ and Bilu had to use some rectification arguments and to restrict himself to small sets.

As notified to us by Bilu, The part $(i)\implique (1) \mbox{ and }(2)$ of Theorem \ref{intro_3k-4} could be deduced from his result. Nevertheless, we believe that the most interesting statement, and the hardest to prove, in Theorem \ref{intro_3k-4} is the third consequence. We also think that the main interest of this theorem is the simplicity of our proof which does not make use of any result from the discrete setting whereas Bilu's proof consisted in transferring the problem from the torus to the integers and to use Freiman's theorem for integers.

Note also that Eberhard, Green and Manners obtained in \cite{EGM} a structural property for subsets of $\RR$ of doubling less than $4$. They proved that these sets must have density strictly larger than $1/2$ on some not too small interval.

In \cite{Ruz}, Ruzsa improved on the well-known lower bound
$$\lambda(A+B)\geq \lambda(A)+\lambda(B)$$
and proved that, if $\lambda(A)\leq \lambda(B)$, this can be strengthened:
$$\lambda(A+B)\geq \lambda(A)+\min(\diam(B),\lambda(A)+\lambda(B)).$$
The main idea of his proof is to transfer the sum in $\RR$ in a sum in $\Tor=\RR/\ZZ$.
Ruzsa considers the sets $A$ and $B$ of real numbers as sets of numbers modulo $D_B$, the diameter of $B$.
In this setting, he can use a rescaled version of Raikov's theorem \cite{Raikov} as well as the fact that if $x$ belongs to $A$ and if $B$ is a closed set then $x+\min(B)$ and $x+\max(B)$ belong to $A+B$.

Ruzsa's result directly yields the first two statements of our theorem under condition (i). To get these statements from condition (ii), we need to use Ruzsa's arguments in a slightly different way. This part is the continuous analogue of Freiman's $3k-4$ theorem in \cite{Freiman1959} as generalised to the sum of two distinct sets by Freiman \cite{Freiman1962}, Lev and Smeliansky \cite{Lev-Smeliansky} and Stanchescu \cite{stanchescu}.

As far as we know, the third consequence (the existence of an interval $I$ of length at least $\lambda(A)+\lambda(B)$ included in $A+B$) was not known in the continuous setting. The discrete analogue of our third statement was proved by Freiman in \cite{Freiman2009IAP11} in the special case $A=B$. It has been generalised to the case $A\not=B$ by Bardaji and Grynkiewicz in \cite{Bardaji-Grynkiewicz}. An exposition of these results can be found in \hbox{\cite[Chap.\,7]{Gr}}. We could adapt their proof but a simpler proof follows from some density arguments in the continuous setting. Actually, we think that the ideas are more natural in the continuous setting where a graphic illustration leads to the result. We hope that this sheds some new light on inverse results for integers too.

This third statement is a consequence of the simple remark that if $0=\inf{A}=\inf{B}$ and if the sum of the densities of $A$ and $B$ on $[0,x]$ is strictly larger than $x$, then $x$ can be written as a sum of an element in $A$ and an element in $B$. This allows us to partition $[0,D_A]$ into three sets: a subset $Z_1$ of $A+B$, a subset $Z_3$ of $A+B-D_A$ and their complementary set~$Z_2$ included in both $A+B$ and $A+B-D_A$. To go from $Z_1$ to $Z_3$ and reciprocally, one need to cross $Z_2$. The proof relies on the fact that there is only one such crossing under the hypothesis and on a lower bound for the measure of $Z_2$.

The graphic interpretation also leads to a relaxed inverse Freiman theorem for sets of large density with small sumset. Namely, we prove the following result.
\begin{thm}\label{intro_relaxed_3k-4}
Let $A$ and $B$ be measurable bounded subsets of $\mathbb{R}$ such that $D_B:=\diam(B)\leq D_A:=\diam(A)$ and $\Delta:=\lambda(A)+\lambda(B)-D_A>0$. Let $m$ be a non negative integer.
If $$\lambda(A+B)< D_A+\lambda(B)+(m+1)(D_A-D_B+\Delta),$$ then the sum $A+B$ contains a union of at most $2m+1$ disjoint intervals $K_1, K_2, \dots, K_{2n+1}$ ($n\leq m$), each of length at least $2\Delta+D_A-D_B$, such that the measure of this union of intervals is at least $D_A+(2n+1)\Delta+n(D_A-D_B)$.
\end{thm}

With the weak hypothesis in Theorem \ref{intro_relaxed_3k-4}, a description of the sets $A$ and $B$ can be given. This is nevertheless a rather vague description. On the contrary, we get a precise description of critical sets $A$ and $B$ for which the lower bound for the measure of $A+B$ is attained.
\begin{thm}\label{intro_equalarge}
Let $A$ and $B$ be some bounded closed sets of real numbers such that $D_B\leq D_A$ and $\lambda(A+B)=D_B+\lambda(A)< \lambda(A)+2\lambda(B)$.
Then there exist two positive real numbers $b$ and $c$ such that $b,c\leq D_B$, the interval $I=(b,D_A-c)$ has size at least $\lambda(A)+\lambda(B)-D_B=\Delta+D_A-D_B$ and
the sets $A$, $B$ and $A+B$ may each be partitioned into three parts as follows
$$A=\min(A)+\left(A_1\cup A_I\cup (D_A-A_2)\right), \quad B=\min(B)+(B_1\cup B_I\cup (D_B-B_2)),$$
$$A+B=\min(A+B)+\left(S_1\cup [b,D_A+D_B-c]\cup(D_A+D_B-S_2)\right),$$
with $A_1, B_1,S_1\subset [0,b]$, $A_2,B_2,S_2\subset [0,c]$ and
\begin{enumeratei}
\item
 $A_1\subsetsim S_1$, $A_2\subsetsim S_2$, $A_I\subsetsim[b,D_A-c]$,
\item
$\lambda(B_1\setminus A_1)=\lambda(B_2\setminus A_2)=0$, $B_I\subset[b,D_B-c]$.
\end{enumeratei}
\end{thm}

Here, we used the notation $C\subsetsim D$ for $C\subset D$ and $\lambda(D\setminus C)=0$ (thus $C=D$ up to a set of measure $0$). This result is a consequence of our previous observations on function graphs.

\begin{rem}
The hypothesis $\lambda(A+B)=D_B+\lambda(A)< \lambda(A)+2\lambda(B)$ can be replaced by $\lambda(A+B)=D_A+\lambda(B)< \lambda(A)+2\lambda(B)$ and we get the same conclusions with the roles of $A$ and $B$ interchanged.
\end{rem}

Theorems \ref{intro_3k-4}, \ref{intro_relaxed_3k-4} and \ref{intro_equalarge} describe the structure of sets $A$, $B$ and $A+B$ such that $\lambda(A)+\lambda(B)\geq\diam(B)$. If this last inequality does not hold, Ruzsa proved a lower bound (in \cite{Ruz}) for the sum $A+B$ in terms of the ratio $\lambda(A)/\lambda(B)$. Precisely, Ruzsa proved the following theorem \cite{Ruz}
\begin{thm}[Ruzsa]\label{intro_cor_ruzsa}
Let $A$ and $B$ be bounded subsets of $\mathbb{R}$ such that $\lambda(B)\not=0$. Write $D_B=\diam(B)$ and define $K\in\NN^*$ and $\delta\in \RR$ such that
\begin{equation*}
\frac{\lambda(A)}{\lambda(B)} =\frac{K(K-1)}{2}+K\delta, \quad 0\leq\delta<1.
\end{equation*}
Then we have
\begin{equation*}
\lambda(A+B)\geq \lambda(A)+\min(\diam(B),(K+\delta)\lambda(B)).
\end{equation*}
\end{thm}
A simple remark yields an improvement of this lower bound when
\[
\diam(A)/\diam(B)\leq K
\]
and a partial result on sets $B$ such that $\lambda(A+B)<\lambda(A)+(K+\delta)\lambda(B)$.
The extremal sets in this context can also be described, in a very precise way.
\begin{thm}\label{small_equa}
Let $A$ and $B$ be bounded closed subsets of $\mathbb{R}$ such that $\lambda(A),\lambda(B)\not=0$.
Let $K\in\NN$ and $\delta\in[0,1)$ be such that
$$\frac{\lambda(A)}{\lambda(B)} =\frac{K(K-1)}{2}+K\delta \quad\mbox{ and }\quad \lambda(A+B)=\lambda(A)+(K+\delta)\lambda(B)<\lambda(A)+ D_B,$$
where $D_B=\diam(B)$.
Then $A$ and $B$ are subsets of full measure in translates of sets~$A'$ and $B'$ of the form
\begin{align*}
B'&=[0,b_+]\cup[D_B-b_-, D_B], \\
A'&=\bigcup_{k=1}^K \left[(k-1)(D_B-b_-),(k-1)D_B+(K-k)b_++\delta b\right],
\end{align*}
with $b_+,b_-\geq 0$ and $b_++b_-=b=\lambda(B)$.
\end{thm}

In Section \ref{ruz}, we recall and discuss Ruzsa's results that we use in this paper. In Section \ref{secswitch}, we present the method of switches that leads to the third statement in Theorem \ref{intro_3k-4} and to Theorem \ref{intro_relaxed_3k-4}. We prove Theorem \ref{intro_3k-4} in Section \ref{sec:4} and Theorem \ref{intro_relaxed_3k-4} in Section \ref{sec:5}. We describe in Section \ref{sec:6} the large critical sets for which the lower bound in Ruzsa's inequality is attained. Finally, the last section is devoted to the characterisation of the small critical sets for which the lower bound in Ruzsa's inequality is attained.

We write $\lambda$ for the inner Lebesgue measure on $\RR$ and $\mu$ for the inner Haar measure on $\Tor=\RR/\ZZ$. Given a bounded set $S$ of real numbers, we define its diameter $D_S=\diam(S)=\sup(S)-\inf(S)$.

\subsubsection*{Acknowledgement}
I am pleased to warmly thank Professor Ruzsa for very useful conversations and comments. I am also indebted to Professor Serra who gave a talk at the conference Additive Combinatorics in Bordeaux which helped me to get a perspective on some works in the discrete setting related to mine. He also helped me to improve the presentation of this paper. I am also grateful to Pablo Candela for bringing to my knowledge Grynkiewicz's book and for his careful reading of this paper and to Yuri Bilu for bringing my attention to the fact that the part (i) implies~(1) and~(2) of Theorem \ref{intro_3k-4} could be obtained as a consequence of his main result in \cite{Bilu}. I~am also indebted to the anonymous referee whose advice helped me a lot to (hopefully) improve the presentation of this paper and to enlighten the ideas contained in the proofs.

\section{Ruzsa's lower bound for sumsets in \texorpdfstring{$\RR$}{R}}\label{ruz}
All along this paper, we shall use some results and some arguments from Ruzsa's paper \cite{Ruz}. In order to keep this paper self contained, we collect them here.

In \cite{Ruz}, Ruzsa obtains lower bounds for the inner Lebesgue measure of the sum $A+B$ of two subsets $A$ and $B$ of real numbers in terms of $\lambda(A)$, $\lambda(B)$ and $\diam(B)$. We state here one of his intermediate results and give its proof.

\begin{lem}[Ruzsa \cite{Ruz}]\label{ruzsa1}
Let $A$ and $B$ be non empty bounded subsets of $\mathbb{R}$. Write $D_B=\diam(B)$.
Then we have either
\begin{equation}
\lambda(A+B)\geq \lambda(A)+\diam(B)
\end{equation}
or
\begin{equation}\label{min_sum1}
\lambda(A+B)\geq \frac{k+1}{k}\lambda(A)+\frac{k+1}{2}\lambda(B),
\end{equation}
with $k$ the positive integer defined by
$$k=\max\{k'\in\NN \sep \exists x\in[0,D_B),\; \#\{n\in\NN \sep x+nD_B\in A\}\geq k'\}.$$
\end{lem}

\begin{proof}
$D_B=0$ yields \eqref{min_sum1}, so we assume $D_B>0$. We can translate and rescale~$A$ and $B$ so that $0=\inf A=\inf B$ and $D_B=1$. Working with the inner Lebesgue measure, we can assume that $A$ and $B$ are closed sets. The case of general sets can be obtained by applying the result to some sequences of closed sets $A_n\subset A$ and $B_n\subset B$ such that
\[
\lim_{n\to \infty}\lambda(A_n)=\lambda(A),\quad \lim_{n\to \infty}\lambda(B_n)=\lambda(B)\quad\text{and}\quad \lim_{n\to\infty}\diam(B_n)=D_B.
\]


For any positive integer $k$ and any subset $E$ of $\RR^+$, we define
$$\tilde{E}_k=\left\{x\in[0,1) \sep \#\{n\in\NN \sep x+n\in E\}\geq k\right\}$$
and $K_E=\max\{k\in\NN \sep \tilde{E}_k\not=\emptyset\}.$ Note that $\tilde{E}_{k+1}\subset\tilde{E}_k$.

We write $S=A+B$. Since $0,1\in B$, we have $\tilde{A}_{k-1}\subset \tilde{S}_k$ for $k\geq 2$, thus
\begin{equation}\label{minSk1_2}
\mu(\tilde{S}_k)\geq \mu(\tilde{A}_{k-1}) \quad (k\geq 2)
\end{equation}
and
$$\lambda(A+B)=\sum_{k=1}^{K_S}\mu(\tilde{S}_k)\geq \sum_{k=1}^{K_A}\mu(\tilde{A}_k)+\mu(\tilde{S}_1)=\lambda(A)+\mu(\tilde{S}_1).$$
By Raikov's theorem \cite{Raikov}, either $\mu(\tilde{S}_1)=1$ and $\lambda(A+B)\geq \lambda(A)+1=\lambda(A)+D_B$, or for all $k\geq 1$, we have $\mu(\tilde{S}_{k})\leq\mu(\tilde{S}_1)<1$ and
\begin{equation}\label{minSk2}
\mu(\tilde{S}_k)\geq \mu(\tilde{A}_k)+\mu(B) \quad (k\leq K_A).
\end{equation}
If $\mu(\tilde{S}_1)<1$, combining \eqref{minSk1_2} and \eqref{minSk2} leads to
$$\mu(\tilde{S}_k)\geq\frac{k-1}{K_A}\mu(\tilde{A}_{k-1})+ \frac{K_A+1-k}{K_A}(\mu(\tilde{A}_k)+\mu(B) )\quad (1\leq k\leq K_A+1)$$
and
\begin{equation}\label{minSK}
\lambda(A+B)\geq \frac{K_A+1}{K_A}\lambda(A)+\frac{K_A+1}{2}\lambda(B),
\end{equation}
which is Ruzsa's lower bound.
\end{proof}

As a corollary, Ruzsa derives Theorem \ref{intro_cor_ruzsa} stated in the introduction. In the following theorem, we improve this result for small sets $A$ and $B$ such that $D_A/D_B$ is small. This gives a partial answer to one of the questions asked by Ruzsa in \cite{Ruz}. Namely Ruzsa asked for a lower bound depending on the measures and the diameters of the two sets $A$ and $B$.
\begin{thm}\label{cor_ruzsa}
Let $A$ and $B$ be bounded subsets of $\mathbb{R}$ such that $\lambda(B)>0$. Write $D_B=\diam(B)$, $D_A=\diam(A)$ and define $K\in\NN^*$ and $\delta\in \RR$ by \begin{equation}\label{defKdelta}
\frac{\lambda(A)}{\lambda(B)} =\frac{K(K-1)}{2}+K\delta, \quad 0\leq\delta<1.
\end{equation}
Then we have either
\begin{equation*}
\lambda(A+B)\geq \lambda(A)+\diam(B)
\end{equation*}
or
\begin{equation}\label{min_sum2}
\lambda(A+B)\geq \lambda(A)+(K+\delta)\lambda(B).
\end{equation}
Furthermore, if $D_A/D_B\leq K$, then \eqref{min_sum2} can be replaced by the better estimate
$$\lambda(A+B)\geq\frac{\lceil{D_A/D_B}\rceil+1}{\lceil{D_A/D_B}\rceil}\lambda(A)+\frac{\lceil{D_A/D_B}\rceil+1}{2}\lambda(B).$$
\end{thm}

\begin{rem}\label{rkdiam}
This theorem is mostly due to Ruzsa in \cite{Ruz}. Our only contribution consists in noticing that the lower bound can be improved in case $D_A/D_B\leq K$. If $D_A\leq D_B$ then this remark yields the lower bound
\begin{equation}\label{minD_A<D_B}
\lambda(A+B)\geq \lambda(A)+\min(\diam(B), \lambda(A)+\lambda(B)).
\end{equation}
As noticed by Ruzsa in \cite{Ruz}, when $\lambda(A)\leq\lambda(B)$, \eqref{min_sum2} also yields \eqref{minD_A<D_B}. Indeed, if $\lambda(A)\leq\lambda(B)$, then in \eqref{defKdelta}, we have either $K=1$, in which case we have $\lambda(A)=\delta\lambda(B)$ and \eqref{min_sum2} yields $\lambda(A+B)\geq \lambda(A)+(1+\delta)\lambda(B)=2\lambda(A)+\lambda(B)$, or $(K,\delta)=(2,0)$, in which case we have $\lambda(A)=\lambda(B)$ and \eqref{min_sum2} yields $\lambda(A+B)\geq \lambda(A)+2\lambda(B)=2\lambda(A)+\lambda(B)$.
\end{rem}


\begin{proof}
Let us assume that $ \lambda(A+B)< \lambda(A)+\diam(B)$. Then by
Lemma \ref{ruzsa1}, $\lambda(A+B)\geq f(K_A)$ holds
with $f(k)=\frac{k+1}{k}\lambda(A)+\frac{k+1}{2}\lambda(B)$ and $$K_A=\max\{k'\in\NN \sep \exists x\in[0,D_B),\; \#\{n\in\NN \sep x+nD_B\in A\}\geq k'\}.$$
As noticed by Ruzsa,
the sequence $(f(k))_{k\geq 1}$ is non increasing for $k\leq K$ and increasing for $k\geq K$ with $K$ the integer defined by \eqref{defKdelta}.
Therefore $f(k)$ is minimal for $k=K$ and we get the lower bound
\begin{equation*}
\lambda(A+B)\geq f(K_A)\geq f(K)=\lambda(A)+(K+\delta)\lambda(B).
\end{equation*}
On the other hand, it is clear that $K_A\leq \lceil D_A/D_B\rceil$. Therefore, if $D_A/D_B\leq K$ then we have the better estimate
$\lambda(A+B)\geq f(\lceil D_A/D_B\rceil)$.\end{proof}

\section{Method of switches}\label{secswitch}

In the next lemma, we prove that large density of $A$ and $B$ on $[0,x]$ forces $x$ to belong to $A+B$. For integer sets, a discrete analogue of this lemma was used by Grynkiewicz in \cite{Gr}.

\begin{lem}\label{lem_mes}
Let $A$ and $B$ be two non empty subsets of $\RR$ such that $\inf(A)\!=\!\inf(B)\!=\!0$. Let $x$ be a real number.
\begin{itemize}
\item If $x\not\in A+B$ and $x\geq 0$ then
\begin{equation*}
\lambda([0,x]\cap A)+\lambda([0,x]\cap B)\leq x.
\end{equation*}
\item If $x\not\in A+B$ and $x\leq D_A+D_B$ then
\begin{equation*}
\lambda([x-D_B,D_A]\cap A)+\lambda([x-D_A,D_B]\cap B)\leq D_A+D_B-x.
\end{equation*}
\end{itemize}
\end{lem}

\skpt
\begin{proof}
\begin{itemize}
\item If $x\not\in A+B$, then for all $b\in[0,x]$, we have either $b\not\in B$ or $x-b\not\in A$ thus $[0,x]\subset ([0,x]\setminus B)\cup ([0,x]\setminus (x-A))$. This yields $x\leq x-\lambda([0,x]\cap B)+x-\lambda([0,x]\cap A)$ and the first inequality.
\item We write $A'=D_A-A$, $B'=D_B-B$ and $x'=D_A+D_B-x$. If $x\not\in A+B$, then $x'\not\in A'+B'$ and an application of the first inequality yields the second one.\qedhere
\end{itemize}
\end{proof}

We now present a method to get some structure for sets of large density.
Let $A$ and $B$ be two non empty sets of real numbers satisfying $\inf(A)=\inf(B)=0$. Recall that $D_A=\diam(A)$ and $D_B=\diam(B)$ and assume that $D_A\geq D_B$.
For any non negative real number $x$, we define
$$g_A(x)=\lambda(A\cap[0,x]), \quad g_B(x)=\lambda(B\cap[0,x]), \quad $$
$$ g(x)=g_A(x)+g_B(x) \, \mbox{ and } \, h(x)=g_A(x+D_A-D_B)+g_B(x).$$
By contraposition, Lemma \ref{lem_mes} can be rephrased as follows:
\begin{gather}\label{majx_petit}
(g(x)> x, \ x\geq 0) \implique x\in A+B,\\
\label{majx_grand}
(h(y)< y+\lambda(A)+\lambda(B)-D_B, \quad 0\leq y\leq D_B) \implique y+D_A\in A+B.
\end{gather}
The statement \eqref{majx_petit} is straightforward. Let us explain \eqref{majx_grand}.
By Lemma \ref{lem_mes}, if
\[
x\leq D_A+D_B\quad\text{and}\quad\lambda([x-D_B,D_A]\cap A)+\lambda([x-D_A,D_B]\cap B)> D_A+D_B-x,
\]
then $x\in A+B$. Writing $x=y+D_A$, this leads to
$$ (\lambda([y+D_A-D_B,D_A]\cap A)+\lambda([y,D_B]\cap B)> D_B-y, \ 0\leq y\leq D_B) \implique y+D_A\in A+B. $$
Since
\begin{align*}
\lambda([y+D_A-D_B,D_A]&\cap A)+\lambda([y,D_B]\cap B)\\
&=\lambda(A)-\lambda([0,y+D_A-D_B]\cap A)+\lambda(B)-\lambda([0,y]\cap B)\\
&=\lambda(A)+\lambda(B)-h(y),
\end{align*}
the statement \eqref{majx_grand} holds.

We notice that $g$ and $h$ are non decreasing continuous positive functions. They are also $2$-Lipschitz functions and satisfy the inequalities
\begin{equation}\label{gh}
0\leq g(x)\leq h(x)\leq g(x)+D_A-D_B\quad(x\geq 0).
\end{equation}
From now on, we assume that $\lambda(A)+\lambda(B)>D_A$ and define $\Delta=\lambda(A)+\lambda(B)-D_A$.

The region $[0,D_B]\times[0,\lambda(A)+\lambda(B)]$ of the plane can be partitioned into three regions delimited by the lines $L_1$ and $L_2$ respectively defined by the equations $y=x$ and $y=x+D_A-D_B+\Delta$. It leads to a partition of $[0,D_B]$ into three regions:
\begin{itemize}
\item $Z_1=\{x\in[0,D_B]\sep g(x)\leq x\}$ is the closed set of real numbers in $[0,D_B]$ for which the function $g$ is under the line $L_1$,
\item $Z_3=\{x\in[0,D_B]\sep h(x)\geq x+D_A-D_B+\Delta\}$ is the closed set of real numbers in $[0,D_B]$ for which the function $h$ is above $L_2$,
\item $Z_2=\{x\in[0,D_B]\sep x<g(x)\leq h(x)< x+D_A-D_B+\Delta\}$ is the remaining open set.
\end{itemize}

\begin{lem}\label{propZ}
Let $A$ and $B$ be two non empty sets of real numbers satisfying $\inf(A)=\inf(B)=0$.
If $D_B\leq D_A$ and $\Delta=\lambda(A)+\lambda(B)-D_A>0$, the family $\{Z_1,Z_2,Z_3\}$ form a partition of $[0,D_B]$. Furthermore, $D_A+Z_1\subset A+B$, $Z_3\subset A+B$ and $[D_B,D_A],Z_2, D_A+Z_2\subset A+B$.
\end{lem}
\begin{rem}
In particular, we have $[0,D_A]\subset (A+B)\cup(A+B-D_A)$ under the hypothesis of the lemma.
\end{rem}

\begin{proof}
By \eqref{gh},
\[
\left(g(x)\leq x\implique h(x)\leq x+D_A-D_B<x+D_A-D_B+\Delta\right),
\]
thus
\[
\left(h(x)\geq x+D_A-D_B+\Delta\implique g(x)>x\right)
\]
and $Z_1$ and $Z_3$ are disjoint subsets, which implies that $Z_1$, $Z_2$ and $Z_3$ are disjoint subsets. Now $0\in Z_1$, $D_B\in Z_3$, so by continuity of $g$ and $h$, the family $\{Z_1,Z_2,Z_3\}$ form a partition of $[0,D_B]$.

By the previous implications and \eqref{majx_grand}, if $x\in Z_1\cup Z_2$, then $x+D_A\in A+B$ and by \eqref{majx_petit}, if $x\in Z_2\cup Z_3$, then $x\in A+B$.
For $x\in[D_B,D_A]$,
$$g(x)\geq \lambda(B)+\lambda(A)-(D_A-x)=x+\Delta>x,$$ thus by \eqref{majx_petit} again, $[D_B,D_A]\subset A+B$.
\end{proof}

Now, to switch from $Z_1$ to $Z_3$ or reciprocally, one has to cross $Z_2$. We shall call the crossings from $Z_1$ to $Z_3$ the ``up crossings'' and the crossings from $Z_3$ to $Z_1$ the ``down crossings'' (although the functions $g$ and $h$ remain nondecreasing functions). By continuity, since $0$ is in $Z_1$, $D_B$ in $Z_3$, there is at least one up crossing and if there are $m$ down crossings, then there are $m+1$ up crossings and up crossings and down crossings alternate. Therefore, if $m$ is the number of down crossings, we can partition $[0,D_A]$ as a union of $4m+3$ consecutive intervals and the interval $(D_B,D_A]$ as follows:
\begin{equation}\label{decA}
[0,D_A]=I_0^{(1)}\cup I_0^{(2)}\cup I_0^{(3)}\cup\bigcup_{k=1}^m \bigl(J_k\cup I_k^{(1)}\cup I_k^{(2)}\cup I_k^{(3)}\bigr)\cup(D_B,D_A]
\end{equation}
with $I_k^{(1)}$, $I_k^{(3)}$ closed intervals such that
\[
Z_1\subset\bigcup_{k=0}^m I_k^{(1)}\subset Z_1\cup Z_2,\quad Z_3\subset\bigcup_{k=0}^m I_k^{(3)}\subset Z_3\cup Z_2,
\]
and $I_k^{(2)}$, $J_k$ open intervals such that $\bigcup_{k=0}^m I_k^{(2)}\cup \bigcup_{k=1}^m J_k\subset Z_2$.
The intervals $I_k^{(2)}$ correspond to up crossings whereas the intervals $J_k$ correspond down crossings.

We illustrate this by Figure \ref{fig:1}. For simplicity, we chose $D_A=D_B$ so that $g=h$ and only one down crossing ($m=1$).

\begin{figure}[htb]
\begin{center}
\begin{tikzpicture}[xscale=7,yscale=7]\smaller\smaller
\draw [<->] (0,1.1) -- (0,0) -- (1.2,0);
\node [below left] at (0,0) {$0$};
\draw [] (0,0) -- (1,1);
\draw [] (0,0.05) -- (1,1.05);
\draw [dashed] (1,0) -- (1,1.05);
\node [below] at (1,0) {$D_A$};
\node at (0.5,1) {$m=1$};
\draw [<->] (1.01,1+0.05) -- (1.01,1) node[above right]{$\Delta$};
\draw[thick, red] (0,0) to [out=20,in=240] (0.2,0.2) ;
\draw[thick,red,domain=0.2:0.25] plot (\x,{2*\x-0.2});
\draw[thick, red] (0.25,0.3) to [out=60,in=190] (0.6,0.58);
\node[red] at (0.4,0.55) {$g$};
\draw[thick, red] (0.6,0.58) to [out=10,in=240] (0.8,0.8) ;
\draw[thick,red,domain=0.8:0.85] plot (\x,{2*\x-0.8});
\draw[thick, red] (0.85,0.9) to [out=60,in=180] (1,1.05) ;
\draw [dashed, red] (0.25,0) -- (0.25,0.3);
\draw [dashed, red] (0.2,0) -- (0.2,0.2);
\draw [dashed, red] (0.575,0) -- (0.575,0.575);
\draw [dashed, red] (0.5,0) -- (0.5,0.55);
\draw [dashed, red] (0.8,0) -- (0.8,0.8);
\draw [dashed, red] (0.85,0) -- (0.85,0.9);
\draw[ultra thick, blue] (0.25,0) -- (0.5,0);
\draw[ultra thick, blue] (0.85,0) -- (1,0);
\node [below, red] at (0.1,0){$I_0^{(1)}$};
\node [below, red] at (0.7125,0){$I_1^{(1)}$};
\node [below, violet] at (0.225,0){$I_0^{(2)}$};
\node [below, violet] at (0.825,0){$I_1^{(2)}$};
\node [below, violet] at (0.535,0){$J_1^{\vphantom{(2)}}$};
\node [below, blue] at (0.925,0){$I_1^{(3)}$};
\node [below, blue] at (0.36,0){$I_0^{(3)}$};
\draw[ultra thick, red] (0.2,0) -- (0,0);
\draw[ultra thick, red] (0.575,0) -- (0.8,0);
\draw[line width=4, violet] (0.575,0) -- (0.5,0);
\draw[line width=4, violet] (0.8,0) -- (0.85,0);
\draw[line width=4, violet] (0.2,0) -- (0.25,0);

\node [ right] at (1.1,-0.12) {$A+A$};
\node [below right] at (1,-0.1) {$D_A$};
\node [below right] at (1,-0.15) {$2D_A$};
\node [below left] at (0,-0.15) {$D_A$};
\node [below left] at (0,-0.1) {$0$};
\draw [] (0,-0.1) -- (1,-0.1);
\draw[line width=4] (0.2,-0.1) -- (0.575,-0.1);
\draw[line width=4] (0.8,-0.1) -- (1,-0.1);
\draw[line width=4] (0,-0.15) -- (0.25,-0.15);
\draw[line width=4] (0.5,-0.15) -- (0.85,-0.15);
\draw [] (0,-0.15) -- (1,-0.15);
\end{tikzpicture}
\end{center}
\caption{\label{fig:1}}
\end{figure}

According to Lemma \ref{propZ}, the set $A+B$ contains the following union of $2m+1$ intervals
\begin{multline}\label{decS}
\bigcup_{k=1}^m\bigl( I_{k-1}^{(2)}\cup I_{k-1}^{(3)}\cup J_k\bigr) \cup\Bigl(I_m^{(2)}\cup I_m^{(3)}\cup (D_B,D_A]\cup (D_A+ I_0^{(1)})\cup (D_A+I_0^{(2)})\Bigr)\\
\cup \bigcup_{k=1}^m\Bigl(D_A+\bigl( J_k\cup I_{k}^{(1)}\cup I_{k}^{(2)}\bigr)\Bigr).
\end{multline}
Here each set in brackets is a single interval as a union of consecutive intervals.

One of the key points in the proof of the continuous $3k-4$ theorem consists in proving that while we switch from $Z_1$ to $Z_3$ or from $Z_3$ to $Z_1$, there is a not too small interval included in $Z_2$ in the meanwhile. We make this precise in the following lemma.
\begin{lem}\label{switch}
Let $A$ and $B$ be two non empty sets of real numbers satisfying $\inf(A)=\inf(B)=0$, $D_A\geq D_B$ and $\Delta:=\lambda(A)+\lambda(B)-D_A>0$.
Let $x$ and $y$ be two real numbers in $[0,D_B]$ such that $x\in Z_1$ and $y\in Z_3$.
\begin{itemize}
\item If $x<y$ then the interval $(x,y)$ contains an open subinterval $I$ which is in $Z_2$ and has length at least $\Delta$.
\item If $x>y$ then the interval $(y,x)$ contains an open subinterval $J$ which is in $Z_2$ and satisfies $\lambda(J\cap B^c)\geq \Delta+D_A-D_B$.
\end{itemize}
\end{lem}
\begin{rem}\label{rksizesum}
This implies that the intervals $\bigl( I_{k-1}^{(2)}\cup I_{k-1}^{(3)}\cup J_k\bigr)$, $\bigl( J_k\cup I_{k}^{(1)}\cup I_{k}^{(2)}\bigr)$ and $\bigl(I_m^{(2)}\cup I_m^{(3)}\cup(D_B,D_A]\cup (D_A+ I_0^{(1)})\cup (D_A+I_0^{(2)})\bigr)$ in \eqref{decS} each have length at least $2\Delta+D_A-D_B$.
\end{rem}

\skpt
\begin{proof}
\begin{itemize}
\item Assume $x<y$. Define $b_1=\sup (Z_1\cap[x,y))$ and $b_2=\inf (Z_3\cap(b_1,y])$.
We have $x\leq b_1<b_2\leq y$ and $I=(b_1,b_2)\subset Z_2$ since $z\in(b_1,b_2)$ implies $z\not\in Z_1$ and $z\not\in Z_3$.

By continuity of $g$ and $h$, $h(b_2)=b_2+\Delta+D_A-D_B$ and $g(b_1)=b_1$. Since $g(b_2)\geq h(b_2)-(D_A-D_B)$ and since $g$ is a $2$-Lipschitz function, we get
$$2(b_2-b_1)\geq g(b_2)-g(b_1)\geq h(b_2)-(D_A-D_B)-g(b_1)= b_2+\Delta-b_1,$$
thus $\lambda(I)=b_2-b_1\geq \Delta$.
\item Assume $y<x$. Define $b_1=\sup Z_3\cap[y,x)$ and $b_2=\inf Z_1\cap(b_1,x]$.
As in the previous case, we have $J=(b_1,b_2)\subset Z_2$, $g(b_2)=b_2$ and $h(b_1)=b_1+\Delta+D_A-D_B$. By definition of $h$ and $g$, this yields
$$g_A(b_1+D_A-D_B)-g_A(b_2)+g_B(b_1)-g_B(b_2)= b_1-b_2+(D_A-D_B) +\Delta.$$
In case $b_2\leq b_1+D_A-D_B$, since $b_2> b_1$, $g_B$ is a non decreasing function and $\Delta>0$, this would lead to
$$\lambda([b_2, b_1+D_A-D_B]\cap A)>\lambda([b_2, b_1+D_A-D_B]),$$
a contradiction. Thus we must have $b_2> b_1+D_A-D_B$.
\begin{figure}[htb]
\begin{center}
\begin{tikzpicture}[xscale=7,yscale=7]\smaller\smaller
\draw [->] (0.1,0.05) -- (0.9,0.05);
\draw [] (0.2,0.2) -- (1,1);
\draw [dashed] (0.2,0.2) -- (0.05,0.05);
\draw [dashed] (0.1,0.2) -- (0,0.1);
\draw [] (0.1,0.2) -- (0.9,1);
\draw [] (0.1,0.4) -- (0.7,1);
\draw [dashed] (0,0.3) -- (0.1,0.4);
\draw[thick, red] (0.1,0.58) to [out=5,in=195] (1,0.85) node[right]{$g$};
\draw[thick, blue] (0.1,0.6) to [out=7,in=190] (1,0.9) node[right]{$h$};
\draw[fill,red] (0.78,0.78) circle [radius=0.005] node [below right]{$(b_2,b_2)$};
\draw [dashed, red] (0.78,0.78) -- (0.78,0.05);
\draw[fill,red] (0.78,0.05) circle [radius=0.005] node [above right ]{$b_2$};
\draw[fill,blue] (0.365,0.665) circle [radius=0.005] node [above left]{$(b_1,b_1+\Delta+D_A-D_B)$};
\draw [dashed, blue] (0.365,0.665) -- (0.365,0.05);
\draw[fill,blue] (0.365,0.05) circle [radius=0.005] node [below ]{$b_1$};
\draw[fill] (0.535,0.05) circle [radius=0.005] node [below ]{$b_1+D_A-D_B$};
\draw [dashed,] (0.535,0.69) -- (0.535,0.05);
\draw[fill] (0.535,0.685) circle [radius=0.005];
\draw [<->] (0.22,0.22) -- (0.22,0.32);
\node[left] at (0.22,0.26){$\Delta$};
\draw [<->] (0.15,0.25) -- (0.15,0.45);
\node[left] at (0.15,0.35) {$D_A-D_B$};
\end{tikzpicture}
\end{center}
\caption{\label{fig:2}}

\end{figure}

Since $b_2> b_1+D_A-D_B$, we have
\begin{align*}
g_B(b_2)-g_B(b_1)&\leq g_A(b_2)-g_A(b_1+D_A-D_B)+g_B(b_2)-g_B(b_1)\\
&\leq b_2-b_1-(D_A-D_B)-\Delta,
\end{align*}
which yields
$
\lambda(J\cap B^c)=(b_2-b_1)-(g_B(b_2)-g_B(b_1))\geq\Delta+D_A-D_B
$.\qedhere
\end{itemize}
\end{proof}

\section{Proof of the continuous Freiman \texorpdfstring{$3k-4$}{3k} theorem}\label{sec:4}
We can now prove Theorem \ref{intro_3k-4}.
As before, we can assume that $A$ and $B$ are closed bounded subsets of $\RR$ such that $\min(A)=\min(B)=0$.

We first prove that each hypothesis yields the first two points. This is a consequence of Ruzsa's lower bound and our remark \ref{rkdiam}. The proof of the third item is more demanding and will require the use of the switches method introduced in the previous section.
\begin{itemize}
\item Let us assume that we have hypothesis (i) and that $\lambda(A)\leq \lambda(B)$, say. Then by Remark \ref{rkdiam}, $\lambda(A+B)< 2\lambda(A)+\lambda(B)$ implies
$\diam(B)\leq \lambda(A+B)-\lambda(A)$.

On the other hand, $$\frac{\lambda(B)}{\lambda(A)}=\frac{K'(K'-1)}{2}+K'\delta'$$ with $K'\geq 2$ and $0\leq\delta'< 1$ thus
\[
\lambda(A+B)< 2\lambda(A)+\lambda(B)\leq\lambda(B)+(K'+\delta')\lambda(A)
\]
and Theorem \ref{cor_ruzsa} with $(B,A)$ instead of $(A,B)$ yields $\diam(A)\leq \lambda(A+B)-\lambda(B)$.

\item If $\diam(B)\leq \diam(A)$, then by \eqref{minD_A<D_B} with $(B,A)$ in place of $(A,B)$, hypothesis~(ii) gives $\diam(A)\leq \lambda(A+B)-\lambda(B)$.

\begin{itemize}
\item
If $\lambda(A)\leq\lambda(B)$ then
\[
\diam(B)\leq \diam(A)\leq \lambda(A+B)-\lambda(B)\leq \lambda(A+B)-\lambda(A)
\]
and we are done.

\item
If $\lambda(A)>\lambda(B)$ then we have $\lambda(A+B)< \lambda(A)+\lambda(B)+\min(\lambda(A),\lambda(B))$ and the first part of this proof gives the result.
\end{itemize}
\end{itemize}

We now turn to the end of the proof and prove that under one of the two hypotheses of Theorem \ref{intro_3k-4} there exists an interval $I$ of length at least $\lambda(A)+\lambda(B)$ included in $A+B$.

We assume without loss of generality that $D_A\geq D_B$.
Hypothesis (i) yields
\[
\lambda(A+B)< \lambda(A)+\lambda(B)+\min(\lambda(A),\lambda(B))\leq \lambda(A)+2\lambda(B)
\]
and hypothesis (ii) yields $\lambda(A+B)< \lambda(A)+2\lambda(B)$, so in any case we assume $\lambda(A+B)< \lambda(A)+2\lambda(B)$. The part of the theorem already proven imply that $D_A\leq \lambda(A+B)-\lambda(B)<\lambda(A)+\lambda(B)$. We write $\Delta=\lambda(A)+\lambda(B)-D_A$. By hypothesis $\Delta>0$.

Reasoning modulo $D_A$ as Ruzsa does in \cite{Ruz}, we write
$$\lambda(A+B)=\mu_A(A+B)+\mu_A(\left\{x\in[0,D_B] \sep  x,x+D_A\in A+B\right\}),$$
where $\mu_A$ denotes the inner Haar measure modulo $D_A$.
Since $0,D_A \in A$, we have
$$B\subset\{x\in[0,D_B] \sep  x,x+D_A\in A+B\}.$$
Therefore
\begin{equation}\label{mes_som}
\lambda(A+B)\geq\mu_A(A+B)+\mu_A\left(\left\{x\in[0,D_B]\cap B^c \sep  x,x+D_A\in A+B\right\}\right)+\mu_A(B).
\end{equation}
As in the previous section, we define the functions $g_A$, $g_B$, $g$ and $h$ and partition $[0,D_A]$ into three regions $Z_1$, $Z_2$ and $Z_3$.
In the following picture, we draw two functions $g_A$ and $g_B$, the corresponding functions $g$ and $h$ and the corresponding regions $Z_1$, $Z_2$ and $Z_3$. The main part of the proof will consist in showing that with our hypothesis this drawing covers the possible configurations of the curves. More precisely, we shall prove that there is no down crossing, thus only one up crossing (see Figure \ref{fig:3}).

\begin{figure}[htb]
\begin{center}
\begin{tikzpicture}[xscale=7,yscale=7]\smaller\smaller
\draw [<->] (0,1.2) -- (0,0) -- (1.2,0);
\node [below left] at (0,0) {$0$};
\draw [] (0,0) -- (1,1);
\draw [] (0,0.425+0.025+0.5+0.1-1) -- (1,0.425+0.025+0.5+0.1);
\draw [] (0,0.425+0.025+0.5+0.1-1+0.15) -- (1,0.425+0.025+0.5+0.1+0.15);
\draw [dashed] (1,0) -- (1,1.2);
\node [below] at (1,0) {$D_A$};
\draw [dashed] (0.85,0) -- (0.85,1.2);
\node [below] at (0.85,0) {$D_B$};

\draw [<->] (1.01,1+0.425+0.025+0.5+0.1-1) -- (1.01,1) node[above right]{$\Delta$};
\draw [<->] (1.015,1+0.425+0.025+0.5+0.1-1) -- (1.015,1+0.425+0.025+0.5+0.1-1+0.15);
\node[right] at (1.015,1+0.425+0.025+0.5+0.1-1+0.075) {$D_A-D_B$};

\draw[orange, domain=0:0.4] plot (\x,{\x*\x/0.8});
\draw[orange,domain=0.4:0.6] plot (\x,{\x-0.2});
\draw[orange,domain=0.6:1] plot (\x,{0.5+0.1-(1-\x)*(1-\x)/(2*(1-0.4-0.2))}) node[right] {$g_A(x)$};

\draw[cyan, domain=0:0.3] plot (\x,{\x*\x/0.6});
\draw[cyan,domain=0.3:0.35] plot (\x,{\x-0.15});
\draw[cyan,domain=0.35:0.85] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))});
\draw[cyan,domain=0.85:1] plot (\x,{0.425+0.025}) node[right] {$g_B(x)$};

\draw[thick,red, domain=0:0.3] plot (\x,{\x*\x/0.6+\x*\x/0.8});
\draw[fill,red] (0.3455,0.3455) circle [radius=0.005] ;
\draw [dashed, red] (0.3455,0) -- (0.3455,0.3455);
\node [below left, red] at (0.36,0){$b_1$};
\draw[thick,red,domain=0.3:0.35] plot (\x,{\x-0.15+\x*\x/0.8});
\draw[thick,red,domain=0.35:0.4] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+\x*\x/0.8});
\draw[thick,red,domain=0.4:0.6] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+\x-0.2})node[below right] {$g(x)$};
\draw[thick,red,domain=0.6:0.85] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+0.5+0.1-(1-\x)*(1-\x)/(2*(1-0.4-0.2))});
\draw[thick,red,domain=0.85:1] plot (\x,{0.425+0.025+0.5+0.1-(1-\x)*(1-\x)/(2*(1-0.4-0.2))}) ;
\draw[thick,blue, domain=0:0.25] plot (\x,{\x*\x/0.6+(\x+0.15)*(\x+0.15)/0.8});
\draw[thick,blue, domain=0.25:0.3] plot (\x,{\x*\x/0.6+\x-0.2+0.15});
\draw[thick, blue,domain=0.3:0.35] plot (\x,{\x-0.15+\x-0.2+0.15});
\draw[fill,blue] (0.405,0.605) circle [radius=0.005] ;
\draw [dashed, blue] (0.405,0) -- (0.405,0.605);
\node [below right, blue] at (0.4,0){$b_2$};
\draw[thick, blue, domain=0.35:0.45] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+\x-0.2+0.15})node[above left] {$h(x)$};
\draw[thick, blue,domain=0.45:0.85] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+ 0.5+0.1-(1-(\x+0.15))*(1-(\x+0.15))/(2*(1-0.4-0.2))});
\draw[thick,blue,domain=0.7:0.85] plot (\x,{0.425+0.025-(0.85-\x)*(0.85-\x)/(2*(0.85-0.3-0.05))+0.5+0.1-(1-(\x+0.15))*(1-(\x+0.15))/(2*(1-0.4-0.2)) });
\draw[thick,blue,domain=0.85:1] plot (\x,{0.425+0.025+0.5+0.1});
\draw[ultra thick, blue] (0.405,0) -- (1,0);
\node [below, red] at (0.185,0){$Z_1$};
\node [below, blue] at (0.7025,0){$Z_3$};
\node [below, violet] at (0.38,0){$Z_2$};
\draw[ultra thick, red] (0.3455,0) -- (0,0);
\draw[line width=4, violet] (0.3455,0) -- (0.405,0);
\draw [] (0,-0.1) -- (1,-0.1);
\draw [] (0,-0.11) -- (0,-0.09);
\node [below left] at (0,-0.10){$0$};
\draw [] (1,-0.11) -- (1,-0.09);
\node [below ] at (1,-0.10){$D_A$};
\draw[line width=4] (0.3455,-0.1) -- (1,-0.1);
\draw[line width=4] (0,-0.15) -- (0.25,-0.15);
\draw[line width=4] (0.405,-0.15) -- (0,-0.15);
\draw [] (0.405,-0.15) -- (0.85,-0.15);
\draw [] (0.85,-0.16) -- (0.85,-0.14);
\node [below ] at (0.85,-0.15){$D_A+D_B$};
\draw [] (0,-0.16) -- (0,-0.14);
\node [below ] at (0,-0.15){$D_A$};
\end{tikzpicture}
\end{center}
\caption{\label{fig:3}}
\end{figure}

Since $[0,D_B]=Z_1\cup Z_2\cup Z_3$, $(D_B,D_A]\subset A+B$ and $Z_i\subset A+B \bmod D_A$ for $i=1,2,3$ (which we proved in Lemma \ref{propZ}), we have $\mu_A(A+B)=D_A$ and $Z_2\subset \left\{x\in[0,D_B] \sep  x,x+D_A\in A+B\right\}$.

With \eqref{mes_som} this yields
\begin{align}
\lambda(A+B)&\geq D_A+\lambda(B)+\lambda(Z_2\cap B^c)=\lambda(A)+2\lambda(B)+\lambda(Z_2\cap B^c)-\Delta.\label{minsum}
\end{align}

If there exist $x,y\in[0, D_B]$ such that $y< x$, $ x\in Z_1$, $y\in Z_3$, by Lemma \ref{switch} and~\eqref{minsum}, we get $\lambda(A+B)\geq \lambda(A)+2\lambda(B)+D_A-D_B$
which contradicts the hypothesis. Therefore there is no down crossing (i.e. for $x,y\in [0, D_B]$, $x\in Z_1$ and $y\in Z_3$
imply $x<y$).

Since $0\in Z_1$ and $D_B\in Z_3$, there is a unique up crossing. We apply the first part of Lemma \ref{switch} and get an interval $I_2=(b_1,b_2)\subset Z_2$ of length at least $\Delta$ such that $g(b_1)=b_1$, $h(b_2)=b_2+\Delta+D_A-D_B$. We write $I_1=[0,b_1]$ and $I_3=[b_2,D_A]$.

Then $I=(b_1,D_A+b_2)$ is a subinterval of $A+B$ of size at least $D_A+\Delta=\lambda(A)+\lambda(B)$.

\section{Some observation on sets with large density}\label{sec:5}
Our graphic interpretation for large sets of real numbers with small sumset gives rise to further comments, especially Theorem \ref{intro_relaxed_3k-4}.

For this section, let $A$ and $B$ be some bounded closed subsets of real numbers such that $\min{A}=\min{B}=0$, $D_B\leq D_A$ and $\Delta:=\lambda(A)+\lambda(B)-D_A>0$. We define the functions $g$ and $h$ as in Section \ref{secswitch}.


\begin{proof}[Proof of Theorem \ref{intro_relaxed_3k-4}]
As explained in Section 3, we can partition
\[
[0,D_B]\times [0,\lambda(A)+\lambda(B)]
\]
into three regions $Z_1$, $Z_2$ and $Z_3$. Let $m$ be the number of down crossings from $Z_3$ to~$Z_1$.
In Lemma \ref{switch}, we proved that for each down crossing, we gain a subset of $B^c\cap Z_2$ of measure at least $\Delta+D_A-D_B$. By use of \eqref{minsum}, it yields
$$\lambda(A+B)\geq \lambda(B)+D_A+\lambda(B^c\cap Z_2)\geq \lambda(B)+D_A+m(\Delta+D_A-D_B).$$
Furthermore, $[0,D_A]$ can be written as a union of $4m+4$ consecutive intervals as in~\eqref{decA} and by \eqref{decS} the set $A+B$ contains a union of $2m+1$ intervals, each of length at least $2\Delta+D_A-D_B$ by Remark \ref{rksizesum}. Furthermore the sum of the length of these intervals is at least
\begin{multline*}
D_A+\sum_{k=0}^n\lambda(I_k^{(2)})+\sum_{k=1}^n\lambda(J_k)\\\geq D_A+(n+1)\Delta+n(\Delta+D_A-D_B)\geq D_A+(2n+1)\Delta+n(D_A-D_B).
\end{multline*}
Here we used that $[0,D_A]\bmod D_A$ is covered by these intervals and that each $I_k^{(2)}$ and $J_k$ appear twice in the sum $A+B$ modulo $D_A$.
This yields the result.\end{proof}

Note that even in the case $m=0$, this theorem gives a new information. In case $D_B<D_A$, Theorem \ref{intro_3k-4} needed $\lambda(A+B)<\lambda(A)+2\lambda(B)$ to conclude that $A+B$ contained an interval of size at least $\lambda(A)+\lambda(B)$ whereas Theorem \ref{intro_relaxed_3k-4} only needs $\lambda(A+B)<\lambda(A)+2\lambda(B)+D_A-D_B$ and $\lambda(A)+\lambda(B)>D_A$ to get the same conclusion.

Some more elements on the structure of the sets $A$ and $B$ could be derived from the graphic interpretation we gave. For simplicity $A=B$ and $\lambda(A)\geq \frac12 D_A$. In this case, we write $\lambda(A)=\frac12D_A+\delta$. The hypothesis of Theorem \ref{intro_relaxed_3k-4} becomes
\[
\lambda(A+A)<D_A+\lambda(A)+2(m+1)\delta.
\]
Since $\lambda(A+A)\leq 2D_A$ this hypothesis is fulfilled as soon as $\delta> \frac12\spfrac{D_A}{2m+3}$.

The set $[0,D_A]$ may be partitioned into the union of some disjoint intervals as follows
$$[0,D_A]=I_0^{(1)}\cup I_0^{(2)}\cup I_0^{(3)}\cup\bigcup_{k=1}^n \bigl(J_k\cup I_k^{(1)}\cup I_k^{(2)}\cup I_k^{(3)}\bigr),$$
On endpoints of $I_k^{(1)}$, thus on right endpoints of $J_k$ and left endpoints of $I_k^{(2)}$, we have $g(x)=x$ whereas on endpoints of $I_k^{(3)}$, thus on left endpoints of $J_k$ and right endpoints of $I_k^{(2)}$, we have $h(x)=g(x)=x+\Delta$. Therefore
$A$ has density $1/2$ of each interval $I_k^{(1)}$ and $I_k^{(3)}$, $\lambda(A\cap I_k^{(2)})=\frac12\lambda( I_k^{(2)})+\delta$ and $\lambda(A\cap J_k)=\frac12\lambda(J_k)-\delta$. Furthermore, there is a connection in the structures of $A$ and $A+A$. This connection is easier to explicate in the special case of extremal sets. This shall be the purpose of the next section.

\section{Small sumset and large densities: structure of the extremal sets}\label{sec:6}
In \cite{Freiman2009IAP11}, Freiman exhibits a strong connection in the description of $A$ and $A+A$ and reveals the structures of these sets of integers in case the size of $A+A$ is as small as it can be. In Theorem \ref{intro_equalarge} we give a similar result in the continuous setting. Our result also applies to sets $A$ and $B$ with $A\not=B$. As far as we know, no discrete analogue of this result can be found in the literature.


\begin{proof}[Proof of Theorem \ref{intro_equalarge}]
We use the same notation as in the proof of Theorem \ref{intro_3k-4} and we assume that $A$ and $B$ are closed bounded subsets of $\RR$ such that
\[
0=\min {A}=\min {B},\quad D_B\leq D_A\quad\text{and}\quad\lambda(A+B)=D_B+\lambda(A)< \lambda(A)+2\lambda(B).
\]
We proved already that there exists $I_2=(b,D_B-c)$ with
\[
g(b)=b,\quad h(D_B-c)=D_A-c+\Delta,
\]
where
\[
\Delta:=\lambda(A)+\lambda(B)-D_A>0\quad\text{and}\quad(b,D_A+D_B-c)\subset (A+B).
\]
Write
\[
A_1=A\cap[0,b],\quad B_1=B\cap[0,b],\quad S_1=(A+B)\cap[0,b]
\]
and
\begin{gather*}
A_2=(D_A-A)\cap[0,c],\quad (\text{\ie} D_A-A_2=A\cap[D_A-c,D_A]),\\ B_2=(D_B-B)\cap[0,c],\quad
S_2=\left((D_A+D_B)-(A+B)\right)\cap[0,c]. 
\end{gather*}
Then $A_1\subset S_1$ (since $0\in B$) and $A_2\subset S_2$ (since $D_B\in B$).
Furthermore
we have, on the one side,
$$A+B=S_1\cup (b,D_A+D_B-c)\cup \left(D_A+D_B-S_2\right)$$
and, on the other side,
$$\lambda(A+B)=D_B+\lambda(A)=D_B+\lambda(A_1)+\lambda\left(A\cap (b,D_A-c) \right)+\lambda(A_2).$$
Therefore we get $A_1\subsetsim S_1$, $A_2\subsetsim S_2$ and $A_I= A\cap(b,D_A-c) \subsetsim (b,D_A-c)$.

Since $0, D_A\in A$, this in particular implies, up to a set of measure $0$, that $B_1\subset A_1$ and $B_2\subset A_2$.
\end{proof}

\section{Small sets with small sumset: the extremal case}
We now characterise the sets $A$ and $B$ such that equality holds in \eqref{min_sum2}, thus
\[
\lambda(A+B)=\lambda(A)+(K+\delta)\lambda(B)
\]
with $K$ and $\delta$ defined in \eqref{defKdelta}. In \cite{Ruz}, Ruzsa gives an example of such sets $A$ and $B$. Theorem \ref{small_equa} states that his example is essentially the only kind of sets for which this equality holds.
Extremal sets will have the following shape (In this example, $K=3$ and $D_B=1$).

\begin{figure}[htb]
\begin{tikzpicture}[xscale=4]\smaller\smaller
\draw [draw=red, thick] (0.2,-.1) -- (0.2,0.1);
\draw[-][draw=red, line width=3] (0,0) -- (.2,0);
\draw[-][thick] (.2,0) -- (.9,0);
\draw [draw=red, thick] (0.9,-.1) -- (0.9,0.1);
\draw[-][draw=red, line width=3] (.9,0) -- (1,0);
\draw[-][thick] (1,0) -- (2.5,0);
\draw [draw=red, thick] (0,-.1) node[below]{0} -- (0,0.1);
\draw [draw=red, thick] (1,-.1) node[below]{1} -- (1,0.1);
\draw [thick] (2,-.1) node[below]{2} -- (2,0.1);
\node[align=center, above] at (1.25,.3){Set $B$};
\end{tikzpicture}

\begin{tikzpicture}[xscale=4]\smaller\smaller
\draw [draw=red, thick] (0.55,-.1) -- (0.55,0.1);
\draw[-][draw=red, line width=3] (0,0) -- (.55,0);
\draw[-][thick] (.55,0) -- (.9,0);
\draw [draw=red, thick] (0.9,-.1) -- (0.9,0.1);
\draw [draw=red, thick] (1.9,-.1) -- (1.9,0.1);
\draw[-][draw=red, line width=3] (.9,0) -- (1.35,0);
\draw [draw=red, thick] (1.35,-.1) -- (1.35,0.1);
\draw[-][thick] (1.35,0) -- (1.8,0);
\draw [draw=red, thick] (1.8,-.1) -- (1.8,0.1);
\draw[-][draw=red, line width=3] (1.8,0) -- (2.15,0);
\draw [draw=red, thick] (2.15,-.1) -- (2.15,0.1);
\draw[-][thick] (2.15,0) -- (2.5,0);
\draw [draw=red, thick] (0,-.1) node[below]{0} -- (0,0.1);
\draw [thick] (1,-.1) node[below]{1} -- (1,0.1);
\draw [draw=red, thick] (0.2,-.1)--(0.2,0.1);
\draw [draw=red, thick] (0.4,-.1)--(0.4,0.1);
\draw [draw=red, thick] (1.2,-.1)--(1.2,0.1);
\draw [thick] (2,-.1) node[below]{2} -- (2,0.1);
\node[align=center, above] at (1.25,.3){Set $A$};
\end{tikzpicture}
\caption{\label{fig:4}}
\end{figure}


\begin{proof}[Proof of Theorem \ref{small_equa}]
We assume without loss of generality that $A$ and $B$ are closed sets of $\RR^+$ such that
\[
0\!=\!\min A\!=\!\min B,\ D_B\!=\!1,\ \lambda(B)\!\neq\!0\text{ and }\lambda(A+B)\!=\!\lambda(A)+(K+\delta)\lambda(B)\!<\!1+\lambda(A),
\]
where $K$ and $\delta$ are defined by \eqref{defKdelta}.

Given two subsets $C$ and $D$ of $\Tor$ or $\RR$, we introduce the notation $C\subsetsim D$ when $C\subset D$ and $\mu(C)=\mu(D)$ in case $C, D\subset\Tor$, $\lambda(C)=\lambda(D)$ in case $C, D\subset\RR$.

We need to prove that
$$B\subsetsim[0,b_+]\cup [1-b_-,1] \quad\text{and}\quad A\subsetsim \bigcup_{\ell=0}^{K-1}[(\ell-\ell b_-,\ell+\delta b+(K-1-\ell)b_+],$$ with $b=b_++b_-$.

We use the notation introduced in the proof of Lemma \ref{ruzsa1}.
The proof will be divided into three steps. We first prove that $B$, $\tilde{A}_k$ and $\tilde{S}_k$ are unions of at most $m$ intervals in $\Tor$, then we prove that $m=1$. Finally, we determine the precise shape of $A$ and $B$.

The first step consists in determining the shape of $B$, $\tilde{A}_k$ and $\tilde{S}_k$ for positive integers~$k$. To this aim, we shall follow Ruzsa's arguments in \cite{Ruz} and use Kneser's theorem on critical sets in $\Tor$ \cite{kneser}.

Following the argumentation of the proof of Lemma \ref{ruzsa1}, the equality $$\lambda(A+B)=\lambda(A)+(K+\delta)\lambda(B)=\frac{K+1}{K}\lambda(A)+\frac{K+1}2\lambda(B)<\lambda(A)+1$$ implies $\mu(\tilde{S}_1)<1$, $K_A=K$, and
\begin{equation}\label{muSk}
\begin{cases}
\mu(\tilde{S}_k)= \mu(\tilde{A}_{k-1}) & (2\leq k\leq K+1),\\
\mu(\tilde{S}_k)= \mu(\tilde{A}_k)+\mu(B) & (1\leq k\leq K),\\
\mu(\tilde{S}_k)=0 &( k\geq K+2).
\end{cases}
\end{equation}
For $1\leq k\leq K$, we have $\tilde{A}_k+B\subset \tilde{S}_k$ thus the second line in \eqref{muSk} implies that we have equality in Raikov's inequality, meaning $\mu(\tilde{A}_k+B)=\mu(\tilde{A}_k)+\mu(B)$ and by Kneser's theorem on critical sets in $\Tor$ \cite{kneser} there exists $m_k\in\NN$, there exist two closed intervals $I_k$ and $J_k$ of $\Tor$ such that $m_k\tilde{A}_k\subset I_k$, $m_k B\subset J_k$ and $\mu(I_k)=\mu(\tilde{A}_k)$, $\mu(J_k)=\mu(B)$.

Now $m_k B\subset J_k$ with $\mu(J_k)=\mu(B)$ and $m_\ell B\subset J_\ell$ with $\mu(J_\ell)=\mu(B)$ implies \hbox{$m_k\!=\!m_\ell$} and $J_k=J_\ell$. Let us write $J=J_k$ and $m=m_k$. We thus have for some~\hbox{$m\in\NN$},\vspace*{-3pt}
\begin{equation}\label{Sk}
\begin{cases}
m\tilde{A}_k\subsetsim I_k, & mB\subsetsim J,\\
\tilde{A}_{k-1}\subsetsim \tilde{S}_k & (2\leq k\leq K+1),\\
\tilde{A}_k+B\subsetsim\tilde{S}_k & (1\leq k\leq K),\\
\emptyset\subsetsim\tilde{S}_k &( k\geq K+2).
\end{cases}
\end{equation}
This implies $I_{k-1}=I_k+J$ for $2\leq k\leq K$ thus $I_k=I_K+(K-k)J$ for $1\leq k\leq K$. Since\vspace*{-3pt}
$$\lambda(A)=\sum_{k=1}^K\mu(\tilde{A}_k)=\sum_{k=1}^K\mu(I_k),$$
we get, using $\mu(J)=\mu(B)$ and the definition of $K$ and $\delta$, that\vspace*{-3pt}
$$\mu(I_K)=\frac1K\lambda(A)-\frac{K-1}{2}\lambda(B)=\delta\lambda(B).$$
Now, we write $b=\lambda(B)$. We proved that we have
$$m\tilde{A}_k\subsetsim I_k= I_K+(K-k)J,\, \mbox{ with }\,\mu(I_K)=\delta b\,\mbox{ and }\,\mu(J)=b.$$

As a second step, we prove that $m=1$.
Write $J=J_+\cup J_-$ with $J_-$ a closed interval in $(-1,0]$ and $J_+$ a closed interval in $[0,1)$ and $b_+=\lambda(J_+)$, $b_-=\lambda(J_-)$.

Assume for contradiction that $m\geq 2$. Then, since $0\in B$,
$$B=\bigcup_{\ell=0}^mB_\ell\quad\mbox{ with }\quad B_0=\frac{J_+}m, \, B_m=1+\frac{J_-}{m}, \quad\text{and}\quad B_\ell= \frac{\ell+J}{m} \, \mbox{ if }\, 1\leq\ell\leq m-1.$$
In particular $\lambda(B_\ell)=\sfrac{b}{m}$ for $1\leq \ell\leq m-1$ and $\sum_{\ell=0}^m\lambda(B_\ell)=b$.
Similarly,\vspace*{-3pt}
$$A=\bigcup_{\ell=0}^L A_\ell\quad\mbox{ with }\quad A_\ell=A\cap \frac{\ell+I_1}{m} \, \mbox{ and }L=\max\{\ell\sep A_\ell\not=\emptyset\}$$
and\vspace*{-3pt}
$$A+B=\bigcup_{\ell=0}^{L+m} S_\ell\quad\mbox{ with }\quad S_\ell=(A+B)\cap \frac{\ell+I_1+J}{m}.$$
We write $\mathcal{L}=\{\ell\geq 0\sep  A_\ell\not=\emptyset\}$.
On the one hand, we have $A_i+B_j\subset S_{i+j}$ for $i\in\mathcal{L}$ and $0\leq j\leq m$, thus\vspace*{-3pt}
\begin{equation}\tag{$*$}
\begin{split}
\lambda(A)+(K+\delta)b&=\lambda(A+B)=\sum_{\ell=0}^{L+m} \lambda(S_\ell)\\[-3pt]
&=\lambda(S_0)+\sum_{\ell=0}^{L} \lambda(S_{\ell+1})+\sum_{\ell=2}^{m} \lambda(S_{L+\ell})\\[-3pt]
&\geq\lambda(A_0)+\lambda(B_0)+\sum_{\ell\in\mathcal{L}} (\lambda(A_{\ell})+\lambda(B_1))+\sum_{\ell=2}^{m} (\lambda(A_L)+\lambda(B_\ell))\\
&\geq\lambda(A)+\lambda(A_0)+(m-1)\lambda(A_L)+b-\frac{b}{m}+\frac{b}{m}\#\{\ell\sep A_\ell\not=\emptyset\}\\
&\geq\lambda(A)+b-\frac{b}{m}+\frac{b}{m}\#\mathcal{L},
\end{split}
\end{equation}
therefore $\#\mathcal{L}\leq (K+\delta-1)m+1<Km+1$.

On the other hand,
\[
\#\mathcal{L}=\sum_{\ell=0}^{m-1}\#\{k\sep A_{\ell+km}\not=\emptyset\}.
\]
Since $m\tilde{A}_K\subsetsim I_K$, for each $\ell\in\{0,\dots,m-1\}$, $\#\{k\sep A_{\ell+km}\not=\emptyset\}\geq K$. This yields $\#\mathcal{L}=Km$.
Since $m\tilde{A}_K\subsetsim I_K$, this implies that for any $\ell\in\mathcal{L}$, up to a set of measure~$0$, we have $\tfrac1m(\ell+I_K)\subset A_\ell$ which yields $\lambda(A_\ell)\geq \tfrac1m\lambda(I_K)$. Since $0,L\in \mathcal{L}$, this gives $\lambda(A_0)+(m-1)\lambda(A_L)\geq \lambda(I_K)=\delta b$. With $(*)$, we obtain
$$(K+\delta)b\geq \delta b+b-\frac{b}{m}+\frac{b}{m}\#\mathcal{L}=\delta b+b-\frac{b}{m}+Kb.$$
Therefore we must have $m=1$ and $B=J_+\cup (1+J_-)$.

We now prove that, for $0\leq\ell\leq L$, $A_\ell$ satisfies $A_\ell\subsetsim[\ell-\ell b_-,\ell+\delta b+(K-1-\ell)b_+]$.
We have, for $\ell\in\mathcal{L}$, $A_\ell+B_0\subset S_\ell$ and for $\ell-1\in\mathcal{L}$, $A_{\ell-1}+B_1\subset S_\ell$ thus, by \eqref{Sk}, $\mathcal{L}=\{0,1\cdots,L\}$ is a set of consecutive integers. Therefore we have for $0\leq \ell\leq L$, $A_\ell+B_0\subset S_\ell$ and for $1\leq \ell\leq L+1$, $A_{\ell-1}+B_1\subset S_\ell$, thus for any $\ell\in\{0,\dots, L+1\}$,
$$\lambda(S_\ell)\geq \frac{L+1-\ell}{L+1}(\lambda(A_\ell)+b_+)+\frac{\ell}{L+1}(\lambda(A_{\ell-1})+b_-).$$
Therefore,
\begin{align*}
\lambda(A+B)
&=\sum_{\ell=0}^{L+1} \lambda(S_\ell)\\
&\geq\sum_{\ell=0}^{L+1} \Bigl(\frac{L+1-\ell}{L+1}(\lambda(A_\ell)+b_+)+\frac{\ell}{L+1}(\lambda(A_{\ell-1})+b_-)\Bigr)\\
&\geq\sum_{\ell=0}^{L} \Bigl(\frac{L+1-\ell}{L+1}(\lambda(A_\ell)+b_+)\Bigr)+\sum_{\ell=0}^{L} \Bigl(\frac{\ell+1}{L+1}(\lambda(A_{\ell})+b_-)\Bigr)\\
&\geq\sum_{\ell=0}^{L} \frac{L+2}{L+1}\lambda(A_\ell)+b\frac{L+2}{2}\\
&\geq \frac{L+2}{L+1}\lambda(A)+\frac{L+2}{2}b.
\end{align*}
Writing $f(k)=\frac{k+1}{k}\lambda(A)+\frac{k+1}{2}b$ as in the proof of Theorem \ref{cor_ruzsa} we get $f(K)\geq f(L+1)$. As noticed before, $f$ is increasing for $k\geq K$ thus, $L$ being at least $K-1$, we must have $L=K-1$ and the above inequalities are indeed equalities. In particular we must have $\lambda(A_\ell)+b_+= \lambda(S_\ell)$ for $0\leq \ell\leq K-1$, and $\lambda(A_{\ell-1})+b_-=\lambda(S_\ell)$ for $1\leq \ell\leq L+1$.
Since we had for $0\leq \ell\leq L$, $A_\ell+B_0\subset S_\ell$ and for $1\leq \ell\leq L+1$, $A_{\ell-1}+B_1\subset S_\ell$, this implies that for any $\ell$, $A_\ell$ has full measure in an interval. Furthermore $A_{\ell+1}+B_0\subsetsim S_{\ell+1}$ and $A_{\ell}+B_1\subsetsim S_{\ell+1}$, thus
$A_{\ell+1}+J_+=1+A_\ell+J_-$.

Writing $A_0\subsetsim[0,a]$, we get $A_\ell\subsetsim [\ell-\ell b_-, \ell+a-\ell b_+]$. To compute $a$, we write $\lambda(A)$ in two different forms. On the one side
\[
\lambda(A)=\sum_{\ell=0}^{K-1}\lambda(A_\ell)=Ka+\frac12(K-1)K(b_--b_+)
\]
and on the other side
\[
\lambda(A)=\frac12(K-1)Kb+K\delta b,
\]
thus $a=(K-1)b_++\delta b$. This concludes the third step and the theorem.
\end{proof}

\backmatter
\bibliographystyle{jepalpha}
\bibliography{deroton}
\end{document}
