Suppose that we have a perfect dipole with $+q$ at $\vec{r}+\vec{d}$ and -q at $\vec{r}$, and that this dipole is in a uniform electric field $\vec{E}$,
Then:
\begin{equation}U=-\vec{p}\cdot \vec{E}.\end{equation}
First, what does a perfect dipole mean ? Then I don't really understand the solution of problem $4.7$ in the David J.Griffiths introduction to Electrodynamics which goal is to prove that $U=-\vec{p}\cdot \vec{E}$. For me, the energy of a system of two point charges is equal to $\frac{1}{4\pi\epsilon_0}q\times(-q)\frac {1}{d}$? But in the solution, it is written that the energy $U$ is given by: $$U=qV(\vec{r}+\vec{d})-qV(\vec{r}),$$ where $V$ is the electric potential. I don't understand where does this formula come from...