Let \(F(\theta, \beta, s)\) be a twice differentiable function of the three variables \(\theta\), \(\beta\) and \(s\). Let \(\overline{s}\) be a stationarity point of \(F(\overline{\theta}, \overline{\beta}, \cdot)\), i.e. \( \frac{\partial F}{\partial s}(\overline{\theta}, \overline{\beta}, \overline{s}) = 0\), and suppose that \(\frac{\partial^2 F}{\partial s^2}(\overline{\theta}, \overline{\beta}, \overline{s})\) is invertible. Then, there exists a neighborhood of \((\overline{\theta}, \overline{\beta})\) and a continuously differentiable function \((\theta, \beta) \mapsto s_\theta^\beta\) defined in this neighborhood, such that \(s_{\overline{\theta}}^{\overline{\beta}} = \overline{s}\) and \begin{equation} \frac{\partial F}{\partial s}(\theta, \beta, s_\theta^\beta) = 0 \end{equation} for every \((\theta\), \(\beta\)). Furthermore, we have the following identity: \begin{equation} \frac{d}{d\theta} \frac{\partial F}{\partial \beta}(\theta, \beta, s_\theta^\beta) = \frac{d}{d\beta} \frac{\partial F}{\partial \theta}(\theta, \beta, s_\theta^\beta). \end{equation}
The first statement follows from the implicit function theorem. It remains to prove the formula. Let us consider \(F \left(\theta, \beta, s_\theta^\beta \right)\) as a function of \((\theta, \beta)\). Using the chain rule of differentiation and the stationary condition, we have \begin{equation} \frac{d}{d\beta} F(\theta, \beta, s_\theta^\beta) = \frac{\partial F}{\partial \beta} \left( \theta, \beta, s_\theta^\beta \right) + \underbrace{\frac{\partial F}{\partial s} \left( \theta, \beta, s_\theta^\beta \right)}_{= \; 0} \cdot \frac{\partial s_\theta^\beta}{\partial \beta}. \end{equation} Similarly, we have \begin{equation} \frac{d}{d\theta} F(\theta, \beta, s_\theta^\beta) = \frac{\partial F}{\partial \theta} \left( \theta, \beta, s_\theta^\beta \right) + \underbrace{\frac{\partial F}{\partial s} \left( \theta, \beta, s_\theta^\beta \right)}_{= \; 0} \cdot \frac{\partial s_\theta^\beta}{\partial \theta}. \end{equation} Combining these equations and using the symmetry of second-derivatives, we get: \begin{equation} \frac{d}{d\theta} \frac{\partial F}{\partial \beta}(\theta, \beta, s_\theta^\beta) = \frac{d}{d\theta} \frac{d}{d\beta} F(\theta, \beta, s_\theta^\beta) = \frac{d}{d\beta} \frac{d}{d\theta} F(\theta, \beta, s_\theta^\beta) = \frac{d}{d\beta} \frac{\partial F}{\partial \theta}(\theta, \beta, s_\theta^\beta). \end{equation}
Consider the function \(F(\theta, \beta, s) = E(\theta, s) + \beta C(s)\). Applying the lemma to \(F\), we get \begin{equation} \frac{d}{d\theta} C(s_\theta^\beta) = \frac{d}{d\beta} \frac{\partial E}{\partial \theta}(\theta, s_\theta^\beta). \end{equation} Evaluating this equation at the point \(\beta=0\), we obtain the EP formula.