  Szemeredi's regularity lemma is an important tool in graph theory which has
applications throughout combinatorics.
  In this paper we prove an analogue of Szemeredi's regularity lemma in the
context of abelian groups and use it to derive some results in additive number
theory.
  One is a structure theorm for sets which are almost sum-free. If A is a
subset of [N] which contains just o(N^2) triples (x,y,z) such that x + y = z
then A may be written as the union of B and C, where B is sum-free and |C| =
o(N).
  Another answers a question of Bergelson, Host and Kra. If alpha, epsilon > 0,
if N > N_0(alpha,epsilon) and if A is a subset of {1,...,N} of size alpha N,
then there is some non-zero d such that A contains at least (alpha^3 -
epsilon)N three-term arithmetic progressions with common difference d.
