  The paper is a part of an ongoing program which aims to show that the
existential theory in free groups (hyperbolic groups or even toral relatively
hyperbolic) is NP-complete. For that we study compression of solutions with
straight-line programs (SLPs) as suggested originally by Plandowski and Rytter
in the context of a single word equation. We review some basic results on SLPs
and give full proofs in order to keep this fundamental part of the program
self-contained. Next we study systems of equations with constraints in free
groups and more generally in free products of abelian groups. We show how to
compress minimal solutions with extended Parikh-constraints. This type of
constraints allows to express semi linear conditions as e.g. alphabetic
information. The result relies on some combinatorial analysis and has not been
shown elsewhere. We show similar compression results for Boolean formula of
equations over a torsion-free $\delta$-hyperbolic group. The situation is much
more delicate than in free groups. As byproduct we improve the estimation of
the "capacity" constant used by Rips and Sela in their paper "Canonical
representatives and equations in hyperbolic groups" from a double-exponential
bound in $\delta$ to some single-exponential bound. The final section shows
compression results for toral relatively hyperbolic group using the work of
Dahmani: We show that given a system of equations over a fixed toral relatively
hyperbolic group, for every solution of length $N$ there is an SLP for another
solution such that the size of the SLP is bounded by some polynomial $p(s+ \log
N)$ where $s$ is the size of the system.
