Encryption Scheme & Perfect Secrecy [Katz & Lindell] An encryption scheme consists of the following data


a plaintext space $\mathcal M$
a ciphertext space $\mathcal C$
a key space $\mathcal K$
a key generating algorithm Gen
encryption and decryption algorithms $\operatorname{Enc}_k$ and $\operatorname{Dec}_k$ for each key $k\in \mathcal K$


I would like some clarification on the following extract from Katz &amp; Lindell:



More specifically, my question is:
What does, say, $P(K=k)$ mean exactly? What is the domain and codomain of the random variable $K$? What is the set $\{K=k\}$? Also, what is the domain of Gen?
What does, say, $P(K=k)$ mean exactly?


It signifies the probability that the key $K$ selected by the key generation algorithm $Gen$ is the value $k$.

The notation he is using is that $P(condition)$ (actually, they use $Pr[condition]$, perhaps to emphasize that $P$ isn't a function on the value condition, but rather its probability distribution) is the probability that the condition is true.  For example, if I flip a fair coin, we have $P(\text{heads}) = 0.5$


  What is the domain and codomain of the random variable $K$?


The key space $\mathcal K$


  What is the set $\{K=k\}$?


It's not a set; it's an equality which is true with a certain probability.


  Also, what is the domain of Gen?


The key space $\mathcal K$