Phase difference and optical path difference (OPD) My textbook says that $\frac{\delta}{2\pi}=\frac{\Delta L}{\lambda}$, where $\delta$ is the phase difference and $\Delta L$ is so called path difference. But that's a cheat in my opinion. Even if the geometrical paths of two waves are equal it doesn't imply that their phases will be equal too. This leads me to a conclusion that $\Delta L$ is rather the optical path difference ($\textrm{OPD}$) than the actual difference in distance the waves have traveled. Hence we arrive to a following formula: $$
\delta=2\pi \frac{\textrm{OPD}}{\lambda}.
$$
The problem is (assuming that my reasoning is valid) I have no idea how to prove it. Here's my attempt: let's assume we are given two waves $f(x,t)=A\cos{(kx-\omega t)}$ and $f'(x,t)=A'\cos{(k'x-\omega t)}$. Their phase difference at a given point $x$ would obviously be $$
\delta=(k'-k)x=\frac{2\pi}{\lambda}(n'-n)x
$$
That's seems totally cool, except for one thing. The $\textrm{OPD}$ is defined as $$
\sum_{i=1}^k(n'_i-n_i)d_i
$$
where $d_i$ is the distance a wave $f$ travels in environment with index of refraction equal to $n_i$. So the question is: how on earth can I show that $\sum_{i=1}^k(n'_i-n_i)d_i=(n'-n)x$ ?
 A: 
My textbook says that $\frac{\delta}{2\pi}=\frac{\Delta L}{\lambda}$, where $\delta$ is the phase difference and $\Delta L$ is so called path difference. But that's a cheat in my opinion. Even if the geometrical paths of two waves are equal it doesn't imply that their phases will be equal too. This leads me to a conclusion that $\Delta L$ is rather the optical path difference (OPD) than the actual difference in distance the waves have traveled.

Your textbook is describing a special case.
Consider a wave described by the equation
$$\xi = A\sin 2\pi\left(ft-\frac x \lambda\right) = A\sin (\omega t - \varphi)$$
where $x$ is the distance from the source of the wave.
From that we apparently have
$$\varphi = 2\pi\frac x \lambda$$
Now consider two points lying on a line, one with distance $x_1$ from the source and the other with distance $x_2$. Now the path difference is
$$\Delta L\equiv x_2 - x_1$$
and the phase difference
$$\delta\equiv\varphi_2-\varphi_1 = 2\pi\frac{\Delta L}\lambda$$
In vacuum, we obviously don't need to take index of refraction into account.
In case of the entire space being filled with environment with index of refraction $n\neq1$, it doesn't matter either, because we can either take the wavelength of the wave in the environment to be $\lambda$ (in which case the equation stays the same), or we'll take the wavelength in vacuum to be $\lambda$, then the wavelength in the environment becomes
$$\lambda_e = \frac\lambda n$$
and we have
$$\delta = 2\pi\frac{n\Delta L}{\lambda}=2\pi\frac{\text{OPD}}{\lambda}$$
where $\text{OPD}$ is optical path difference.

[L]et's assume we are given two waves $f(x,t)=A\cos{(kx-\omega t)}$ and $f'(x,t)=A'\cos{(k'x-\omega t)}$. Their phase difference at a given point $x$ would obviously be $$
\delta=(k'-k)x=\frac{2\pi}{\lambda}(n'-n)x
$$

That's true if you have two waves, each of them traveling through distance $x$ in different environments, the first wave traveling through an environment with index of refraction $n$, and the second one through an environment with $n'$.
(If instead they traveled through the same path in the same environment, and they had the same wavelength in vacuum ($\lambda$), the index of refraction for them would be the same as well, so for two such waves described by your equations, $\delta = 0$.)

So the question is: how on earth can I show that
$$\sum\limits_{i=1}^k(n'_i-n_i)d_i=(n'-n)x$$

Since $x$ is the distance the waves traveled, you can rewrite the right side as
$$\sum\limits_{i=1}^k(n'_i-n_i)d_i=(n'-n)d$$
Now it's apparent that both sides are identical, except the left side takes into account the possibility of each wave travelling through $k$ environments.
