I don't think that the 'two passengers with the same boarding card' comparison is valid.
It would be more valid to compare it with one passenger sitting in their assigned seat, and then refusing to allow the only passenger assigned to the seat next door to sit in it - say, because they want to keep their carry-on bag in that seat instead.
In that situation I think it's clear who would have to be offloaded!
I appreciate that this situation is very, very unlikely and that the CC would use their considerable resourcefulness as has been explained above, though.