Definition of entropy for canonical vs. microcanonical ensembles The two following definitions of entropy are often used in the microcanonical and canonical ensembles, respectively:


*

*$S=k_b\ln(\Omega)$

*$S=-k_b\sum_ip_i\ln(p_i)$
I am curious how the second can be derived from the first, and if they can both be applied to the canonical ensemble.  Specifically, how could one apply equation 1 to the canonical ensemble?  
As well, this is somewhat unrelated, but if you work backwards from the canonical ensemble, and use $F=-kT\ln(Z)$ and $S=-(\partial F/ \partial T) $, you can arrive at $S/k_b =\ln(Z)+\beta \bar E $.   If you then apply definition 1, you can rearrange this to get $\Omega = Ze^{\beta \bar E}$.  Is this application of definition 1 valid, and is the relation between $\Omega$ and $Z$ true for the canonical ensemble?
 A: Definition $1$ is specific to the microcanonical ensemble, because the quantity $\Omega$ is the number of microstates (mutually orthogonal microstates in the quantum case) compatible with the specified conditions. The logarithm of $\Omega$ is used for mathematical convenience, and the factor of Boltzmann's constant $k_b$ is included only because old traditions are hard to break, despite the minor inconvenience it causes.
Definition $2$ can be applied to any ensemble. It is a natural measure of how "non-presumptous" a given probability distribution is. The larger the value of $S$, the less presumptuous the distribution.  The previous comment about the factor of $k_b$ applies here, too.
When definition $2$ is applied to the microcanonical ensemble, all of the $p_i$ are equal to each other for all states that are compatible with the specified conditions, and are zero otherwise. That is, $p_i=1/\Omega$. Using this in definition $2$ gives
$$
 S=-k_b\sum_i p_i\ln(p_i)=-k_b \frac{1}{\Omega}\sum\ln(1/\Omega)
 =k_b\ln(\Omega)
$$
because $\Omega$ is also the number of terms in the sum. In this sense, definition $1$ is a special case of definition $2$.
Definition $1$ does not apply to the canonical ensemble, but it can be used to deduce the canonical ensemble for a subsystem that is part of a larger system described by the microcanonical ensemble. This derivation only works if $\Omega(E)$ does not increase exponentially (or faster) as a function of $E$. If it does, then the canonical ensemble doesn't exist. The microcanonical ensemble is more generally applicable than the canonical ensemble, but the canonical ensemble (when it exists) is usually more convenient.
Definition $2$ can also be used to deduce the canonical ensemble: among all probability distributions with a given average value of the total energy, the canonical ensemble is the least presumptuous distribution — it maximizes the entropy in definition $2$. 
Given the canonical ensemble $p_i\propto \exp(-\beta E_i)$, the partition function can be written as
$$
 Z=\sum_i \exp(-\beta E_i)
 \sim \sum_E\Omega(E) e^{-\beta E}
$$
where $\Omega(E)$ is the number of states with total energy $E$. (I'm writing "$\sim$" so that I don't have to define $\Omega(E)$ more carefully, which would probably not be helpful here.) Typically, $\Omega(E)$ is a rapidly increasing function of $E$, but not exponentially increasing, so the summand is sharply peaked at a particular value $\bar E$ of $E$ (which is typically essentially the average value), and we might as well have $Z\sim \Omega(\bar E)\exp(-\beta \bar E)$. Using this in the equation $S/k_b=\ln(Z)+\beta\bar E$ that was shown in the OP gives $S\sim k_b\ln\Omega(\bar E)$, in agreement with definition $1$. The agreement is only approximate, as expected, because the canonical ensemble with the given temperature is only approximately equivalent to a microcanonical ensemble with the specific total energy $\bar E$. The approximation is typically very good for a macroscopic system, and a more-careful version of this derivation can be used to quantify just how good the approximation is.
