Grinding through type soundness again

At least I think the invariant is correct now.