Solution (source code)

= Solution

First, <finite additivity of a set function> gives $f(\varnothing)=0$, since $f(\varnothing)=2f(\varnothing)$. Put $w_s=f(\{s\})$. Decomposing any subset into its singleton elements and using <induction> gives $f(A)=\sum_{s\in A}w_s$. Fix $s\in S$ and let $r$ be the number of sets $A_i$ containing it. Its total coefficient in the alternating intersection sum is zero if $r=0$, and otherwise is
$$
\sum_{k=1}^r(-1)^{k+1}\binom rk=1-(1-1)^r=1
$$
by the <binomial theorem>. These are exactly the coefficients in $f(\bigcup_iA_i)$. Summing against $w_s$ proves the required <inclusion-exclusion principle> for the additive <set function>, including signed weights.