Proving one time pad is perfectly secret I'm reading about one-time pad in "Introduction to Modern Cryptography" by Katz and Lindell. I can understand the definition of perfect secrecy. However, how is OTP proven to be perfectly secure ? I'm quite rusty on probability, so please explain the steps.

The proof in the book goes like this,

$M$ is the set of messages (all possible bit strings of length $\ell$), the message space. $K$ (the key space) is equal to the message space, and the cipher is computer as $c=k\oplus m$, where $k$ belongs to $K$ (chosen uniformly at random) and m belongs to $M$,
\begin{align*}
    \Pr&amp;[C=c\mathrel|M=m] \\
    &amp;= \Pr[M \oplus K = c \mathrel| M = m] \\&amp;\quad\text{(How did the random variable $C$ become $M\oplus K$ here?)} \\
    &amp;= \Pr[m \oplus K = c] \\&amp;\quad\text{(where did the conditional probability go ? what rule should I apply here ?)} \\
    &amp;= \Pr[K = m \oplus c] \\&amp;\quad\text{(what is this ?)} \\
    &amp;= 1/2^\ell \\&amp;\quad\text{(how should I arrive at this finally ?)}
\end{align*}
I did not understand any of these four steps. Please explain the reasoning behind these steps. This result is being used to show that it satisfies the definition of perfect secrecy. Please help me understand this result.
First, be careful about case:


The uppercase letters denote random variables in some probability space.
The lowercase letters denote particular values in the domains of the corresponding random variables.


For example, if the probability space is $\Omega$, then $C\colon \Omega \to \{0,1\}^\ell$ is a random variable for the ciphertext in the one-time pad system, and $c \in \{0,1\}^\ell$ is a particular value of a ciphertext, which at some sample $\omega \in \Omega$ might be the value of $C(\omega) = c$.

The random variable $C$ is related to the random variables $M$ and $K$ by $C = M \oplus K$, which is the standard mild abuse of notation for random variables meaning that $C(\omega) = M(\omega) \oplus K(\omega)$ in any sample $\omega \in \Omega$.  Any fixed values $c$, $m$, and $k$ might or might not be related by $c = m \oplus k$, although if in some sample $\omega$ we have $C(\omega) = c$ and $M(\omega) = m$ and $K(\omega) = k$ then $c$, $m$, and $k$ are indeed related by $c = m \oplus k$.

For any fixed message $m \in \{0,1\}^\ell$, in the event $E = \{\omega \in \Omega \mathrel: M(\omega) = m\}$ where the message $M$ takes on the value $m \in \{0,1\}^\ell$, what can you conclude about $C$?  In other words, if for any $\omega$ we have $M(\omega) = m$, what can you say about $C(\omega)$?  Can you use this to eliminate $C$ from the ellipsis in $\Pr[\;\cdots \mathrel| M = m]$?

Next, if you have an equation about the random variable $K$ without reference to $M$, given an equation about $M$, recall the definition of independence of random variables and how it relates to conditional probabilities.  Finally, use the probability mass function for $K$, and you'll have an answer.