Consider a canonical transformation $(p,q) \rightarrow (P,Q)$ under a generating function $F$. The condition for form invariance of Hamiltonian equations of motion looks like : $$\sum_{s}P_s\dot{Q_s} - H' = \sum_{s,r}(\frac{\partial{q_s}}{\partial{Q_r}}\dot{Q_r} + \frac{\partial{q_s}}{\partial{P_r}}\dot{P_r}) + \sum_sp_s\frac{\partial{q_s}}{\partial{t}} - H + \sum_r(\frac{\partial F}{\partial Q_r}\dot{Q_r} + \frac{\partial F}{\partial P_r}\dot{P_r}) + \frac{\partial F}{\partial t}\tag{22}$$
As quoted in "Classical Dynamics - a modern perspective, Sudarshan, Mukunda", the necessary and sufficient condition for the existence of $F$ are the following three integrability conditions (24a-c):
Where do these come from and what is the missing link between these two statements?