On taking the gradient of a compressible fluid potential In literature I read:

$$\tag{1} \mathbf{q}=(Nd^2)(\rho/\mu)[\mathbf{g}-(1/\rho) \nabla p]=\sigma \mathbf{E}$$
which is valid for liquid generally, and for gases at pressures higher than about 20 atmospheres.
$\mathbf{E}=[\mathbf{g}-(1/\rho) \nabla p]$ is the impelling force per unit mass acting upon the fluid. So long as the fluid density is constant or is a function of the pressure only,
$$\tag{2} \nabla \times \mathbf{E}=0, \mathbf{E}=-\nabla \Phi$$
where
$$\tag{3} \Phi = gz+\int \frac{dp}{\rho}$$

In quoting the literature above, I note they did not emphasize how the density can be compressible and a function of the pressure only. I.e., I suppose they could have wrote:
$$\tag{4} \Phi = gz+\int \frac{dp}{\rho(p)}$$
According to Eqn(2), taking the negative gradient of $\Phi$ as defined in Eqn(3) or Eqn(4), I should end up with the relation given for $\mathbf{E}=[\mathbf{g}-(1/\rho) \nabla p]$.
I can see that for the first term on the right, the gravity term $gz$, when taking its gradient I get $\frac{\partial (gz)}{\partial z}=g\hat k=\mathbf{g}$. What I don't understand is how to take the gradient of the second term on the right of Eqn(3) or Eqn(4). How is this done? How does one show that:
$$\tag{5} \nabla \left(\int \frac{dp}{\rho}\right)=(1/\rho) \nabla p$$
or
$$\tag{6} \nabla \left(\int \frac{dp}{\rho(p)}\right)=(1/\rho) \nabla p$$
 A: Not obvious, but not too difficult either: In
$$
g - \frac{1}{\rho\left(p\right)}\nabla p = \nabla \phi
$$
we need to write the second lefthand-side term as a gradient of some function $F\left(p\right)$, i.e. we require
$$
F' \nabla p = \nabla F = \frac{1}{\rho}\nabla p\,,
$$
and because $F'=\frac{1}{\rho}$ the contribution to the potential is
$$
F\left(p\right) = \int \frac{1}{\rho\left(p\right)}\text{d}p\,.
$$
A bit more technical/thorough would be to start calculating the potential by a line integral starting from some reference point, which eventually yields the same...
Edit: Ok, let's make this clearer by making the notation more explicit. The integral
$$
\int \frac{\text{d}p}{\rho}
$$
actually stands for
$$
\int_{p_0}^{p\left(x\right)} \frac{1}{\rho\left(p'\right)}\text{d}p'\quad\left(=F\left(p\left(x\right)\right)\right)\,,
$$
good old physicists' sloppiness, where you need some experience to actually understand the meaning of the notation. In this more precise notation $p_0$ is some constant reference pressure, $p$ is the pressure field - depending on the position -, $p'$ is just an integration variable and $\rho$ is the density depending on the pressure (some equation of state). Now here it is easier to see that
$$
\nabla \left(\int_{p_0}^{p\left(x\right)} \frac{1}{\rho\left(p'\right)}\text{d}p'\right) = \nabla\left(F\left(p\left(x\right)\right)\right) = F'\left(p\left(x\right)\right)\nabla p\left(x\right)=
\frac{1}{\rho\left(p\left(x\right)\right)}\nabla p\left(x\right)\,,
$$
by the chain rule, right?
