Solution (source code)

= Solution

For a <transferable utility game> with $v(\varnothing)=0$, an efficient allocation satisfies $\sum_{i\in N}x_i=v(N)$. An <imputation> is efficient and individually rational, $x_i\geq v(\{i\})$. Write $x(S)=\sum_{i\in S}x_i$ and define the <excess of a coalition> as $e(S,x)=v(S)-x(S)$.

The <core of a cooperative game> is
$$
\boxed{\{x:x(N)=v(N),\quad x(S)\geq v(S)\text{ for every }S\subseteq N\}.}
$$
It consists of allocations immune to a <coalition>'s blocking: no <coalition> can obtain more for its members by leaving. The singleton inequalities imply individual rationality. The core may be empty.

The <nucleolus>, when the <imputation> set is nonempty, is the unique <imputation> that lexicographically minimizes the list of <coalition> excesses arranged from largest to smallest. It first minimizes the largest complaint, then the second largest among ties, and so on. Including the empty and grand <coalitions> adds constant zeros and does not change the solution. Minimization on efficient allocations without individual rationality instead defines the <prenucleolus>, a different convention that matters for this paper's game.

The <Shapley value> is the average <marginal contribution> of each player over all uniformly ordered player arrivals:
$$
\boxed{\phi_i(v)=\sum_{S\subseteq N\setminus\{i\}}\frac{|S|!(n-|S|-1)!}{n!}\bigl(v(S\cup\{i\})-v(S)\bigr).}
$$
Exactly $|S|!(n-|S|-1)!$ orderings have $S$ as the predecessor set of $i$. This is an average-contribution fairness rule, rather than a blocking-stability condition; it need not be individually rational for an arbitrary game.