# Understanding this math notation in probability?

I have a really beginner question which I hope people won't mind me asking. I don't get this notation at all and cannot find a place to start with understanding this: $$\mathcal L_D=-\mathbb E_{x\sim P}[\log(D(x))]-\mathbb E_{\hat x\sim Q}[\log(1-D(\hat x))]$$ I don't get $\mathbb E$ there. Does it mean expectation? The equation says it's "negative log-likelihood". I understand that $D(x)$ is either 1 or 0. What does the $\mathbb E_{x\sim P}$ mean, especially in the contex of statistics?

Assuming that $E$ is expectation, what does it mean to have an expectation of a probability distribution $P$? Does it imply the mean of the distribution, and in that case what does $\hat x$ typically mean? Unfortunately the paper I'm reading doesn't spell these out so I'm guessing I lack a bit of statistics background here.

$\mathbb{E}_{x\sim P}[f(x)]$ is the mean of $f(x)$ if $x$ has distribution $P$.
It means the expected value of the function $\log(D(x))$ where $x$ is drawn from distribution $P$, i.e. $$\mathbb{E}_{x\sim P}[\log(D(x))] = \int \log(D(x)) \cdot P(x) \cdot dx.$$
Note that if $D(x) = 0$ that $\log(D(x))$ is not defined. Similarly, if $\hat{x} = 1$ then $\log(1 - D(\hat{x}))$ is not defined. So it's more likely that $D(x) \in (0,1)$ rather than $D(x) \in \{0,1\}$. Or at least there are some technical matters to work out here.