Solution (source code)

= Solution

Write every fermion as a left-handed Weyl field. One Standard Model generation then has
$$
Q_L:(3,2)_{1/6},\quad
u_R^c:(\bar3,1)_{-2/3},\quad
d_R^c:(\bar3,1)_{1/3},\quad
L_L:(1,2)_{-1/2},\quad
e_R^c:(1,1)_1,
$$
with an optional neutral $\nu_R^c:(1,1)_0$. The purely colored anomaly vanishes because
$$
[SU(3)_c]^3:\qquad 2-1-1=0.
$$
The mixed non-Abelian-hypercharge coefficients are
$$
[SU(3)_c]^2U(1)_Y:\qquad
2\left(\frac16\right)-\frac23+\frac13=0,
$$
$$
[SU(2)_L]^2U(1)_Y:\qquad
3\left(\frac16\right)-\frac12=0.
$$
The cubic hypercharge anomaly also cancels:
$$
6\left(\frac16\right)^3
+3\left(-\frac23\right)^3
+3\left(\frac13\right)^3
+2\left(-\frac12\right)^3+1^3=0,
$$
as does the <mixed gauge-gravitational anomaly>,
$$
6\left(\frac16\right)+3\left(-\frac23\right)
+3\left(\frac13\right)+2\left(-\frac12\right)+1=0.
$$
There is no perturbative cubic $SU(2)$ anomaly because its representations are pseudoreal. There are four left-handed weak doublets after counting the three colors of $Q_L$, so the global <Witten SU(2) anomaly> also vanishes. This proves <Standard Model anomaly cancellation> generation by generation.

The equality of proton and positron charges follows from the same constraints. Let the Higgs hypercharge be $Y_H=1/2$. Gauge-invariant <Yukawa interactions> imply
$$
Y_u=Y_Q+Y_H,
\qquad Y_d=Y_Q-Y_H,
\qquad Y_e=Y_L-Y_H,
$$
while cancellation of $[SU(2)_L]^2U(1)_Y$ gives $3Y_Q+Y_L=0$. Since electric charge is $Q=T^3+Y$,
$$
Q_p=2Q_u+Q_d=\frac12+3Y_Q,
\qquad
Q_e=Y_e=-3Y_Q-\frac12.
$$
Therefore
$$
\boxed{Q_p=-Q_e},
$$
showing how anomaly cancellation, together with Yukawa gauge invariance and the normalization fixed by the neutral Higgs vacuum, enforces this instance of <charge quantization>.