On taking the gradient of a compressible fluid potential

$$\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$$

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?
• (+1) can you help me with some of the math? Does $F’$ denote the derivative of $F$? If $F(p)=\int F’ dp$, how can I see that $\nabla F(p) = (1/\rho (p)) \nabla p$? I’m particularly confused how the $dp$ within the integration becomes the gradient of $p$, i.e., $\nabla p$. May 3, 2022 at 15:27
• 1st question: Yes, I can. 2nd question: Yes, it is. 3rd question: That's how we define $F$. For your confusion I'll add an edit. May 3, 2022 at 17:37
• Excellent clarification. Kindly, I’d like to ask a couple questions for more clarity. Regarding the integration variable $p’$, it is making reference to variable pressure $p$, or is the integration variable designation arbitrary, e.g., could it be labeled as, for instance, $a$? In making the derivative of $F$, in the third equation you show as $F’(p(x))\nabla p(x)$, what is the derivative being made with respect to? I.e., is it $dF/dp’$? May 3, 2022 at 19:16
• $p'$ would be a pressure physically, yes, but it is indeed just an (arbitrary) integration variable. You could name it $a$, but in the physical context a $p$ is more suitable. $F$ is a function of one real variable and the prime is the derivative with respect to its argument. Usual stuff. Depending on the context you could indeed denote it as you mention at the end. May 4, 2022 at 11:01