He seems to have defined M in two contradictory ways. First, he defines . Then a couple of lines later he defines .
If you take the first of those definitions for M, and then ask that , the proof makes sense and becomes correct.
[I'll have to tease David about that next time I see him. ]